wolfSSL SSL/TLS library, support up to TLS1.3

Dependents:   CyaSSL-Twitter-OAuth4Tw Example-client-tls-cert TwitterReader TweetTest ... more

Committer:
wolfSSL
Date:
Fri Jun 26 00:39:20 2015 +0000
Revision:
0:d92f9d21154c
wolfSSL 3.6.0

Who changed what in which revision?

UserRevisionLine numberNew contents of line
wolfSSL 0:d92f9d21154c 1 /* error-crypt.h
wolfSSL 0:d92f9d21154c 2 *
wolfSSL 0:d92f9d21154c 3 * Copyright (C) 2006-2015 wolfSSL Inc.
wolfSSL 0:d92f9d21154c 4 *
wolfSSL 0:d92f9d21154c 5 * This file is part of wolfSSL. (formerly known as CyaSSL)
wolfSSL 0:d92f9d21154c 6 *
wolfSSL 0:d92f9d21154c 7 * wolfSSL is free software; you can redistribute it and/or modify
wolfSSL 0:d92f9d21154c 8 * it under the terms of the GNU General Public License as published by
wolfSSL 0:d92f9d21154c 9 * the Free Software Foundation; either version 2 of the License, or
wolfSSL 0:d92f9d21154c 10 * (at your option) any later version.
wolfSSL 0:d92f9d21154c 11 *
wolfSSL 0:d92f9d21154c 12 * wolfSSL is distributed in the hope that it will be useful,
wolfSSL 0:d92f9d21154c 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
wolfSSL 0:d92f9d21154c 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
wolfSSL 0:d92f9d21154c 15 * GNU General Public License for more details.
wolfSSL 0:d92f9d21154c 16 *
wolfSSL 0:d92f9d21154c 17 * You should have received a copy of the GNU General Public License
wolfSSL 0:d92f9d21154c 18 * along with this program; if not, write to the Free Software
wolfSSL 0:d92f9d21154c 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
wolfSSL 0:d92f9d21154c 20 */
wolfSSL 0:d92f9d21154c 21
wolfSSL 0:d92f9d21154c 22
wolfSSL 0:d92f9d21154c 23 #ifndef WOLF_CRYPT_ERROR_H
wolfSSL 0:d92f9d21154c 24 #define WOLF_CRYPT_ERROR_H
wolfSSL 0:d92f9d21154c 25
wolfSSL 0:d92f9d21154c 26 #include <wolfssl/wolfcrypt/types.h>
wolfSSL 0:d92f9d21154c 27
wolfSSL 0:d92f9d21154c 28 #ifdef HAVE_FIPS
wolfSSL 0:d92f9d21154c 29 #include <cyassl/ctaocrypt/error-crypt.h>
wolfSSL 0:d92f9d21154c 30 #define wc_ErrorString CTaoCryptErrorString
wolfSSL 0:d92f9d21154c 31 #define wc_GetErrorString CTaoCryptGetErrorString
wolfSSL 0:d92f9d21154c 32 #endif /* HAVE_FIPS */
wolfSSL 0:d92f9d21154c 33
wolfSSL 0:d92f9d21154c 34 #ifdef __cplusplus
wolfSSL 0:d92f9d21154c 35 extern "C" {
wolfSSL 0:d92f9d21154c 36 #endif
wolfSSL 0:d92f9d21154c 37
wolfSSL 0:d92f9d21154c 38
wolfSSL 0:d92f9d21154c 39 /* error codes */
wolfSSL 0:d92f9d21154c 40 enum {
wolfSSL 0:d92f9d21154c 41 MAX_CODE_E = -100, /* errors -101 - -299 */
wolfSSL 0:d92f9d21154c 42 OPEN_RAN_E = -101, /* opening random device error */
wolfSSL 0:d92f9d21154c 43 READ_RAN_E = -102, /* reading random device error */
wolfSSL 0:d92f9d21154c 44 WINCRYPT_E = -103, /* windows crypt init error */
wolfSSL 0:d92f9d21154c 45 CRYPTGEN_E = -104, /* windows crypt generation error */
wolfSSL 0:d92f9d21154c 46 RAN_BLOCK_E = -105, /* reading random device would block */
wolfSSL 0:d92f9d21154c 47 BAD_MUTEX_E = -106, /* Bad mutex operation */
wolfSSL 0:d92f9d21154c 48
wolfSSL 0:d92f9d21154c 49 MP_INIT_E = -110, /* mp_init error state */
wolfSSL 0:d92f9d21154c 50 MP_READ_E = -111, /* mp_read error state */
wolfSSL 0:d92f9d21154c 51 MP_EXPTMOD_E = -112, /* mp_exptmod error state */
wolfSSL 0:d92f9d21154c 52 MP_TO_E = -113, /* mp_to_xxx error state, can't convert */
wolfSSL 0:d92f9d21154c 53 MP_SUB_E = -114, /* mp_sub error state, can't subtract */
wolfSSL 0:d92f9d21154c 54 MP_ADD_E = -115, /* mp_add error state, can't add */
wolfSSL 0:d92f9d21154c 55 MP_MUL_E = -116, /* mp_mul error state, can't multiply */
wolfSSL 0:d92f9d21154c 56 MP_MULMOD_E = -117, /* mp_mulmod error state, can't multiply mod */
wolfSSL 0:d92f9d21154c 57 MP_MOD_E = -118, /* mp_mod error state, can't mod */
wolfSSL 0:d92f9d21154c 58 MP_INVMOD_E = -119, /* mp_invmod error state, can't inv mod */
wolfSSL 0:d92f9d21154c 59 MP_CMP_E = -120, /* mp_cmp error state */
wolfSSL 0:d92f9d21154c 60 MP_ZERO_E = -121, /* got a mp zero result, not expected */
wolfSSL 0:d92f9d21154c 61
wolfSSL 0:d92f9d21154c 62 MEMORY_E = -125, /* out of memory error */
wolfSSL 0:d92f9d21154c 63
wolfSSL 0:d92f9d21154c 64 RSA_WRONG_TYPE_E = -130, /* RSA wrong block type for RSA function */
wolfSSL 0:d92f9d21154c 65 RSA_BUFFER_E = -131, /* RSA buffer error, output too small or
wolfSSL 0:d92f9d21154c 66 input too large */
wolfSSL 0:d92f9d21154c 67 BUFFER_E = -132, /* output buffer too small or input too large */
wolfSSL 0:d92f9d21154c 68 ALGO_ID_E = -133, /* setting algo id error */
wolfSSL 0:d92f9d21154c 69 PUBLIC_KEY_E = -134, /* setting public key error */
wolfSSL 0:d92f9d21154c 70 DATE_E = -135, /* setting date validity error */
wolfSSL 0:d92f9d21154c 71 SUBJECT_E = -136, /* setting subject name error */
wolfSSL 0:d92f9d21154c 72 ISSUER_E = -137, /* setting issuer name error */
wolfSSL 0:d92f9d21154c 73 CA_TRUE_E = -138, /* setting CA basic constraint true error */
wolfSSL 0:d92f9d21154c 74 EXTENSIONS_E = -139, /* setting extensions error */
wolfSSL 0:d92f9d21154c 75
wolfSSL 0:d92f9d21154c 76 ASN_PARSE_E = -140, /* ASN parsing error, invalid input */
wolfSSL 0:d92f9d21154c 77 ASN_VERSION_E = -141, /* ASN version error, invalid number */
wolfSSL 0:d92f9d21154c 78 ASN_GETINT_E = -142, /* ASN get big int error, invalid data */
wolfSSL 0:d92f9d21154c 79 ASN_RSA_KEY_E = -143, /* ASN key init error, invalid input */
wolfSSL 0:d92f9d21154c 80 ASN_OBJECT_ID_E = -144, /* ASN object id error, invalid id */
wolfSSL 0:d92f9d21154c 81 ASN_TAG_NULL_E = -145, /* ASN tag error, not null */
wolfSSL 0:d92f9d21154c 82 ASN_EXPECT_0_E = -146, /* ASN expect error, not zero */
wolfSSL 0:d92f9d21154c 83 ASN_BITSTR_E = -147, /* ASN bit string error, wrong id */
wolfSSL 0:d92f9d21154c 84 ASN_UNKNOWN_OID_E = -148, /* ASN oid error, unknown sum id */
wolfSSL 0:d92f9d21154c 85 ASN_DATE_SZ_E = -149, /* ASN date error, bad size */
wolfSSL 0:d92f9d21154c 86 ASN_BEFORE_DATE_E = -150, /* ASN date error, current date before */
wolfSSL 0:d92f9d21154c 87 ASN_AFTER_DATE_E = -151, /* ASN date error, current date after */
wolfSSL 0:d92f9d21154c 88 ASN_SIG_OID_E = -152, /* ASN signature error, mismatched oid */
wolfSSL 0:d92f9d21154c 89 ASN_TIME_E = -153, /* ASN time error, unknown time type */
wolfSSL 0:d92f9d21154c 90 ASN_INPUT_E = -154, /* ASN input error, not enough data */
wolfSSL 0:d92f9d21154c 91 ASN_SIG_CONFIRM_E = -155, /* ASN sig error, confirm failure */
wolfSSL 0:d92f9d21154c 92 ASN_SIG_HASH_E = -156, /* ASN sig error, unsupported hash type */
wolfSSL 0:d92f9d21154c 93 ASN_SIG_KEY_E = -157, /* ASN sig error, unsupported key type */
wolfSSL 0:d92f9d21154c 94 ASN_DH_KEY_E = -158, /* ASN key init error, invalid input */
wolfSSL 0:d92f9d21154c 95 ASN_NTRU_KEY_E = -159, /* ASN ntru key decode error, invalid input */
wolfSSL 0:d92f9d21154c 96 ASN_CRIT_EXT_E = -160, /* ASN unsupported critical extension */
wolfSSL 0:d92f9d21154c 97
wolfSSL 0:d92f9d21154c 98 ECC_BAD_ARG_E = -170, /* ECC input argument of wrong type */
wolfSSL 0:d92f9d21154c 99 ASN_ECC_KEY_E = -171, /* ASN ECC bad input */
wolfSSL 0:d92f9d21154c 100 ECC_CURVE_OID_E = -172, /* Unsupported ECC OID curve type */
wolfSSL 0:d92f9d21154c 101 BAD_FUNC_ARG = -173, /* Bad function argument provided */
wolfSSL 0:d92f9d21154c 102 NOT_COMPILED_IN = -174, /* Feature not compiled in */
wolfSSL 0:d92f9d21154c 103 UNICODE_SIZE_E = -175, /* Unicode password too big */
wolfSSL 0:d92f9d21154c 104 NO_PASSWORD = -176, /* no password provided by user */
wolfSSL 0:d92f9d21154c 105 ALT_NAME_E = -177, /* alt name size problem, too big */
wolfSSL 0:d92f9d21154c 106
wolfSSL 0:d92f9d21154c 107 AES_GCM_AUTH_E = -180, /* AES-GCM Authentication check failure */
wolfSSL 0:d92f9d21154c 108 AES_CCM_AUTH_E = -181, /* AES-CCM Authentication check failure */
wolfSSL 0:d92f9d21154c 109
wolfSSL 0:d92f9d21154c 110 CAVIUM_INIT_E = -182, /* Cavium Init type error */
wolfSSL 0:d92f9d21154c 111
wolfSSL 0:d92f9d21154c 112 COMPRESS_INIT_E = -183, /* Compress init error */
wolfSSL 0:d92f9d21154c 113 COMPRESS_E = -184, /* Compress error */
wolfSSL 0:d92f9d21154c 114 DECOMPRESS_INIT_E = -185, /* DeCompress init error */
wolfSSL 0:d92f9d21154c 115 DECOMPRESS_E = -186, /* DeCompress error */
wolfSSL 0:d92f9d21154c 116
wolfSSL 0:d92f9d21154c 117 BAD_ALIGN_E = -187, /* Bad alignment for operation, no alloc */
wolfSSL 0:d92f9d21154c 118 ASN_NO_SIGNER_E = -188, /* ASN no signer to confirm failure */
wolfSSL 0:d92f9d21154c 119 ASN_CRL_CONFIRM_E = -189, /* ASN CRL signature confirm failure */
wolfSSL 0:d92f9d21154c 120 ASN_CRL_NO_SIGNER_E = -190, /* ASN CRL no signer to confirm failure */
wolfSSL 0:d92f9d21154c 121 ASN_OCSP_CONFIRM_E = -191, /* ASN OCSP signature confirm failure */
wolfSSL 0:d92f9d21154c 122
wolfSSL 0:d92f9d21154c 123 BAD_ENC_STATE_E = -192, /* Bad ecc enc state operation */
wolfSSL 0:d92f9d21154c 124 BAD_PADDING_E = -193, /* Bad padding, msg not correct length */
wolfSSL 0:d92f9d21154c 125
wolfSSL 0:d92f9d21154c 126 REQ_ATTRIBUTE_E = -194, /* setting cert request attributes error */
wolfSSL 0:d92f9d21154c 127
wolfSSL 0:d92f9d21154c 128 PKCS7_OID_E = -195, /* PKCS#7, mismatched OID error */
wolfSSL 0:d92f9d21154c 129 PKCS7_RECIP_E = -196, /* PKCS#7, recipient error */
wolfSSL 0:d92f9d21154c 130 FIPS_NOT_ALLOWED_E = -197, /* FIPS not allowed error */
wolfSSL 0:d92f9d21154c 131 ASN_NAME_INVALID_E = -198, /* ASN name constraint error */
wolfSSL 0:d92f9d21154c 132
wolfSSL 0:d92f9d21154c 133 RNG_FAILURE_E = -199, /* RNG Failed, Reinitialize */
wolfSSL 0:d92f9d21154c 134 HMAC_MIN_KEYLEN_E = -200, /* FIPS Mode HMAC Minimum Key Length error */
wolfSSL 0:d92f9d21154c 135 RSA_PAD_E = -201, /* RSA Padding Error */
wolfSSL 0:d92f9d21154c 136 LENGTH_ONLY_E = -202, /* Returning output length only */
wolfSSL 0:d92f9d21154c 137
wolfSSL 0:d92f9d21154c 138 IN_CORE_FIPS_E = -203, /* In Core Integrity check failure */
wolfSSL 0:d92f9d21154c 139 AES_KAT_FIPS_E = -204, /* AES KAT failure */
wolfSSL 0:d92f9d21154c 140 DES3_KAT_FIPS_E = -205, /* DES3 KAT failure */
wolfSSL 0:d92f9d21154c 141 HMAC_KAT_FIPS_E = -206, /* HMAC KAT failure */
wolfSSL 0:d92f9d21154c 142 RSA_KAT_FIPS_E = -207, /* RSA KAT failure */
wolfSSL 0:d92f9d21154c 143 DRBG_KAT_FIPS_E = -208, /* HASH DRBG KAT failure */
wolfSSL 0:d92f9d21154c 144 DRBG_CONT_FIPS_E = -209, /* HASH DRBG Continious test failure */
wolfSSL 0:d92f9d21154c 145 AESGCM_KAT_FIPS_E = -210, /* AESGCM KAT failure */
wolfSSL 0:d92f9d21154c 146 THREAD_STORE_KEY_E = -211, /* Thread local storage key create failure */
wolfSSL 0:d92f9d21154c 147 THREAD_STORE_SET_E = -212, /* Thread local storage key set failure */
wolfSSL 0:d92f9d21154c 148
wolfSSL 0:d92f9d21154c 149 MAC_CMP_FAILED_E = -213, /* MAC comparison failed */
wolfSSL 0:d92f9d21154c 150 IS_POINT_E = -214, /* ECC is point on curve failed */
wolfSSL 0:d92f9d21154c 151 ECC_INF_E = -215, /* ECC point infinity error */
wolfSSL 0:d92f9d21154c 152 ECC_PRIV_KEY_E = -216, /* ECC private key not valid error */
wolfSSL 0:d92f9d21154c 153
wolfSSL 0:d92f9d21154c 154 MIN_CODE_E = -300 /* errors -101 - -299 */
wolfSSL 0:d92f9d21154c 155 };
wolfSSL 0:d92f9d21154c 156
wolfSSL 0:d92f9d21154c 157
wolfSSL 0:d92f9d21154c 158 WOLFSSL_API void wc_ErrorString(int err, char* buff);
wolfSSL 0:d92f9d21154c 159 WOLFSSL_API const char* wc_GetErrorString(int error);
wolfSSL 0:d92f9d21154c 160
wolfSSL 0:d92f9d21154c 161
wolfSSL 0:d92f9d21154c 162 #ifdef __cplusplus
wolfSSL 0:d92f9d21154c 163 } /* extern "C" */
wolfSSL 0:d92f9d21154c 164 #endif
wolfSSL 0:d92f9d21154c 165 #endif /* WOLF_CRYPT_ERROR_H */
wolfSSL 0:d92f9d21154c 166
wolfSSL 0:d92f9d21154c 167
wolfSSL 0:d92f9d21154c 168