mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-28 00:21:48 +03:00
Merge branch 'development' into iotssl-1204
This commit is contained in:
131
library/error.c
131
library/error.c
@ -45,6 +45,10 @@
|
||||
#include "mbedtls/aes.h"
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_ARC4_C)
|
||||
#include "mbedtls/arc4.h"
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_BASE64_C)
|
||||
#include "mbedtls/base64.h"
|
||||
#endif
|
||||
@ -69,6 +73,10 @@
|
||||
#include "mbedtls/cipher.h"
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_CMAC_C)
|
||||
#include "mbedtls/cmac.h"
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_CTR_DRBG_C)
|
||||
#include "mbedtls/ctr_drbg.h"
|
||||
#endif
|
||||
@ -101,6 +109,18 @@
|
||||
#include "mbedtls/md.h"
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_MD2_C)
|
||||
#include "mbedtls/md2.h"
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_MD4_C)
|
||||
#include "mbedtls/md4.h"
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_MD5_C)
|
||||
#include "mbedtls/md5.h"
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_NET_C)
|
||||
#include "mbedtls/net_sockets.h"
|
||||
#endif
|
||||
@ -129,10 +149,26 @@
|
||||
#include "mbedtls/pkcs5.h"
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_RIPEMD160_C)
|
||||
#include "mbedtls/ripemd160.h"
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_RSA_C)
|
||||
#include "mbedtls/rsa.h"
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_SHA1_C)
|
||||
#include "mbedtls/sha1.h"
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_SHA256_C)
|
||||
#include "mbedtls/sha256.h"
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_SHA512_C)
|
||||
#include "mbedtls/sha512.h"
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_SSL_TLS_C)
|
||||
#include "mbedtls/ssl.h"
|
||||
#endif
|
||||
@ -174,7 +210,7 @@ void mbedtls_strerror( int ret, char *buf, size_t buflen )
|
||||
if( use_ret == -(MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE) )
|
||||
mbedtls_snprintf( buf, buflen, "CIPHER - The selected feature is not available" );
|
||||
if( use_ret == -(MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA) )
|
||||
mbedtls_snprintf( buf, buflen, "CIPHER - Bad input parameters to function" );
|
||||
mbedtls_snprintf( buf, buflen, "CIPHER - Bad input parameters" );
|
||||
if( use_ret == -(MBEDTLS_ERR_CIPHER_ALLOC_FAILED) )
|
||||
mbedtls_snprintf( buf, buflen, "CIPHER - Failed to allocate memory" );
|
||||
if( use_ret == -(MBEDTLS_ERR_CIPHER_INVALID_PADDING) )
|
||||
@ -184,12 +220,14 @@ void mbedtls_strerror( int ret, char *buf, size_t buflen )
|
||||
if( use_ret == -(MBEDTLS_ERR_CIPHER_AUTH_FAILED) )
|
||||
mbedtls_snprintf( buf, buflen, "CIPHER - Authentication failed (for AEAD modes)" );
|
||||
if( use_ret == -(MBEDTLS_ERR_CIPHER_INVALID_CONTEXT) )
|
||||
mbedtls_snprintf( buf, buflen, "CIPHER - The context is invalid, eg because it was free()ed" );
|
||||
mbedtls_snprintf( buf, buflen, "CIPHER - The context is invalid. For example, because it was freed" );
|
||||
if( use_ret == -(MBEDTLS_ERR_CIPHER_HW_ACCEL_FAILED) )
|
||||
mbedtls_snprintf( buf, buflen, "CIPHER - Cipher hardware accelerator failed" );
|
||||
#endif /* MBEDTLS_CIPHER_C */
|
||||
|
||||
#if defined(MBEDTLS_DHM_C)
|
||||
if( use_ret == -(MBEDTLS_ERR_DHM_BAD_INPUT_DATA) )
|
||||
mbedtls_snprintf( buf, buflen, "DHM - Bad input parameters to function" );
|
||||
mbedtls_snprintf( buf, buflen, "DHM - Bad input parameters" );
|
||||
if( use_ret == -(MBEDTLS_ERR_DHM_READ_PARAMS_FAILED) )
|
||||
mbedtls_snprintf( buf, buflen, "DHM - Reading of the DHM parameters failed" );
|
||||
if( use_ret == -(MBEDTLS_ERR_DHM_MAKE_PARAMS_FAILED) )
|
||||
@ -205,7 +243,11 @@ void mbedtls_strerror( int ret, char *buf, size_t buflen )
|
||||
if( use_ret == -(MBEDTLS_ERR_DHM_ALLOC_FAILED) )
|
||||
mbedtls_snprintf( buf, buflen, "DHM - Allocation of memory failed" );
|
||||
if( use_ret == -(MBEDTLS_ERR_DHM_FILE_IO_ERROR) )
|
||||
mbedtls_snprintf( buf, buflen, "DHM - Read/write of file failed" );
|
||||
mbedtls_snprintf( buf, buflen, "DHM - Read or write of file failed" );
|
||||
if( use_ret == -(MBEDTLS_ERR_DHM_HW_ACCEL_FAILED) )
|
||||
mbedtls_snprintf( buf, buflen, "DHM - DHM hardware accelerator failed" );
|
||||
if( use_ret == -(MBEDTLS_ERR_DHM_SET_GROUP_FAILED) )
|
||||
mbedtls_snprintf( buf, buflen, "DHM - Setting the modulus and generator failed" );
|
||||
#endif /* MBEDTLS_DHM_C */
|
||||
|
||||
#if defined(MBEDTLS_ECP_C)
|
||||
@ -225,6 +267,8 @@ void mbedtls_strerror( int ret, char *buf, size_t buflen )
|
||||
mbedtls_snprintf( buf, buflen, "ECP - Invalid private or public key" );
|
||||
if( use_ret == -(MBEDTLS_ERR_ECP_SIG_LEN_MISMATCH) )
|
||||
mbedtls_snprintf( buf, buflen, "ECP - Signature is valid but shorter than the user-supplied length" );
|
||||
if( use_ret == -(MBEDTLS_ERR_ECP_HW_ACCEL_FAILED) )
|
||||
mbedtls_snprintf( buf, buflen, "ECP - ECP hardware accelerator failed" );
|
||||
#endif /* MBEDTLS_ECP_C */
|
||||
|
||||
#if defined(MBEDTLS_MD_C)
|
||||
@ -236,6 +280,8 @@ void mbedtls_strerror( int ret, char *buf, size_t buflen )
|
||||
mbedtls_snprintf( buf, buflen, "MD - Failed to allocate memory" );
|
||||
if( use_ret == -(MBEDTLS_ERR_MD_FILE_IO_ERROR) )
|
||||
mbedtls_snprintf( buf, buflen, "MD - Opening or reading of file failed" );
|
||||
if( use_ret == -(MBEDTLS_ERR_MD_HW_ACCEL_FAILED) )
|
||||
mbedtls_snprintf( buf, buflen, "MD - MD hardware accelerator failed" );
|
||||
#endif /* MBEDTLS_MD_C */
|
||||
|
||||
#if defined(MBEDTLS_PEM_PARSE_C) || defined(MBEDTLS_PEM_WRITE_C)
|
||||
@ -288,6 +334,8 @@ void mbedtls_strerror( int ret, char *buf, size_t buflen )
|
||||
mbedtls_snprintf( buf, buflen, "PK - Unavailable feature, e.g. RSA disabled for RSA key" );
|
||||
if( use_ret == -(MBEDTLS_ERR_PK_SIG_LEN_MISMATCH) )
|
||||
mbedtls_snprintf( buf, buflen, "PK - The signature is valid but its length is less than expected" );
|
||||
if( use_ret == -(MBEDTLS_ERR_PK_HW_ACCEL_FAILED) )
|
||||
mbedtls_snprintf( buf, buflen, "PK - PK hardware accelerator failed" );
|
||||
#endif /* MBEDTLS_PK_C */
|
||||
|
||||
#if defined(MBEDTLS_PKCS12_C)
|
||||
@ -320,7 +368,7 @@ void mbedtls_strerror( int ret, char *buf, size_t buflen )
|
||||
if( use_ret == -(MBEDTLS_ERR_RSA_KEY_GEN_FAILED) )
|
||||
mbedtls_snprintf( buf, buflen, "RSA - Something failed during generation of a key" );
|
||||
if( use_ret == -(MBEDTLS_ERR_RSA_KEY_CHECK_FAILED) )
|
||||
mbedtls_snprintf( buf, buflen, "RSA - Key failed to pass the library's validity check" );
|
||||
mbedtls_snprintf( buf, buflen, "RSA - Key failed to pass the validity check of the library" );
|
||||
if( use_ret == -(MBEDTLS_ERR_RSA_PUBLIC_FAILED) )
|
||||
mbedtls_snprintf( buf, buflen, "RSA - The public key operation failed" );
|
||||
if( use_ret == -(MBEDTLS_ERR_RSA_PRIVATE_FAILED) )
|
||||
@ -331,6 +379,10 @@ void mbedtls_strerror( int ret, char *buf, size_t buflen )
|
||||
mbedtls_snprintf( buf, buflen, "RSA - The output buffer for decryption is not large enough" );
|
||||
if( use_ret == -(MBEDTLS_ERR_RSA_RNG_FAILED) )
|
||||
mbedtls_snprintf( buf, buflen, "RSA - The random generator failed to generate non-zeros" );
|
||||
if( use_ret == -(MBEDTLS_ERR_RSA_UNSUPPORTED_OPERATION) )
|
||||
mbedtls_snprintf( buf, buflen, "RSA - The implementation does not offer the requested operation, for example, because of security violations or lack of functionality" );
|
||||
if( use_ret == -(MBEDTLS_ERR_RSA_HW_ACCEL_FAILED) )
|
||||
mbedtls_snprintf( buf, buflen, "RSA - RSA hardware accelerator failed" );
|
||||
#endif /* MBEDTLS_RSA_C */
|
||||
|
||||
#if defined(MBEDTLS_SSL_TLS_C)
|
||||
@ -520,8 +572,17 @@ void mbedtls_strerror( int ret, char *buf, size_t buflen )
|
||||
mbedtls_snprintf( buf, buflen, "AES - Invalid key length" );
|
||||
if( use_ret == -(MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH) )
|
||||
mbedtls_snprintf( buf, buflen, "AES - Invalid data input length" );
|
||||
if( use_ret == -(MBEDTLS_ERR_AES_FEATURE_UNAVAILABLE) )
|
||||
mbedtls_snprintf( buf, buflen, "AES - Feature not available. For example, an unsupported AES key size" );
|
||||
if( use_ret == -(MBEDTLS_ERR_AES_HW_ACCEL_FAILED) )
|
||||
mbedtls_snprintf( buf, buflen, "AES - AES hardware accelerator failed" );
|
||||
#endif /* MBEDTLS_AES_C */
|
||||
|
||||
#if defined(MBEDTLS_ARC4_C)
|
||||
if( use_ret == -(MBEDTLS_ERR_ARC4_HW_ACCEL_FAILED) )
|
||||
mbedtls_snprintf( buf, buflen, "ARC4 - ARC4 hardware accelerator failed" );
|
||||
#endif /* MBEDTLS_ARC4_C */
|
||||
|
||||
#if defined(MBEDTLS_ASN1_PARSE_C)
|
||||
if( use_ret == -(MBEDTLS_ERR_ASN1_OUT_OF_DATA) )
|
||||
mbedtls_snprintf( buf, buflen, "ASN1 - Out of data when parsing an ASN1 data structure" );
|
||||
@ -568,6 +629,8 @@ void mbedtls_strerror( int ret, char *buf, size_t buflen )
|
||||
#if defined(MBEDTLS_BLOWFISH_C)
|
||||
if( use_ret == -(MBEDTLS_ERR_BLOWFISH_INVALID_KEY_LENGTH) )
|
||||
mbedtls_snprintf( buf, buflen, "BLOWFISH - Invalid key length" );
|
||||
if( use_ret == -(MBEDTLS_ERR_BLOWFISH_HW_ACCEL_FAILED) )
|
||||
mbedtls_snprintf( buf, buflen, "BLOWFISH - Blowfish hardware accelerator failed" );
|
||||
if( use_ret == -(MBEDTLS_ERR_BLOWFISH_INVALID_INPUT_LENGTH) )
|
||||
mbedtls_snprintf( buf, buflen, "BLOWFISH - Invalid data input length" );
|
||||
#endif /* MBEDTLS_BLOWFISH_C */
|
||||
@ -577,29 +640,40 @@ void mbedtls_strerror( int ret, char *buf, size_t buflen )
|
||||
mbedtls_snprintf( buf, buflen, "CAMELLIA - Invalid key length" );
|
||||
if( use_ret == -(MBEDTLS_ERR_CAMELLIA_INVALID_INPUT_LENGTH) )
|
||||
mbedtls_snprintf( buf, buflen, "CAMELLIA - Invalid data input length" );
|
||||
if( use_ret == -(MBEDTLS_ERR_CAMELLIA_HW_ACCEL_FAILED) )
|
||||
mbedtls_snprintf( buf, buflen, "CAMELLIA - Camellia hardware accelerator failed" );
|
||||
#endif /* MBEDTLS_CAMELLIA_C */
|
||||
|
||||
#if defined(MBEDTLS_CCM_C)
|
||||
if( use_ret == -(MBEDTLS_ERR_CCM_BAD_INPUT) )
|
||||
mbedtls_snprintf( buf, buflen, "CCM - Bad input parameters to function" );
|
||||
mbedtls_snprintf( buf, buflen, "CCM - Bad input parameters to the function" );
|
||||
if( use_ret == -(MBEDTLS_ERR_CCM_AUTH_FAILED) )
|
||||
mbedtls_snprintf( buf, buflen, "CCM - Authenticated decryption failed" );
|
||||
if( use_ret == -(MBEDTLS_ERR_CCM_HW_ACCEL_FAILED) )
|
||||
mbedtls_snprintf( buf, buflen, "CCM - CCM hardware accelerator failed" );
|
||||
#endif /* MBEDTLS_CCM_C */
|
||||
|
||||
#if defined(MBEDTLS_CMAC_C)
|
||||
if( use_ret == -(MBEDTLS_ERR_CMAC_HW_ACCEL_FAILED) )
|
||||
mbedtls_snprintf( buf, buflen, "CMAC - CMAC hardware accelerator failed" );
|
||||
#endif /* MBEDTLS_CMAC_C */
|
||||
|
||||
#if defined(MBEDTLS_CTR_DRBG_C)
|
||||
if( use_ret == -(MBEDTLS_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED) )
|
||||
mbedtls_snprintf( buf, buflen, "CTR_DRBG - The entropy source failed" );
|
||||
if( use_ret == -(MBEDTLS_ERR_CTR_DRBG_REQUEST_TOO_BIG) )
|
||||
mbedtls_snprintf( buf, buflen, "CTR_DRBG - Too many random requested in single call" );
|
||||
mbedtls_snprintf( buf, buflen, "CTR_DRBG - The requested random buffer length is too big" );
|
||||
if( use_ret == -(MBEDTLS_ERR_CTR_DRBG_INPUT_TOO_BIG) )
|
||||
mbedtls_snprintf( buf, buflen, "CTR_DRBG - Input too large (Entropy + additional)" );
|
||||
mbedtls_snprintf( buf, buflen, "CTR_DRBG - The input (entropy + additional data) is too large" );
|
||||
if( use_ret == -(MBEDTLS_ERR_CTR_DRBG_FILE_IO_ERROR) )
|
||||
mbedtls_snprintf( buf, buflen, "CTR_DRBG - Read/write error in file" );
|
||||
mbedtls_snprintf( buf, buflen, "CTR_DRBG - Read or write error in file" );
|
||||
#endif /* MBEDTLS_CTR_DRBG_C */
|
||||
|
||||
#if defined(MBEDTLS_DES_C)
|
||||
if( use_ret == -(MBEDTLS_ERR_DES_INVALID_INPUT_LENGTH) )
|
||||
mbedtls_snprintf( buf, buflen, "DES - The data input has an invalid length" );
|
||||
if( use_ret == -(MBEDTLS_ERR_DES_HW_ACCEL_FAILED) )
|
||||
mbedtls_snprintf( buf, buflen, "DES - DES hardware accelerator failed" );
|
||||
#endif /* MBEDTLS_DES_C */
|
||||
|
||||
#if defined(MBEDTLS_ENTROPY_C)
|
||||
@ -618,6 +692,8 @@ void mbedtls_strerror( int ret, char *buf, size_t buflen )
|
||||
#if defined(MBEDTLS_GCM_C)
|
||||
if( use_ret == -(MBEDTLS_ERR_GCM_AUTH_FAILED) )
|
||||
mbedtls_snprintf( buf, buflen, "GCM - Authenticated decryption failed" );
|
||||
if( use_ret == -(MBEDTLS_ERR_GCM_HW_ACCEL_FAILED) )
|
||||
mbedtls_snprintf( buf, buflen, "GCM - GCM hardware accelerator failed" );
|
||||
if( use_ret == -(MBEDTLS_ERR_GCM_BAD_INPUT) )
|
||||
mbedtls_snprintf( buf, buflen, "GCM - Bad input parameters to function" );
|
||||
#endif /* MBEDTLS_GCM_C */
|
||||
@ -633,6 +709,21 @@ void mbedtls_strerror( int ret, char *buf, size_t buflen )
|
||||
mbedtls_snprintf( buf, buflen, "HMAC_DRBG - The entropy source failed" );
|
||||
#endif /* MBEDTLS_HMAC_DRBG_C */
|
||||
|
||||
#if defined(MBEDTLS_MD2_C)
|
||||
if( use_ret == -(MBEDTLS_ERR_MD2_HW_ACCEL_FAILED) )
|
||||
mbedtls_snprintf( buf, buflen, "MD2 - MD2 hardware accelerator failed" );
|
||||
#endif /* MBEDTLS_MD2_C */
|
||||
|
||||
#if defined(MBEDTLS_MD4_C)
|
||||
if( use_ret == -(MBEDTLS_ERR_MD4_HW_ACCEL_FAILED) )
|
||||
mbedtls_snprintf( buf, buflen, "MD4 - MD4 hardware accelerator failed" );
|
||||
#endif /* MBEDTLS_MD4_C */
|
||||
|
||||
#if defined(MBEDTLS_MD5_C)
|
||||
if( use_ret == -(MBEDTLS_ERR_MD5_HW_ACCEL_FAILED) )
|
||||
mbedtls_snprintf( buf, buflen, "MD5 - MD5 hardware accelerator failed" );
|
||||
#endif /* MBEDTLS_MD5_C */
|
||||
|
||||
#if defined(MBEDTLS_NET_C)
|
||||
if( use_ret == -(MBEDTLS_ERR_NET_SOCKET_FAILED) )
|
||||
mbedtls_snprintf( buf, buflen, "NET - Failed to open a socket" );
|
||||
@ -674,6 +765,26 @@ void mbedtls_strerror( int ret, char *buf, size_t buflen )
|
||||
mbedtls_snprintf( buf, buflen, "PADLOCK - Input data should be aligned" );
|
||||
#endif /* MBEDTLS_PADLOCK_C */
|
||||
|
||||
#if defined(MBEDTLS_RIPEMD160_C)
|
||||
if( use_ret == -(MBEDTLS_ERR_RIPEMD160_HW_ACCEL_FAILED) )
|
||||
mbedtls_snprintf( buf, buflen, "RIPEMD160 - RIPEMD160 hardware accelerator failed" );
|
||||
#endif /* MBEDTLS_RIPEMD160_C */
|
||||
|
||||
#if defined(MBEDTLS_SHA1_C)
|
||||
if( use_ret == -(MBEDTLS_ERR_SHA1_HW_ACCEL_FAILED) )
|
||||
mbedtls_snprintf( buf, buflen, "SHA1 - SHA-1 hardware accelerator failed" );
|
||||
#endif /* MBEDTLS_SHA1_C */
|
||||
|
||||
#if defined(MBEDTLS_SHA256_C)
|
||||
if( use_ret == -(MBEDTLS_ERR_SHA256_HW_ACCEL_FAILED) )
|
||||
mbedtls_snprintf( buf, buflen, "SHA256 - SHA-256 hardware accelerator failed" );
|
||||
#endif /* MBEDTLS_SHA256_C */
|
||||
|
||||
#if defined(MBEDTLS_SHA512_C)
|
||||
if( use_ret == -(MBEDTLS_ERR_SHA512_HW_ACCEL_FAILED) )
|
||||
mbedtls_snprintf( buf, buflen, "SHA512 - SHA-512 hardware accelerator failed" );
|
||||
#endif /* MBEDTLS_SHA512_C */
|
||||
|
||||
#if defined(MBEDTLS_THREADING_C)
|
||||
if( use_ret == -(MBEDTLS_ERR_THREADING_FEATURE_UNAVAILABLE) )
|
||||
mbedtls_snprintf( buf, buflen, "THREADING - The selected feature is not available" );
|
||||
@ -686,6 +797,8 @@ void mbedtls_strerror( int ret, char *buf, size_t buflen )
|
||||
#if defined(MBEDTLS_XTEA_C)
|
||||
if( use_ret == -(MBEDTLS_ERR_XTEA_INVALID_INPUT_LENGTH) )
|
||||
mbedtls_snprintf( buf, buflen, "XTEA - The data input has an invalid length" );
|
||||
if( use_ret == -(MBEDTLS_ERR_XTEA_HW_ACCEL_FAILED) )
|
||||
mbedtls_snprintf( buf, buflen, "XTEA - XTEA hardware accelerator failed" );
|
||||
#endif /* MBEDTLS_XTEA_C */
|
||||
// END generated code
|
||||
|
||||
|
Reference in New Issue
Block a user