mirror of
https://github.com/espressif/mbedtls.git
synced 2025-06-25 01:30:16 +08:00
Update generated files
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
parent
1b6c09a62e
commit
ec03b0431d
@ -211,14 +211,14 @@ const char * mbedtls_high_level_strerr( int error_code )
|
|||||||
{
|
{
|
||||||
int high_level_error_code;
|
int high_level_error_code;
|
||||||
|
|
||||||
if( error_code < 0 )
|
if (error_code < 0) {
|
||||||
error_code = -error_code;
|
error_code = -error_code;
|
||||||
|
}
|
||||||
|
|
||||||
/* Extract the high-level part from the error code. */
|
/* Extract the high-level part from the error code. */
|
||||||
high_level_error_code = error_code & 0xFF80;
|
high_level_error_code = error_code & 0xFF80;
|
||||||
|
|
||||||
switch( high_level_error_code )
|
switch (high_level_error_code) {
|
||||||
{
|
|
||||||
/* Begin Auto-Generated Code. */
|
/* Begin Auto-Generated Code. */
|
||||||
#if defined(MBEDTLS_CIPHER_C)
|
#if defined(MBEDTLS_CIPHER_C)
|
||||||
case -(MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE):
|
case -(MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE):
|
||||||
@ -568,21 +568,21 @@ const char * mbedtls_high_level_strerr( int error_code )
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return( NULL );
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *mbedtls_low_level_strerr(int error_code)
|
const char *mbedtls_low_level_strerr(int error_code)
|
||||||
{
|
{
|
||||||
int low_level_error_code;
|
int low_level_error_code;
|
||||||
|
|
||||||
if( error_code < 0 )
|
if (error_code < 0) {
|
||||||
error_code = -error_code;
|
error_code = -error_code;
|
||||||
|
}
|
||||||
|
|
||||||
/* Extract the low-level part from the error code. */
|
/* Extract the low-level part from the error code. */
|
||||||
low_level_error_code = error_code & ~0xFF80;
|
low_level_error_code = error_code & ~0xFF80;
|
||||||
|
|
||||||
switch( low_level_error_code )
|
switch (low_level_error_code) {
|
||||||
{
|
|
||||||
/* Begin Auto-Generated Code. */
|
/* Begin Auto-Generated Code. */
|
||||||
#if defined(MBEDTLS_AES_C)
|
#if defined(MBEDTLS_AES_C)
|
||||||
case -(MBEDTLS_ERR_AES_INVALID_KEY_LENGTH):
|
case -(MBEDTLS_ERR_AES_INVALID_KEY_LENGTH):
|
||||||
@ -886,7 +886,7 @@ const char * mbedtls_low_level_strerr( int error_code )
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return( NULL );
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void mbedtls_strerror(int ret, char *buf, size_t buflen)
|
void mbedtls_strerror(int ret, char *buf, size_t buflen)
|
||||||
@ -896,48 +896,52 @@ void mbedtls_strerror( int ret, char *buf, size_t buflen )
|
|||||||
const char *high_level_error_description = NULL;
|
const char *high_level_error_description = NULL;
|
||||||
const char *low_level_error_description = NULL;
|
const char *low_level_error_description = NULL;
|
||||||
|
|
||||||
if( buflen == 0 )
|
if (buflen == 0) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
memset(buf, 0x00, buflen);
|
memset(buf, 0x00, buflen);
|
||||||
|
|
||||||
if( ret < 0 )
|
if (ret < 0) {
|
||||||
ret = -ret;
|
ret = -ret;
|
||||||
|
}
|
||||||
|
|
||||||
if( ret & 0xFF80 )
|
if (ret & 0xFF80) {
|
||||||
{
|
|
||||||
use_ret = ret & 0xFF80;
|
use_ret = ret & 0xFF80;
|
||||||
|
|
||||||
// Translate high level error code.
|
// Translate high level error code.
|
||||||
high_level_error_description = mbedtls_high_level_strerr(ret);
|
high_level_error_description = mbedtls_high_level_strerr(ret);
|
||||||
|
|
||||||
if( high_level_error_description == NULL )
|
if (high_level_error_description == NULL) {
|
||||||
mbedtls_snprintf(buf, buflen, "UNKNOWN ERROR CODE (%04X)", (unsigned int) use_ret);
|
mbedtls_snprintf(buf, buflen, "UNKNOWN ERROR CODE (%04X)", (unsigned int) use_ret);
|
||||||
else
|
} else {
|
||||||
mbedtls_snprintf(buf, buflen, "%s", high_level_error_description);
|
mbedtls_snprintf(buf, buflen, "%s", high_level_error_description);
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(MBEDTLS_SSL_TLS_C)
|
#if defined(MBEDTLS_SSL_TLS_C)
|
||||||
// Early return in case of a fatal error - do not try to translate low
|
// Early return in case of a fatal error - do not try to translate low
|
||||||
// level code.
|
// level code.
|
||||||
if(use_ret == -(MBEDTLS_ERR_SSL_FATAL_ALERT_MESSAGE))
|
if (use_ret == -(MBEDTLS_ERR_SSL_FATAL_ALERT_MESSAGE)) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
#endif /* MBEDTLS_SSL_TLS_C */
|
#endif /* MBEDTLS_SSL_TLS_C */
|
||||||
}
|
}
|
||||||
|
|
||||||
use_ret = ret & ~0xFF80;
|
use_ret = ret & ~0xFF80;
|
||||||
|
|
||||||
if( use_ret == 0 )
|
if (use_ret == 0) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// If high level code is present, make a concatenation between both
|
// If high level code is present, make a concatenation between both
|
||||||
// error strings.
|
// error strings.
|
||||||
//
|
//
|
||||||
len = strlen(buf);
|
len = strlen(buf);
|
||||||
|
|
||||||
if( len > 0 )
|
if (len > 0) {
|
||||||
{
|
if (buflen - len < 5) {
|
||||||
if( buflen - len < 5 )
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
mbedtls_snprintf(buf + len, buflen - len, " : ");
|
mbedtls_snprintf(buf + len, buflen - len, " : ");
|
||||||
|
|
||||||
@ -948,11 +952,12 @@ void mbedtls_strerror( int ret, char *buf, size_t buflen )
|
|||||||
// Translate low level error code.
|
// Translate low level error code.
|
||||||
low_level_error_description = mbedtls_low_level_strerr(ret);
|
low_level_error_description = mbedtls_low_level_strerr(ret);
|
||||||
|
|
||||||
if( low_level_error_description == NULL )
|
if (low_level_error_description == NULL) {
|
||||||
mbedtls_snprintf(buf, buflen, "UNKNOWN ERROR CODE (%04X)", (unsigned int) use_ret);
|
mbedtls_snprintf(buf, buflen, "UNKNOWN ERROR CODE (%04X)", (unsigned int) use_ret);
|
||||||
else
|
} else {
|
||||||
mbedtls_snprintf(buf, buflen, "%s", low_level_error_description);
|
mbedtls_snprintf(buf, buflen, "%s", low_level_error_description);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#else /* MBEDTLS_ERROR_C */
|
#else /* MBEDTLS_ERROR_C */
|
||||||
|
|
||||||
@ -963,9 +968,10 @@ void mbedtls_strerror( int ret, char *buf, size_t buflen )
|
|||||||
{
|
{
|
||||||
((void) ret);
|
((void) ret);
|
||||||
|
|
||||||
if( buflen > 0 )
|
if (buflen > 0) {
|
||||||
buf[0] = '\0';
|
buf[0] = '\0';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* MBEDTLS_ERROR_C */
|
#endif /* MBEDTLS_ERROR_C */
|
||||||
|
|
||||||
|
@ -854,19 +854,21 @@ int mbedtls_version_check_feature( const char *feature )
|
|||||||
{
|
{
|
||||||
const char * const *idx = features;
|
const char * const *idx = features;
|
||||||
|
|
||||||
if( *idx == NULL )
|
if (*idx == NULL) {
|
||||||
return( -2 );
|
return -2;
|
||||||
|
}
|
||||||
|
|
||||||
if( feature == NULL )
|
if (feature == NULL) {
|
||||||
return( -1 );
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
while( *idx != NULL )
|
while (*idx != NULL) {
|
||||||
{
|
if (!strcmp(*idx, feature)) {
|
||||||
if( !strcmp( *idx, feature ) )
|
return 0;
|
||||||
return( 0 );
|
}
|
||||||
idx++;
|
idx++;
|
||||||
}
|
}
|
||||||
return( -1 );
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* MBEDTLS_VERSION_C */
|
#endif /* MBEDTLS_VERSION_C */
|
||||||
|
@ -114,7 +114,8 @@
|
|||||||
|
|
||||||
#define STRINGIFY(macro) #macro
|
#define STRINGIFY(macro) #macro
|
||||||
#define OUTPUT_MACRO_NAME_VALUE(macro) mbedtls_printf( #macro "%s\n", \
|
#define OUTPUT_MACRO_NAME_VALUE(macro) mbedtls_printf( #macro "%s\n", \
|
||||||
( STRINGIFY(macro) "" )[0] != 0 ? "=" STRINGIFY(macro) : "" )
|
(STRINGIFY(macro) "")[0] != 0 ? "=" STRINGIFY( \
|
||||||
|
macro) : "")
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
/*
|
/*
|
||||||
@ -2876,7 +2877,7 @@ int query_config( const char *config )
|
|||||||
#endif /* MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED */
|
#endif /* MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED */
|
||||||
|
|
||||||
/* If the symbol is not found, return an error */
|
/* If the symbol is not found, return an error */
|
||||||
return( 1 );
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void list_config(void)
|
void list_config(void)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user