forked from wolfSSL/wolfssl
Merge branch 'nocerts'
This commit is contained in:
@@ -1237,7 +1237,7 @@ static int GetKey(DecodedCert* cert)
|
||||
if (b != ASN_BIT_STRING)
|
||||
return ASN_BITSTR_E;
|
||||
|
||||
if (GetLength(cert->source, &cert->srcIdx, &length, cert->maxIdx) < 0)
|
||||
if (GetLength(cert->source,&cert->srcIdx,&length,cert->maxIdx) < 0)
|
||||
return ASN_PARSE_E;
|
||||
b = cert->source[cert->srcIdx++];
|
||||
if (b != 0x00)
|
||||
@@ -2134,9 +2134,9 @@ static int ConfirmSignature(const byte* buf, word32 bufSz,
|
||||
else {
|
||||
/* make sure we're right justified */
|
||||
encodedSigSz =
|
||||
EncodeSignature(encodedSig, digest, digestSz, typeH);
|
||||
EncodeSignature(encodedSig, digest, digestSz, typeH);
|
||||
if (encodedSigSz != verifySz ||
|
||||
XMEMCMP(out, encodedSig, encodedSigSz) != 0) {
|
||||
XMEMCMP(out, encodedSig, encodedSigSz) != 0) {
|
||||
CYASSL_MSG("Rsa SSL verify match encode error");
|
||||
ret = 0;
|
||||
}
|
||||
@@ -2180,7 +2180,7 @@ static int ConfirmSignature(const byte* buf, word32 bufSz,
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = ecc_verify_hash(sig, sigSz, digest, digestSz, &verify, &pubKey);
|
||||
ret = ecc_verify_hash(sig,sigSz,digest,digestSz,&verify,&pubKey);
|
||||
ecc_free(&pubKey);
|
||||
if (ret == 0 && verify == 1)
|
||||
return 1; /* match */
|
||||
@@ -2631,257 +2631,6 @@ void FreeSigners(Signer* signer, void* heap)
|
||||
}
|
||||
|
||||
|
||||
void CTaoCryptErrorString(int error, char* buffer)
|
||||
{
|
||||
const int max = MAX_ERROR_SZ; /* shorthand */
|
||||
|
||||
#ifdef NO_ERROR_STRINGS
|
||||
|
||||
XSTRNCPY(buffer, "no support for error strings built in", max);
|
||||
|
||||
#else
|
||||
|
||||
switch (error) {
|
||||
|
||||
case OPEN_RAN_E :
|
||||
XSTRNCPY(buffer, "opening random device error", max);
|
||||
break;
|
||||
|
||||
case READ_RAN_E :
|
||||
XSTRNCPY(buffer, "reading random device error", max);
|
||||
break;
|
||||
|
||||
case WINCRYPT_E :
|
||||
XSTRNCPY(buffer, "windows crypt init error", max);
|
||||
break;
|
||||
|
||||
case CRYPTGEN_E :
|
||||
XSTRNCPY(buffer, "windows crypt generation error", max);
|
||||
break;
|
||||
|
||||
case RAN_BLOCK_E :
|
||||
XSTRNCPY(buffer, "random device read would block error", max);
|
||||
break;
|
||||
|
||||
case MP_INIT_E :
|
||||
XSTRNCPY(buffer, "mp_init error state", max);
|
||||
break;
|
||||
|
||||
case MP_READ_E :
|
||||
XSTRNCPY(buffer, "mp_read error state", max);
|
||||
break;
|
||||
|
||||
case MP_EXPTMOD_E :
|
||||
XSTRNCPY(buffer, "mp_exptmod error state", max);
|
||||
break;
|
||||
|
||||
case MP_TO_E :
|
||||
XSTRNCPY(buffer, "mp_to_xxx error state, can't convert", max);
|
||||
break;
|
||||
|
||||
case MP_SUB_E :
|
||||
XSTRNCPY(buffer, "mp_sub error state, can't subtract", max);
|
||||
break;
|
||||
|
||||
case MP_ADD_E :
|
||||
XSTRNCPY(buffer, "mp_add error state, can't add", max);
|
||||
break;
|
||||
|
||||
case MP_MUL_E :
|
||||
XSTRNCPY(buffer, "mp_mul error state, can't multiply", max);
|
||||
break;
|
||||
|
||||
case MP_MULMOD_E :
|
||||
XSTRNCPY(buffer, "mp_mulmod error state, can't multiply mod", max);
|
||||
break;
|
||||
|
||||
case MP_MOD_E :
|
||||
XSTRNCPY(buffer, "mp_mod error state, can't mod", max);
|
||||
break;
|
||||
|
||||
case MP_INVMOD_E :
|
||||
XSTRNCPY(buffer, "mp_invmod error state, can't inv mod", max);
|
||||
break;
|
||||
|
||||
case MP_CMP_E :
|
||||
XSTRNCPY(buffer, "mp_cmp error state", max);
|
||||
break;
|
||||
|
||||
case MP_ZERO_E :
|
||||
XSTRNCPY(buffer, "mp zero result, not expected", max);
|
||||
break;
|
||||
|
||||
case MEMORY_E :
|
||||
XSTRNCPY(buffer, "out of memory error", max);
|
||||
break;
|
||||
|
||||
case RSA_WRONG_TYPE_E :
|
||||
XSTRNCPY(buffer, "RSA wrong block type for RSA function", max);
|
||||
break;
|
||||
|
||||
case RSA_BUFFER_E :
|
||||
XSTRNCPY(buffer, "RSA buffer error, output too small or input too big",
|
||||
max);
|
||||
break;
|
||||
|
||||
case BUFFER_E :
|
||||
XSTRNCPY(buffer, "Buffer error, output too small or input too big",max);
|
||||
break;
|
||||
|
||||
case ALGO_ID_E :
|
||||
XSTRNCPY(buffer, "Setting Cert AlogID error", max);
|
||||
break;
|
||||
|
||||
case PUBLIC_KEY_E :
|
||||
XSTRNCPY(buffer, "Setting Cert Public Key error", max);
|
||||
break;
|
||||
|
||||
case DATE_E :
|
||||
XSTRNCPY(buffer, "Setting Cert Date validity error", max);
|
||||
break;
|
||||
|
||||
case SUBJECT_E :
|
||||
XSTRNCPY(buffer, "Setting Cert Subject name error", max);
|
||||
break;
|
||||
|
||||
case ISSUER_E :
|
||||
XSTRNCPY(buffer, "Setting Cert Issuer name error", max);
|
||||
break;
|
||||
|
||||
case CA_TRUE_E :
|
||||
XSTRNCPY(buffer, "Setting basic constraint CA true error", max);
|
||||
break;
|
||||
|
||||
case EXTENSIONS_E :
|
||||
XSTRNCPY(buffer, "Setting extensions error", max);
|
||||
break;
|
||||
|
||||
case ASN_PARSE_E :
|
||||
XSTRNCPY(buffer, "ASN parsing error, invalid input", max);
|
||||
break;
|
||||
|
||||
case ASN_VERSION_E :
|
||||
XSTRNCPY(buffer, "ASN version error, invalid number", max);
|
||||
break;
|
||||
|
||||
case ASN_GETINT_E :
|
||||
XSTRNCPY(buffer, "ASN get big int error, invalid data", max);
|
||||
break;
|
||||
|
||||
case ASN_RSA_KEY_E :
|
||||
XSTRNCPY(buffer, "ASN key init error, invalid input", max);
|
||||
break;
|
||||
|
||||
case ASN_OBJECT_ID_E :
|
||||
XSTRNCPY(buffer, "ASN object id error, invalid id", max);
|
||||
break;
|
||||
|
||||
case ASN_TAG_NULL_E :
|
||||
XSTRNCPY(buffer, "ASN tag error, not null", max);
|
||||
break;
|
||||
|
||||
case ASN_EXPECT_0_E :
|
||||
XSTRNCPY(buffer, "ASN expect error, not zero", max);
|
||||
break;
|
||||
|
||||
case ASN_BITSTR_E :
|
||||
XSTRNCPY(buffer, "ASN bit string error, wrong id", max);
|
||||
break;
|
||||
|
||||
case ASN_UNKNOWN_OID_E :
|
||||
XSTRNCPY(buffer, "ASN oid error, unknown sum id", max);
|
||||
break;
|
||||
|
||||
case ASN_DATE_SZ_E :
|
||||
XSTRNCPY(buffer, "ASN date error, bad size", max);
|
||||
break;
|
||||
|
||||
case ASN_BEFORE_DATE_E :
|
||||
XSTRNCPY(buffer, "ASN date error, current date before", max);
|
||||
break;
|
||||
|
||||
case ASN_AFTER_DATE_E :
|
||||
XSTRNCPY(buffer, "ASN date error, current date after", max);
|
||||
break;
|
||||
|
||||
case ASN_SIG_OID_E :
|
||||
XSTRNCPY(buffer, "ASN signature error, mismatched oid", max);
|
||||
break;
|
||||
|
||||
case ASN_TIME_E :
|
||||
XSTRNCPY(buffer, "ASN time error, unkown time type", max);
|
||||
break;
|
||||
|
||||
case ASN_INPUT_E :
|
||||
XSTRNCPY(buffer, "ASN input error, not enough data", max);
|
||||
break;
|
||||
|
||||
case ASN_SIG_CONFIRM_E :
|
||||
XSTRNCPY(buffer, "ASN sig error, confirm failure", max);
|
||||
break;
|
||||
|
||||
case ASN_SIG_HASH_E :
|
||||
XSTRNCPY(buffer, "ASN sig error, unsupported hash type", max);
|
||||
break;
|
||||
|
||||
case ASN_SIG_KEY_E :
|
||||
XSTRNCPY(buffer, "ASN sig error, unsupported key type", max);
|
||||
break;
|
||||
|
||||
case ASN_DH_KEY_E :
|
||||
XSTRNCPY(buffer, "ASN key init error, invalid input", max);
|
||||
break;
|
||||
|
||||
case ASN_NTRU_KEY_E :
|
||||
XSTRNCPY(buffer, "ASN NTRU key decode error, invalid input", max);
|
||||
break;
|
||||
|
||||
case ECC_BAD_ARG_E :
|
||||
XSTRNCPY(buffer, "ECC input argument wrong type, invalid input", max);
|
||||
break;
|
||||
|
||||
case ASN_ECC_KEY_E :
|
||||
XSTRNCPY(buffer, "ECC ASN1 bad key data, invalid input", max);
|
||||
break;
|
||||
|
||||
case ECC_CURVE_OID_E :
|
||||
XSTRNCPY(buffer, "ECC curve sum OID unsupported, invalid input", max);
|
||||
break;
|
||||
|
||||
case BAD_FUNC_ARG :
|
||||
XSTRNCPY(buffer, "Bad function argument", max);
|
||||
break;
|
||||
|
||||
case NOT_COMPILED_IN :
|
||||
XSTRNCPY(buffer, "Feature not compiled in", max);
|
||||
break;
|
||||
|
||||
case UNICODE_SIZE_E :
|
||||
XSTRNCPY(buffer, "Unicode password too big", max);
|
||||
break;
|
||||
|
||||
case NO_PASSWORD :
|
||||
XSTRNCPY(buffer, "No password provided by user", max);
|
||||
break;
|
||||
|
||||
case ALT_NAME_E :
|
||||
XSTRNCPY(buffer, "Alt Name problem, too big", max);
|
||||
break;
|
||||
|
||||
case AES_GCM_AUTH_E:
|
||||
XSTRNCPY(buffer, "AES-GCM Authentication check fail", max);
|
||||
break;
|
||||
|
||||
default:
|
||||
XSTRNCPY(buffer, "unknown error number", max);
|
||||
|
||||
}
|
||||
|
||||
#endif /* NO_ERROR_STRINGS */
|
||||
|
||||
}
|
||||
|
||||
|
||||
#if defined(CYASSL_KEY_GEN) || defined(CYASSL_CERT_GEN)
|
||||
|
||||
static int SetMyVersion(word32 version, byte* output, int header)
|
||||
@@ -4396,90 +4145,90 @@ static int GetEnumerated(const byte* input, word32* inOutIdx, int *value)
|
||||
static int DecodeSingleResponse(byte* source,
|
||||
word32* ioIndex, OcspResponse* resp, word32 size)
|
||||
{
|
||||
word32 index = *ioIndex, prevIndex, oid;
|
||||
word32 idx = *ioIndex, prevIndex, oid;
|
||||
int length, wrapperSz;
|
||||
CertStatus* cs = resp->status;
|
||||
|
||||
CYASSL_ENTER("DecodeSingleResponse");
|
||||
|
||||
/* Outer wrapper of the SEQUENCE OF Single Responses. */
|
||||
if (GetSequence(source, &index, &wrapperSz, size) < 0)
|
||||
if (GetSequence(source, &idx, &wrapperSz, size) < 0)
|
||||
return ASN_PARSE_E;
|
||||
|
||||
prevIndex = index;
|
||||
prevIndex = idx;
|
||||
|
||||
/* When making a request, we only request one status on one certificate
|
||||
* at a time. There should only be one SingleResponse */
|
||||
|
||||
/* Wrapper around the Single Response */
|
||||
if (GetSequence(source, &index, &length, size) < 0)
|
||||
if (GetSequence(source, &idx, &length, size) < 0)
|
||||
return ASN_PARSE_E;
|
||||
|
||||
/* Wrapper around the CertID */
|
||||
if (GetSequence(source, &index, &length, size) < 0)
|
||||
if (GetSequence(source, &idx, &length, size) < 0)
|
||||
return ASN_PARSE_E;
|
||||
/* Skip the hash algorithm */
|
||||
if (GetAlgoId(source, &index, &oid, size) < 0)
|
||||
if (GetAlgoId(source, &idx, &oid, size) < 0)
|
||||
return ASN_PARSE_E;
|
||||
/* Save reference to the hash of CN */
|
||||
if (source[index++] != ASN_OCTET_STRING)
|
||||
if (source[idx++] != ASN_OCTET_STRING)
|
||||
return ASN_PARSE_E;
|
||||
if (GetLength(source, &index, &length, size) < 0)
|
||||
if (GetLength(source, &idx, &length, size) < 0)
|
||||
return ASN_PARSE_E;
|
||||
resp->issuerHash = source + index;
|
||||
index += length;
|
||||
resp->issuerHash = source + idx;
|
||||
idx += length;
|
||||
/* Save reference to the hash of the issuer public key */
|
||||
if (source[index++] != ASN_OCTET_STRING)
|
||||
if (source[idx++] != ASN_OCTET_STRING)
|
||||
return ASN_PARSE_E;
|
||||
if (GetLength(source, &index, &length, size) < 0)
|
||||
if (GetLength(source, &idx, &length, size) < 0)
|
||||
return ASN_PARSE_E;
|
||||
resp->issuerKeyHash = source + index;
|
||||
index += length;
|
||||
resp->issuerKeyHash = source + idx;
|
||||
idx += length;
|
||||
|
||||
/* Read the serial number, it is handled as a string, not as a
|
||||
* proper number. Just XMEMCPY the data over, rather than load it
|
||||
* as an mp_int. */
|
||||
if (source[index++] != ASN_INTEGER)
|
||||
if (source[idx++] != ASN_INTEGER)
|
||||
return ASN_PARSE_E;
|
||||
if (GetLength(source, &index, &length, size) < 0)
|
||||
if (GetLength(source, &idx, &length, size) < 0)
|
||||
return ASN_PARSE_E;
|
||||
if (length <= EXTERNAL_SERIAL_SIZE)
|
||||
{
|
||||
if (source[index] == 0)
|
||||
if (source[idx] == 0)
|
||||
{
|
||||
index++;
|
||||
idx++;
|
||||
length--;
|
||||
}
|
||||
XMEMCPY(cs->serial, source + index, length);
|
||||
XMEMCPY(cs->serial, source + idx, length);
|
||||
cs->serialSz = length;
|
||||
}
|
||||
else
|
||||
{
|
||||
return ASN_GETINT_E;
|
||||
}
|
||||
index += length;
|
||||
idx += length;
|
||||
|
||||
/* CertStatus */
|
||||
switch (source[index++])
|
||||
switch (source[idx++])
|
||||
{
|
||||
case (ASN_CONTEXT_SPECIFIC | CERT_GOOD):
|
||||
cs->status = CERT_GOOD;
|
||||
index++;
|
||||
idx++;
|
||||
break;
|
||||
case (ASN_CONTEXT_SPECIFIC | ASN_CONSTRUCTED | CERT_REVOKED):
|
||||
cs->status = CERT_REVOKED;
|
||||
GetLength(source, &index, &length, size);
|
||||
index += length;
|
||||
GetLength(source, &idx, &length, size);
|
||||
idx += length;
|
||||
break;
|
||||
case (ASN_CONTEXT_SPECIFIC | CERT_UNKNOWN):
|
||||
cs->status = CERT_UNKNOWN;
|
||||
index++;
|
||||
idx++;
|
||||
break;
|
||||
default:
|
||||
return ASN_PARSE_E;
|
||||
}
|
||||
|
||||
if (GetBasicDate(source, &index, cs->thisDate,
|
||||
if (GetBasicDate(source, &idx, cs->thisDate,
|
||||
&cs->thisDateFormat, size) < 0)
|
||||
return ASN_PARSE_E;
|
||||
if (!ValidateDate(cs->thisDate, cs->thisDateFormat, BEFORE))
|
||||
@@ -4488,26 +4237,26 @@ static int DecodeSingleResponse(byte* source,
|
||||
/* The following items are optional. Only check for them if there is more
|
||||
* unprocessed data in the singleResponse wrapper. */
|
||||
|
||||
if ((index - prevIndex < wrapperSz) &&
|
||||
(source[index] == (ASN_CONSTRUCTED | ASN_CONTEXT_SPECIFIC | 0)))
|
||||
if (((int)(idx - prevIndex) < wrapperSz) &&
|
||||
(source[idx] == (ASN_CONSTRUCTED | ASN_CONTEXT_SPECIFIC | 0)))
|
||||
{
|
||||
index++;
|
||||
if (GetLength(source, &index, &length, size) < 0)
|
||||
idx++;
|
||||
if (GetLength(source, &idx, &length, size) < 0)
|
||||
return ASN_PARSE_E;
|
||||
if (GetBasicDate(source, &index, cs->nextDate,
|
||||
if (GetBasicDate(source, &idx, cs->nextDate,
|
||||
&cs->nextDateFormat, size) < 0)
|
||||
return ASN_PARSE_E;
|
||||
}
|
||||
if ((index - prevIndex < wrapperSz) &&
|
||||
(source[index] == (ASN_CONSTRUCTED | ASN_CONTEXT_SPECIFIC | 1)))
|
||||
if (((int)(idx - prevIndex) < wrapperSz) &&
|
||||
(source[idx] == (ASN_CONSTRUCTED | ASN_CONTEXT_SPECIFIC | 1)))
|
||||
{
|
||||
index++;
|
||||
if (GetLength(source, &index, &length, size) < 0)
|
||||
idx++;
|
||||
if (GetLength(source, &idx, &length, size) < 0)
|
||||
return ASN_PARSE_E;
|
||||
index += length;
|
||||
idx += length;
|
||||
}
|
||||
|
||||
*ioIndex = index;
|
||||
*ioIndex = idx;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -4833,7 +4582,7 @@ static word32 SetOcspReqExtensions(word32 extSz, byte* output,
|
||||
seqArray[1][0] = ASN_OBJECT_ID;
|
||||
seqSz[1] = 1 + SetLength(sizeof(NonceObjId), &seqArray[1][1]);
|
||||
|
||||
totalSz = seqSz[0] + seqSz[1] + nonceSz + sizeof(NonceObjId);
|
||||
totalSz = seqSz[0] + seqSz[1] + nonceSz + (word32)sizeof(NonceObjId);
|
||||
|
||||
seqSz[2] = SetSequence(totalSz, seqArray[2]);
|
||||
totalSz += seqSz[2];
|
||||
@@ -4857,7 +4606,7 @@ static word32 SetOcspReqExtensions(word32 extSz, byte* output,
|
||||
XMEMCPY(output + totalSz, seqArray[1], seqSz[1]);
|
||||
totalSz += seqSz[1];
|
||||
XMEMCPY(output + totalSz, NonceObjId, sizeof(NonceObjId));
|
||||
totalSz += sizeof(NonceObjId);
|
||||
totalSz += (word32)sizeof(NonceObjId);
|
||||
XMEMCPY(output + totalSz, seqArray[0], seqSz[0]);
|
||||
totalSz += seqSz[0];
|
||||
XMEMCPY(output + totalSz, nonce, nonceSz);
|
||||
@@ -4878,7 +4627,6 @@ int EncodeOcspRequest(OcspRequest* req)
|
||||
byte snArray[MAX_SN_SZ];
|
||||
byte extArray[MAX_OCSP_EXT_SZ];
|
||||
byte* output = req->dest;
|
||||
word32 outputSz = req->destSz;
|
||||
RNG rng;
|
||||
word32 seqSz[5], algoSz, issuerSz, issuerKeySz, snSz, extSz, totalSz;
|
||||
int i;
|
||||
|
||||
276
ctaocrypt/src/error.c
Normal file
276
ctaocrypt/src/error.c
Normal file
@@ -0,0 +1,276 @@
|
||||
/* error.c
|
||||
*
|
||||
* Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
* CyaSSL is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* CyaSSL is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <cyassl/ctaocrypt/error.h>
|
||||
|
||||
void CTaoCryptErrorString(int error, char* buffer)
|
||||
{
|
||||
const int max = MAX_ERROR_SZ; /* shorthand */
|
||||
|
||||
#ifdef NO_ERROR_STRINGS
|
||||
|
||||
XSTRNCPY(buffer, "no support for error strings built in", max);
|
||||
|
||||
#else
|
||||
|
||||
switch (error) {
|
||||
|
||||
case OPEN_RAN_E :
|
||||
XSTRNCPY(buffer, "opening random device error", max);
|
||||
break;
|
||||
|
||||
case READ_RAN_E :
|
||||
XSTRNCPY(buffer, "reading random device error", max);
|
||||
break;
|
||||
|
||||
case WINCRYPT_E :
|
||||
XSTRNCPY(buffer, "windows crypt init error", max);
|
||||
break;
|
||||
|
||||
case CRYPTGEN_E :
|
||||
XSTRNCPY(buffer, "windows crypt generation error", max);
|
||||
break;
|
||||
|
||||
case RAN_BLOCK_E :
|
||||
XSTRNCPY(buffer, "random device read would block error", max);
|
||||
break;
|
||||
|
||||
case MP_INIT_E :
|
||||
XSTRNCPY(buffer, "mp_init error state", max);
|
||||
break;
|
||||
|
||||
case MP_READ_E :
|
||||
XSTRNCPY(buffer, "mp_read error state", max);
|
||||
break;
|
||||
|
||||
case MP_EXPTMOD_E :
|
||||
XSTRNCPY(buffer, "mp_exptmod error state", max);
|
||||
break;
|
||||
|
||||
case MP_TO_E :
|
||||
XSTRNCPY(buffer, "mp_to_xxx error state, can't convert", max);
|
||||
break;
|
||||
|
||||
case MP_SUB_E :
|
||||
XSTRNCPY(buffer, "mp_sub error state, can't subtract", max);
|
||||
break;
|
||||
|
||||
case MP_ADD_E :
|
||||
XSTRNCPY(buffer, "mp_add error state, can't add", max);
|
||||
break;
|
||||
|
||||
case MP_MUL_E :
|
||||
XSTRNCPY(buffer, "mp_mul error state, can't multiply", max);
|
||||
break;
|
||||
|
||||
case MP_MULMOD_E :
|
||||
XSTRNCPY(buffer, "mp_mulmod error state, can't multiply mod", max);
|
||||
break;
|
||||
|
||||
case MP_MOD_E :
|
||||
XSTRNCPY(buffer, "mp_mod error state, can't mod", max);
|
||||
break;
|
||||
|
||||
case MP_INVMOD_E :
|
||||
XSTRNCPY(buffer, "mp_invmod error state, can't inv mod", max);
|
||||
break;
|
||||
|
||||
case MP_CMP_E :
|
||||
XSTRNCPY(buffer, "mp_cmp error state", max);
|
||||
break;
|
||||
|
||||
case MP_ZERO_E :
|
||||
XSTRNCPY(buffer, "mp zero result, not expected", max);
|
||||
break;
|
||||
|
||||
case MEMORY_E :
|
||||
XSTRNCPY(buffer, "out of memory error", max);
|
||||
break;
|
||||
|
||||
case RSA_WRONG_TYPE_E :
|
||||
XSTRNCPY(buffer, "RSA wrong block type for RSA function", max);
|
||||
break;
|
||||
|
||||
case RSA_BUFFER_E :
|
||||
XSTRNCPY(buffer, "RSA buffer error, output too small or input too big",
|
||||
max);
|
||||
break;
|
||||
|
||||
case BUFFER_E :
|
||||
XSTRNCPY(buffer, "Buffer error, output too small or input too big",max);
|
||||
break;
|
||||
|
||||
case ALGO_ID_E :
|
||||
XSTRNCPY(buffer, "Setting Cert AlogID error", max);
|
||||
break;
|
||||
|
||||
case PUBLIC_KEY_E :
|
||||
XSTRNCPY(buffer, "Setting Cert Public Key error", max);
|
||||
break;
|
||||
|
||||
case DATE_E :
|
||||
XSTRNCPY(buffer, "Setting Cert Date validity error", max);
|
||||
break;
|
||||
|
||||
case SUBJECT_E :
|
||||
XSTRNCPY(buffer, "Setting Cert Subject name error", max);
|
||||
break;
|
||||
|
||||
case ISSUER_E :
|
||||
XSTRNCPY(buffer, "Setting Cert Issuer name error", max);
|
||||
break;
|
||||
|
||||
case CA_TRUE_E :
|
||||
XSTRNCPY(buffer, "Setting basic constraint CA true error", max);
|
||||
break;
|
||||
|
||||
case EXTENSIONS_E :
|
||||
XSTRNCPY(buffer, "Setting extensions error", max);
|
||||
break;
|
||||
|
||||
case ASN_PARSE_E :
|
||||
XSTRNCPY(buffer, "ASN parsing error, invalid input", max);
|
||||
break;
|
||||
|
||||
case ASN_VERSION_E :
|
||||
XSTRNCPY(buffer, "ASN version error, invalid number", max);
|
||||
break;
|
||||
|
||||
case ASN_GETINT_E :
|
||||
XSTRNCPY(buffer, "ASN get big int error, invalid data", max);
|
||||
break;
|
||||
|
||||
case ASN_RSA_KEY_E :
|
||||
XSTRNCPY(buffer, "ASN key init error, invalid input", max);
|
||||
break;
|
||||
|
||||
case ASN_OBJECT_ID_E :
|
||||
XSTRNCPY(buffer, "ASN object id error, invalid id", max);
|
||||
break;
|
||||
|
||||
case ASN_TAG_NULL_E :
|
||||
XSTRNCPY(buffer, "ASN tag error, not null", max);
|
||||
break;
|
||||
|
||||
case ASN_EXPECT_0_E :
|
||||
XSTRNCPY(buffer, "ASN expect error, not zero", max);
|
||||
break;
|
||||
|
||||
case ASN_BITSTR_E :
|
||||
XSTRNCPY(buffer, "ASN bit string error, wrong id", max);
|
||||
break;
|
||||
|
||||
case ASN_UNKNOWN_OID_E :
|
||||
XSTRNCPY(buffer, "ASN oid error, unknown sum id", max);
|
||||
break;
|
||||
|
||||
case ASN_DATE_SZ_E :
|
||||
XSTRNCPY(buffer, "ASN date error, bad size", max);
|
||||
break;
|
||||
|
||||
case ASN_BEFORE_DATE_E :
|
||||
XSTRNCPY(buffer, "ASN date error, current date before", max);
|
||||
break;
|
||||
|
||||
case ASN_AFTER_DATE_E :
|
||||
XSTRNCPY(buffer, "ASN date error, current date after", max);
|
||||
break;
|
||||
|
||||
case ASN_SIG_OID_E :
|
||||
XSTRNCPY(buffer, "ASN signature error, mismatched oid", max);
|
||||
break;
|
||||
|
||||
case ASN_TIME_E :
|
||||
XSTRNCPY(buffer, "ASN time error, unkown time type", max);
|
||||
break;
|
||||
|
||||
case ASN_INPUT_E :
|
||||
XSTRNCPY(buffer, "ASN input error, not enough data", max);
|
||||
break;
|
||||
|
||||
case ASN_SIG_CONFIRM_E :
|
||||
XSTRNCPY(buffer, "ASN sig error, confirm failure", max);
|
||||
break;
|
||||
|
||||
case ASN_SIG_HASH_E :
|
||||
XSTRNCPY(buffer, "ASN sig error, unsupported hash type", max);
|
||||
break;
|
||||
|
||||
case ASN_SIG_KEY_E :
|
||||
XSTRNCPY(buffer, "ASN sig error, unsupported key type", max);
|
||||
break;
|
||||
|
||||
case ASN_DH_KEY_E :
|
||||
XSTRNCPY(buffer, "ASN key init error, invalid input", max);
|
||||
break;
|
||||
|
||||
case ASN_NTRU_KEY_E :
|
||||
XSTRNCPY(buffer, "ASN NTRU key decode error, invalid input", max);
|
||||
break;
|
||||
|
||||
case ECC_BAD_ARG_E :
|
||||
XSTRNCPY(buffer, "ECC input argument wrong type, invalid input", max);
|
||||
break;
|
||||
|
||||
case ASN_ECC_KEY_E :
|
||||
XSTRNCPY(buffer, "ECC ASN1 bad key data, invalid input", max);
|
||||
break;
|
||||
|
||||
case ECC_CURVE_OID_E :
|
||||
XSTRNCPY(buffer, "ECC curve sum OID unsupported, invalid input", max);
|
||||
break;
|
||||
|
||||
case BAD_FUNC_ARG :
|
||||
XSTRNCPY(buffer, "Bad function argument", max);
|
||||
break;
|
||||
|
||||
case NOT_COMPILED_IN :
|
||||
XSTRNCPY(buffer, "Feature not compiled in", max);
|
||||
break;
|
||||
|
||||
case UNICODE_SIZE_E :
|
||||
XSTRNCPY(buffer, "Unicode password too big", max);
|
||||
break;
|
||||
|
||||
case NO_PASSWORD :
|
||||
XSTRNCPY(buffer, "No password provided by user", max);
|
||||
break;
|
||||
|
||||
case ALT_NAME_E :
|
||||
XSTRNCPY(buffer, "Alt Name problem, too big", max);
|
||||
break;
|
||||
|
||||
case AES_GCM_AUTH_E:
|
||||
XSTRNCPY(buffer, "AES-GCM Authentication check fail", max);
|
||||
break;
|
||||
|
||||
default:
|
||||
XSTRNCPY(buffer, "unknown error number", max);
|
||||
|
||||
}
|
||||
|
||||
#endif /* NO_ERROR_STRINGS */
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user