wolf SSL / wolfSSL-TLS13-Beta

Fork of wolfSSL by wolf SSL

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers error-crypt.h Source File

error-crypt.h

00001 /* error-crypt.h
00002  *
00003  * Copyright (C) 2006-2016 wolfSSL Inc.
00004  *
00005  * This file is part of wolfSSL.
00006  *
00007  * wolfSSL is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 2 of the License, or
00010  * (at your option) any later version.
00011  *
00012  * wolfSSL is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
00020  */
00021 
00022 
00023 
00024 #ifndef WOLF_CRYPT_ERROR_H
00025 #define WOLF_CRYPT_ERROR_H
00026 
00027 #include <wolfssl/wolfcrypt/types.h>
00028 
00029 #ifdef HAVE_FIPS
00030     #include <cyassl/ctaocrypt/error-crypt.h>
00031 #endif /* HAVE_FIPS */
00032 
00033 #ifdef __cplusplus
00034     extern "C" {
00035 #endif
00036 
00037 
00038 /* error codes, add string for new errors !!! */
00039 enum {
00040     MAX_CODE_E         = -100,  /* errors -101 - -299 */
00041     OPEN_RAN_E         = -101,  /* opening random device error */
00042     READ_RAN_E         = -102,  /* reading random device error */
00043     WINCRYPT_E         = -103,  /* windows crypt init error */
00044     CRYPTGEN_E         = -104,  /* windows crypt generation error */
00045     RAN_BLOCK_E        = -105,  /* reading random device would block */
00046     BAD_MUTEX_E        = -106,  /* Bad mutex operation */
00047     WC_TIMEOUT_E       = -107,  /* timeout error */
00048     WC_PENDING_E       = -108,  /* wolfCrypt operation pending (would block) */
00049     WC_NOT_PENDING_E   = -109,  /* wolfCrypt operation not pending */
00050 
00051     MP_INIT_E          = -110,  /* mp_init error state */
00052     MP_READ_E          = -111,  /* mp_read error state */
00053     MP_EXPTMOD_E       = -112,  /* mp_exptmod error state */
00054     MP_TO_E            = -113,  /* mp_to_xxx error state, can't convert */
00055     MP_SUB_E           = -114,  /* mp_sub error state, can't subtract */
00056     MP_ADD_E           = -115,  /* mp_add error state, can't add */
00057     MP_MUL_E           = -116,  /* mp_mul error state, can't multiply */
00058     MP_MULMOD_E        = -117,  /* mp_mulmod error state, can't multiply mod */
00059     MP_MOD_E           = -118,  /* mp_mod error state, can't mod */
00060     MP_INVMOD_E        = -119,  /* mp_invmod error state, can't inv mod */
00061     MP_CMP_E           = -120,  /* mp_cmp error state */
00062     MP_ZERO_E          = -121,  /* got a mp zero result, not expected */
00063 
00064     MEMORY_E           = -125,  /* out of memory error */
00065     VAR_STATE_CHANGE_E = -126,  /* var state modified by different thread */
00066 
00067     RSA_WRONG_TYPE_E   = -130,  /* RSA wrong block type for RSA function */
00068     RSA_BUFFER_E       = -131,  /* RSA buffer error, output too small or
00069                                    input too large */
00070     BUFFER_E           = -132,  /* output buffer too small or input too large */
00071     ALGO_ID_E          = -133,  /* setting algo id error */
00072     PUBLIC_KEY_E       = -134,  /* setting public key error */
00073     DATE_E             = -135,  /* setting date validity error */
00074     SUBJECT_E          = -136,  /* setting subject name error */
00075     ISSUER_E           = -137,  /* setting issuer  name error */
00076     CA_TRUE_E          = -138,  /* setting CA basic constraint true error */
00077     EXTENSIONS_E       = -139,  /* setting extensions error */
00078 
00079     ASN_PARSE_E        = -140,  /* ASN parsing error, invalid input */
00080     ASN_VERSION_E      = -141,  /* ASN version error, invalid number */
00081     ASN_GETINT_E       = -142,  /* ASN get big int error, invalid data */
00082     ASN_RSA_KEY_E      = -143,  /* ASN key init error, invalid input */
00083     ASN_OBJECT_ID_E    = -144,  /* ASN object id error, invalid id */
00084     ASN_TAG_NULL_E     = -145,  /* ASN tag error, not null */
00085     ASN_EXPECT_0_E     = -146,  /* ASN expect error, not zero */
00086     ASN_BITSTR_E       = -147,  /* ASN bit string error, wrong id */
00087     ASN_UNKNOWN_OID_E  = -148,  /* ASN oid error, unknown sum id */
00088     ASN_DATE_SZ_E      = -149,  /* ASN date error, bad size */
00089     ASN_BEFORE_DATE_E  = -150,  /* ASN date error, current date before */
00090     ASN_AFTER_DATE_E   = -151,  /* ASN date error, current date after */
00091     ASN_SIG_OID_E      = -152,  /* ASN signature error, mismatched oid */
00092     ASN_TIME_E         = -153,  /* ASN time error, unknown time type */
00093     ASN_INPUT_E        = -154,  /* ASN input error, not enough data */
00094     ASN_SIG_CONFIRM_E  = -155,  /* ASN sig error, confirm failure */
00095     ASN_SIG_HASH_E     = -156,  /* ASN sig error, unsupported hash type */
00096     ASN_SIG_KEY_E      = -157,  /* ASN sig error, unsupported key type */
00097     ASN_DH_KEY_E       = -158,  /* ASN key init error, invalid input */
00098     ASN_NTRU_KEY_E     = -159,  /* ASN ntru key decode error, invalid input */
00099     ASN_CRIT_EXT_E     = -160,  /* ASN unsupported critical extension */
00100 
00101     ECC_BAD_ARG_E      = -170,  /* ECC input argument of wrong type */
00102     ASN_ECC_KEY_E      = -171,  /* ASN ECC bad input */
00103     ECC_CURVE_OID_E    = -172,  /* Unsupported ECC OID curve type */
00104     BAD_FUNC_ARG       = -173,  /* Bad function argument provided */
00105     NOT_COMPILED_IN    = -174,  /* Feature not compiled in */
00106     UNICODE_SIZE_E     = -175,  /* Unicode password too big */
00107     NO_PASSWORD        = -176,  /* no password provided by user */
00108     ALT_NAME_E         = -177,  /* alt name size problem, too big */
00109 
00110     AES_GCM_AUTH_E     = -180,  /* AES-GCM Authentication check failure */
00111     AES_CCM_AUTH_E     = -181,  /* AES-CCM Authentication check failure */
00112 
00113     ASYNC_INIT_E       = -182,  /* Async Init type error */
00114 
00115     COMPRESS_INIT_E    = -183,  /* Compress init error */
00116     COMPRESS_E         = -184,  /* Compress error */
00117     DECOMPRESS_INIT_E  = -185,  /* DeCompress init error */
00118     DECOMPRESS_E       = -186,  /* DeCompress error */
00119 
00120     BAD_ALIGN_E         = -187,  /* Bad alignment for operation, no alloc */
00121     ASN_NO_SIGNER_E     = -188,  /* ASN no signer to confirm failure */
00122     ASN_CRL_CONFIRM_E   = -189,  /* ASN CRL signature confirm failure */
00123     ASN_CRL_NO_SIGNER_E = -190,  /* ASN CRL no signer to confirm failure */
00124     ASN_OCSP_CONFIRM_E  = -191,  /* ASN OCSP signature confirm failure */
00125 
00126     BAD_STATE_E         = -192,  /* Bad state operation */
00127     BAD_PADDING_E       = -193,  /* Bad padding, msg not correct length  */
00128 
00129     REQ_ATTRIBUTE_E     = -194,  /* setting cert request attributes error */
00130 
00131     PKCS7_OID_E         = -195,  /* PKCS#7, mismatched OID error */
00132     PKCS7_RECIP_E       = -196,  /* PKCS#7, recipient error */
00133     FIPS_NOT_ALLOWED_E  = -197,  /* FIPS not allowed error */
00134     ASN_NAME_INVALID_E  = -198,  /* ASN name constraint error */
00135 
00136     RNG_FAILURE_E       = -199,  /* RNG Failed, Reinitialize */
00137     HMAC_MIN_KEYLEN_E   = -200,  /* FIPS Mode HMAC Minimum Key Length error */
00138     RSA_PAD_E           = -201,  /* RSA Padding Error */
00139     LENGTH_ONLY_E       = -202,  /* Returning output length only */
00140 
00141     IN_CORE_FIPS_E      = -203,  /* In Core Integrity check failure */
00142     AES_KAT_FIPS_E      = -204,  /* AES KAT failure */
00143     DES3_KAT_FIPS_E     = -205,  /* DES3 KAT failure */
00144     HMAC_KAT_FIPS_E     = -206,  /* HMAC KAT failure */
00145     RSA_KAT_FIPS_E      = -207,  /* RSA KAT failure */
00146     DRBG_KAT_FIPS_E     = -208,  /* HASH DRBG KAT failure */
00147     DRBG_CONT_FIPS_E    = -209,  /* HASH DRBG Continuous test failure */
00148     AESGCM_KAT_FIPS_E   = -210,  /* AESGCM KAT failure */
00149     THREAD_STORE_KEY_E  = -211,  /* Thread local storage key create failure */
00150     THREAD_STORE_SET_E  = -212,  /* Thread local storage key set failure */
00151 
00152     MAC_CMP_FAILED_E    = -213,  /* MAC comparison failed */
00153     IS_POINT_E          = -214,  /* ECC is point on curve failed */
00154     ECC_INF_E           = -215,  /* ECC point infinity error */
00155     ECC_PRIV_KEY_E      = -216,  /* ECC private key not valid error */
00156     ECC_OUT_OF_RANGE_E  = -217,  /* ECC key component out of range */
00157 
00158     SRP_CALL_ORDER_E    = -218,  /* SRP function called in the wrong order. */
00159     SRP_VERIFY_E        = -219,  /* SRP proof verification failed. */
00160     SRP_BAD_KEY_E       = -220,  /* SRP bad ephemeral values. */
00161 
00162     ASN_NO_SKID         = -221,  /* ASN no Subject Key Identifier found */
00163     ASN_NO_AKID         = -222,  /* ASN no Authority Key Identifier found */
00164     ASN_NO_KEYUSAGE     = -223,  /* ASN no Key Usage found */
00165     SKID_E              = -224,  /* setting Subject Key Identifier error */
00166     AKID_E              = -225,  /* setting Authority Key Identifier error */
00167     KEYUSAGE_E          = -226,  /* Bad Key Usage value */
00168     CERTPOLICIES_E      = -227,  /* setting Certificate Policies error */
00169 
00170     WC_INIT_E           = -228,  /* wolfcrypt failed to initialize */
00171     SIG_VERIFY_E        = -229,  /* wolfcrypt signature verify error */
00172     BAD_COND_E          = -230,  /* Bad condition variable operation */
00173     SIG_TYPE_E          = -231,  /* Signature Type not enabled/available */
00174     HASH_TYPE_E         = -232,  /* Hash Type not enabled/available */
00175 
00176     WC_KEY_SIZE_E       = -234,  /* Key size error, either too small or large */
00177     ASN_COUNTRY_SIZE_E  = -235,  /* ASN Cert Gen, invalid country code size */
00178     MISSING_RNG_E       = -236,  /* RNG required but not provided */
00179     ASN_PATHLEN_SIZE_E  = -237,  /* ASN CA path length too large error */
00180     ASN_PATHLEN_INV_E   = -238,  /* ASN CA path length inversion error */
00181 
00182     BAD_KEYWRAP_ALG_E   = -239,
00183     BAD_KEYWRAP_IV_E    = -240,  /* Decrypted AES key wrap IV incorrect */
00184     WC_CLEANUP_E        = -241,  /* wolfcrypt cleanup failed */
00185     ECC_CDH_KAT_FIPS_E  = -242,  /* ECC CDH Known Answer Test failure */
00186     DH_CHECK_PUB_E      = -243,  /* DH Check Pub Key error */
00187     BAD_PATH_ERROR      = -244,  /* Bad path for opendir */
00188 
00189     ASYNC_OP_E          = -245,  /* Async operation error */
00190 
00191     WC_LAST_E           = -245,  /* Update this to indicate last error */
00192     MIN_CODE_E          = -300   /* errors -101 - -299 */
00193 
00194     /* add new companion error id strings for any new error codes
00195        wolfcrypt/src/error.c !!! */
00196 };
00197 
00198 
00199 WOLFSSL_API void wc_ErrorString(int err, char* buff);
00200 WOLFSSL_API const char* wc_GetErrorString(int error);
00201 
00202 
00203 #ifdef __cplusplus
00204     } /* extern "C" */
00205 #endif
00206 #endif /* WOLF_CRYPT_ERROR_H */
00207