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