mirror of
https://github.com/yuzu-emu/mbedtls
synced 2024-11-24 12:28:40 +00:00
- Adapted error generation to include ASN.1 changes and have Windows snprintf macro
This commit is contained in:
parent
5e18aed436
commit
dceecd80f7
2 changed files with 18 additions and 14 deletions
|
@ -90,6 +90,10 @@
|
|||
|
||||
#include <string.h>
|
||||
|
||||
#if defined _MSC_VER && !defined snprintf
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
|
||||
void error_strerror( int ret, char *buf, size_t buflen )
|
||||
{
|
||||
size_t len;
|
||||
|
@ -325,6 +329,19 @@ void error_strerror( int ret, char *buf, size_t buflen )
|
|||
snprintf( buf, buflen, "AES - Invalid data input length" );
|
||||
#endif /* POLARSSL_AES_C */
|
||||
|
||||
#if defined(POLARSSL_ASN1_PARSE_C)
|
||||
if( use_ret == -(POLARSSL_ERR_ASN1_OUT_OF_DATA) )
|
||||
snprintf( buf, buflen, "ASN1 - Out of data when parsing an ASN1 data structure" );
|
||||
if( use_ret == -(POLARSSL_ERR_ASN1_UNEXPECTED_TAG) )
|
||||
snprintf( buf, buflen, "ASN1 - ASN1 tag was of an unexpected value" );
|
||||
if( use_ret == -(POLARSSL_ERR_ASN1_INVALID_LENGTH) )
|
||||
snprintf( buf, buflen, "ASN1 - Error when trying to determine the length or invalid length" );
|
||||
if( use_ret == -(POLARSSL_ERR_ASN1_LENGTH_MISMATCH) )
|
||||
snprintf( buf, buflen, "ASN1 - Actual length differs from expected length" );
|
||||
if( use_ret == -(POLARSSL_ERR_ASN1_INVALID_DATA) )
|
||||
snprintf( buf, buflen, "ASN1 - Data is invalid. (not used)" );
|
||||
#endif /* POLARSSL_ASN1_PARSE_C */
|
||||
|
||||
#if defined(POLARSSL_BASE64_C)
|
||||
if( use_ret == -(POLARSSL_ERR_BASE64_BUFFER_TOO_SMALL) )
|
||||
snprintf( buf, buflen, "BASE64 - Output buffer too small" );
|
||||
|
@ -391,19 +408,6 @@ void error_strerror( int ret, char *buf, size_t buflen )
|
|||
snprintf( buf, buflen, "PADLOCK - Input data should be aligned" );
|
||||
#endif /* POLARSSL_PADLOCK_C */
|
||||
|
||||
#if defined(POLARSSL_X509_PARSE_C)
|
||||
if( use_ret == -(POLARSSL_ERR_ASN1_OUT_OF_DATA) )
|
||||
snprintf( buf, buflen, "ASN1 - Out of data when parsing an ASN1 data structure" );
|
||||
if( use_ret == -(POLARSSL_ERR_ASN1_UNEXPECTED_TAG) )
|
||||
snprintf( buf, buflen, "ASN1 - ASN1 tag was of an unexpected value" );
|
||||
if( use_ret == -(POLARSSL_ERR_ASN1_INVALID_LENGTH) )
|
||||
snprintf( buf, buflen, "ASN1 - Error when trying to determine the length or invalid length" );
|
||||
if( use_ret == -(POLARSSL_ERR_ASN1_LENGTH_MISMATCH) )
|
||||
snprintf( buf, buflen, "ASN1 - Actual length differs from expected length" );
|
||||
if( use_ret == -(POLARSSL_ERR_ASN1_INVALID_DATA) )
|
||||
snprintf( buf, buflen, "ASN1 - Data is invalid. (not used)" );
|
||||
#endif /* POLARSSL_X509_PARSE_C */
|
||||
|
||||
#if defined(POLARSSL_XTEA_C)
|
||||
if( use_ret == -(POLARSSL_ERR_XTEA_INVALID_INPUT_LENGTH) )
|
||||
snprintf( buf, buflen, "XTEA - The data input has an invalid length" );
|
||||
|
|
|
@ -45,7 +45,7 @@ while (my $line = <GREP>)
|
|||
|
||||
my $define_name = $module_name;
|
||||
$define_name = "X509_PARSE" if ($define_name eq "X509");
|
||||
$define_name = "X509_PARSE" if ($define_name eq "ASN1");
|
||||
$define_name = "ASN1_PARSE" if ($define_name eq "ASN1");
|
||||
$define_name = "SSL_TLS" if ($define_name eq "SSL");
|
||||
|
||||
my $include_name = $module_name;
|
||||
|
|
Loading…
Reference in a new issue