Assigned error codes to the error defines
This commit is contained in:
parent
82e2945ed2
commit
0e06c0fdb4
5 changed files with 37 additions and 21 deletions
|
@ -149,6 +149,10 @@
|
|||
#include "polarssl/x509.h"
|
||||
#endif
|
||||
|
||||
#if defined(POLARSSL_X509_WRITE_C)
|
||||
#include "polarssl/x509write.h"
|
||||
#endif
|
||||
|
||||
#if defined(POLARSSL_XTEA_C)
|
||||
#include "polarssl/xtea.h"
|
||||
#endif
|
||||
|
@ -251,7 +255,7 @@ void polarssl_strerror( int ret, char *buf, size_t buflen )
|
|||
if( use_ret == -(POLARSSL_ERR_PK_MALLOC_FAILED) )
|
||||
snprintf( buf, buflen, "PK - Memory alloation failed" );
|
||||
if( use_ret == -(POLARSSL_ERR_PK_TYPE_MISMATCH) )
|
||||
snprintf( buf, buflen, "PK - Type mismatch, eg attempt to use a RSA key as EC, or to modify key type" );
|
||||
snprintf( buf, buflen, "PK - Type mismatch, eg attempt to encrypt with an ECDSA key" );
|
||||
if( use_ret == -(POLARSSL_ERR_PK_BAD_INPUT_DATA) )
|
||||
snprintf( buf, buflen, "PK - Bad input parameters to function" );
|
||||
#endif /* POLARSSL_PK_C */
|
||||
|
@ -432,6 +436,15 @@ void polarssl_strerror( int ret, char *buf, size_t buflen )
|
|||
snprintf( buf, buflen, "X509 - Elliptic curve is unsupported (only NIST curves are supported)" );
|
||||
#endif /* POLARSSL_X509_PARSE_C */
|
||||
|
||||
#if defined(POLARSSL_X509_WRITE_C)
|
||||
if( use_ret == -(POLARSSL_ERR_X509WRITE_UNKNOWN_OID) )
|
||||
snprintf( buf, buflen, "X509WRITE - Requested OID is unknown" );
|
||||
if( use_ret == -(POLARSSL_ERR_X509WRITE_BAD_INPUT_DATA) )
|
||||
snprintf( buf, buflen, "X509WRITE - Failed to allocate memory" );
|
||||
if( use_ret == -(POLARSSL_ERR_X509WRITE_MALLOC_FAILED) )
|
||||
snprintf( buf, buflen, "X509WRITE - Failed to allocate memory" );
|
||||
#endif /* POLARSSL_X509_WRITE_C */
|
||||
|
||||
if( strlen( buf ) == 0 )
|
||||
snprintf( buf, buflen, "UNKNOWN ERROR CODE (%04X)", use_ret );
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue