• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * This file is part of the openHiTLS project.
3  *
4  * openHiTLS is licensed under the Mulan PSL v2.
5  * You can use this software according to the terms and conditions of the Mulan PSL v2.
6  * You may obtain a copy of Mulan PSL v2 at:
7  *
8  *     http://license.coscl.org.cn/MulanPSL2
9  *
10  * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
11  * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
12  * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
13  * See the Mulan PSL v2 for more details.
14  */
15 
16 /**
17  * @defgroup crypt_errno
18  * @ingroup crypt
19  * @brief error number module of crypto module
20  */
21 
22 #ifndef CRYPT_ERRNO_H
23 #define CRYPT_ERRNO_H
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 /**
30  * @ingroup crypt_errno
31  * @brief   Return success
32  */
33 #define CRYPT_SUCCESS 0
34 
35 /**
36  * @ingroup crypt_errno
37  *
38  * CRYPTO module return value.
39  */
40 enum CRYPT_ERROR {
41     CRYPT_NULL_INPUT = 0x01010001,      /**< Null pointer input error, bufferLen is 0. */
42     CRYPT_SECUREC_FAIL,                 /**< Security function  returns an error. */
43     CRYPT_MEM_ALLOC_FAIL,               /**< Failed to apply for memory. */
44     CRYPT_NO_REGIST_RAND,               /**< The global random number is not registered.*/
45     CRYPT_ERR_ALGID,                    /**< Incorrect algorithm ID. */
46     CRYPT_INVALID_ARG,                  /**< Invalid input parameter. */
47     CRYPT_NOT_SUPPORT,                  /**< unsupported operation. */
48     CRYPT_INCONSISTENT_OPERATION,       /**< Inconsistent operation. */
49 
50     CRYPT_BN_BUFF_LEN_NOT_ENOUGH = 0x01020001, /**< Insufficient buffer length. */
51     CRYPT_BN_SPACE_NOT_ENOUGH,          /**< Insufficient big number space. */
52     CRYPT_BN_BITS_TOO_MAX,              /**< The maximum bit limit is exceeded of the big number. */
53     CRYPT_BN_RAND_GEN_FAIL,             /**< Failed to generate the random number. */
54     CRYPT_BN_OPTIMIZER_STACK_FULL,      /**< Optimizer stack is full. */
55     CRYPT_BN_NO_NEGATIVE_ZERO,          /**< The big number is set to a positive number only. */
56     CRYPT_BN_ERR_RAND_ZERO,             /**< Generates a random number smaller than 0. */
57     CRYPT_BN_ERR_RAND_NEGATIVE,         /**< Generate a negative random number. */
58     CRYPT_BN_ERR_RAND_TOP_BOTTOM,       /**< The top or bottom is invalid during random number generation. */
59     CRYPT_BN_ERR_RAND_BITS_NOT_ENOUGH,  /**< The bit is too small during random number generation. */
60     CRYPT_BN_OPTIMIZER_GET_FAIL,        /**< Failed to obtain the space from the optimizer. */
61     CRYPT_BN_ERR_DIVISOR_ZERO,          /**< The divisor cannot be 0. */
62     CRYPT_BN_ERR_EXP_NO_NEGATIVE,       /**< The value of exponent cannot be negative. */
63     CRYPT_BN_MONT_BASE_TOO_MAX,         /**< Montgomery module exponentiation base is too large. */
64     CRYPT_BN_NOR_GEN_PRIME,             /**< Prime Number Generation Failure. */
65     CRYPT_BN_NOR_CHECK_PRIME,           /**< prime number check failed. */
66     CRYPT_BN_ERR_GCD_NO_ZERO,           /**< The maximum common divisor cannot contain 0. */
67     CRYPT_BN_ERR_NO_INVERSE,            /**< Cannot obtain the inverse module. */
68     CRYPT_BN_ERR_SQRT_PARA,             /**< The parameter is incorrect when modulus square root. */
69     CRYPT_BN_ERR_LEGENDE_DATA,          /**< Failed to find a specific number for z to p's Legendre sign (z|p)
70                                              equal to -1 when calculating the square root. */
71     CRYPT_BN_ERR_NO_SQUARE_ROOT,        /**< The square root cannot be found. */
72     CRYPT_BN_ERR_MASKCOPY_LEN,          /**< Data lengths are inconsistent when data is copied with masks. */
73     CRYPT_BN_ERR_QUICK_MODDATA,         /**< Uses the BN_ModNistEccMul and BN_ModNistEccSqr interfaces,
74                                              the module data is not supported. */
75 
76     CRYPT_BN_FLAG_INVALID,              /**< Invalid big number flag. */
77     CRYPT_BN_CONVERT_INPUT_INVALID,     /**< Invalid input parameter of big number strings. */
78     CRYPT_BN_NOT_SUPPORT_EXTENSION,     /**< The big number does not support dynamic extension. */
79     CRYPT_BN_INPUT_INVALID,             /**< Invalid external big number input. */
80     CRYPT_BN_BITS_INVALID,              /**< The bits of the big number exceeds the limit. */
81     CRYPT_BN_ERR_SWAP_LEN,              /**< Data lengths are inconsistent when data is swapped with masks. */
82 
83     CRYPT_RSA_BUFF_LEN_NOT_ENOUGH = 0x01030001, /**< The buffer length is insufficient. */
84     CRYPT_RSA_NO_KEY_INFO,              /**< Lacks valid key information. */
85     CRYPT_RSA_ERR_KEY_BITS,             /**< Incorrect key length. */
86     CRYPT_RSA_ERR_E_VALUE,              /**< The value of parameter e is incorrect. */
87     CRYPT_RSA_NOR_KEYGEN_FAIL,          /**< Key generation failure, it's normal error. */
88     CRYPT_RSA_NOR_VERIFY_FAIL,          /**< Failed to verify the signature. it's normal error. */
89     CRYPT_RSA_ERR_ENC_BITS,             /**< Incorrect length of the encrypted plaintext of the public key. */
90     CRYPT_RSA_ERR_DEC_BITS,             /**< Incorrect length of the decrypted ciphertext of the private key. */
91     CRYPT_RSA_ERR_PSS_SALT_LEN,         /**< Incorrect salt length of the PSS operation. */
92     CRYPT_RSA_ERR_PSS_SALT_DATA,        /**< PSS operation salt data error, failed to compare the salt extracted
93                                              during signature verification with the user's input. */
94     CRYPT_RSA_ERR_PKCSV15_SALT_LEN,     /**< Incorrect salt length of the PKCSV15 operation. */
95     CRYPT_RSA_ERR_PKCSV15_SALT_DATA,    /**< PKCSV15 salt data error. */
96     CRYPT_RSA_ERR_INPUT_VALUE,          /**< Some special values, which are used as input errors. */
97     CRYPT_RSA_ERR_MD_ALGID,             /**< The hash ID of the input parameter is incorrect when
98                                              the pkcs1.5 padding mode is set. */
99     CRYPT_RSA_PAD_NO_SET_ERROR,         /**< Padding information is not set when using RSA key for
100                                              signature verification. */
101     CRYPT_RSA_CTRL_NOT_SUPPORT_ERROR,   /**< The Ctrl type is not supported When RSA is used for Ctrl. */
102     CRYPT_RSA_SET_SALT_NOT_PSS_ERROR,   /**< When the padding type of the key is not pss, and set the salt
103                                              information, return failure. */
104     CRYPT_RSA_SET_EMS_PKCSV15_LEN_ERROR,/**< Sets the PKCSV15 padding information, the length of the input data
105                                              is incorrect and return failure. */
106     CRYPT_RSA_SET_EMS_PSS_LEN_ERROR,    /**< Sets the PSS padding information, the length of the input data is
107                                              incorrect, and return failure. */
108     CRYPT_RSA_SET_RSAES_OAEP_LEN_ERROR, /**< Sets the OAEP padding information, the length of the input data
109                                              is incorrect and return failure. */
110     CRYPT_RSA_SET_FLAG_LEN_ERROR,       /**< The length of the input data is incorrect and return failure When
111                                              sets the flag. */
112     CRYPT_RSA_FLAG_NOT_SUPPORT_ERROR,   /**< Unsupported flag. */
113     CRYPT_RSA_ERR_SALT_LEN,             /**< Salt length error. */
114     CRYPT_RSA_ERR_ALGID,                /**< The hash ID of the input parameter is incorrect or conflict occurs when
115                                              sets the signature, signature verification, and padding parameters. */
116     CRYPT_RSA_ERR_GEN_SALT,             /**< An error is returned when salt information fails to be generated
117                                              during PSS signature. */
118     CRYPT_RSA_ERR_ENC_INPUT_NOT_ENOUGH, /**< The plaintext length is too short for RSA NO PAD encryption. */
119     CRYPT_RSA_ERR_DATA_LEN,             /**< Incorrect encryption length. */
120     CRYPT_RSA_ERR_PAD_NUM,              /**< Incorrect padding length. */
121     CRYPT_RSA_PUBKEY_NOT_EQUAL,         /**< RSA public keys are not equal. */
122     CRYPT_RSA_KEYPAIRWISE_CONSISTENCY_FAILURE,   /**< RSA pair-wise consistency failure. */
123     CRYPT_RSA_ERR_BLIND_TYPE,           /**< Invalid RSA blinding type. Only RSA-BSSA is currently supported. */
124     CRYPT_RSA_ERR_NO_BLIND_INFO,        /**< RSA blinding information is missing.
125                                             The blind/unblind operation requires previous blinding parameters. */
126     CRYPT_RSA_ERR_NO_PUBKEY_INFO,       /**< The rsa pub key is missing. */
127     CRYPT_RSA_PADDING_NOT_SUPPORTED,    /**< The specified RSA padding mode is not supported in blinding. */
128     CRYPT_RSA_ERR_BSSA_PARAM,           /**< The param of bssa is not invalid. */
129     CRYPT_RSA_GET_SALT_LEN_ERROR,       /**< The input length of getting salt-len is incorrect. */
130     CRYPT_RSA_GET_SALT_NOT_PSS_ERROR,   /**< When the padding type of the key is not pss, and get the salt len. */
131     CRYPT_RSA_ERR_PSS_PARAMS,            /**< The parameter is error when the padding type of the key is pss. */
132 
133     CRYPT_EAL_BUFF_LEN_NOT_ENOUGH = 0x01040001, /**< Insufficient buffer length. */
134     CRYPT_EAL_BUFF_LEN_TOO_LONG,        /**< Insufficient buffer length. */
135     CRYPT_EAL_ERR_ALGID,                /**< Incorrect algorithm ID. */
136     CRYPT_EAL_ALG_NOT_SUPPORT,          /**< Algorithm not supported, algorithm behavior not supported. */
137     CRYPT_EAL_ERR_NEW_PARA_FAIL,        /**< Failed to generate parameters. */
138     CRYPT_EAL_ERR_RAND_WORKING,         /**< DRBG is in the working state. */
139     CRYPT_EAL_ERR_RAND_NO_WORKING,      /**< DRBG is not working. */
140     CRYPT_EAL_ERR_METH_NULL_NUMBER,     /**< The method variable member is NULL. */
141     CRYPT_EAL_ERR_GLOBAL_DRBG_NULL,     /**< The global DRBG is null. */
142     CRYPT_EAL_ERR_DRBG_REPEAT_INIT,     /**< DRBG is initialized repeatedly. */
143     CRYPT_EAL_ERR_DRBG_INIT_FAIL,       /**< DRBG initialization failure. */
144     CRYPT_EAL_ERR_STATE,                /**< The usage process is incorrect. For example, run the update
145                                              command without running the init command.
146                                              For details, see related algorithms. */
147     CRYPT_EAL_CIPHER_DATA_ERROR,        /**< Data error occurs when unpadding the decrypted data.
148                                              For X923, the last bit is the length of the original data, and the
149                                              rest data is 0, if this requirement is not met, an error is reported.
150                                              For pkcs, all padding data is
151                                              (the length of the padding data - the length of the original data),
152                                              if this requirement is not met,an error will be reported.
153                                              For ISO7816, the first bit of padding data is 0x80, and the other bits
154                                              are 0, if this requirement is not met, an error will be reported. */
155     CRYPT_EAL_PADDING_NOT_SUPPORT,      /**< Unsupported padding. */
156     CRYPT_EAL_CIPHER_CTRL_ERROR,        /**< CRYPT_EAL_CipherCtrl interface unsupported CTRL type. */
157     CRYPT_EAL_CIPHER_FINAL_WITH_AEAD_ERROR,  /**< An error occurs when the final operation is performed on the
158                                                   AEAD algorithm. */
159     CRYPT_EAL_PKEY_CTRL_ERROR,          /**< When the CRYPT_EAL_PkeyCtrl interface performs CTRL,
160                                              the function is not supported or the input length is incorrect. */
161     CRYPT_EAL_MAC_CTRL_TYPE_ERROR,      /**< When the CRYPT_EAL_PkeyCtrl interface performs CTRL,
162                                              the function is not supported or the input length is incorrect. */
163     CRYPT_EAL_PKEY_DUP_ERROR,           /**< Pkey context duplicate failure. */
164     CRYPT_EAL_PKEY_CMP_DIFF_KEY_TYPE,   /**< Pkey comparison failure: different algorithm types. */
165     CRYPT_EAL_ERR_PART_OVERLAP,         /**< Some memory overlap. */
166     CRYPT_EAL_INTO_TYPE_NOT_SUPPORT,    /**< The info type is not supported. */
167     CRYPT_EAL_ALG_ASM_NOT_SUPPORT,      /**< Algorithm assembly is not supported. */
168     CRYPT_EAL_CIPHER_ERR_NEWCTX,
169 
170     CRYPT_SHA2_INPUT_OVERFLOW = 0x01050001, /**< The length of the input data exceeds the maximum
171                                                      processing range of SHA2. */
172     CRYPT_SHA2_OUT_BUFF_LEN_NOT_ENOUGH,     /**< The length of the buffer that storing the output
173                                              result is insufficient. */
174 
175     CRYPT_DRBG_ERR_STATE = 0x01060001,  /**< DRBG status error. */
176     CRYPT_DRBG_FAIL_GET_ENTROPY,        /**< Failed to obtain the entropy. */
177     CRYPT_DRBG_FAIL_GET_NONCE,          /**< Failed to obtain the nonce. */
178     CRYPT_DRBG_ALG_NOT_SUPPORT,         /**< Does not support the given algorithm. */
179     CRYPT_DRBG_INVALID_LEN,             /**< Incorrect data length. */
180     CRYPT_DRBG_PARAM_ERROR,             /**< Incorrect input parameter. */
181 
182     CRYPT_CURVE25519_NO_PUBKEY = 0x01080001,    /**< No public key. */
183     CRYPT_CURVE25519_NO_PRVKEY,                 /**< No private key. */
184     CRYPT_CURVE25519_KEYLEN_ERROR,              /**< Incorrect key length. */
185     CRYPT_CURVE25519_SIGNLEN_ERROR,             /**< Incorrect signature length. */
186     CRYPT_CURVE25519_HASH_METH_ERROR,           /**< Hash method is not SHA512. */
187     CRYPT_CURVE25519_VERIFY_FAIL,               /**< Signature verification fails due to incorrect signature. */
188     CRYPT_CURVE25519_NO_HASH_METHOD,            /**< Hash method not set. */
189     CRYPT_CURVE25519_UNSUPPORTED_CTRL_OPTION,   /**< Unsupported mode of operation. */
190     CRYPT_CURVE25519_KEY_COMPUTE_FAILED,        /**< Failed to generate the shared key. */
191     CRYPT_CURVE25519_INVALID_PUBKEY,            /**< Invalid public key. */
192     CRYPT_CURVE25519_PUBKEY_NOT_EQUAL,          /**< Public keys are not equal. */
193 
194     CRYPT_SHA1_INPUT_OVERFLOW = 0x01090001,          /**< The length of the input data exceeds the
195                                                            maximum processing range of SHA1. */
196     CRYPT_SHA1_OUT_BUFF_LEN_NOT_ENOUGH,              /**< The length of the buffer that storing
197                                                           the output result is insufficient. */
198 
199     CRYPT_ENTROPY_RCT_FAILURE = 0x010A0001,          /**< RCT detection fails, restart the entropy source. */
200     CRYPT_ENTROPY_APT_FAILURE,                       /**< APT detection fails, restart the entropy source. */
201     CRYPT_ENTROPY_CONDITION_FAILURE,                 /**< Processing method error after invoking. */
202     CRYPT_ENTROPY_RANGE_ERROR,                       /**< Entropy source generation range error */
203     CRYPT_ENTROPY_ECF_ALG_ERROR,                     /**< Entropy source conditioning algorithm is incorrect. */
204     CRYPT_ENTROPY_ECF_IS_ERROR,                      /**< Entropy source conditioning is incorrect. */
205     CRYPT_ENTROPY_ES_CREATE_ERROR,                   /**< Entropy pool creation error. */
206     CRYPT_ENTROPY_ES_STATE_ERROR,                    /**< Incorrect entropy pool status. */
207     CRYPT_ENTROPY_ES_CTRL_ERROR,                     /**< Incorrect entropy pool settings. */
208     CRYPT_ENTROPY_ES_NO_NS,                          /**< No available noise source in the entropy pool. */
209     CRYPT_ENTROPY_ES_NS_NOT_FOUND,                   /**< Noise source not found. */
210     CRYPT_ENTROPY_ES_DUP_NS,                         /**< Noise source Repetition. */
211     CRYPT_ENTROPY_ES_NS_NOT_AVA,                     /**< Noise source not available. */
212     CRYPT_ENTROPY_ES_NS_FULL,                        /**< Noise source list is full. */
213     CRYPT_ENTROPY_ES_CF_NOT_SUPPORT,                 /**< Nonditioning function not supported. */
214     CRYPT_ENTROPY_ES_CF_ERROR,                       /**< Nonditioning function error. */
215     CRYPT_ENTROPY_ES_ENTROPY_NOT_ENOUGH,             /**< Not getting enough entropy. */
216     CRYPT_ENTROPY_ES_POOL_ERROR,                     /**< Entropy pool error. */
217     CRYPT_ENTROPY_ES_POOL_INSUFFICIENT,              /**< Entropy pool capacity is insufficient. */
218     CRYPT_ENTROPY_CTRL_INVALID_PARAM,                /**< Entropy invalid parameter. */
219 
220     CRYPT_DSA_BUFF_LEN_NOT_ENOUGH = 0x010B0001, /**< Insufficient buffer length. */
221     CRYPT_DSA_ERR_KEY_PARA,                     /**< Incorrect key parameter data. */
222     CRYPT_DSA_ERR_KEY_INFO,                     /**< Incorrect key information. */
223     CRYPT_DSA_VERIFY_FAIL,                      /**< Verification failure. */
224     CRYPT_DSA_ERR_TRY_CNT,                      /**< Key generation and signature fail to be
225                                                      generated within the specified number of attempts. */
226     CRYPT_DSA_DECODE_FAIL,                      /**< Data decoding fails, the data does not meet
227                                                      the decoding requirements. */
228     CRYPT_DSA_UNSUPPORTED_CTRL_OPTION,          /**< Unsupported mode of operation. */
229     CRYPT_DSA_PARA_ERROR,                       /**< The value of the key parameter does not meet
230                                                      the requirements. The ctx command does not
231                                                      contain necessary parameter information. */
232     CRYPT_DSA_PUBKEY_NOT_EQUAL,                 /**< Public keys are not equal. */
233     CRYPT_DSA_PARA_NOT_EQUAL,                   /**< Key parameters are not equal. */
234 
235     CRYPT_HMAC_OUT_BUFF_LEN_NOT_ENOUGH = 0x010C0001, /**< The length of the buffer that storing
236                                                           the output result is insufficient. */
237     CRYPT_HMAC_ERR_UNSUPPORTED_CTRL_OPTION,  /**< Unsupport the control type. */
238 
239     CRYPT_DH_BUFF_LEN_NOT_ENOUGH = 0x010D0001,   /**< The buffer length is insufficient. */
240     CRYPT_DH_PARA_ERROR,                         /**< The value of the key parameter does not meet
241                                                       the requirements, the ctx command does not
242                                                       contain necessary parameter information. */
243     CRYPT_DH_KEYINFO_ERROR,                      /**< The value of the public and private keys do
244                                                       not meet the requirements, the ctx does not
245                                                       contain the necessary public and private keys. */
246     CRYPT_DH_RAND_GENERATE_ERROR,                /**< Key generation fails within the specified
247                                                       number of attempts. */
248     CRYPT_DH_PAIRWISE_CHECK_FAIL,                /**< The public and private keys are inconsistent. */
249     CRYPT_DH_UNSUPPORTED_CTRL_OPTION,            /**< Unsupported mode of operation. */
250     CRYPT_DH_CREATE_PARA_FAIL,                   /**< Failed to create the p, q, and g parameters
251                                                       of the DH algorithm. */
252     CRYPT_DH_PUBKEY_NOT_EQUAL,                   /**< Public keys are not equal. */
253     CRYPT_DH_PARA_NOT_EQUAL,                     /**< DH key parameters are not equal. */
254     CRYPT_DH_SET_FLAG_LEN_ERROR,                 /**< The length of the input data is incorrect and return failure when
255                                                       setting the flag. */
256     CRYPT_DH_FLAG_NOT_SUPPORT_ERROR,             /**< Unsupported flag. */
257 
258     CRYPT_CHACHA20_KEYLEN_ERROR = 0x010E0001,        /**< The key length input is incorrect during key setting. */
259     CRYPT_CHACHA20_NONCELEN_ERROR,                   /**< The length of the input nounce is incorrect when you
260                                                           set the nounce. */
261     CRYPT_CHACHA20_COUNTLEN_ERROR,                   /**< The length of the input count is incorrect when you
262                                                           set the count. */
263     CRYPT_CHACHA20_NO_KEYINFO,                       /**< Lack of valid key information during
264                                                           encryption and decryption. */
265     CRYPT_CHACHA20_NO_NONCEINFO,                     /**< Lack of valid nounce information during
266                                                           encryption and decryption. */
267     CRYPT_CHACHA20_CTRLTYPE_ERROR,                   /**< The input type is not supported when the
268                                                           ctrl interface is used. */
269 
270     CRYPT_AES_ERR_KEYLEN = 0x010F0001,               /**< Incorrect key length. */
271 
272     CRYPT_MODES_TAGLEN_ERROR = 0x01100001,           /**< In AEAD mode, the length of the TAG
273                                                           is incorrect when the tag is obtained and verified. */
274     CRYPT_MODES_IVLEN_ERROR,                         /**< The length of the input IV is incorrect
275                                                           when setting the IV. */
276     CRYPT_MODES_KEYUSE_TOOMANY_TIME,                 /**< In GCM mode, the number of times that a key
277                                                           can be used for encryption and decryption is limited.
278                                                           When the number of times that a key is used exceeds
279                                                           the limit, an error is reported. */
280     CRYPT_MODES_CRYPTLEN_OVERFLOW,                   /**< In AEAD mode, the length of the plaintext
281                                                           or ciphertext input for a single
282                                                           encryption exceeds the limit. */
283     CRYPT_MODES_CTRL_TAGLEN_ERROR,                   /**< In GCM or CCM mode, the length of the input
284                                                           parameter or the length of the input
285                                                           parameter data is incorrect when the ctrl
286                                                           interface is used to set the tag length. */
287     CRYPT_MODES_AAD_REPEAT_SET_ERROR,                /**< In the AEAD mode, the AAD information
288                                                           is set repeatedly. */
289     CRYPT_MODE_BUFF_LEN_NOT_ENOUGH,                  /**< The buffer length is insufficient. */
290     CRYPT_MODE_ERR_INPUT_LEN,                        /**< The function input length is not the
291                                                           expected length. */
292     CRYPT_MODES_CTRL_TYPE_ERROR,                     /**< The input type is not supported when the ctrl
293                                                           interface is used. */
294     CRYPT_MODES_AAD_IS_SET_ERROR,                    /**< In ccm mode, an error is returned when the tagLen and
295                                                           msgLen are set after the aad is set. */
296     CRYPT_MODES_MSGLEN_OVERFLOW,                     /**< In ccm mode, the length of the input message during
297                                                           encryption and decryption exceeds the set msgLen. */
298     CRYPT_MODES_CTRL_MSGLEN_ERROR,                   /**< In ccm mode, When the ctrl interface is used to set the
299                                                           msg length, the input parameter length or the input
300                                                           parameter data length is incorrect. (This
301                                                           specification is affected by ivLen.) */
302     CRYPT_MODES_MSGLEN_LEFT_ERROR,                   /**< In ccm mode, when the ctrl interface is used to
303                                                           obtain the tag, the length of the encrypted and
304                                                           decrypted messages does not reach the configured
305                                                           number. As a result, an error occurs. */
306     CRYPT_MODES_ERR_KEYLEN,                          /**< Incorrect key length set. */
307     CRYPT_MODES_ERR_KEY,                             /**< Incorrect key set. */
308     CRYPT_MODES_ERR_FEEDBACKSIZE,                    /**< The operation are not support by the algorithm
309                                                           on which the pattern depends on. */
310     CRYPT_MODES_METHODS_NOT_SUPPORT,                 /**< Mode depends does not support the behavior. */
311     CRYPT_MODES_FEEDBACKSIZE_NOT_SUPPORT,            /**< The algorithm does not support the setting of feedbacksize. */
312     CRYPT_MODES_PADDING_NOT_SUPPORT,                 /**< Unsupported padding. */
313 
314     CRYPT_HKDF_DKLEN_OVERFLOW = 0x01110001,          /**< The length of the derived key exceeds the maximum. */
315     CRYPT_HKDF_NOT_SUPPORTED,                        /**< Unsupport HKDF algorithm. */
316     CRYPT_HKDF_PARAM_ERROR,                          /**< Incorrect input parameter. */
317 
318     CRYPT_CMAC_OUT_BUFF_LEN_NOT_ENOUGH = 0x01120001, /**< The length of the buffer that storing the output
319                                                           result is insufficient. */
320     CRYPT_CMAC_INPUT_OVERFLOW,                       /**< The input length exceeds the limit. As a result,
321                                                           the integer type is reversed. */
322     CRYPT_CMAC_ERR_UNSUPPORTED_CTRL_OPTION,          /**< Unsupport the control type. */
323     CRYPT_GMAC_ERR_UNSUPPORTED_CTRL_OPTION,          /**< Unsupport the control type. */
324 
325     CRYPT_SCRYPT_PARAM_ERROR = 0x01130001,           /**< Incorrect input parameter. */
326     CRYPT_SCRYPT_NOT_SUPPORTED,                      /**< Unsupport the SCRYPT algorithm. */
327     CRYPT_SCRYPT_DATA_TOO_MAX,                       /**< The data calculated by the SCRYPT algorithm is too large. */
328 
329     CRYPT_PBKDF2_PARAM_ERROR = 0x01150001,           /**< Incorrect input parameter. */
330     CRYPT_PBKDF2_NOT_SUPPORTED,                      /**< Does not support the PBKDF2 algorithm. */
331 
332     CRYPT_ECC_POINT_AT_INFINITY = 0x01160001,         /**< Point at infinity. */
333     CRYPT_ECC_POINT_NOT_ON_CURVE,                    /**< Point is not on the curve. */
334     CRYPT_ECC_POINT_ERR_CURVE_ID,                    /**< Curve ID is inconsistent or incorrect. */
335     CRYPT_ECC_POINT_WINDOW_TOO_MAX,                  /**< Window is too max. */
336     CRYPT_ECC_POINT_NOT_EQUAL,                       /**< The two points are not equal. */
337     CRYPT_ECC_POINT_BLIND_WITH_ZERO,                 /**< The random number generated during point salting is 0. */
338     CRYPT_ECC_POINT_NOT_AFFINE,                      /**< Point is not affine coordinates. */
339     CRYPT_ECC_NOT_SUPPORT,                           /**< This function is not supported. */
340     CRYPT_ECC_POINT_MUL_ERR_K_LEN,                    /** The scalar length exceeds the curve specification
341                                                           when using the dot multiplication function */
342     CRYPT_ECC_BUFF_LEN_NOT_ENOUGH,                   /**< Insufficient buffer length. */
343     CRYPT_ECC_ERR_POINT_FORMAT,                      /**< The encoding format input during point encoding
344                                                           is incorrect. */
345     CRYPT_ECC_ERR_POINT_CODE,                        /**< Incorrect point code information. */
346     CRYPT_ECC_PKEY_ERR_UNSUPPORTED_CTRL_OPTION,      /**< Unsupport the control type. */
347     CRYPT_ECC_PKEY_ERR_EMPTY_KEY,                    /**< Key is null. */
348     CRYPT_ECC_PKEY_ERR_INVALID_POINT_FORMAT,         /**< Invalid dot format. */
349     CRYPT_ECC_PKEY_ERR_CTRL_LEN,                     /**< Control input parameter is incorrect. */
350     CRYPT_ECC_PKEY_ERR_INVALID_PRIVATE_KEY,          /**< Invalid private key. */
351     CRYPT_ECC_PKEY_ERR_INVALID_PUBLIC_KEY,           /**< Invalid public key. */
352     CRYPT_ECC_PKEY_ERR_TRY_CNT,                      /**< Key generation or generater signature fail
353                                                           within the specified number of attempts. */
354     CRYPT_ECC_PKEY_ERR_SIGN_LEN,                     /**< Invalid sign length  */
355     CRYPT_ECC_ERR_PARA,                              /**< Incorrect curve parameter. */
356 
357     CRYPT_ECC_INVERSE_INPUT_ZERO,                     /** Modulo inverse input is 0. */
358     CRYPT_ECC_KEY_PUBKEY_NOT_EQUAL,                   /**< ECC public keys are not equal. */
359 
360     CRYPT_SHA3_OUT_BUFF_LEN_NOT_ENOUGH = 0x01170001,  /**< Insufficient buffer length for storing output results. */
361     CRYPT_SHA3_INVALID_STATE,                       /**< Invalid state. */
362 
363     CRYPT_ECDH_ERR_UNSUPPORT_CURVE_TYPE = 0x01180001, /**< Unsupported curve type. */
364     CRYPT_ECDH_ERR_EMPTY_KEY,                         /**< Key is null. */
365     CRYPT_ECDH_ERR_INVALID_COFACTOR,                  /**< Invalid cofactor value. */
366 
367     CRYPT_ECDSA_ERR_EMPTY_KEY = 0x01190001,           /**< Key is NULL. */
368     CRYPT_ECDSA_ERR_TRY_CNT,                          /**< Key generation and generate signature fail
369                                                            within the specified number of attempts. */
370     CRYPT_ECDSA_VERIFY_FAIL,                          /**< Verification failure. */
371     CRYPT_ECDSA_ERR_UNSUPPORTED_CTRL_OPTION,          /**< Unsupport the control type. */
372     CRYPT_ECDSA_BUFF_LEN_NOT_ENOUGH,                  /**< BUFF insufficient length. */
373 
374     CRYPT_SM3_INPUT_OVERFLOW = 0x011A0001,             /**< The length of the input data exceeds the maximum
375                                                            processing range of the SM3. */
376     CRYPT_SM3_OUT_BUFF_LEN_NOT_ENOUGH,                /**< The length of the buffer that storing the output
377                                                            result is insufficient. */
378 
379     CRYPT_SM4_ERR_IV_LEN = 0x011B0001,              /**< Wrong key length set. */
380     CRYPT_SM4_ERR_MSG_LEN,                          /**< Wrong data length is set. */
381     CRYPT_SM4_ERR_KEY_LEN,                            /**< Wrong key length is set. */
382     CRYPT_SM4_UNSAFE_KEY,                             /**< DataKey is the same as tweakKey. */
383 
384     CRYPT_MD5_INPUT_OVERFLOW = 0x011D0001,             /**< The length of the input data exceeds the
385                                                            maximum processing range of the MD5. */
386     CRYPT_MD5_OUT_BUFF_LEN_NOT_ENOUGH,                /**< The length of the buffer that storing the
387                                                            output result is insufficient. */
388     CRYPT_MD_ERR_NEWCTX,                              /**< create md ctx failed. */
389 
390     CRYPT_SM2_BUFF_LEN_NOT_ENOUGH = 0x01200001,       /**< Insufficient buffer length. */
391     CRYPT_SM2_NO_PUBKEY,                              /**< SM2 the public key is not set. */
392     CRYPT_SM2_NO_PRVKEY,                              /**< SM2 The private key is not set. */
393     CRYPT_SM2_ERR_EMPTY_KEY,                          /**< SM2 key is null. */
394     CRYPT_SM2_ERR_TRY_CNT,                            /**< Key generation and generate signature fail
395                                                            within the specified number of attempts. */
396     CRYPT_SM2_VERIFY_FAIL,                            /**< verification failure. */
397     CRYPT_SM2_ERR_UNSUPPORTED_CTRL_OPTION,            /**< Unsupported control type. */
398     CRYPT_SM2_ERR_NO_HASH_METHOD,                     /**< No hash method information. */
399     CRYPT_SM2_USERID_NOT_SET,                         /**< Unset userID. */
400     CRYPT_SM2_R_NOT_SET,                              /**< The peer R value is not set. */
401     CRYPT_SM2_INVALID_SERVER_TYPE,                    /**< The user is neither the initiator nor the recipient. */
402     CRYPT_SM2_ERR_CTRL_LEN,                           /**< Incorrect ctrl length. */
403     CRYPT_SM2_DECRYPT_FAIL,                           /**< Decryption failure. */
404     CRYPT_SM2_ERR_DATA_LEN,                           /**< Incorrect data length. */
405     CRYPT_SM2_ERR_GET_S,                              /**< Failed to obtain the checksum. */
406     CRYPT_SM2_ERR_S_NOT_SET,                          /**< Unset checksum. */
407     CRYPT_SM2_EXCH_VERIFY_FAIL,                       /**< Key Negotiation Failure. */
408     CRYPT_SM2_DECODE_FAIL,                            /**< Data decoding fails, the data does not meet
409                                                             the decoding requirements. */
410     CRYPT_SM2_ID_TOO_LARGE,                           /**< User id to large. */
411 
412     CRYPT_KDFTLS12_NOT_SUPPORTED = 0x01210001,        /**< Unsupport the KDFTLS12 algorithm. */
413     CRYPT_KDFTLS12_PARAM_ERROR,
414 
415     CRYPT_SIPHASH_OUT_BUFF_LEN_NOT_ENOUGH = 0x01220001, /**< The buffer size for storing the output
416                                                              result is insufficient. */
417     CRYPT_SIPHASH_INPUT_OVERFLOW,
418     CRYPT_SIPHASH_ERR_UNSUPPORTED_CTRL_OPTION,          /**< Unsupport the control type. */
419 
420     CRYPT_CBC_MAC_ERR_CTRL_LEN = 0x01240001,
421     CRYPT_CBC_MAC_ERR_UNSUPPORTED_CTRL_OPTION,
422     CRYPT_CBC_MAC_PADDING_NOT_SET,
423     CRYPT_CBC_MAC_PADDING_NOT_SUPPORT,
424     CRYPT_CBC_MAC_OUT_BUFF_LEN_NOT_ENOUGH,
425 
426     CRYPT_SEED_POOL_NEW_ERROR = 0x01290001,             /**< The length of the key input is
427                                                              incorrect when setting the key. */
428     CRYPT_SEED_POOL_STATE_ERROR,                        /**< Incorrect seed pool status. */
429     CRYPT_SEED_POOL_ES_LIST_FULL,                       /**< The number of entropy sources exceeds the upper limit. */
430     CRYPT_SEED_POOL_NO_SUFFICIENT_ENTROPY,              /**< The seed pool cannot provide sufficient entropy. */
431     CRYPT_SEED_POOL_NO_ENTROPY_SOURCE,                  /**< The seed pool has no entropy source. */
432     CRYPT_SEED_POOL_NO_ENTROPY_OBTAINED,                /**< No entropy data is obtained from the seed pool. */
433     CRYPT_SEED_POOL_NOT_MEET_REQUIREMENT,               /**< The entropy data does not meet the requirements. */
434     CRYPT_ENTROPY_CTX_CREATE_FAILED,                    /**< Failed to create the handle for obtaining the entropy. */
435 
436     CRYPT_MLKEM_KEYLEN_ERROR = 0x01300001,              /**< Incorrect input data length. */
437     CRYPT_MLKEM_LEN_NOT_ENOUGH,                         /**<The buffer size of output is insufficient. */
438     CRYPT_MLKEM_KEY_NOT_SET,                            /**<The encaps or decaps key not set. */
439     CRYPT_MLKEM_KEYINFO_NOT_SET,                        /**<The algorithm not set. */
440     CRYPT_MLKEM_KEY_NOT_EQUAL,                          /**< The MLKEM keys are not equal. */
441     CRYPT_MLKEM_CTRL_NOT_SUPPORT,                       /**< The Ctrl type is not supported.*/
442     CRYPT_MLKEM_CTRL_INIT_REPEATED,                     /**< The CTX cannot be initialized repeatedly.*/
443 
444     CRYPT_HPKE_ERR_GEN_ASYM_KEY = 0x01310001,            /**< HPKE Generate asymmetric key error. */
445     CRYPT_HPKE_ERR_AEAD_TAG,                             /**< Failed to verify AEAD tag when decrypt. */
446     CRYPT_HPKE_ERR_CALL,                                 /**< It is not appropriate to call this function. */
447     CRYPT_HPKE_FAILED_FETCH_CIPHER,                      /**< Failed to fetch cipher. */
448     CRYPT_HPKE_FAILED_FETCH_PKEY,                        /**< Failed to fetch pkey. */
449     CRYPT_HPKE_FAILED_FETCH_KDF,                         /**< Failed to fetch kdf. */
450 
451     CRYPT_DECODE_ASN1_BUFF_NUM_NOT_ENOUGH = 0x01320001,  /**< The input number of BSL_ANS1_Buffer is not enough. */
452     CRYPT_DECODE_UNSUPPORTED_PUBKEY_TYPE,                /**< Unsupported pubkey type */
453     CRYPT_DECODE_UNSUPPORTED_PKCS8_TYPE,                 /**< Unsupported pkcs8 type */
454     CRYPT_DECODE_PKCS8_INVALID_ALGO_PARAM,               /**< pkcs8 has no valid algorithm parameters */
455     CRYPT_DECODE_UNKNOWN_OID,                            /**< Unknown OID */
456     CRYPT_DECODE_ASN1_BUFF_FAILED,                       /**< decode asn1 buffer failed. */
457     CRYPT_DECODE_NO_SUPPORT_TYPE,                        /**< decode no support key type. */
458     CRYPT_DECODE_NO_SUPPORT_FORMAT,                      /**< decode no support key format. */
459     CRYPT_DECODE_PKCS8_INVALID_ITER,                     /**< pkcs8 invalid iter num */
460     CRYPT_DECODE_PKCS8_INVALID_KEYLEN,                   /**< pkcs8 invalid keylen */
461     CRYPT_DECODE_ERR_RSSPSS_GET_ANY_TAG,                 /**< decode rsapss param failed. */
462     CRYPT_DECODE_ERR_RSSPSS,                             /**< decode rsapss param failed. */
463     CRYPT_DECODE_ERR_RSSPSS_MD,                          /**< rsapss md is invalid. */
464     CRYPT_DECODE_ERR_RSSPSS_MGF1MD,                      /**< rsapss mgf1md is invalid. */
465     CRYPT_DECODE_ERR_RSSPSS_TRAILER,                     /**< rsapss trailer field is invalid. */
466     CRYPT_DECODE_PKCS7_INVALIDE_ENCRYPTDATA_TYPE,        /**< Invaild pkcs7-encryptedData. */
467     CRYPT_DECODE_UNSUPPORTED_PKCS7_TYPE,                 /**< Unsupported pkcs7 type */
468     CRYPT_DECODE_UNSUPPORTED_ENCRYPT_TYPE,               /**< Unsupported encrypt type */
469     CRYPT_DECODE_BUFF_NOT_ENOUGH,                        /**< The input buffer space is not enough */
470     CRYPT_DECODE_ASN1_BUFF_LEN_ZERO,                     /**< The decoding length of asn1 buffer is zero. */
471     CRYPT_DECODE_ERR_NO_DECODER,                         /**< No decoder found. */
472     CRYPT_DECODE_ERR_NO_USABLE_DECODER,                  /**< No decoder found. */
473     CRYPT_DECODE_RETRY,                                  /**< Retry decode. */
474     CRYPT_DECODE_ERR_CURR_NODE_NOT_FOUND,                /**< Current node not found. */
475     CRYPT_DECODE_ERR_NO_KEY_TYPE,                        /**< No key type found. */
476     CRYPT_DECODE_ERR_KEY_TYPE_NOT_MATCH,                 /**< Key type not match. */
477 
478     CRYPT_ENCODE_NO_SUPPORT_TYPE = 0x01330001,           /**< encode no support key type. */
479     CRYPT_ENCODE_NO_SUPPORT_FORMAT,                      /**< encode no support key format. */
480     CRYPT_ENCODE_ERR_RSA_PAD,                            /**< rsa pad err. */
481     CRYPT_ENCODE_BUFF_NOT_ENOUGH,                        /**< The input buffer space is not enough */
482     CRYPT_ENCODE_ERR_SIGN_LEN_OVERFLOW,                  /**< The r and s length is too large. */
483     CRYPT_ENCODE_ERR_SM2_ENCRYPT_DATA_LEN_OVERFLOW,      /**< The sm2 encrypt data length is too large. */
484 
485     CRYPT_PROVIDER_ERR_UNEXPECTED_IMPL = 0x01350001,     /**< Unexpected impl */
486     CRYPT_PROVIDER_ERR_IMPL_NULL,
487     CRYPT_PROVIDER_NOT_FOUND,                            /**< Provider not found. */
488     CRYPT_PROVIDER_NOT_SUPPORT,
489     CRYPT_PROVIDER_ERR_ATTRIBUTE,
490     CRYPT_PROVIDER_INVALID_LIB_CTX,
491 
492     CRYPT_MLDSA_KEYINFO_NOT_SET = 0x01360001,           /**< The algorithm not set. */
493     CRYPT_MLDSA_CTRL_NOT_SUPPORT,                       /**< The Ctrl type is not supported. */
494     CRYPT_MLDSA_PAD_TOO_LONG,                           /**< The pad is too long. */
495     CRYPT_MLDSA_KEYLEN_ERROR,                           /**< Incorrect input data length. */
496     CRYPT_MLDSA_SIGN_DATA_ERROR,                        /**< Invalid signature value. */
497     CRYPT_MLDSA_VERIFY_FAIL,                            /**< Failed to verify the signature. */
498     CRYPT_MLDSA_KEY_NOT_SET,                            /**< The public key or private not set. */
499     CRYPT_MLDSA_LEN_NOT_ENOUGH,                         /**< The buffer size of output is insufficient. */
500     CRYPT_MLDSA_KEY_NOT_EQUAL,                          /**< The MLDSA keys are not equal. */
501     CRYPT_MLDSA_CTRL_INIT_REPEATED,                     /**< The CTX cannot be initialized repeatedly.*/
502     CRYPT_MLDSA_SET_KEY_FAILED,                         /**< Failed to set the key. */
503 
504     CRYPT_ELGAMAL_BUFF_LEN_NOT_ENOUGH = 0x01370001, /**< The buffer length is insufficient. */
505     CRYPT_ELGAMAL_NO_KEY_INFO,              /**< Lacks valid key information. */
506     CRYPT_ELGAMAL_ERR_KEY_BITS,             /**< Incorrect key length. */
507     CRYPT_ELGAMAL_ERR_ENC_BITS,             /**< Incorrect length of the encrypted plaintext of the public key. */
508     CRYPT_ELGAMAL_ERR_DEC_BITS,             /**< Incorrect length of the decrypted ciphertext of the private key. */
509     CRYPT_ELGAMAL_ERR_KEY_KBITS,             /**< Incorrect key length. */
510     CRYPT_ELGAMAL_ERR_KEY_BITS_KBITS,       /**< Incorrect key length. */
511     CRYPT_ELGAMAL_ERR_ENC_KBITS,             /**< Incorrect length of the encrypted plaintext of the public key. */
512     CRYPT_ELGAMAL_ERR_DEC_KBITS,             /**< Incorrect length of the decrypted ciphertext of the private key. */
513     CRYPT_ELGAMAL_ERR_INPUT_VALUE,          /**< Some special values, which are used as input errors. */
514     CRYPT_ELGAMAL_CTRL_NOT_SUPPORT_ERROR,   /**< The Ctrl type is not supported When elgamal is used for Ctrl. */
515 
516     CRYPT_SLHDSA_ERR_INVALID_ALGID = 0x01380001,         /**< The algorithm id is invalid. */
517     CRYPT_SLHDSA_ERR_INVALID_SIG_LEN,                    /**< The signature length is invalid. */
518     CRYPT_SLHDSA_ERR_INVALID_KEYLEN,                     /**< The key length is invalid. */
519     CRYPT_SLHDSA_ERR_SIG_LEN_NOT_ENOUGH,                 /**< The signature length is not enough. */
520     CRYPT_SLHDSA_ERR_HYPERTREE_VERIFY_FAIL,              /**< Hypertree verify failed. */
521     CRYPT_SLHDSA_ERR_PREHASH_ID_NOT_SUPPORTED,           /**< Prehash id is not supported. */
522     CRYPT_SLHDSA_ERR_CONTEXT_LEN_OVERFLOW,               /**< Context length is overflow. */
523 
524     CRYPT_PAILLIER_BUFF_LEN_NOT_ENOUGH = 0x01390001, /**< The buffer length is insufficient. */
525     CRYPT_PAILLIER_NO_KEY_INFO,              /**< Lacks valid key information. */
526     CRYPT_PAILLIER_ERR_KEY_BITS,             /**< Incorrect key length. */
527     CRYPT_PAILLIER_ERR_ENC_BITS,             /**< Incorrect length of the encrypted plaintext of the public key. */
528     CRYPT_PAILLIER_ERR_DEC_BITS,             /**< Incorrect length of the decrypted ciphertext of the private key. */
529     CRYPT_PAILLIER_ERR_INPUT_VALUE,          /**< Some special values, which are used as input errors. */
530     CRYPT_PAILLIER_CTRL_NOT_SUPPORT_ERROR,   /**< The Ctrl type is not supported When paillier is used for Ctrl. */
531 };
532 #ifdef __cplusplus
533 }
534 #endif
535 
536 #endif // CRYPT_ERRNO_H
537