PolarSSL v1.3.9
Main Page
Modules
Data Structures
Files
File List
Globals
library
error.c
Go to the documentation of this file.
1
/*
2
* Error message information
3
*
4
* Copyright (C) 2006-2014, Brainspark B.V.
5
*
6
* This file is part of PolarSSL (http://www.polarssl.org)
7
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
8
*
9
* All rights reserved.
10
*
11
* This program is free software; you can redistribute it and/or modify
12
* it under the terms of the GNU General Public License as published by
13
* the Free Software Foundation; either version 2 of the License, or
14
* (at your option) any later version.
15
*
16
* This program is distributed in the hope that it will be useful,
17
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
* GNU General Public License for more details.
20
*
21
* You should have received a copy of the GNU General Public License along
22
* with this program; if not, write to the Free Software Foundation, Inc.,
23
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24
*/
25
26
#if !defined(POLARSSL_CONFIG_FILE)
27
#include "
polarssl/config.h
"
28
#else
29
#include POLARSSL_CONFIG_FILE
30
#endif
31
32
#if defined(POLARSSL_ERROR_C) || defined(POLARSSL_ERROR_STRERROR_DUMMY)
33
#include "
polarssl/error.h
"
34
#endif
35
36
#if defined(POLARSSL_ERROR_C)
37
38
#if defined(POLARSSL_AES_C)
39
#include "
polarssl/aes.h
"
40
#endif
41
42
#if defined(POLARSSL_BASE64_C)
43
#include "
polarssl/base64.h
"
44
#endif
45
46
#if defined(POLARSSL_BIGNUM_C)
47
#include "
polarssl/bignum.h
"
48
#endif
49
50
#if defined(POLARSSL_BLOWFISH_C)
51
#include "
polarssl/blowfish.h
"
52
#endif
53
54
#if defined(POLARSSL_CAMELLIA_C)
55
#include "
polarssl/camellia.h
"
56
#endif
57
58
#if defined(POLARSSL_CCM_C)
59
#include "
polarssl/ccm.h
"
60
#endif
61
62
#if defined(POLARSSL_CIPHER_C)
63
#include "
polarssl/cipher.h
"
64
#endif
65
66
#if defined(POLARSSL_CTR_DRBG_C)
67
#include "
polarssl/ctr_drbg.h
"
68
#endif
69
70
#if defined(POLARSSL_DES_C)
71
#include "
polarssl/des.h
"
72
#endif
73
74
#if defined(POLARSSL_DHM_C)
75
#include "
polarssl/dhm.h
"
76
#endif
77
78
#if defined(POLARSSL_ECP_C)
79
#include "
polarssl/ecp.h
"
80
#endif
81
82
#if defined(POLARSSL_ENTROPY_C)
83
#include "
polarssl/entropy.h
"
84
#endif
85
86
#if defined(POLARSSL_GCM_C)
87
#include "
polarssl/gcm.h
"
88
#endif
89
90
#if defined(POLARSSL_HMAC_DRBG_C)
91
#include "
polarssl/hmac_drbg.h
"
92
#endif
93
94
#if defined(POLARSSL_MD_C)
95
#include "
polarssl/md.h
"
96
#endif
97
98
#if defined(POLARSSL_MD2_C)
99
#include "
polarssl/md2.h
"
100
#endif
101
102
#if defined(POLARSSL_MD4_C)
103
#include "
polarssl/md4.h
"
104
#endif
105
106
#if defined(POLARSSL_MD5_C)
107
#include "
polarssl/md5.h
"
108
#endif
109
110
#if defined(POLARSSL_NET_C)
111
#include "
polarssl/net.h
"
112
#endif
113
114
#if defined(POLARSSL_OID_C)
115
#include "
polarssl/oid.h
"
116
#endif
117
118
#if defined(POLARSSL_PADLOCK_C)
119
#include "
polarssl/padlock.h
"
120
#endif
121
122
#if defined(POLARSSL_PBKDF2_C)
123
#include "
polarssl/pbkdf2.h
"
124
#endif
125
126
#if defined(POLARSSL_PEM_PARSE_C) || defined(POLARSSL_PEM_WRITE_C)
127
#include "
polarssl/pem.h
"
128
#endif
129
130
#if defined(POLARSSL_PK_C)
131
#include "
polarssl/pk.h
"
132
#endif
133
134
#if defined(POLARSSL_PKCS12_C)
135
#include "
polarssl/pkcs12.h
"
136
#endif
137
138
#if defined(POLARSSL_PKCS5_C)
139
#include "
polarssl/pkcs5.h
"
140
#endif
141
142
#if defined(POLARSSL_RIPEMD160_C)
143
#include "
polarssl/ripemd160.h
"
144
#endif
145
146
#if defined(POLARSSL_RSA_C)
147
#include "
polarssl/rsa.h
"
148
#endif
149
150
#if defined(POLARSSL_SHA1_C)
151
#include "
polarssl/sha1.h
"
152
#endif
153
154
#if defined(POLARSSL_SHA256_C)
155
#include "
polarssl/sha256.h
"
156
#endif
157
158
#if defined(POLARSSL_SHA512_C)
159
#include "
polarssl/sha512.h
"
160
#endif
161
162
#if defined(POLARSSL_SSL_TLS_C)
163
#include "
polarssl/ssl.h
"
164
#endif
165
166
#if defined(POLARSSL_THREADING_C)
167
#include "
polarssl/threading.h
"
168
#endif
169
170
#if defined(POLARSSL_X509_USE_C) || defined(POLARSSL_X509_CREATE_C)
171
#include "
polarssl/x509.h
"
172
#endif
173
174
#if defined(POLARSSL_XTEA_C)
175
#include "
polarssl/xtea.h
"
176
#endif
177
178
179
#include <string.h>
180
181
#if defined(_MSC_VER) && !defined snprintf && !defined(EFIX64) && \
182
!defined(EFI32)
183
#define snprintf _snprintf
184
#endif
185
186
void
polarssl_strerror
(
int
ret,
char
*buf,
size_t
buflen )
187
{
188
size_t
len;
189
int
use_ret;
190
191
if
( buflen == 0 )
192
return
;
193
194
memset( buf, 0x00, buflen );
195
/* Reduce buflen to make sure MSVC _snprintf() ends with \0 as well */
196
buflen -= 1;
197
198
if
( ret < 0 )
199
ret = -ret;
200
201
if
( ret & 0xFF80 )
202
{
203
use_ret = ret & 0xFF80;
204
205
// High level error codes
206
//
207
// BEGIN generated code
208
#if defined(POLARSSL_CIPHER_C)
209
if
( use_ret == -(
POLARSSL_ERR_CIPHER_FEATURE_UNAVAILABLE
) )
210
snprintf( buf, buflen,
"CIPHER - The selected feature is not available"
);
211
if
( use_ret == -(
POLARSSL_ERR_CIPHER_BAD_INPUT_DATA
) )
212
snprintf( buf, buflen,
"CIPHER - Bad input parameters to function"
);
213
if
( use_ret == -(
POLARSSL_ERR_CIPHER_ALLOC_FAILED
) )
214
snprintf( buf, buflen,
"CIPHER - Failed to allocate memory"
);
215
if
( use_ret == -(
POLARSSL_ERR_CIPHER_INVALID_PADDING
) )
216
snprintf( buf, buflen,
"CIPHER - Input data contains invalid padding and is rejected"
);
217
if
( use_ret == -(
POLARSSL_ERR_CIPHER_FULL_BLOCK_EXPECTED
) )
218
snprintf( buf, buflen,
"CIPHER - Decryption of block requires a full block"
);
219
if
( use_ret == -(
POLARSSL_ERR_CIPHER_AUTH_FAILED
) )
220
snprintf( buf, buflen,
"CIPHER - Authentication failed (for AEAD modes)"
);
221
#endif
/* POLARSSL_CIPHER_C */
222
223
#if defined(POLARSSL_DHM_C)
224
if
( use_ret == -(
POLARSSL_ERR_DHM_BAD_INPUT_DATA
) )
225
snprintf( buf, buflen,
"DHM - Bad input parameters to function"
);
226
if
( use_ret == -(
POLARSSL_ERR_DHM_READ_PARAMS_FAILED
) )
227
snprintf( buf, buflen,
"DHM - Reading of the DHM parameters failed"
);
228
if
( use_ret == -(
POLARSSL_ERR_DHM_MAKE_PARAMS_FAILED
) )
229
snprintf( buf, buflen,
"DHM - Making of the DHM parameters failed"
);
230
if
( use_ret == -(
POLARSSL_ERR_DHM_READ_PUBLIC_FAILED
) )
231
snprintf( buf, buflen,
"DHM - Reading of the public values failed"
);
232
if
( use_ret == -(
POLARSSL_ERR_DHM_MAKE_PUBLIC_FAILED
) )
233
snprintf( buf, buflen,
"DHM - Making of the public value failed"
);
234
if
( use_ret == -(
POLARSSL_ERR_DHM_CALC_SECRET_FAILED
) )
235
snprintf( buf, buflen,
"DHM - Calculation of the DHM secret failed"
);
236
if
( use_ret == -(
POLARSSL_ERR_DHM_INVALID_FORMAT
) )
237
snprintf( buf, buflen,
"DHM - The ASN.1 data is not formatted correctly"
);
238
if
( use_ret == -(
POLARSSL_ERR_DHM_MALLOC_FAILED
) )
239
snprintf( buf, buflen,
"DHM - Allocation of memory failed"
);
240
if
( use_ret == -(
POLARSSL_ERR_DHM_FILE_IO_ERROR
) )
241
snprintf( buf, buflen,
"DHM - Read/write of file failed"
);
242
#endif
/* POLARSSL_DHM_C */
243
244
#if defined(POLARSSL_ECP_C)
245
if
( use_ret == -(
POLARSSL_ERR_ECP_BAD_INPUT_DATA
) )
246
snprintf( buf, buflen,
"ECP - Bad input parameters to function"
);
247
if
( use_ret == -(
POLARSSL_ERR_ECP_BUFFER_TOO_SMALL
) )
248
snprintf( buf, buflen,
"ECP - The buffer is too small to write to"
);
249
if
( use_ret == -(
POLARSSL_ERR_ECP_FEATURE_UNAVAILABLE
) )
250
snprintf( buf, buflen,
"ECP - Requested curve not available"
);
251
if
( use_ret == -(
POLARSSL_ERR_ECP_VERIFY_FAILED
) )
252
snprintf( buf, buflen,
"ECP - The signature is not valid"
);
253
if
( use_ret == -(
POLARSSL_ERR_ECP_MALLOC_FAILED
) )
254
snprintf( buf, buflen,
"ECP - Memory allocation failed"
);
255
if
( use_ret == -(
POLARSSL_ERR_ECP_RANDOM_FAILED
) )
256
snprintf( buf, buflen,
"ECP - Generation of random value, such as (ephemeral) key, failed"
);
257
if
( use_ret == -(
POLARSSL_ERR_ECP_INVALID_KEY
) )
258
snprintf( buf, buflen,
"ECP - Invalid private or public key"
);
259
if
( use_ret == -(
POLARSSL_ERR_ECP_SIG_LEN_MISMATCH
) )
260
snprintf( buf, buflen,
"ECP - Signature is valid but shorter than the user-supplied length"
);
261
#endif
/* POLARSSL_ECP_C */
262
263
#if defined(POLARSSL_MD_C)
264
if
( use_ret == -(
POLARSSL_ERR_MD_FEATURE_UNAVAILABLE
) )
265
snprintf( buf, buflen,
"MD - The selected feature is not available"
);
266
if
( use_ret == -(
POLARSSL_ERR_MD_BAD_INPUT_DATA
) )
267
snprintf( buf, buflen,
"MD - Bad input parameters to function"
);
268
if
( use_ret == -(
POLARSSL_ERR_MD_ALLOC_FAILED
) )
269
snprintf( buf, buflen,
"MD - Failed to allocate memory"
);
270
if
( use_ret == -(
POLARSSL_ERR_MD_FILE_IO_ERROR
) )
271
snprintf( buf, buflen,
"MD - Opening or reading of file failed"
);
272
#endif
/* POLARSSL_MD_C */
273
274
#if defined(POLARSSL_PEM_PARSE_C) || defined(POLARSSL_PEM_WRITE_C)
275
if
( use_ret == -(
POLARSSL_ERR_PEM_NO_HEADER_FOOTER_PRESENT
) )
276
snprintf( buf, buflen,
"PEM - No PEM header or footer found"
);
277
if
( use_ret == -(
POLARSSL_ERR_PEM_INVALID_DATA
) )
278
snprintf( buf, buflen,
"PEM - PEM string is not as expected"
);
279
if
( use_ret == -(
POLARSSL_ERR_PEM_MALLOC_FAILED
) )
280
snprintf( buf, buflen,
"PEM - Failed to allocate memory"
);
281
if
( use_ret == -(
POLARSSL_ERR_PEM_INVALID_ENC_IV
) )
282
snprintf( buf, buflen,
"PEM - RSA IV is not in hex-format"
);
283
if
( use_ret == -(
POLARSSL_ERR_PEM_UNKNOWN_ENC_ALG
) )
284
snprintf( buf, buflen,
"PEM - Unsupported key encryption algorithm"
);
285
if
( use_ret == -(
POLARSSL_ERR_PEM_PASSWORD_REQUIRED
) )
286
snprintf( buf, buflen,
"PEM - Private key password can't be empty"
);
287
if
( use_ret == -(
POLARSSL_ERR_PEM_PASSWORD_MISMATCH
) )
288
snprintf( buf, buflen,
"PEM - Given private key password does not allow for correct decryption"
);
289
if
( use_ret == -(
POLARSSL_ERR_PEM_FEATURE_UNAVAILABLE
) )
290
snprintf( buf, buflen,
"PEM - Unavailable feature, e.g. hashing/encryption combination"
);
291
if
( use_ret == -(
POLARSSL_ERR_PEM_BAD_INPUT_DATA
) )
292
snprintf( buf, buflen,
"PEM - Bad input parameters to function"
);
293
#endif
/* POLARSSL_PEM_PARSE_C || POLARSSL_PEM_WRITE_C */
294
295
#if defined(POLARSSL_PK_C)
296
if
( use_ret == -(
POLARSSL_ERR_PK_MALLOC_FAILED
) )
297
snprintf( buf, buflen,
"PK - Memory alloation failed"
);
298
if
( use_ret == -(
POLARSSL_ERR_PK_TYPE_MISMATCH
) )
299
snprintf( buf, buflen,
"PK - Type mismatch, eg attempt to encrypt with an ECDSA key"
);
300
if
( use_ret == -(
POLARSSL_ERR_PK_BAD_INPUT_DATA
) )
301
snprintf( buf, buflen,
"PK - Bad input parameters to function"
);
302
if
( use_ret == -(
POLARSSL_ERR_PK_FILE_IO_ERROR
) )
303
snprintf( buf, buflen,
"PK - Read/write of file failed"
);
304
if
( use_ret == -(
POLARSSL_ERR_PK_KEY_INVALID_VERSION
) )
305
snprintf( buf, buflen,
"PK - Unsupported key version"
);
306
if
( use_ret == -(
POLARSSL_ERR_PK_KEY_INVALID_FORMAT
) )
307
snprintf( buf, buflen,
"PK - Invalid key tag or value"
);
308
if
( use_ret == -(
POLARSSL_ERR_PK_UNKNOWN_PK_ALG
) )
309
snprintf( buf, buflen,
"PK - Key algorithm is unsupported (only RSA and EC are supported)"
);
310
if
( use_ret == -(
POLARSSL_ERR_PK_PASSWORD_REQUIRED
) )
311
snprintf( buf, buflen,
"PK - Private key password can't be empty"
);
312
if
( use_ret == -(
POLARSSL_ERR_PK_PASSWORD_MISMATCH
) )
313
snprintf( buf, buflen,
"PK - Given private key password does not allow for correct decryption"
);
314
if
( use_ret == -(
POLARSSL_ERR_PK_INVALID_PUBKEY
) )
315
snprintf( buf, buflen,
"PK - The pubkey tag or value is invalid (only RSA and EC are supported)"
);
316
if
( use_ret == -(
POLARSSL_ERR_PK_INVALID_ALG
) )
317
snprintf( buf, buflen,
"PK - The algorithm tag or value is invalid"
);
318
if
( use_ret == -(
POLARSSL_ERR_PK_UNKNOWN_NAMED_CURVE
) )
319
snprintf( buf, buflen,
"PK - Elliptic curve is unsupported (only NIST curves are supported)"
);
320
if
( use_ret == -(
POLARSSL_ERR_PK_FEATURE_UNAVAILABLE
) )
321
snprintf( buf, buflen,
"PK - Unavailable feature, e.g. RSA disabled for RSA key"
);
322
if
( use_ret == -(
POLARSSL_ERR_PK_SIG_LEN_MISMATCH
) )
323
snprintf( buf, buflen,
"PK - The signature is valid but its length is less than expected"
);
324
#endif
/* POLARSSL_PK_C */
325
326
#if defined(POLARSSL_PKCS12_C)
327
if
( use_ret == -(
POLARSSL_ERR_PKCS12_BAD_INPUT_DATA
) )
328
snprintf( buf, buflen,
"PKCS12 - Bad input parameters to function"
);
329
if
( use_ret == -(
POLARSSL_ERR_PKCS12_FEATURE_UNAVAILABLE
) )
330
snprintf( buf, buflen,
"PKCS12 - Feature not available, e.g. unsupported encryption scheme"
);
331
if
( use_ret == -(
POLARSSL_ERR_PKCS12_PBE_INVALID_FORMAT
) )
332
snprintf( buf, buflen,
"PKCS12 - PBE ASN.1 data not as expected"
);
333
if
( use_ret == -(
POLARSSL_ERR_PKCS12_PASSWORD_MISMATCH
) )
334
snprintf( buf, buflen,
"PKCS12 - Given private key password does not allow for correct decryption"
);
335
#endif
/* POLARSSL_PKCS12_C */
336
337
#if defined(POLARSSL_PKCS5_C)
338
if
( use_ret == -(
POLARSSL_ERR_PKCS5_BAD_INPUT_DATA
) )
339
snprintf( buf, buflen,
"PKCS5 - Bad input parameters to function"
);
340
if
( use_ret == -(
POLARSSL_ERR_PKCS5_INVALID_FORMAT
) )
341
snprintf( buf, buflen,
"PKCS5 - Unexpected ASN.1 data"
);
342
if
( use_ret == -(
POLARSSL_ERR_PKCS5_FEATURE_UNAVAILABLE
) )
343
snprintf( buf, buflen,
"PKCS5 - Requested encryption or digest alg not available"
);
344
if
( use_ret == -(
POLARSSL_ERR_PKCS5_PASSWORD_MISMATCH
) )
345
snprintf( buf, buflen,
"PKCS5 - Given private key password does not allow for correct decryption"
);
346
#endif
/* POLARSSL_PKCS5_C */
347
348
#if defined(POLARSSL_RSA_C)
349
if
( use_ret == -(
POLARSSL_ERR_RSA_BAD_INPUT_DATA
) )
350
snprintf( buf, buflen,
"RSA - Bad input parameters to function"
);
351
if
( use_ret == -(
POLARSSL_ERR_RSA_INVALID_PADDING
) )
352
snprintf( buf, buflen,
"RSA - Input data contains invalid padding and is rejected"
);
353
if
( use_ret == -(
POLARSSL_ERR_RSA_KEY_GEN_FAILED
) )
354
snprintf( buf, buflen,
"RSA - Something failed during generation of a key"
);
355
if
( use_ret == -(
POLARSSL_ERR_RSA_KEY_CHECK_FAILED
) )
356
snprintf( buf, buflen,
"RSA - Key failed to pass the libraries validity check"
);
357
if
( use_ret == -(
POLARSSL_ERR_RSA_PUBLIC_FAILED
) )
358
snprintf( buf, buflen,
"RSA - The public key operation failed"
);
359
if
( use_ret == -(
POLARSSL_ERR_RSA_PRIVATE_FAILED
) )
360
snprintf( buf, buflen,
"RSA - The private key operation failed"
);
361
if
( use_ret == -(
POLARSSL_ERR_RSA_VERIFY_FAILED
) )
362
snprintf( buf, buflen,
"RSA - The PKCS#1 verification failed"
);
363
if
( use_ret == -(
POLARSSL_ERR_RSA_OUTPUT_TOO_LARGE
) )
364
snprintf( buf, buflen,
"RSA - The output buffer for decryption is not large enough"
);
365
if
( use_ret == -(
POLARSSL_ERR_RSA_RNG_FAILED
) )
366
snprintf( buf, buflen,
"RSA - The random generator failed to generate non-zeros"
);
367
#endif
/* POLARSSL_RSA_C */
368
369
#if defined(POLARSSL_SSL_TLS_C)
370
if
( use_ret == -(
POLARSSL_ERR_SSL_FEATURE_UNAVAILABLE
) )
371
snprintf( buf, buflen,
"SSL - The requested feature is not available"
);
372
if
( use_ret == -(
POLARSSL_ERR_SSL_BAD_INPUT_DATA
) )
373
snprintf( buf, buflen,
"SSL - Bad input parameters to function"
);
374
if
( use_ret == -(
POLARSSL_ERR_SSL_INVALID_MAC
) )
375
snprintf( buf, buflen,
"SSL - Verification of the message MAC failed"
);
376
if
( use_ret == -(
POLARSSL_ERR_SSL_INVALID_RECORD
) )
377
snprintf( buf, buflen,
"SSL - An invalid SSL record was received"
);
378
if
( use_ret == -(
POLARSSL_ERR_SSL_CONN_EOF
) )
379
snprintf( buf, buflen,
"SSL - The connection indicated an EOF"
);
380
if
( use_ret == -(
POLARSSL_ERR_SSL_UNKNOWN_CIPHER
) )
381
snprintf( buf, buflen,
"SSL - An unknown cipher was received"
);
382
if
( use_ret == -(
POLARSSL_ERR_SSL_NO_CIPHER_CHOSEN
) )
383
snprintf( buf, buflen,
"SSL - The server has no ciphersuites in common with the client"
);
384
if
( use_ret == -(
POLARSSL_ERR_SSL_NO_RNG
) )
385
snprintf( buf, buflen,
"SSL - No RNG was provided to the SSL module"
);
386
if
( use_ret == -(
POLARSSL_ERR_SSL_NO_CLIENT_CERTIFICATE
) )
387
snprintf( buf, buflen,
"SSL - No client certification received from the client, but required by the authentication mode"
);
388
if
( use_ret == -(
POLARSSL_ERR_SSL_CERTIFICATE_TOO_LARGE
) )
389
snprintf( buf, buflen,
"SSL - DESCRIPTION MISSING"
);
390
if
( use_ret == -(
POLARSSL_ERR_SSL_CERTIFICATE_REQUIRED
) )
391
snprintf( buf, buflen,
"SSL - The own certificate is not set, but needed by the server"
);
392
if
( use_ret == -(
POLARSSL_ERR_SSL_PRIVATE_KEY_REQUIRED
) )
393
snprintf( buf, buflen,
"SSL - The own private key or pre-shared key is not set, but needed"
);
394
if
( use_ret == -(
POLARSSL_ERR_SSL_CA_CHAIN_REQUIRED
) )
395
snprintf( buf, buflen,
"SSL - No CA Chain is set, but required to operate"
);
396
if
( use_ret == -(
POLARSSL_ERR_SSL_UNEXPECTED_MESSAGE
) )
397
snprintf( buf, buflen,
"SSL - An unexpected message was received from our peer"
);
398
if
( use_ret == -(
POLARSSL_ERR_SSL_FATAL_ALERT_MESSAGE
) )
399
{
400
snprintf( buf, buflen,
"SSL - A fatal alert message was received from our peer"
);
401
return
;
402
}
403
if
( use_ret == -(
POLARSSL_ERR_SSL_PEER_VERIFY_FAILED
) )
404
snprintf( buf, buflen,
"SSL - Verification of our peer failed"
);
405
if
( use_ret == -(
POLARSSL_ERR_SSL_PEER_CLOSE_NOTIFY
) )
406
snprintf( buf, buflen,
"SSL - The peer notified us that the connection is going to be closed"
);
407
if
( use_ret == -(
POLARSSL_ERR_SSL_BAD_HS_CLIENT_HELLO
) )
408
snprintf( buf, buflen,
"SSL - Processing of the ClientHello handshake message failed"
);
409
if
( use_ret == -(
POLARSSL_ERR_SSL_BAD_HS_SERVER_HELLO
) )
410
snprintf( buf, buflen,
"SSL - Processing of the ServerHello handshake message failed"
);
411
if
( use_ret == -(
POLARSSL_ERR_SSL_BAD_HS_CERTIFICATE
) )
412
snprintf( buf, buflen,
"SSL - Processing of the Certificate handshake message failed"
);
413
if
( use_ret == -(
POLARSSL_ERR_SSL_BAD_HS_CERTIFICATE_REQUEST
) )
414
snprintf( buf, buflen,
"SSL - Processing of the CertificateRequest handshake message failed"
);
415
if
( use_ret == -(
POLARSSL_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE
) )
416
snprintf( buf, buflen,
"SSL - Processing of the ServerKeyExchange handshake message failed"
);
417
if
( use_ret == -(
POLARSSL_ERR_SSL_BAD_HS_SERVER_HELLO_DONE
) )
418
snprintf( buf, buflen,
"SSL - Processing of the ServerHelloDone handshake message failed"
);
419
if
( use_ret == -(
POLARSSL_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE
) )
420
snprintf( buf, buflen,
"SSL - Processing of the ClientKeyExchange handshake message failed"
);
421
if
( use_ret == -(
POLARSSL_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE_RP
) )
422
snprintf( buf, buflen,
"SSL - Processing of the ClientKeyExchange handshake message failed in DHM / ECDH Read Public"
);
423
if
( use_ret == -(
POLARSSL_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE_CS
) )
424
snprintf( buf, buflen,
"SSL - Processing of the ClientKeyExchange handshake message failed in DHM / ECDH Calculate Secret"
);
425
if
( use_ret == -(
POLARSSL_ERR_SSL_BAD_HS_CERTIFICATE_VERIFY
) )
426
snprintf( buf, buflen,
"SSL - Processing of the CertificateVerify handshake message failed"
);
427
if
( use_ret == -(
POLARSSL_ERR_SSL_BAD_HS_CHANGE_CIPHER_SPEC
) )
428
snprintf( buf, buflen,
"SSL - Processing of the ChangeCipherSpec handshake message failed"
);
429
if
( use_ret == -(
POLARSSL_ERR_SSL_BAD_HS_FINISHED
) )
430
snprintf( buf, buflen,
"SSL - Processing of the Finished handshake message failed"
);
431
if
( use_ret == -(
POLARSSL_ERR_SSL_MALLOC_FAILED
) )
432
snprintf( buf, buflen,
"SSL - Memory allocation failed"
);
433
if
( use_ret == -(
POLARSSL_ERR_SSL_HW_ACCEL_FAILED
) )
434
snprintf( buf, buflen,
"SSL - Hardware acceleration function returned with error"
);
435
if
( use_ret == -(
POLARSSL_ERR_SSL_HW_ACCEL_FALLTHROUGH
) )
436
snprintf( buf, buflen,
"SSL - Hardware acceleration function skipped / left alone data"
);
437
if
( use_ret == -(
POLARSSL_ERR_SSL_COMPRESSION_FAILED
) )
438
snprintf( buf, buflen,
"SSL - Processing of the compression / decompression failed"
);
439
if
( use_ret == -(
POLARSSL_ERR_SSL_BAD_HS_PROTOCOL_VERSION
) )
440
snprintf( buf, buflen,
"SSL - Handshake protocol not within min/max boundaries"
);
441
if
( use_ret == -(
POLARSSL_ERR_SSL_BAD_HS_NEW_SESSION_TICKET
) )
442
snprintf( buf, buflen,
"SSL - Processing of the NewSessionTicket handshake message failed"
);
443
if
( use_ret == -(
POLARSSL_ERR_SSL_SESSION_TICKET_EXPIRED
) )
444
snprintf( buf, buflen,
"SSL - Session ticket has expired"
);
445
if
( use_ret == -(
POLARSSL_ERR_SSL_PK_TYPE_MISMATCH
) )
446
snprintf( buf, buflen,
"SSL - Public key type mismatch (eg, asked for RSA key exchange and presented EC key)"
);
447
if
( use_ret == -(
POLARSSL_ERR_SSL_UNKNOWN_IDENTITY
) )
448
snprintf( buf, buflen,
"SSL - Unknown identity received (eg, PSK identity)"
);
449
if
( use_ret == -(
POLARSSL_ERR_SSL_INTERNAL_ERROR
) )
450
snprintf( buf, buflen,
"SSL - Internal error (eg, unexpected failure in lower-level module)"
);
451
if
( use_ret == -(
POLARSSL_ERR_SSL_COUNTER_WRAPPING
) )
452
snprintf( buf, buflen,
"SSL - A counter would wrap (eg, too many messages exchanged)"
);
453
if
( use_ret == -(
POLARSSL_ERR_SSL_WAITING_SERVER_HELLO_RENEGO
) )
454
snprintf( buf, buflen,
"SSL - Unexpected message at ServerHello in renegotiation"
);
455
#endif
/* POLARSSL_SSL_TLS_C */
456
457
#if defined(POLARSSL_X509_USE_C) || defined(POLARSSL_X509_CREATE_C)
458
if
( use_ret == -(
POLARSSL_ERR_X509_FEATURE_UNAVAILABLE
) )
459
snprintf( buf, buflen,
"X509 - Unavailable feature, e.g. RSA hashing/encryption combination"
);
460
if
( use_ret == -(
POLARSSL_ERR_X509_UNKNOWN_OID
) )
461
snprintf( buf, buflen,
"X509 - Requested OID is unknown"
);
462
if
( use_ret == -(
POLARSSL_ERR_X509_INVALID_FORMAT
) )
463
snprintf( buf, buflen,
"X509 - The CRT/CRL/CSR format is invalid, e.g. different type expected"
);
464
if
( use_ret == -(
POLARSSL_ERR_X509_INVALID_VERSION
) )
465
snprintf( buf, buflen,
"X509 - The CRT/CRL/CSR version element is invalid"
);
466
if
( use_ret == -(
POLARSSL_ERR_X509_INVALID_SERIAL
) )
467
snprintf( buf, buflen,
"X509 - The serial tag or value is invalid"
);
468
if
( use_ret == -(
POLARSSL_ERR_X509_INVALID_ALG
) )
469
snprintf( buf, buflen,
"X509 - The algorithm tag or value is invalid"
);
470
if
( use_ret == -(
POLARSSL_ERR_X509_INVALID_NAME
) )
471
snprintf( buf, buflen,
"X509 - The name tag or value is invalid"
);
472
if
( use_ret == -(
POLARSSL_ERR_X509_INVALID_DATE
) )
473
snprintf( buf, buflen,
"X509 - The date tag or value is invalid"
);
474
if
( use_ret == -(
POLARSSL_ERR_X509_INVALID_SIGNATURE
) )
475
snprintf( buf, buflen,
"X509 - The signature tag or value invalid"
);
476
if
( use_ret == -(
POLARSSL_ERR_X509_INVALID_EXTENSIONS
) )
477
snprintf( buf, buflen,
"X509 - The extension tag or value is invalid"
);
478
if
( use_ret == -(
POLARSSL_ERR_X509_UNKNOWN_VERSION
) )
479
snprintf( buf, buflen,
"X509 - CRT/CRL/CSR has an unsupported version number"
);
480
if
( use_ret == -(
POLARSSL_ERR_X509_UNKNOWN_SIG_ALG
) )
481
snprintf( buf, buflen,
"X509 - Signature algorithm (oid) is unsupported"
);
482
if
( use_ret == -(
POLARSSL_ERR_X509_SIG_MISMATCH
) )
483
snprintf( buf, buflen,
"X509 - Signature algorithms do not match. (see \\c ::x509_crt sig_oid)"
);
484
if
( use_ret == -(
POLARSSL_ERR_X509_CERT_VERIFY_FAILED
) )
485
snprintf( buf, buflen,
"X509 - Certificate verification failed, e.g. CRL, CA or signature check failed"
);
486
if
( use_ret == -(
POLARSSL_ERR_X509_CERT_UNKNOWN_FORMAT
) )
487
snprintf( buf, buflen,
"X509 - Format not recognized as DER or PEM"
);
488
if
( use_ret == -(
POLARSSL_ERR_X509_BAD_INPUT_DATA
) )
489
snprintf( buf, buflen,
"X509 - Input invalid"
);
490
if
( use_ret == -(
POLARSSL_ERR_X509_MALLOC_FAILED
) )
491
snprintf( buf, buflen,
"X509 - Allocation of memory failed"
);
492
if
( use_ret == -(
POLARSSL_ERR_X509_FILE_IO_ERROR
) )
493
snprintf( buf, buflen,
"X509 - Read/write of file failed"
);
494
#endif
/* POLARSSL_X509_USE,X509_CREATE_C */
495
// END generated code
496
497
if
( strlen( buf ) == 0 )
498
snprintf( buf, buflen,
"UNKNOWN ERROR CODE (%04X)"
, use_ret );
499
}
500
501
use_ret = ret & ~0xFF80;
502
503
if
( use_ret == 0 )
504
return
;
505
506
// If high level code is present, make a concatenation between both
507
// error strings.
508
//
509
len = strlen( buf );
510
511
if
( len > 0 )
512
{
513
if
( buflen - len < 5 )
514
return
;
515
516
snprintf( buf + len, buflen - len,
" : "
);
517
518
buf += len + 3;
519
buflen -= len + 3;
520
}
521
522
// Low level error codes
523
//
524
// BEGIN generated code
525
#if defined(POLARSSL_AES_C)
526
if
( use_ret == -(
POLARSSL_ERR_AES_INVALID_KEY_LENGTH
) )
527
snprintf( buf, buflen,
"AES - Invalid key length"
);
528
if
( use_ret == -(
POLARSSL_ERR_AES_INVALID_INPUT_LENGTH
) )
529
snprintf( buf, buflen,
"AES - Invalid data input length"
);
530
#endif
/* POLARSSL_AES_C */
531
532
#if defined(POLARSSL_ASN1_PARSE_C)
533
if
( use_ret == -(
POLARSSL_ERR_ASN1_OUT_OF_DATA
) )
534
snprintf( buf, buflen,
"ASN1 - Out of data when parsing an ASN1 data structure"
);
535
if
( use_ret == -(
POLARSSL_ERR_ASN1_UNEXPECTED_TAG
) )
536
snprintf( buf, buflen,
"ASN1 - ASN1 tag was of an unexpected value"
);
537
if
( use_ret == -(
POLARSSL_ERR_ASN1_INVALID_LENGTH
) )
538
snprintf( buf, buflen,
"ASN1 - Error when trying to determine the length or invalid length"
);
539
if
( use_ret == -(
POLARSSL_ERR_ASN1_LENGTH_MISMATCH
) )
540
snprintf( buf, buflen,
"ASN1 - Actual length differs from expected length"
);
541
if
( use_ret == -(
POLARSSL_ERR_ASN1_INVALID_DATA
) )
542
snprintf( buf, buflen,
"ASN1 - Data is invalid. (not used)"
);
543
if
( use_ret == -(
POLARSSL_ERR_ASN1_MALLOC_FAILED
) )
544
snprintf( buf, buflen,
"ASN1 - Memory allocation failed"
);
545
if
( use_ret == -(
POLARSSL_ERR_ASN1_BUF_TOO_SMALL
) )
546
snprintf( buf, buflen,
"ASN1 - Buffer too small when writing ASN.1 data structure"
);
547
#endif
/* POLARSSL_ASN1_PARSE_C */
548
549
#if defined(POLARSSL_BASE64_C)
550
if
( use_ret == -(
POLARSSL_ERR_BASE64_BUFFER_TOO_SMALL
) )
551
snprintf( buf, buflen,
"BASE64 - Output buffer too small"
);
552
if
( use_ret == -(
POLARSSL_ERR_BASE64_INVALID_CHARACTER
) )
553
snprintf( buf, buflen,
"BASE64 - Invalid character in input"
);
554
#endif
/* POLARSSL_BASE64_C */
555
556
#if defined(POLARSSL_BIGNUM_C)
557
if
( use_ret == -(
POLARSSL_ERR_MPI_FILE_IO_ERROR
) )
558
snprintf( buf, buflen,
"BIGNUM - An error occurred while reading from or writing to a file"
);
559
if
( use_ret == -(
POLARSSL_ERR_MPI_BAD_INPUT_DATA
) )
560
snprintf( buf, buflen,
"BIGNUM - Bad input parameters to function"
);
561
if
( use_ret == -(
POLARSSL_ERR_MPI_INVALID_CHARACTER
) )
562
snprintf( buf, buflen,
"BIGNUM - There is an invalid character in the digit string"
);
563
if
( use_ret == -(
POLARSSL_ERR_MPI_BUFFER_TOO_SMALL
) )
564
snprintf( buf, buflen,
"BIGNUM - The buffer is too small to write to"
);
565
if
( use_ret == -(
POLARSSL_ERR_MPI_NEGATIVE_VALUE
) )
566
snprintf( buf, buflen,
"BIGNUM - The input arguments are negative or result in illegal output"
);
567
if
( use_ret == -(
POLARSSL_ERR_MPI_DIVISION_BY_ZERO
) )
568
snprintf( buf, buflen,
"BIGNUM - The input argument for division is zero, which is not allowed"
);
569
if
( use_ret == -(
POLARSSL_ERR_MPI_NOT_ACCEPTABLE
) )
570
snprintf( buf, buflen,
"BIGNUM - The input arguments are not acceptable"
);
571
if
( use_ret == -(
POLARSSL_ERR_MPI_MALLOC_FAILED
) )
572
snprintf( buf, buflen,
"BIGNUM - Memory allocation failed"
);
573
#endif
/* POLARSSL_BIGNUM_C */
574
575
#if defined(POLARSSL_BLOWFISH_C)
576
if
( use_ret == -(
POLARSSL_ERR_BLOWFISH_INVALID_KEY_LENGTH
) )
577
snprintf( buf, buflen,
"BLOWFISH - Invalid key length"
);
578
if
( use_ret == -(
POLARSSL_ERR_BLOWFISH_INVALID_INPUT_LENGTH
) )
579
snprintf( buf, buflen,
"BLOWFISH - Invalid data input length"
);
580
#endif
/* POLARSSL_BLOWFISH_C */
581
582
#if defined(POLARSSL_CAMELLIA_C)
583
if
( use_ret == -(
POLARSSL_ERR_CAMELLIA_INVALID_KEY_LENGTH
) )
584
snprintf( buf, buflen,
"CAMELLIA - Invalid key length"
);
585
if
( use_ret == -(
POLARSSL_ERR_CAMELLIA_INVALID_INPUT_LENGTH
) )
586
snprintf( buf, buflen,
"CAMELLIA - Invalid data input length"
);
587
#endif
/* POLARSSL_CAMELLIA_C */
588
589
#if defined(POLARSSL_CCM_C)
590
if
( use_ret == -(
POLARSSL_ERR_CCM_BAD_INPUT
) )
591
snprintf( buf, buflen,
"CCM - Bad input parameters to function"
);
592
if
( use_ret == -(
POLARSSL_ERR_CCM_AUTH_FAILED
) )
593
snprintf( buf, buflen,
"CCM - Authenticated decryption failed"
);
594
#endif
/* POLARSSL_CCM_C */
595
596
#if defined(POLARSSL_CTR_DRBG_C)
597
if
( use_ret == -(
POLARSSL_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED
) )
598
snprintf( buf, buflen,
"CTR_DRBG - The entropy source failed"
);
599
if
( use_ret == -(
POLARSSL_ERR_CTR_DRBG_REQUEST_TOO_BIG
) )
600
snprintf( buf, buflen,
"CTR_DRBG - Too many random requested in single call"
);
601
if
( use_ret == -(
POLARSSL_ERR_CTR_DRBG_INPUT_TOO_BIG
) )
602
snprintf( buf, buflen,
"CTR_DRBG - Input too large (Entropy + additional)"
);
603
if
( use_ret == -(
POLARSSL_ERR_CTR_DRBG_FILE_IO_ERROR
) )
604
snprintf( buf, buflen,
"CTR_DRBG - Read/write error in file"
);
605
#endif
/* POLARSSL_CTR_DRBG_C */
606
607
#if defined(POLARSSL_DES_C)
608
if
( use_ret == -(
POLARSSL_ERR_DES_INVALID_INPUT_LENGTH
) )
609
snprintf( buf, buflen,
"DES - The data input has an invalid length"
);
610
#endif
/* POLARSSL_DES_C */
611
612
#if defined(POLARSSL_ENTROPY_C)
613
if
( use_ret == -(
POLARSSL_ERR_ENTROPY_SOURCE_FAILED
) )
614
snprintf( buf, buflen,
"ENTROPY - Critical entropy source failure"
);
615
if
( use_ret == -(
POLARSSL_ERR_ENTROPY_MAX_SOURCES
) )
616
snprintf( buf, buflen,
"ENTROPY - No more sources can be added"
);
617
if
( use_ret == -(
POLARSSL_ERR_ENTROPY_NO_SOURCES_DEFINED
) )
618
snprintf( buf, buflen,
"ENTROPY - No sources have been added to poll"
);
619
if
( use_ret == -(
POLARSSL_ERR_ENTROPY_FILE_IO_ERROR
) )
620
snprintf( buf, buflen,
"ENTROPY - Read/write error in file"
);
621
#endif
/* POLARSSL_ENTROPY_C */
622
623
#if defined(POLARSSL_GCM_C)
624
if
( use_ret == -(
POLARSSL_ERR_GCM_AUTH_FAILED
) )
625
snprintf( buf, buflen,
"GCM - Authenticated decryption failed"
);
626
if
( use_ret == -(
POLARSSL_ERR_GCM_BAD_INPUT
) )
627
snprintf( buf, buflen,
"GCM - Bad input parameters to function"
);
628
#endif
/* POLARSSL_GCM_C */
629
630
#if defined(POLARSSL_HMAC_DRBG_C)
631
if
( use_ret == -(
POLARSSL_ERR_HMAC_DRBG_REQUEST_TOO_BIG
) )
632
snprintf( buf, buflen,
"HMAC_DRBG - Too many random requested in single call"
);
633
if
( use_ret == -(
POLARSSL_ERR_HMAC_DRBG_INPUT_TOO_BIG
) )
634
snprintf( buf, buflen,
"HMAC_DRBG - Input too large (Entropy + additional)"
);
635
if
( use_ret == -(
POLARSSL_ERR_HMAC_DRBG_FILE_IO_ERROR
) )
636
snprintf( buf, buflen,
"HMAC_DRBG - Read/write error in file"
);
637
if
( use_ret == -(
POLARSSL_ERR_HMAC_DRBG_ENTROPY_SOURCE_FAILED
) )
638
snprintf( buf, buflen,
"HMAC_DRBG - The entropy source failed"
);
639
#endif
/* POLARSSL_HMAC_DRBG_C */
640
641
#if defined(POLARSSL_MD2_C)
642
if
( use_ret == -(
POLARSSL_ERR_MD2_FILE_IO_ERROR
) )
643
snprintf( buf, buflen,
"MD2 - Read/write error in file"
);
644
#endif
/* POLARSSL_MD2_C */
645
646
#if defined(POLARSSL_MD4_C)
647
if
( use_ret == -(
POLARSSL_ERR_MD4_FILE_IO_ERROR
) )
648
snprintf( buf, buflen,
"MD4 - Read/write error in file"
);
649
#endif
/* POLARSSL_MD4_C */
650
651
#if defined(POLARSSL_MD5_C)
652
if
( use_ret == -(
POLARSSL_ERR_MD5_FILE_IO_ERROR
) )
653
snprintf( buf, buflen,
"MD5 - Read/write error in file"
);
654
#endif
/* POLARSSL_MD5_C */
655
656
#if defined(POLARSSL_NET_C)
657
if
( use_ret == -(
POLARSSL_ERR_NET_UNKNOWN_HOST
) )
658
snprintf( buf, buflen,
"NET - Failed to get an IP address for the given hostname"
);
659
if
( use_ret == -(
POLARSSL_ERR_NET_SOCKET_FAILED
) )
660
snprintf( buf, buflen,
"NET - Failed to open a socket"
);
661
if
( use_ret == -(
POLARSSL_ERR_NET_CONNECT_FAILED
) )
662
snprintf( buf, buflen,
"NET - The connection to the given server / port failed"
);
663
if
( use_ret == -(
POLARSSL_ERR_NET_BIND_FAILED
) )
664
snprintf( buf, buflen,
"NET - Binding of the socket failed"
);
665
if
( use_ret == -(
POLARSSL_ERR_NET_LISTEN_FAILED
) )
666
snprintf( buf, buflen,
"NET - Could not listen on the socket"
);
667
if
( use_ret == -(
POLARSSL_ERR_NET_ACCEPT_FAILED
) )
668
snprintf( buf, buflen,
"NET - Could not accept the incoming connection"
);
669
if
( use_ret == -(
POLARSSL_ERR_NET_RECV_FAILED
) )
670
snprintf( buf, buflen,
"NET - Reading information from the socket failed"
);
671
if
( use_ret == -(
POLARSSL_ERR_NET_SEND_FAILED
) )
672
snprintf( buf, buflen,
"NET - Sending information through the socket failed"
);
673
if
( use_ret == -(
POLARSSL_ERR_NET_CONN_RESET
) )
674
snprintf( buf, buflen,
"NET - Connection was reset by peer"
);
675
if
( use_ret == -(
POLARSSL_ERR_NET_WANT_READ
) )
676
snprintf( buf, buflen,
"NET - Connection requires a read call"
);
677
if
( use_ret == -(
POLARSSL_ERR_NET_WANT_WRITE
) )
678
snprintf( buf, buflen,
"NET - Connection requires a write call"
);
679
#endif
/* POLARSSL_NET_C */
680
681
#if defined(POLARSSL_OID_C)
682
if
( use_ret == -(
POLARSSL_ERR_OID_NOT_FOUND
) )
683
snprintf( buf, buflen,
"OID - OID is not found"
);
684
if
( use_ret == -(
POLARSSL_ERR_OID_BUF_TOO_SMALL
) )
685
snprintf( buf, buflen,
"OID - output buffer is too small"
);
686
#endif
/* POLARSSL_OID_C */
687
688
#if defined(POLARSSL_PADLOCK_C)
689
if
( use_ret == -(
POLARSSL_ERR_PADLOCK_DATA_MISALIGNED
) )
690
snprintf( buf, buflen,
"PADLOCK - Input data should be aligned"
);
691
#endif
/* POLARSSL_PADLOCK_C */
692
693
#if defined(POLARSSL_PBKDF2_C)
694
if
( use_ret == -(
POLARSSL_ERR_PBKDF2_BAD_INPUT_DATA
) )
695
snprintf( buf, buflen,
"PBKDF2 - Bad input parameters to function"
);
696
#endif
/* POLARSSL_PBKDF2_C */
697
698
#if defined(POLARSSL_RIPEMD160_C)
699
if
( use_ret == -(
POLARSSL_ERR_RIPEMD160_FILE_IO_ERROR
) )
700
snprintf( buf, buflen,
"RIPEMD160 - Read/write error in file"
);
701
#endif
/* POLARSSL_RIPEMD160_C */
702
703
#if defined(POLARSSL_SHA1_C)
704
if
( use_ret == -(
POLARSSL_ERR_SHA1_FILE_IO_ERROR
) )
705
snprintf( buf, buflen,
"SHA1 - Read/write error in file"
);
706
#endif
/* POLARSSL_SHA1_C */
707
708
#if defined(POLARSSL_SHA256_C)
709
if
( use_ret == -(
POLARSSL_ERR_SHA256_FILE_IO_ERROR
) )
710
snprintf( buf, buflen,
"SHA256 - Read/write error in file"
);
711
#endif
/* POLARSSL_SHA256_C */
712
713
#if defined(POLARSSL_SHA512_C)
714
if
( use_ret == -(
POLARSSL_ERR_SHA512_FILE_IO_ERROR
) )
715
snprintf( buf, buflen,
"SHA512 - Read/write error in file"
);
716
#endif
/* POLARSSL_SHA512_C */
717
718
#if defined(POLARSSL_THREADING_C)
719
if
( use_ret == -(
POLARSSL_ERR_THREADING_FEATURE_UNAVAILABLE
) )
720
snprintf( buf, buflen,
"THREADING - The selected feature is not available"
);
721
if
( use_ret == -(
POLARSSL_ERR_THREADING_BAD_INPUT_DATA
) )
722
snprintf( buf, buflen,
"THREADING - Bad input parameters to function"
);
723
if
( use_ret == -(
POLARSSL_ERR_THREADING_MUTEX_ERROR
) )
724
snprintf( buf, buflen,
"THREADING - Locking / unlocking / free failed with error code"
);
725
#endif
/* POLARSSL_THREADING_C */
726
727
#if defined(POLARSSL_XTEA_C)
728
if
( use_ret == -(
POLARSSL_ERR_XTEA_INVALID_INPUT_LENGTH
) )
729
snprintf( buf, buflen,
"XTEA - The data input has an invalid length"
);
730
#endif
/* POLARSSL_XTEA_C */
731
// END generated code
732
733
if
( strlen( buf ) != 0 )
734
return
;
735
736
snprintf( buf, buflen,
"UNKNOWN ERROR CODE (%04X)"
, use_ret );
737
}
738
739
#if defined(POLARSSL_ERROR_STRERROR_BC)
740
void
error_strerror(
int
ret,
char
*buf,
size_t
buflen )
741
{
742
polarssl_strerror
( ret, buf, buflen );
743
}
744
#endif
/* POLARSSL_ERROR_STRERROR_BC */
745
746
#else
/* POLARSSL_ERROR_C */
747
748
#if defined(POLARSSL_ERROR_STRERROR_DUMMY)
749
750
#include <string.h>
751
752
/*
753
* Provide an non-function in case POLARSSL_ERROR_C is not defined
754
*/
755
void
polarssl_strerror
(
int
ret,
char
*buf,
size_t
buflen )
756
{
757
((void) ret);
758
759
if
( buflen > 0 )
760
buf[0] =
'\0'
;
761
}
762
763
#if defined(POLARSSL_ERROR_STRERROR_BC)
764
void
error_strerror(
int
ret,
char
*buf,
size_t
buflen )
765
{
766
polarssl_strerror
( ret, buf, buflen );
767
}
768
#endif
/* POLARSSL_ERROR_STRERROR_BC */
769
#endif
/* POLARSSL_ERROR_STRERROR_DUMMY */
770
771
#endif
/* POLARSSL_ERROR_C */
Generated on Fri Nov 14 2014 20:22:35 for PolarSSL v1.3.9 by
1.8.3