Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
8774 | rgimad | 1 | /* |
2 | * Error message information |
||
3 | * |
||
4 | * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved |
||
5 | * SPDX-License-Identifier: GPL-2.0 |
||
6 | * |
||
7 | * This program 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 | * This program 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 along |
||
18 | * with this program; if not, write to the Free Software Foundation, Inc., |
||
19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
||
20 | * |
||
21 | * This file is part of mbed TLS (https://tls.mbed.org) |
||
22 | */ |
||
23 | |||
24 | #if !defined(MBEDTLS_CONFIG_FILE) |
||
25 | #include "mbedtls/config.h" |
||
26 | #else |
||
27 | #include MBEDTLS_CONFIG_FILE |
||
28 | #endif |
||
29 | |||
30 | #if defined(MBEDTLS_ERROR_C) || defined(MBEDTLS_ERROR_STRERROR_DUMMY) |
||
31 | #include "mbedtls/error.h" |
||
32 | #include |
||
33 | #endif |
||
34 | |||
35 | #if defined(MBEDTLS_PLATFORM_C) |
||
36 | #include "mbedtls/platform.h" |
||
37 | #else |
||
38 | #define mbedtls_snprintf snprintf |
||
39 | #define mbedtls_time_t time_t |
||
40 | #endif |
||
41 | |||
42 | #if defined(MBEDTLS_ERROR_C) |
||
43 | |||
44 | #include |
||
45 | |||
46 | #if defined(MBEDTLS_AES_C) |
||
47 | #include "mbedtls/aes.h" |
||
48 | #endif |
||
49 | |||
50 | #if defined(MBEDTLS_ARC4_C) |
||
51 | #include "mbedtls/arc4.h" |
||
52 | #endif |
||
53 | |||
54 | #if defined(MBEDTLS_ARIA_C) |
||
55 | #include "mbedtls/aria.h" |
||
56 | #endif |
||
57 | |||
58 | #if defined(MBEDTLS_BASE64_C) |
||
59 | #include "mbedtls/base64.h" |
||
60 | #endif |
||
61 | |||
62 | #if defined(MBEDTLS_BIGNUM_C) |
||
63 | #include "mbedtls/bignum.h" |
||
64 | #endif |
||
65 | |||
66 | #if defined(MBEDTLS_BLOWFISH_C) |
||
67 | #include "mbedtls/blowfish.h" |
||
68 | #endif |
||
69 | |||
70 | #if defined(MBEDTLS_CAMELLIA_C) |
||
71 | #include "mbedtls/camellia.h" |
||
72 | #endif |
||
73 | |||
74 | #if defined(MBEDTLS_CCM_C) |
||
75 | #include "mbedtls/ccm.h" |
||
76 | #endif |
||
77 | |||
78 | #if defined(MBEDTLS_CHACHA20_C) |
||
79 | #include "mbedtls/chacha20.h" |
||
80 | #endif |
||
81 | |||
82 | #if defined(MBEDTLS_CHACHAPOLY_C) |
||
83 | #include "mbedtls/chachapoly.h" |
||
84 | #endif |
||
85 | |||
86 | #if defined(MBEDTLS_CIPHER_C) |
||
87 | #include "mbedtls/cipher.h" |
||
88 | #endif |
||
89 | |||
90 | #if defined(MBEDTLS_CMAC_C) |
||
91 | #include "mbedtls/cmac.h" |
||
92 | #endif |
||
93 | |||
94 | #if defined(MBEDTLS_CTR_DRBG_C) |
||
95 | #include "mbedtls/ctr_drbg.h" |
||
96 | #endif |
||
97 | |||
98 | #if defined(MBEDTLS_DES_C) |
||
99 | #include "mbedtls/des.h" |
||
100 | #endif |
||
101 | |||
102 | #if defined(MBEDTLS_DHM_C) |
||
103 | #include "mbedtls/dhm.h" |
||
104 | #endif |
||
105 | |||
106 | #if defined(MBEDTLS_ECP_C) |
||
107 | #include "mbedtls/ecp.h" |
||
108 | #endif |
||
109 | |||
110 | #if defined(MBEDTLS_ENTROPY_C) |
||
111 | #include "mbedtls/entropy.h" |
||
112 | #endif |
||
113 | |||
114 | #if defined(MBEDTLS_GCM_C) |
||
115 | #include "mbedtls/gcm.h" |
||
116 | #endif |
||
117 | |||
118 | #if defined(MBEDTLS_HKDF_C) |
||
119 | #include "mbedtls/hkdf.h" |
||
120 | #endif |
||
121 | |||
122 | #if defined(MBEDTLS_HMAC_DRBG_C) |
||
123 | #include "mbedtls/hmac_drbg.h" |
||
124 | #endif |
||
125 | |||
126 | #if defined(MBEDTLS_MD_C) |
||
127 | #include "mbedtls/md.h" |
||
128 | #endif |
||
129 | |||
130 | #if defined(MBEDTLS_MD2_C) |
||
131 | #include "mbedtls/md2.h" |
||
132 | #endif |
||
133 | |||
134 | #if defined(MBEDTLS_MD4_C) |
||
135 | #include "mbedtls/md4.h" |
||
136 | #endif |
||
137 | |||
138 | #if defined(MBEDTLS_MD5_C) |
||
139 | #include "mbedtls/md5.h" |
||
140 | #endif |
||
141 | |||
142 | #if defined(MBEDTLS_NET_C) |
||
143 | #include "mbedtls/net_sockets.h" |
||
144 | #endif |
||
145 | |||
146 | #if defined(MBEDTLS_OID_C) |
||
147 | #include "mbedtls/oid.h" |
||
148 | #endif |
||
149 | |||
150 | #if defined(MBEDTLS_PADLOCK_C) |
||
151 | #include "mbedtls/padlock.h" |
||
152 | #endif |
||
153 | |||
154 | #if defined(MBEDTLS_PEM_PARSE_C) || defined(MBEDTLS_PEM_WRITE_C) |
||
155 | #include "mbedtls/pem.h" |
||
156 | #endif |
||
157 | |||
158 | #if defined(MBEDTLS_PK_C) |
||
159 | #include "mbedtls/pk.h" |
||
160 | #endif |
||
161 | |||
162 | #if defined(MBEDTLS_PKCS12_C) |
||
163 | #include "mbedtls/pkcs12.h" |
||
164 | #endif |
||
165 | |||
166 | #if defined(MBEDTLS_PKCS5_C) |
||
167 | #include "mbedtls/pkcs5.h" |
||
168 | #endif |
||
169 | |||
170 | #if defined(MBEDTLS_PLATFORM_C) |
||
171 | #include "mbedtls/platform.h" |
||
172 | #endif |
||
173 | |||
174 | #if defined(MBEDTLS_POLY1305_C) |
||
175 | #include "mbedtls/poly1305.h" |
||
176 | #endif |
||
177 | |||
178 | #if defined(MBEDTLS_RIPEMD160_C) |
||
179 | #include "mbedtls/ripemd160.h" |
||
180 | #endif |
||
181 | |||
182 | #if defined(MBEDTLS_RSA_C) |
||
183 | #include "mbedtls/rsa.h" |
||
184 | #endif |
||
185 | |||
186 | #if defined(MBEDTLS_SHA1_C) |
||
187 | #include "mbedtls/sha1.h" |
||
188 | #endif |
||
189 | |||
190 | #if defined(MBEDTLS_SHA256_C) |
||
191 | #include "mbedtls/sha256.h" |
||
192 | #endif |
||
193 | |||
194 | #if defined(MBEDTLS_SHA512_C) |
||
195 | #include "mbedtls/sha512.h" |
||
196 | #endif |
||
197 | |||
198 | #if defined(MBEDTLS_SSL_TLS_C) |
||
199 | #include "mbedtls/ssl.h" |
||
200 | #endif |
||
201 | |||
202 | #if defined(MBEDTLS_THREADING_C) |
||
203 | #include "mbedtls/threading.h" |
||
204 | #endif |
||
205 | |||
206 | #if defined(MBEDTLS_X509_USE_C) || defined(MBEDTLS_X509_CREATE_C) |
||
207 | #include "mbedtls/x509.h" |
||
208 | #endif |
||
209 | |||
210 | #if defined(MBEDTLS_XTEA_C) |
||
211 | #include "mbedtls/xtea.h" |
||
212 | #endif |
||
213 | |||
214 | |||
215 | void mbedtls_strerror( int ret, char *buf, size_t buflen ) |
||
216 | { |
||
217 | size_t len; |
||
218 | int use_ret; |
||
219 | |||
220 | if( buflen == 0 ) |
||
221 | return; |
||
222 | |||
223 | memset( buf, 0x00, buflen ); |
||
224 | |||
225 | if( ret < 0 ) |
||
226 | ret = -ret; |
||
227 | |||
228 | if( ret & 0xFF80 ) |
||
229 | { |
||
230 | use_ret = ret & 0xFF80; |
||
231 | |||
232 | // High level error codes |
||
233 | // |
||
234 | // BEGIN generated code |
||
235 | #if defined(MBEDTLS_CIPHER_C) |
||
236 | if( use_ret == -(MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE) ) |
||
237 | mbedtls_snprintf( buf, buflen, "CIPHER - The selected feature is not available" ); |
||
238 | if( use_ret == -(MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA) ) |
||
239 | mbedtls_snprintf( buf, buflen, "CIPHER - Bad input parameters" ); |
||
240 | if( use_ret == -(MBEDTLS_ERR_CIPHER_ALLOC_FAILED) ) |
||
241 | mbedtls_snprintf( buf, buflen, "CIPHER - Failed to allocate memory" ); |
||
242 | if( use_ret == -(MBEDTLS_ERR_CIPHER_INVALID_PADDING) ) |
||
243 | mbedtls_snprintf( buf, buflen, "CIPHER - Input data contains invalid padding and is rejected" ); |
||
244 | if( use_ret == -(MBEDTLS_ERR_CIPHER_FULL_BLOCK_EXPECTED) ) |
||
245 | mbedtls_snprintf( buf, buflen, "CIPHER - Decryption of block requires a full block" ); |
||
246 | if( use_ret == -(MBEDTLS_ERR_CIPHER_AUTH_FAILED) ) |
||
247 | mbedtls_snprintf( buf, buflen, "CIPHER - Authentication failed (for AEAD modes)" ); |
||
248 | if( use_ret == -(MBEDTLS_ERR_CIPHER_INVALID_CONTEXT) ) |
||
249 | mbedtls_snprintf( buf, buflen, "CIPHER - The context is invalid. For example, because it was freed" ); |
||
250 | if( use_ret == -(MBEDTLS_ERR_CIPHER_HW_ACCEL_FAILED) ) |
||
251 | mbedtls_snprintf( buf, buflen, "CIPHER - Cipher hardware accelerator failed" ); |
||
252 | #endif /* MBEDTLS_CIPHER_C */ |
||
253 | |||
254 | #if defined(MBEDTLS_DHM_C) |
||
255 | if( use_ret == -(MBEDTLS_ERR_DHM_BAD_INPUT_DATA) ) |
||
256 | mbedtls_snprintf( buf, buflen, "DHM - Bad input parameters" ); |
||
257 | if( use_ret == -(MBEDTLS_ERR_DHM_READ_PARAMS_FAILED) ) |
||
258 | mbedtls_snprintf( buf, buflen, "DHM - Reading of the DHM parameters failed" ); |
||
259 | if( use_ret == -(MBEDTLS_ERR_DHM_MAKE_PARAMS_FAILED) ) |
||
260 | mbedtls_snprintf( buf, buflen, "DHM - Making of the DHM parameters failed" ); |
||
261 | if( use_ret == -(MBEDTLS_ERR_DHM_READ_PUBLIC_FAILED) ) |
||
262 | mbedtls_snprintf( buf, buflen, "DHM - Reading of the public values failed" ); |
||
263 | if( use_ret == -(MBEDTLS_ERR_DHM_MAKE_PUBLIC_FAILED) ) |
||
264 | mbedtls_snprintf( buf, buflen, "DHM - Making of the public value failed" ); |
||
265 | if( use_ret == -(MBEDTLS_ERR_DHM_CALC_SECRET_FAILED) ) |
||
266 | mbedtls_snprintf( buf, buflen, "DHM - Calculation of the DHM secret failed" ); |
||
267 | if( use_ret == -(MBEDTLS_ERR_DHM_INVALID_FORMAT) ) |
||
268 | mbedtls_snprintf( buf, buflen, "DHM - The ASN.1 data is not formatted correctly" ); |
||
269 | if( use_ret == -(MBEDTLS_ERR_DHM_ALLOC_FAILED) ) |
||
270 | mbedtls_snprintf( buf, buflen, "DHM - Allocation of memory failed" ); |
||
271 | if( use_ret == -(MBEDTLS_ERR_DHM_FILE_IO_ERROR) ) |
||
272 | mbedtls_snprintf( buf, buflen, "DHM - Read or write of file failed" ); |
||
273 | if( use_ret == -(MBEDTLS_ERR_DHM_HW_ACCEL_FAILED) ) |
||
274 | mbedtls_snprintf( buf, buflen, "DHM - DHM hardware accelerator failed" ); |
||
275 | if( use_ret == -(MBEDTLS_ERR_DHM_SET_GROUP_FAILED) ) |
||
276 | mbedtls_snprintf( buf, buflen, "DHM - Setting the modulus and generator failed" ); |
||
277 | #endif /* MBEDTLS_DHM_C */ |
||
278 | |||
279 | #if defined(MBEDTLS_ECP_C) |
||
280 | if( use_ret == -(MBEDTLS_ERR_ECP_BAD_INPUT_DATA) ) |
||
281 | mbedtls_snprintf( buf, buflen, "ECP - Bad input parameters to function" ); |
||
282 | if( use_ret == -(MBEDTLS_ERR_ECP_BUFFER_TOO_SMALL) ) |
||
283 | mbedtls_snprintf( buf, buflen, "ECP - The buffer is too small to write to" ); |
||
284 | if( use_ret == -(MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE) ) |
||
285 | mbedtls_snprintf( buf, buflen, "ECP - The requested feature is not available, for example, the requested curve is not supported" ); |
||
286 | if( use_ret == -(MBEDTLS_ERR_ECP_VERIFY_FAILED) ) |
||
287 | mbedtls_snprintf( buf, buflen, "ECP - The signature is not valid" ); |
||
288 | if( use_ret == -(MBEDTLS_ERR_ECP_ALLOC_FAILED) ) |
||
289 | mbedtls_snprintf( buf, buflen, "ECP - Memory allocation failed" ); |
||
290 | if( use_ret == -(MBEDTLS_ERR_ECP_RANDOM_FAILED) ) |
||
291 | mbedtls_snprintf( buf, buflen, "ECP - Generation of random value, such as ephemeral key, failed" ); |
||
292 | if( use_ret == -(MBEDTLS_ERR_ECP_INVALID_KEY) ) |
||
293 | mbedtls_snprintf( buf, buflen, "ECP - Invalid private or public key" ); |
||
294 | if( use_ret == -(MBEDTLS_ERR_ECP_SIG_LEN_MISMATCH) ) |
||
295 | mbedtls_snprintf( buf, buflen, "ECP - The buffer contains a valid signature followed by more data" ); |
||
296 | if( use_ret == -(MBEDTLS_ERR_ECP_HW_ACCEL_FAILED) ) |
||
297 | mbedtls_snprintf( buf, buflen, "ECP - The ECP hardware accelerator failed" ); |
||
298 | if( use_ret == -(MBEDTLS_ERR_ECP_IN_PROGRESS) ) |
||
299 | mbedtls_snprintf( buf, buflen, "ECP - Operation in progress, call again with the same parameters to continue" ); |
||
300 | #endif /* MBEDTLS_ECP_C */ |
||
301 | |||
302 | #if defined(MBEDTLS_MD_C) |
||
303 | if( use_ret == -(MBEDTLS_ERR_MD_FEATURE_UNAVAILABLE) ) |
||
304 | mbedtls_snprintf( buf, buflen, "MD - The selected feature is not available" ); |
||
305 | if( use_ret == -(MBEDTLS_ERR_MD_BAD_INPUT_DATA) ) |
||
306 | mbedtls_snprintf( buf, buflen, "MD - Bad input parameters to function" ); |
||
307 | if( use_ret == -(MBEDTLS_ERR_MD_ALLOC_FAILED) ) |
||
308 | mbedtls_snprintf( buf, buflen, "MD - Failed to allocate memory" ); |
||
309 | if( use_ret == -(MBEDTLS_ERR_MD_FILE_IO_ERROR) ) |
||
310 | mbedtls_snprintf( buf, buflen, "MD - Opening or reading of file failed" ); |
||
311 | if( use_ret == -(MBEDTLS_ERR_MD_HW_ACCEL_FAILED) ) |
||
312 | mbedtls_snprintf( buf, buflen, "MD - MD hardware accelerator failed" ); |
||
313 | #endif /* MBEDTLS_MD_C */ |
||
314 | |||
315 | #if defined(MBEDTLS_PEM_PARSE_C) || defined(MBEDTLS_PEM_WRITE_C) |
||
316 | if( use_ret == -(MBEDTLS_ERR_PEM_NO_HEADER_FOOTER_PRESENT) ) |
||
317 | mbedtls_snprintf( buf, buflen, "PEM - No PEM header or footer found" ); |
||
318 | if( use_ret == -(MBEDTLS_ERR_PEM_INVALID_DATA) ) |
||
319 | mbedtls_snprintf( buf, buflen, "PEM - PEM string is not as expected" ); |
||
320 | if( use_ret == -(MBEDTLS_ERR_PEM_ALLOC_FAILED) ) |
||
321 | mbedtls_snprintf( buf, buflen, "PEM - Failed to allocate memory" ); |
||
322 | if( use_ret == -(MBEDTLS_ERR_PEM_INVALID_ENC_IV) ) |
||
323 | mbedtls_snprintf( buf, buflen, "PEM - RSA IV is not in hex-format" ); |
||
324 | if( use_ret == -(MBEDTLS_ERR_PEM_UNKNOWN_ENC_ALG) ) |
||
325 | mbedtls_snprintf( buf, buflen, "PEM - Unsupported key encryption algorithm" ); |
||
326 | if( use_ret == -(MBEDTLS_ERR_PEM_PASSWORD_REQUIRED) ) |
||
327 | mbedtls_snprintf( buf, buflen, "PEM - Private key password can't be empty" ); |
||
328 | if( use_ret == -(MBEDTLS_ERR_PEM_PASSWORD_MISMATCH) ) |
||
329 | mbedtls_snprintf( buf, buflen, "PEM - Given private key password does not allow for correct decryption" ); |
||
330 | if( use_ret == -(MBEDTLS_ERR_PEM_FEATURE_UNAVAILABLE) ) |
||
331 | mbedtls_snprintf( buf, buflen, "PEM - Unavailable feature, e.g. hashing/encryption combination" ); |
||
332 | if( use_ret == -(MBEDTLS_ERR_PEM_BAD_INPUT_DATA) ) |
||
333 | mbedtls_snprintf( buf, buflen, "PEM - Bad input parameters to function" ); |
||
334 | #endif /* MBEDTLS_PEM_PARSE_C || MBEDTLS_PEM_WRITE_C */ |
||
335 | |||
336 | #if defined(MBEDTLS_PK_C) |
||
337 | if( use_ret == -(MBEDTLS_ERR_PK_ALLOC_FAILED) ) |
||
338 | mbedtls_snprintf( buf, buflen, "PK - Memory allocation failed" ); |
||
339 | if( use_ret == -(MBEDTLS_ERR_PK_TYPE_MISMATCH) ) |
||
340 | mbedtls_snprintf( buf, buflen, "PK - Type mismatch, eg attempt to encrypt with an ECDSA key" ); |
||
341 | if( use_ret == -(MBEDTLS_ERR_PK_BAD_INPUT_DATA) ) |
||
342 | mbedtls_snprintf( buf, buflen, "PK - Bad input parameters to function" ); |
||
343 | if( use_ret == -(MBEDTLS_ERR_PK_FILE_IO_ERROR) ) |
||
344 | mbedtls_snprintf( buf, buflen, "PK - Read/write of file failed" ); |
||
345 | if( use_ret == -(MBEDTLS_ERR_PK_KEY_INVALID_VERSION) ) |
||
346 | mbedtls_snprintf( buf, buflen, "PK - Unsupported key version" ); |
||
347 | if( use_ret == -(MBEDTLS_ERR_PK_KEY_INVALID_FORMAT) ) |
||
348 | mbedtls_snprintf( buf, buflen, "PK - Invalid key tag or value" ); |
||
349 | if( use_ret == -(MBEDTLS_ERR_PK_UNKNOWN_PK_ALG) ) |
||
350 | mbedtls_snprintf( buf, buflen, "PK - Key algorithm is unsupported (only RSA and EC are supported)" ); |
||
351 | if( use_ret == -(MBEDTLS_ERR_PK_PASSWORD_REQUIRED) ) |
||
352 | mbedtls_snprintf( buf, buflen, "PK - Private key password can't be empty" ); |
||
353 | if( use_ret == -(MBEDTLS_ERR_PK_PASSWORD_MISMATCH) ) |
||
354 | mbedtls_snprintf( buf, buflen, "PK - Given private key password does not allow for correct decryption" ); |
||
355 | if( use_ret == -(MBEDTLS_ERR_PK_INVALID_PUBKEY) ) |
||
356 | mbedtls_snprintf( buf, buflen, "PK - The pubkey tag or value is invalid (only RSA and EC are supported)" ); |
||
357 | if( use_ret == -(MBEDTLS_ERR_PK_INVALID_ALG) ) |
||
358 | mbedtls_snprintf( buf, buflen, "PK - The algorithm tag or value is invalid" ); |
||
359 | if( use_ret == -(MBEDTLS_ERR_PK_UNKNOWN_NAMED_CURVE) ) |
||
360 | mbedtls_snprintf( buf, buflen, "PK - Elliptic curve is unsupported (only NIST curves are supported)" ); |
||
361 | if( use_ret == -(MBEDTLS_ERR_PK_FEATURE_UNAVAILABLE) ) |
||
362 | mbedtls_snprintf( buf, buflen, "PK - Unavailable feature, e.g. RSA disabled for RSA key" ); |
||
363 | if( use_ret == -(MBEDTLS_ERR_PK_SIG_LEN_MISMATCH) ) |
||
364 | mbedtls_snprintf( buf, buflen, "PK - The buffer contains a valid signature followed by more data" ); |
||
365 | if( use_ret == -(MBEDTLS_ERR_PK_HW_ACCEL_FAILED) ) |
||
366 | mbedtls_snprintf( buf, buflen, "PK - PK hardware accelerator failed" ); |
||
367 | #endif /* MBEDTLS_PK_C */ |
||
368 | |||
369 | #if defined(MBEDTLS_PKCS12_C) |
||
370 | if( use_ret == -(MBEDTLS_ERR_PKCS12_BAD_INPUT_DATA) ) |
||
371 | mbedtls_snprintf( buf, buflen, "PKCS12 - Bad input parameters to function" ); |
||
372 | if( use_ret == -(MBEDTLS_ERR_PKCS12_FEATURE_UNAVAILABLE) ) |
||
373 | mbedtls_snprintf( buf, buflen, "PKCS12 - Feature not available, e.g. unsupported encryption scheme" ); |
||
374 | if( use_ret == -(MBEDTLS_ERR_PKCS12_PBE_INVALID_FORMAT) ) |
||
375 | mbedtls_snprintf( buf, buflen, "PKCS12 - PBE ASN.1 data not as expected" ); |
||
376 | if( use_ret == -(MBEDTLS_ERR_PKCS12_PASSWORD_MISMATCH) ) |
||
377 | mbedtls_snprintf( buf, buflen, "PKCS12 - Given private key password does not allow for correct decryption" ); |
||
378 | #endif /* MBEDTLS_PKCS12_C */ |
||
379 | |||
380 | #if defined(MBEDTLS_PKCS5_C) |
||
381 | if( use_ret == -(MBEDTLS_ERR_PKCS5_BAD_INPUT_DATA) ) |
||
382 | mbedtls_snprintf( buf, buflen, "PKCS5 - Bad input parameters to function" ); |
||
383 | if( use_ret == -(MBEDTLS_ERR_PKCS5_INVALID_FORMAT) ) |
||
384 | mbedtls_snprintf( buf, buflen, "PKCS5 - Unexpected ASN.1 data" ); |
||
385 | if( use_ret == -(MBEDTLS_ERR_PKCS5_FEATURE_UNAVAILABLE) ) |
||
386 | mbedtls_snprintf( buf, buflen, "PKCS5 - Requested encryption or digest alg not available" ); |
||
387 | if( use_ret == -(MBEDTLS_ERR_PKCS5_PASSWORD_MISMATCH) ) |
||
388 | mbedtls_snprintf( buf, buflen, "PKCS5 - Given private key password does not allow for correct decryption" ); |
||
389 | #endif /* MBEDTLS_PKCS5_C */ |
||
390 | |||
391 | #if defined(MBEDTLS_RSA_C) |
||
392 | if( use_ret == -(MBEDTLS_ERR_RSA_BAD_INPUT_DATA) ) |
||
393 | mbedtls_snprintf( buf, buflen, "RSA - Bad input parameters to function" ); |
||
394 | if( use_ret == -(MBEDTLS_ERR_RSA_INVALID_PADDING) ) |
||
395 | mbedtls_snprintf( buf, buflen, "RSA - Input data contains invalid padding and is rejected" ); |
||
396 | if( use_ret == -(MBEDTLS_ERR_RSA_KEY_GEN_FAILED) ) |
||
397 | mbedtls_snprintf( buf, buflen, "RSA - Something failed during generation of a key" ); |
||
398 | if( use_ret == -(MBEDTLS_ERR_RSA_KEY_CHECK_FAILED) ) |
||
399 | mbedtls_snprintf( buf, buflen, "RSA - Key failed to pass the validity check of the library" ); |
||
400 | if( use_ret == -(MBEDTLS_ERR_RSA_PUBLIC_FAILED) ) |
||
401 | mbedtls_snprintf( buf, buflen, "RSA - The public key operation failed" ); |
||
402 | if( use_ret == -(MBEDTLS_ERR_RSA_PRIVATE_FAILED) ) |
||
403 | mbedtls_snprintf( buf, buflen, "RSA - The private key operation failed" ); |
||
404 | if( use_ret == -(MBEDTLS_ERR_RSA_VERIFY_FAILED) ) |
||
405 | mbedtls_snprintf( buf, buflen, "RSA - The PKCS#1 verification failed" ); |
||
406 | if( use_ret == -(MBEDTLS_ERR_RSA_OUTPUT_TOO_LARGE) ) |
||
407 | mbedtls_snprintf( buf, buflen, "RSA - The output buffer for decryption is not large enough" ); |
||
408 | if( use_ret == -(MBEDTLS_ERR_RSA_RNG_FAILED) ) |
||
409 | mbedtls_snprintf( buf, buflen, "RSA - The random generator failed to generate non-zeros" ); |
||
410 | if( use_ret == -(MBEDTLS_ERR_RSA_UNSUPPORTED_OPERATION) ) |
||
411 | mbedtls_snprintf( buf, buflen, "RSA - The implementation does not offer the requested operation, for example, because of security violations or lack of functionality" ); |
||
412 | if( use_ret == -(MBEDTLS_ERR_RSA_HW_ACCEL_FAILED) ) |
||
413 | mbedtls_snprintf( buf, buflen, "RSA - RSA hardware accelerator failed" ); |
||
414 | #endif /* MBEDTLS_RSA_C */ |
||
415 | |||
416 | #if defined(MBEDTLS_SSL_TLS_C) |
||
417 | if( use_ret == -(MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE) ) |
||
418 | mbedtls_snprintf( buf, buflen, "SSL - The requested feature is not available" ); |
||
419 | if( use_ret == -(MBEDTLS_ERR_SSL_BAD_INPUT_DATA) ) |
||
420 | mbedtls_snprintf( buf, buflen, "SSL - Bad input parameters to function" ); |
||
421 | if( use_ret == -(MBEDTLS_ERR_SSL_INVALID_MAC) ) |
||
422 | mbedtls_snprintf( buf, buflen, "SSL - Verification of the message MAC failed" ); |
||
423 | if( use_ret == -(MBEDTLS_ERR_SSL_INVALID_RECORD) ) |
||
424 | mbedtls_snprintf( buf, buflen, "SSL - An invalid SSL record was received" ); |
||
425 | if( use_ret == -(MBEDTLS_ERR_SSL_CONN_EOF) ) |
||
426 | mbedtls_snprintf( buf, buflen, "SSL - The connection indicated an EOF" ); |
||
427 | if( use_ret == -(MBEDTLS_ERR_SSL_UNKNOWN_CIPHER) ) |
||
428 | mbedtls_snprintf( buf, buflen, "SSL - An unknown cipher was received" ); |
||
429 | if( use_ret == -(MBEDTLS_ERR_SSL_NO_CIPHER_CHOSEN) ) |
||
430 | mbedtls_snprintf( buf, buflen, "SSL - The server has no ciphersuites in common with the client" ); |
||
431 | if( use_ret == -(MBEDTLS_ERR_SSL_NO_RNG) ) |
||
432 | mbedtls_snprintf( buf, buflen, "SSL - No RNG was provided to the SSL module" ); |
||
433 | if( use_ret == -(MBEDTLS_ERR_SSL_NO_CLIENT_CERTIFICATE) ) |
||
434 | mbedtls_snprintf( buf, buflen, "SSL - No client certification received from the client, but required by the authentication mode" ); |
||
435 | if( use_ret == -(MBEDTLS_ERR_SSL_CERTIFICATE_TOO_LARGE) ) |
||
436 | mbedtls_snprintf( buf, buflen, "SSL - Our own certificate(s) is/are too large to send in an SSL message" ); |
||
437 | if( use_ret == -(MBEDTLS_ERR_SSL_CERTIFICATE_REQUIRED) ) |
||
438 | mbedtls_snprintf( buf, buflen, "SSL - The own certificate is not set, but needed by the server" ); |
||
439 | if( use_ret == -(MBEDTLS_ERR_SSL_PRIVATE_KEY_REQUIRED) ) |
||
440 | mbedtls_snprintf( buf, buflen, "SSL - The own private key or pre-shared key is not set, but needed" ); |
||
441 | if( use_ret == -(MBEDTLS_ERR_SSL_CA_CHAIN_REQUIRED) ) |
||
442 | mbedtls_snprintf( buf, buflen, "SSL - No CA Chain is set, but required to operate" ); |
||
443 | if( use_ret == -(MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE) ) |
||
444 | mbedtls_snprintf( buf, buflen, "SSL - An unexpected message was received from our peer" ); |
||
445 | if( use_ret == -(MBEDTLS_ERR_SSL_FATAL_ALERT_MESSAGE) ) |
||
446 | { |
||
447 | mbedtls_snprintf( buf, buflen, "SSL - A fatal alert message was received from our peer" ); |
||
448 | return; |
||
449 | } |
||
450 | if( use_ret == -(MBEDTLS_ERR_SSL_PEER_VERIFY_FAILED) ) |
||
451 | mbedtls_snprintf( buf, buflen, "SSL - Verification of our peer failed" ); |
||
452 | if( use_ret == -(MBEDTLS_ERR_SSL_PEER_CLOSE_NOTIFY) ) |
||
453 | mbedtls_snprintf( buf, buflen, "SSL - The peer notified us that the connection is going to be closed" ); |
||
454 | if( use_ret == -(MBEDTLS_ERR_SSL_BAD_HS_CLIENT_HELLO) ) |
||
455 | mbedtls_snprintf( buf, buflen, "SSL - Processing of the ClientHello handshake message failed" ); |
||
456 | if( use_ret == -(MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO) ) |
||
457 | mbedtls_snprintf( buf, buflen, "SSL - Processing of the ServerHello handshake message failed" ); |
||
458 | if( use_ret == -(MBEDTLS_ERR_SSL_BAD_HS_CERTIFICATE) ) |
||
459 | mbedtls_snprintf( buf, buflen, "SSL - Processing of the Certificate handshake message failed" ); |
||
460 | if( use_ret == -(MBEDTLS_ERR_SSL_BAD_HS_CERTIFICATE_REQUEST) ) |
||
461 | mbedtls_snprintf( buf, buflen, "SSL - Processing of the CertificateRequest handshake message failed" ); |
||
462 | if( use_ret == -(MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE) ) |
||
463 | mbedtls_snprintf( buf, buflen, "SSL - Processing of the ServerKeyExchange handshake message failed" ); |
||
464 | if( use_ret == -(MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO_DONE) ) |
||
465 | mbedtls_snprintf( buf, buflen, "SSL - Processing of the ServerHelloDone handshake message failed" ); |
||
466 | if( use_ret == -(MBEDTLS_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE) ) |
||
467 | mbedtls_snprintf( buf, buflen, "SSL - Processing of the ClientKeyExchange handshake message failed" ); |
||
468 | if( use_ret == -(MBEDTLS_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE_RP) ) |
||
469 | mbedtls_snprintf( buf, buflen, "SSL - Processing of the ClientKeyExchange handshake message failed in DHM / ECDH Read Public" ); |
||
470 | if( use_ret == -(MBEDTLS_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE_CS) ) |
||
471 | mbedtls_snprintf( buf, buflen, "SSL - Processing of the ClientKeyExchange handshake message failed in DHM / ECDH Calculate Secret" ); |
||
472 | if( use_ret == -(MBEDTLS_ERR_SSL_BAD_HS_CERTIFICATE_VERIFY) ) |
||
473 | mbedtls_snprintf( buf, buflen, "SSL - Processing of the CertificateVerify handshake message failed" ); |
||
474 | if( use_ret == -(MBEDTLS_ERR_SSL_BAD_HS_CHANGE_CIPHER_SPEC) ) |
||
475 | mbedtls_snprintf( buf, buflen, "SSL - Processing of the ChangeCipherSpec handshake message failed" ); |
||
476 | if( use_ret == -(MBEDTLS_ERR_SSL_BAD_HS_FINISHED) ) |
||
477 | mbedtls_snprintf( buf, buflen, "SSL - Processing of the Finished handshake message failed" ); |
||
478 | if( use_ret == -(MBEDTLS_ERR_SSL_ALLOC_FAILED) ) |
||
479 | mbedtls_snprintf( buf, buflen, "SSL - Memory allocation failed" ); |
||
480 | if( use_ret == -(MBEDTLS_ERR_SSL_HW_ACCEL_FAILED) ) |
||
481 | mbedtls_snprintf( buf, buflen, "SSL - Hardware acceleration function returned with error" ); |
||
482 | if( use_ret == -(MBEDTLS_ERR_SSL_HW_ACCEL_FALLTHROUGH) ) |
||
483 | mbedtls_snprintf( buf, buflen, "SSL - Hardware acceleration function skipped / left alone data" ); |
||
484 | if( use_ret == -(MBEDTLS_ERR_SSL_COMPRESSION_FAILED) ) |
||
485 | mbedtls_snprintf( buf, buflen, "SSL - Processing of the compression / decompression failed" ); |
||
486 | if( use_ret == -(MBEDTLS_ERR_SSL_BAD_HS_PROTOCOL_VERSION) ) |
||
487 | mbedtls_snprintf( buf, buflen, "SSL - Handshake protocol not within min/max boundaries" ); |
||
488 | if( use_ret == -(MBEDTLS_ERR_SSL_BAD_HS_NEW_SESSION_TICKET) ) |
||
489 | mbedtls_snprintf( buf, buflen, "SSL - Processing of the NewSessionTicket handshake message failed" ); |
||
490 | if( use_ret == -(MBEDTLS_ERR_SSL_SESSION_TICKET_EXPIRED) ) |
||
491 | mbedtls_snprintf( buf, buflen, "SSL - Session ticket has expired" ); |
||
492 | if( use_ret == -(MBEDTLS_ERR_SSL_PK_TYPE_MISMATCH) ) |
||
493 | mbedtls_snprintf( buf, buflen, "SSL - Public key type mismatch (eg, asked for RSA key exchange and presented EC key)" ); |
||
494 | if( use_ret == -(MBEDTLS_ERR_SSL_UNKNOWN_IDENTITY) ) |
||
495 | mbedtls_snprintf( buf, buflen, "SSL - Unknown identity received (eg, PSK identity)" ); |
||
496 | if( use_ret == -(MBEDTLS_ERR_SSL_INTERNAL_ERROR) ) |
||
497 | mbedtls_snprintf( buf, buflen, "SSL - Internal error (eg, unexpected failure in lower-level module)" ); |
||
498 | if( use_ret == -(MBEDTLS_ERR_SSL_COUNTER_WRAPPING) ) |
||
499 | mbedtls_snprintf( buf, buflen, "SSL - A counter would wrap (eg, too many messages exchanged)" ); |
||
500 | if( use_ret == -(MBEDTLS_ERR_SSL_WAITING_SERVER_HELLO_RENEGO) ) |
||
501 | mbedtls_snprintf( buf, buflen, "SSL - Unexpected message at ServerHello in renegotiation" ); |
||
502 | if( use_ret == -(MBEDTLS_ERR_SSL_HELLO_VERIFY_REQUIRED) ) |
||
503 | mbedtls_snprintf( buf, buflen, "SSL - DTLS client must retry for hello verification" ); |
||
504 | if( use_ret == -(MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL) ) |
||
505 | mbedtls_snprintf( buf, buflen, "SSL - A buffer is too small to receive or write a message" ); |
||
506 | if( use_ret == -(MBEDTLS_ERR_SSL_NO_USABLE_CIPHERSUITE) ) |
||
507 | mbedtls_snprintf( buf, buflen, "SSL - None of the common ciphersuites is usable (eg, no suitable certificate, see debug messages)" ); |
||
508 | if( use_ret == -(MBEDTLS_ERR_SSL_WANT_READ) ) |
||
509 | mbedtls_snprintf( buf, buflen, "SSL - No data of requested type currently available on underlying transport" ); |
||
510 | if( use_ret == -(MBEDTLS_ERR_SSL_WANT_WRITE) ) |
||
511 | mbedtls_snprintf( buf, buflen, "SSL - Connection requires a write call" ); |
||
512 | if( use_ret == -(MBEDTLS_ERR_SSL_TIMEOUT) ) |
||
513 | mbedtls_snprintf( buf, buflen, "SSL - The operation timed out" ); |
||
514 | if( use_ret == -(MBEDTLS_ERR_SSL_CLIENT_RECONNECT) ) |
||
515 | mbedtls_snprintf( buf, buflen, "SSL - The client initiated a reconnect from the same port" ); |
||
516 | if( use_ret == -(MBEDTLS_ERR_SSL_UNEXPECTED_RECORD) ) |
||
517 | mbedtls_snprintf( buf, buflen, "SSL - Record header looks valid but is not expected" ); |
||
518 | if( use_ret == -(MBEDTLS_ERR_SSL_NON_FATAL) ) |
||
519 | mbedtls_snprintf( buf, buflen, "SSL - The alert message received indicates a non-fatal error" ); |
||
520 | if( use_ret == -(MBEDTLS_ERR_SSL_INVALID_VERIFY_HASH) ) |
||
521 | mbedtls_snprintf( buf, buflen, "SSL - Couldn't set the hash for verifying CertificateVerify" ); |
||
522 | if( use_ret == -(MBEDTLS_ERR_SSL_CONTINUE_PROCESSING) ) |
||
523 | mbedtls_snprintf( buf, buflen, "SSL - Internal-only message signaling that further message-processing should be done" ); |
||
524 | if( use_ret == -(MBEDTLS_ERR_SSL_ASYNC_IN_PROGRESS) ) |
||
525 | mbedtls_snprintf( buf, buflen, "SSL - The asynchronous operation is not completed yet" ); |
||
526 | if( use_ret == -(MBEDTLS_ERR_SSL_EARLY_MESSAGE) ) |
||
527 | mbedtls_snprintf( buf, buflen, "SSL - Internal-only message signaling that a message arrived early" ); |
||
528 | if( use_ret == -(MBEDTLS_ERR_SSL_CRYPTO_IN_PROGRESS) ) |
||
529 | mbedtls_snprintf( buf, buflen, "SSL - A cryptographic operation is in progress. Try again later" ); |
||
530 | #endif /* MBEDTLS_SSL_TLS_C */ |
||
531 | |||
532 | #if defined(MBEDTLS_X509_USE_C) || defined(MBEDTLS_X509_CREATE_C) |
||
533 | if( use_ret == -(MBEDTLS_ERR_X509_FEATURE_UNAVAILABLE) ) |
||
534 | mbedtls_snprintf( buf, buflen, "X509 - Unavailable feature, e.g. RSA hashing/encryption combination" ); |
||
535 | if( use_ret == -(MBEDTLS_ERR_X509_UNKNOWN_OID) ) |
||
536 | mbedtls_snprintf( buf, buflen, "X509 - Requested OID is unknown" ); |
||
537 | if( use_ret == -(MBEDTLS_ERR_X509_INVALID_FORMAT) ) |
||
538 | mbedtls_snprintf( buf, buflen, "X509 - The CRT/CRL/CSR format is invalid, e.g. different type expected" ); |
||
539 | if( use_ret == -(MBEDTLS_ERR_X509_INVALID_VERSION) ) |
||
540 | mbedtls_snprintf( buf, buflen, "X509 - The CRT/CRL/CSR version element is invalid" ); |
||
541 | if( use_ret == -(MBEDTLS_ERR_X509_INVALID_SERIAL) ) |
||
542 | mbedtls_snprintf( buf, buflen, "X509 - The serial tag or value is invalid" ); |
||
543 | if( use_ret == -(MBEDTLS_ERR_X509_INVALID_ALG) ) |
||
544 | mbedtls_snprintf( buf, buflen, "X509 - The algorithm tag or value is invalid" ); |
||
545 | if( use_ret == -(MBEDTLS_ERR_X509_INVALID_NAME) ) |
||
546 | mbedtls_snprintf( buf, buflen, "X509 - The name tag or value is invalid" ); |
||
547 | if( use_ret == -(MBEDTLS_ERR_X509_INVALID_DATE) ) |
||
548 | mbedtls_snprintf( buf, buflen, "X509 - The date tag or value is invalid" ); |
||
549 | if( use_ret == -(MBEDTLS_ERR_X509_INVALID_SIGNATURE) ) |
||
550 | mbedtls_snprintf( buf, buflen, "X509 - The signature tag or value invalid" ); |
||
551 | if( use_ret == -(MBEDTLS_ERR_X509_INVALID_EXTENSIONS) ) |
||
552 | mbedtls_snprintf( buf, buflen, "X509 - The extension tag or value is invalid" ); |
||
553 | if( use_ret == -(MBEDTLS_ERR_X509_UNKNOWN_VERSION) ) |
||
554 | mbedtls_snprintf( buf, buflen, "X509 - CRT/CRL/CSR has an unsupported version number" ); |
||
555 | if( use_ret == -(MBEDTLS_ERR_X509_UNKNOWN_SIG_ALG) ) |
||
556 | mbedtls_snprintf( buf, buflen, "X509 - Signature algorithm (oid) is unsupported" ); |
||
557 | if( use_ret == -(MBEDTLS_ERR_X509_SIG_MISMATCH) ) |
||
558 | mbedtls_snprintf( buf, buflen, "X509 - Signature algorithms do not match. (see \\c ::mbedtls_x509_crt sig_oid)" ); |
||
559 | if( use_ret == -(MBEDTLS_ERR_X509_CERT_VERIFY_FAILED) ) |
||
560 | mbedtls_snprintf( buf, buflen, "X509 - Certificate verification failed, e.g. CRL, CA or signature check failed" ); |
||
561 | if( use_ret == -(MBEDTLS_ERR_X509_CERT_UNKNOWN_FORMAT) ) |
||
562 | mbedtls_snprintf( buf, buflen, "X509 - Format not recognized as DER or PEM" ); |
||
563 | if( use_ret == -(MBEDTLS_ERR_X509_BAD_INPUT_DATA) ) |
||
564 | mbedtls_snprintf( buf, buflen, "X509 - Input invalid" ); |
||
565 | if( use_ret == -(MBEDTLS_ERR_X509_ALLOC_FAILED) ) |
||
566 | mbedtls_snprintf( buf, buflen, "X509 - Allocation of memory failed" ); |
||
567 | if( use_ret == -(MBEDTLS_ERR_X509_FILE_IO_ERROR) ) |
||
568 | mbedtls_snprintf( buf, buflen, "X509 - Read/write of file failed" ); |
||
569 | if( use_ret == -(MBEDTLS_ERR_X509_BUFFER_TOO_SMALL) ) |
||
570 | mbedtls_snprintf( buf, buflen, "X509 - Destination buffer is too small" ); |
||
571 | if( use_ret == -(MBEDTLS_ERR_X509_FATAL_ERROR) ) |
||
572 | mbedtls_snprintf( buf, buflen, "X509 - A fatal error occurred, eg the chain is too long or the vrfy callback failed" ); |
||
573 | #endif /* MBEDTLS_X509_USE_C || MBEDTLS_X509_CREATE_C */ |
||
574 | // END generated code |
||
575 | |||
576 | if( strlen( buf ) == 0 ) |
||
577 | mbedtls_snprintf( buf, buflen, "UNKNOWN ERROR CODE (%04X)", use_ret ); |
||
578 | } |
||
579 | |||
580 | use_ret = ret & ~0xFF80; |
||
581 | |||
582 | if( use_ret == 0 ) |
||
583 | return; |
||
584 | |||
585 | // If high level code is present, make a concatenation between both |
||
586 | // error strings. |
||
587 | // |
||
588 | len = strlen( buf ); |
||
589 | |||
590 | if( len > 0 ) |
||
591 | { |
||
592 | if( buflen - len < 5 ) |
||
593 | return; |
||
594 | |||
595 | mbedtls_snprintf( buf + len, buflen - len, " : " ); |
||
596 | |||
597 | buf += len + 3; |
||
598 | buflen -= len + 3; |
||
599 | } |
||
600 | |||
601 | // Low level error codes |
||
602 | // |
||
603 | // BEGIN generated code |
||
604 | #if defined(MBEDTLS_AES_C) |
||
605 | if( use_ret == -(MBEDTLS_ERR_AES_INVALID_KEY_LENGTH) ) |
||
606 | mbedtls_snprintf( buf, buflen, "AES - Invalid key length" ); |
||
607 | if( use_ret == -(MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH) ) |
||
608 | mbedtls_snprintf( buf, buflen, "AES - Invalid data input length" ); |
||
609 | if( use_ret == -(MBEDTLS_ERR_AES_BAD_INPUT_DATA) ) |
||
610 | mbedtls_snprintf( buf, buflen, "AES - Invalid input data" ); |
||
611 | if( use_ret == -(MBEDTLS_ERR_AES_FEATURE_UNAVAILABLE) ) |
||
612 | mbedtls_snprintf( buf, buflen, "AES - Feature not available. For example, an unsupported AES key size" ); |
||
613 | if( use_ret == -(MBEDTLS_ERR_AES_HW_ACCEL_FAILED) ) |
||
614 | mbedtls_snprintf( buf, buflen, "AES - AES hardware accelerator failed" ); |
||
615 | #endif /* MBEDTLS_AES_C */ |
||
616 | |||
617 | #if defined(MBEDTLS_ARC4_C) |
||
618 | if( use_ret == -(MBEDTLS_ERR_ARC4_HW_ACCEL_FAILED) ) |
||
619 | mbedtls_snprintf( buf, buflen, "ARC4 - ARC4 hardware accelerator failed" ); |
||
620 | #endif /* MBEDTLS_ARC4_C */ |
||
621 | |||
622 | #if defined(MBEDTLS_ARIA_C) |
||
623 | if( use_ret == -(MBEDTLS_ERR_ARIA_BAD_INPUT_DATA) ) |
||
624 | mbedtls_snprintf( buf, buflen, "ARIA - Bad input data" ); |
||
625 | if( use_ret == -(MBEDTLS_ERR_ARIA_INVALID_INPUT_LENGTH) ) |
||
626 | mbedtls_snprintf( buf, buflen, "ARIA - Invalid data input length" ); |
||
627 | if( use_ret == -(MBEDTLS_ERR_ARIA_FEATURE_UNAVAILABLE) ) |
||
628 | mbedtls_snprintf( buf, buflen, "ARIA - Feature not available. For example, an unsupported ARIA key size" ); |
||
629 | if( use_ret == -(MBEDTLS_ERR_ARIA_HW_ACCEL_FAILED) ) |
||
630 | mbedtls_snprintf( buf, buflen, "ARIA - ARIA hardware accelerator failed" ); |
||
631 | #endif /* MBEDTLS_ARIA_C */ |
||
632 | |||
633 | #if defined(MBEDTLS_ASN1_PARSE_C) |
||
634 | if( use_ret == -(MBEDTLS_ERR_ASN1_OUT_OF_DATA) ) |
||
635 | mbedtls_snprintf( buf, buflen, "ASN1 - Out of data when parsing an ASN1 data structure" ); |
||
636 | if( use_ret == -(MBEDTLS_ERR_ASN1_UNEXPECTED_TAG) ) |
||
637 | mbedtls_snprintf( buf, buflen, "ASN1 - ASN1 tag was of an unexpected value" ); |
||
638 | if( use_ret == -(MBEDTLS_ERR_ASN1_INVALID_LENGTH) ) |
||
639 | mbedtls_snprintf( buf, buflen, "ASN1 - Error when trying to determine the length or invalid length" ); |
||
640 | if( use_ret == -(MBEDTLS_ERR_ASN1_LENGTH_MISMATCH) ) |
||
641 | mbedtls_snprintf( buf, buflen, "ASN1 - Actual length differs from expected length" ); |
||
642 | if( use_ret == -(MBEDTLS_ERR_ASN1_INVALID_DATA) ) |
||
643 | mbedtls_snprintf( buf, buflen, "ASN1 - Data is invalid. (not used)" ); |
||
644 | if( use_ret == -(MBEDTLS_ERR_ASN1_ALLOC_FAILED) ) |
||
645 | mbedtls_snprintf( buf, buflen, "ASN1 - Memory allocation failed" ); |
||
646 | if( use_ret == -(MBEDTLS_ERR_ASN1_BUF_TOO_SMALL) ) |
||
647 | mbedtls_snprintf( buf, buflen, "ASN1 - Buffer too small when writing ASN.1 data structure" ); |
||
648 | #endif /* MBEDTLS_ASN1_PARSE_C */ |
||
649 | |||
650 | #if defined(MBEDTLS_BASE64_C) |
||
651 | if( use_ret == -(MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL) ) |
||
652 | mbedtls_snprintf( buf, buflen, "BASE64 - Output buffer too small" ); |
||
653 | if( use_ret == -(MBEDTLS_ERR_BASE64_INVALID_CHARACTER) ) |
||
654 | mbedtls_snprintf( buf, buflen, "BASE64 - Invalid character in input" ); |
||
655 | #endif /* MBEDTLS_BASE64_C */ |
||
656 | |||
657 | #if defined(MBEDTLS_BIGNUM_C) |
||
658 | if( use_ret == -(MBEDTLS_ERR_MPI_FILE_IO_ERROR) ) |
||
659 | mbedtls_snprintf( buf, buflen, "BIGNUM - An error occurred while reading from or writing to a file" ); |
||
660 | if( use_ret == -(MBEDTLS_ERR_MPI_BAD_INPUT_DATA) ) |
||
661 | mbedtls_snprintf( buf, buflen, "BIGNUM - Bad input parameters to function" ); |
||
662 | if( use_ret == -(MBEDTLS_ERR_MPI_INVALID_CHARACTER) ) |
||
663 | mbedtls_snprintf( buf, buflen, "BIGNUM - There is an invalid character in the digit string" ); |
||
664 | if( use_ret == -(MBEDTLS_ERR_MPI_BUFFER_TOO_SMALL) ) |
||
665 | mbedtls_snprintf( buf, buflen, "BIGNUM - The buffer is too small to write to" ); |
||
666 | if( use_ret == -(MBEDTLS_ERR_MPI_NEGATIVE_VALUE) ) |
||
667 | mbedtls_snprintf( buf, buflen, "BIGNUM - The input arguments are negative or result in illegal output" ); |
||
668 | if( use_ret == -(MBEDTLS_ERR_MPI_DIVISION_BY_ZERO) ) |
||
669 | mbedtls_snprintf( buf, buflen, "BIGNUM - The input argument for division is zero, which is not allowed" ); |
||
670 | if( use_ret == -(MBEDTLS_ERR_MPI_NOT_ACCEPTABLE) ) |
||
671 | mbedtls_snprintf( buf, buflen, "BIGNUM - The input arguments are not acceptable" ); |
||
672 | if( use_ret == -(MBEDTLS_ERR_MPI_ALLOC_FAILED) ) |
||
673 | mbedtls_snprintf( buf, buflen, "BIGNUM - Memory allocation failed" ); |
||
674 | #endif /* MBEDTLS_BIGNUM_C */ |
||
675 | |||
676 | #if defined(MBEDTLS_BLOWFISH_C) |
||
677 | if( use_ret == -(MBEDTLS_ERR_BLOWFISH_BAD_INPUT_DATA) ) |
||
678 | mbedtls_snprintf( buf, buflen, "BLOWFISH - Bad input data" ); |
||
679 | if( use_ret == -(MBEDTLS_ERR_BLOWFISH_INVALID_INPUT_LENGTH) ) |
||
680 | mbedtls_snprintf( buf, buflen, "BLOWFISH - Invalid data input length" ); |
||
681 | if( use_ret == -(MBEDTLS_ERR_BLOWFISH_HW_ACCEL_FAILED) ) |
||
682 | mbedtls_snprintf( buf, buflen, "BLOWFISH - Blowfish hardware accelerator failed" ); |
||
683 | #endif /* MBEDTLS_BLOWFISH_C */ |
||
684 | |||
685 | #if defined(MBEDTLS_CAMELLIA_C) |
||
686 | if( use_ret == -(MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA) ) |
||
687 | mbedtls_snprintf( buf, buflen, "CAMELLIA - Bad input data" ); |
||
688 | if( use_ret == -(MBEDTLS_ERR_CAMELLIA_INVALID_INPUT_LENGTH) ) |
||
689 | mbedtls_snprintf( buf, buflen, "CAMELLIA - Invalid data input length" ); |
||
690 | if( use_ret == -(MBEDTLS_ERR_CAMELLIA_HW_ACCEL_FAILED) ) |
||
691 | mbedtls_snprintf( buf, buflen, "CAMELLIA - Camellia hardware accelerator failed" ); |
||
692 | #endif /* MBEDTLS_CAMELLIA_C */ |
||
693 | |||
694 | #if defined(MBEDTLS_CCM_C) |
||
695 | if( use_ret == -(MBEDTLS_ERR_CCM_BAD_INPUT) ) |
||
696 | mbedtls_snprintf( buf, buflen, "CCM - Bad input parameters to the function" ); |
||
697 | if( use_ret == -(MBEDTLS_ERR_CCM_AUTH_FAILED) ) |
||
698 | mbedtls_snprintf( buf, buflen, "CCM - Authenticated decryption failed" ); |
||
699 | if( use_ret == -(MBEDTLS_ERR_CCM_HW_ACCEL_FAILED) ) |
||
700 | mbedtls_snprintf( buf, buflen, "CCM - CCM hardware accelerator failed" ); |
||
701 | #endif /* MBEDTLS_CCM_C */ |
||
702 | |||
703 | #if defined(MBEDTLS_CHACHA20_C) |
||
704 | if( use_ret == -(MBEDTLS_ERR_CHACHA20_BAD_INPUT_DATA) ) |
||
705 | mbedtls_snprintf( buf, buflen, "CHACHA20 - Invalid input parameter(s)" ); |
||
706 | if( use_ret == -(MBEDTLS_ERR_CHACHA20_FEATURE_UNAVAILABLE) ) |
||
707 | mbedtls_snprintf( buf, buflen, "CHACHA20 - Feature not available. For example, s part of the API is not implemented" ); |
||
708 | if( use_ret == -(MBEDTLS_ERR_CHACHA20_HW_ACCEL_FAILED) ) |
||
709 | mbedtls_snprintf( buf, buflen, "CHACHA20 - Chacha20 hardware accelerator failed" ); |
||
710 | #endif /* MBEDTLS_CHACHA20_C */ |
||
711 | |||
712 | #if defined(MBEDTLS_CHACHAPOLY_C) |
||
713 | if( use_ret == -(MBEDTLS_ERR_CHACHAPOLY_BAD_STATE) ) |
||
714 | mbedtls_snprintf( buf, buflen, "CHACHAPOLY - The requested operation is not permitted in the current state" ); |
||
715 | if( use_ret == -(MBEDTLS_ERR_CHACHAPOLY_AUTH_FAILED) ) |
||
716 | mbedtls_snprintf( buf, buflen, "CHACHAPOLY - Authenticated decryption failed: data was not authentic" ); |
||
717 | #endif /* MBEDTLS_CHACHAPOLY_C */ |
||
718 | |||
719 | #if defined(MBEDTLS_CMAC_C) |
||
720 | if( use_ret == -(MBEDTLS_ERR_CMAC_HW_ACCEL_FAILED) ) |
||
721 | mbedtls_snprintf( buf, buflen, "CMAC - CMAC hardware accelerator failed" ); |
||
722 | #endif /* MBEDTLS_CMAC_C */ |
||
723 | |||
724 | #if defined(MBEDTLS_CTR_DRBG_C) |
||
725 | if( use_ret == -(MBEDTLS_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED) ) |
||
726 | mbedtls_snprintf( buf, buflen, "CTR_DRBG - The entropy source failed" ); |
||
727 | if( use_ret == -(MBEDTLS_ERR_CTR_DRBG_REQUEST_TOO_BIG) ) |
||
728 | mbedtls_snprintf( buf, buflen, "CTR_DRBG - The requested random buffer length is too big" ); |
||
729 | if( use_ret == -(MBEDTLS_ERR_CTR_DRBG_INPUT_TOO_BIG) ) |
||
730 | mbedtls_snprintf( buf, buflen, "CTR_DRBG - The input (entropy + additional data) is too large" ); |
||
731 | if( use_ret == -(MBEDTLS_ERR_CTR_DRBG_FILE_IO_ERROR) ) |
||
732 | mbedtls_snprintf( buf, buflen, "CTR_DRBG - Read or write error in file" ); |
||
733 | #endif /* MBEDTLS_CTR_DRBG_C */ |
||
734 | |||
735 | #if defined(MBEDTLS_DES_C) |
||
736 | if( use_ret == -(MBEDTLS_ERR_DES_INVALID_INPUT_LENGTH) ) |
||
737 | mbedtls_snprintf( buf, buflen, "DES - The data input has an invalid length" ); |
||
738 | if( use_ret == -(MBEDTLS_ERR_DES_HW_ACCEL_FAILED) ) |
||
739 | mbedtls_snprintf( buf, buflen, "DES - DES hardware accelerator failed" ); |
||
740 | #endif /* MBEDTLS_DES_C */ |
||
741 | |||
742 | #if defined(MBEDTLS_ENTROPY_C) |
||
743 | if( use_ret == -(MBEDTLS_ERR_ENTROPY_SOURCE_FAILED) ) |
||
744 | mbedtls_snprintf( buf, buflen, "ENTROPY - Critical entropy source failure" ); |
||
745 | if( use_ret == -(MBEDTLS_ERR_ENTROPY_MAX_SOURCES) ) |
||
746 | mbedtls_snprintf( buf, buflen, "ENTROPY - No more sources can be added" ); |
||
747 | if( use_ret == -(MBEDTLS_ERR_ENTROPY_NO_SOURCES_DEFINED) ) |
||
748 | mbedtls_snprintf( buf, buflen, "ENTROPY - No sources have been added to poll" ); |
||
749 | if( use_ret == -(MBEDTLS_ERR_ENTROPY_NO_STRONG_SOURCE) ) |
||
750 | mbedtls_snprintf( buf, buflen, "ENTROPY - No strong sources have been added to poll" ); |
||
751 | if( use_ret == -(MBEDTLS_ERR_ENTROPY_FILE_IO_ERROR) ) |
||
752 | mbedtls_snprintf( buf, buflen, "ENTROPY - Read/write error in file" ); |
||
753 | #endif /* MBEDTLS_ENTROPY_C */ |
||
754 | |||
755 | #if defined(MBEDTLS_GCM_C) |
||
756 | if( use_ret == -(MBEDTLS_ERR_GCM_AUTH_FAILED) ) |
||
757 | mbedtls_snprintf( buf, buflen, "GCM - Authenticated decryption failed" ); |
||
758 | if( use_ret == -(MBEDTLS_ERR_GCM_HW_ACCEL_FAILED) ) |
||
759 | mbedtls_snprintf( buf, buflen, "GCM - GCM hardware accelerator failed" ); |
||
760 | if( use_ret == -(MBEDTLS_ERR_GCM_BAD_INPUT) ) |
||
761 | mbedtls_snprintf( buf, buflen, "GCM - Bad input parameters to function" ); |
||
762 | #endif /* MBEDTLS_GCM_C */ |
||
763 | |||
764 | #if defined(MBEDTLS_HKDF_C) |
||
765 | if( use_ret == -(MBEDTLS_ERR_HKDF_BAD_INPUT_DATA) ) |
||
766 | mbedtls_snprintf( buf, buflen, "HKDF - Bad input parameters to function" ); |
||
767 | #endif /* MBEDTLS_HKDF_C */ |
||
768 | |||
769 | #if defined(MBEDTLS_HMAC_DRBG_C) |
||
770 | if( use_ret == -(MBEDTLS_ERR_HMAC_DRBG_REQUEST_TOO_BIG) ) |
||
771 | mbedtls_snprintf( buf, buflen, "HMAC_DRBG - Too many random requested in single call" ); |
||
772 | if( use_ret == -(MBEDTLS_ERR_HMAC_DRBG_INPUT_TOO_BIG) ) |
||
773 | mbedtls_snprintf( buf, buflen, "HMAC_DRBG - Input too large (Entropy + additional)" ); |
||
774 | if( use_ret == -(MBEDTLS_ERR_HMAC_DRBG_FILE_IO_ERROR) ) |
||
775 | mbedtls_snprintf( buf, buflen, "HMAC_DRBG - Read/write error in file" ); |
||
776 | if( use_ret == -(MBEDTLS_ERR_HMAC_DRBG_ENTROPY_SOURCE_FAILED) ) |
||
777 | mbedtls_snprintf( buf, buflen, "HMAC_DRBG - The entropy source failed" ); |
||
778 | #endif /* MBEDTLS_HMAC_DRBG_C */ |
||
779 | |||
780 | #if defined(MBEDTLS_MD2_C) |
||
781 | if( use_ret == -(MBEDTLS_ERR_MD2_HW_ACCEL_FAILED) ) |
||
782 | mbedtls_snprintf( buf, buflen, "MD2 - MD2 hardware accelerator failed" ); |
||
783 | #endif /* MBEDTLS_MD2_C */ |
||
784 | |||
785 | #if defined(MBEDTLS_MD4_C) |
||
786 | if( use_ret == -(MBEDTLS_ERR_MD4_HW_ACCEL_FAILED) ) |
||
787 | mbedtls_snprintf( buf, buflen, "MD4 - MD4 hardware accelerator failed" ); |
||
788 | #endif /* MBEDTLS_MD4_C */ |
||
789 | |||
790 | #if defined(MBEDTLS_MD5_C) |
||
791 | if( use_ret == -(MBEDTLS_ERR_MD5_HW_ACCEL_FAILED) ) |
||
792 | mbedtls_snprintf( buf, buflen, "MD5 - MD5 hardware accelerator failed" ); |
||
793 | #endif /* MBEDTLS_MD5_C */ |
||
794 | |||
795 | #if defined(MBEDTLS_NET_C) |
||
796 | if( use_ret == -(MBEDTLS_ERR_NET_SOCKET_FAILED) ) |
||
797 | mbedtls_snprintf( buf, buflen, "NET - Failed to open a socket" ); |
||
798 | if( use_ret == -(MBEDTLS_ERR_NET_CONNECT_FAILED) ) |
||
799 | mbedtls_snprintf( buf, buflen, "NET - The connection to the given server / port failed" ); |
||
800 | if( use_ret == -(MBEDTLS_ERR_NET_BIND_FAILED) ) |
||
801 | mbedtls_snprintf( buf, buflen, "NET - Binding of the socket failed" ); |
||
802 | if( use_ret == -(MBEDTLS_ERR_NET_LISTEN_FAILED) ) |
||
803 | mbedtls_snprintf( buf, buflen, "NET - Could not listen on the socket" ); |
||
804 | if( use_ret == -(MBEDTLS_ERR_NET_ACCEPT_FAILED) ) |
||
805 | mbedtls_snprintf( buf, buflen, "NET - Could not accept the incoming connection" ); |
||
806 | if( use_ret == -(MBEDTLS_ERR_NET_RECV_FAILED) ) |
||
807 | mbedtls_snprintf( buf, buflen, "NET - Reading information from the socket failed" ); |
||
808 | if( use_ret == -(MBEDTLS_ERR_NET_SEND_FAILED) ) |
||
809 | mbedtls_snprintf( buf, buflen, "NET - Sending information through the socket failed" ); |
||
810 | if( use_ret == -(MBEDTLS_ERR_NET_CONN_RESET) ) |
||
811 | mbedtls_snprintf( buf, buflen, "NET - Connection was reset by peer" ); |
||
812 | if( use_ret == -(MBEDTLS_ERR_NET_UNKNOWN_HOST) ) |
||
813 | mbedtls_snprintf( buf, buflen, "NET - Failed to get an IP address for the given hostname" ); |
||
814 | if( use_ret == -(MBEDTLS_ERR_NET_BUFFER_TOO_SMALL) ) |
||
815 | mbedtls_snprintf( buf, buflen, "NET - Buffer is too small to hold the data" ); |
||
816 | if( use_ret == -(MBEDTLS_ERR_NET_INVALID_CONTEXT) ) |
||
817 | mbedtls_snprintf( buf, buflen, "NET - The context is invalid, eg because it was free()ed" ); |
||
818 | if( use_ret == -(MBEDTLS_ERR_NET_POLL_FAILED) ) |
||
819 | mbedtls_snprintf( buf, buflen, "NET - Polling the net context failed" ); |
||
820 | if( use_ret == -(MBEDTLS_ERR_NET_BAD_INPUT_DATA) ) |
||
821 | mbedtls_snprintf( buf, buflen, "NET - Input invalid" ); |
||
822 | #endif /* MBEDTLS_NET_C */ |
||
823 | |||
824 | #if defined(MBEDTLS_OID_C) |
||
825 | if( use_ret == -(MBEDTLS_ERR_OID_NOT_FOUND) ) |
||
826 | mbedtls_snprintf( buf, buflen, "OID - OID is not found" ); |
||
827 | if( use_ret == -(MBEDTLS_ERR_OID_BUF_TOO_SMALL) ) |
||
828 | mbedtls_snprintf( buf, buflen, "OID - output buffer is too small" ); |
||
829 | #endif /* MBEDTLS_OID_C */ |
||
830 | |||
831 | #if defined(MBEDTLS_PADLOCK_C) |
||
832 | if( use_ret == -(MBEDTLS_ERR_PADLOCK_DATA_MISALIGNED) ) |
||
833 | mbedtls_snprintf( buf, buflen, "PADLOCK - Input data should be aligned" ); |
||
834 | #endif /* MBEDTLS_PADLOCK_C */ |
||
835 | |||
836 | #if defined(MBEDTLS_PLATFORM_C) |
||
837 | if( use_ret == -(MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED) ) |
||
838 | mbedtls_snprintf( buf, buflen, "PLATFORM - Hardware accelerator failed" ); |
||
839 | if( use_ret == -(MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED) ) |
||
840 | mbedtls_snprintf( buf, buflen, "PLATFORM - The requested feature is not supported by the platform" ); |
||
841 | #endif /* MBEDTLS_PLATFORM_C */ |
||
842 | |||
843 | #if defined(MBEDTLS_POLY1305_C) |
||
844 | if( use_ret == -(MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA) ) |
||
845 | mbedtls_snprintf( buf, buflen, "POLY1305 - Invalid input parameter(s)" ); |
||
846 | if( use_ret == -(MBEDTLS_ERR_POLY1305_FEATURE_UNAVAILABLE) ) |
||
847 | mbedtls_snprintf( buf, buflen, "POLY1305 - Feature not available. For example, s part of the API is not implemented" ); |
||
848 | if( use_ret == -(MBEDTLS_ERR_POLY1305_HW_ACCEL_FAILED) ) |
||
849 | mbedtls_snprintf( buf, buflen, "POLY1305 - Poly1305 hardware accelerator failed" ); |
||
850 | #endif /* MBEDTLS_POLY1305_C */ |
||
851 | |||
852 | #if defined(MBEDTLS_RIPEMD160_C) |
||
853 | if( use_ret == -(MBEDTLS_ERR_RIPEMD160_HW_ACCEL_FAILED) ) |
||
854 | mbedtls_snprintf( buf, buflen, "RIPEMD160 - RIPEMD160 hardware accelerator failed" ); |
||
855 | #endif /* MBEDTLS_RIPEMD160_C */ |
||
856 | |||
857 | #if defined(MBEDTLS_SHA1_C) |
||
858 | if( use_ret == -(MBEDTLS_ERR_SHA1_HW_ACCEL_FAILED) ) |
||
859 | mbedtls_snprintf( buf, buflen, "SHA1 - SHA-1 hardware accelerator failed" ); |
||
860 | if( use_ret == -(MBEDTLS_ERR_SHA1_BAD_INPUT_DATA) ) |
||
861 | mbedtls_snprintf( buf, buflen, "SHA1 - SHA-1 input data was malformed" ); |
||
862 | #endif /* MBEDTLS_SHA1_C */ |
||
863 | |||
864 | #if defined(MBEDTLS_SHA256_C) |
||
865 | if( use_ret == -(MBEDTLS_ERR_SHA256_HW_ACCEL_FAILED) ) |
||
866 | mbedtls_snprintf( buf, buflen, "SHA256 - SHA-256 hardware accelerator failed" ); |
||
867 | if( use_ret == -(MBEDTLS_ERR_SHA256_BAD_INPUT_DATA) ) |
||
868 | mbedtls_snprintf( buf, buflen, "SHA256 - SHA-256 input data was malformed" ); |
||
869 | #endif /* MBEDTLS_SHA256_C */ |
||
870 | |||
871 | #if defined(MBEDTLS_SHA512_C) |
||
872 | if( use_ret == -(MBEDTLS_ERR_SHA512_HW_ACCEL_FAILED) ) |
||
873 | mbedtls_snprintf( buf, buflen, "SHA512 - SHA-512 hardware accelerator failed" ); |
||
874 | if( use_ret == -(MBEDTLS_ERR_SHA512_BAD_INPUT_DATA) ) |
||
875 | mbedtls_snprintf( buf, buflen, "SHA512 - SHA-512 input data was malformed" ); |
||
876 | #endif /* MBEDTLS_SHA512_C */ |
||
877 | |||
878 | #if defined(MBEDTLS_THREADING_C) |
||
879 | if( use_ret == -(MBEDTLS_ERR_THREADING_FEATURE_UNAVAILABLE) ) |
||
880 | mbedtls_snprintf( buf, buflen, "THREADING - The selected feature is not available" ); |
||
881 | if( use_ret == -(MBEDTLS_ERR_THREADING_BAD_INPUT_DATA) ) |
||
882 | mbedtls_snprintf( buf, buflen, "THREADING - Bad input parameters to function" ); |
||
883 | if( use_ret == -(MBEDTLS_ERR_THREADING_MUTEX_ERROR) ) |
||
884 | mbedtls_snprintf( buf, buflen, "THREADING - Locking / unlocking / free failed with error code" ); |
||
885 | #endif /* MBEDTLS_THREADING_C */ |
||
886 | |||
887 | #if defined(MBEDTLS_XTEA_C) |
||
888 | if( use_ret == -(MBEDTLS_ERR_XTEA_INVALID_INPUT_LENGTH) ) |
||
889 | mbedtls_snprintf( buf, buflen, "XTEA - The data input has an invalid length" ); |
||
890 | if( use_ret == -(MBEDTLS_ERR_XTEA_HW_ACCEL_FAILED) ) |
||
891 | mbedtls_snprintf( buf, buflen, "XTEA - XTEA hardware accelerator failed" ); |
||
892 | #endif /* MBEDTLS_XTEA_C */ |
||
893 | // END generated code |
||
894 | |||
895 | if( strlen( buf ) != 0 ) |
||
896 | return; |
||
897 | |||
898 | mbedtls_snprintf( buf, buflen, "UNKNOWN ERROR CODE (%04X)", use_ret ); |
||
899 | } |
||
900 | |||
901 | #else /* MBEDTLS_ERROR_C */ |
||
902 | |||
903 | #if defined(MBEDTLS_ERROR_STRERROR_DUMMY) |
||
904 | |||
905 | /* |
||
906 | * Provide an non-function in case MBEDTLS_ERROR_C is not defined |
||
907 | */ |
||
908 | void mbedtls_strerror( int ret, char *buf, size_t buflen ) |
||
909 | { |
||
910 | ((void) ret); |
||
911 | |||
912 | if( buflen > 0 ) |
||
913 | buf[0] = '\0'; |
||
914 | } |
||
915 | |||
916 | #endif /* MBEDTLS_ERROR_STRERROR_DUMMY */ |
||
917 | |||
918 | #endif /* MBEDTLS_ERROR_C */>> |