pem_read_buffer() already update use_len after header and footer are read
After header and footer are read, pem_read_buffer() is able to determine
the length of input data used. This allows calling functions to skip
this PEM bit if an error occurs during its parsing.
(cherry picked from commit 9255e8300e
)
This commit is contained in:
parent
b2a1140469
commit
00b2860e8d
5 changed files with 31 additions and 22 deletions
library
|
@ -213,8 +213,8 @@ void error_strerror( int ret, char *buf, size_t buflen )
|
|||
#endif /* POLARSSL_MD_C */
|
||||
|
||||
#if defined(POLARSSL_PEM_C)
|
||||
if( use_ret == -(POLARSSL_ERR_PEM_NO_HEADER_PRESENT) )
|
||||
snprintf( buf, buflen, "PEM - No PEM header found" );
|
||||
if( use_ret == -(POLARSSL_ERR_PEM_NO_HEADER_FOOTER_PRESENT) )
|
||||
snprintf( buf, buflen, "PEM - No PEM header or footer found" );
|
||||
if( use_ret == -(POLARSSL_ERR_PEM_INVALID_DATA) )
|
||||
snprintf( buf, buflen, "PEM - PEM string is not as expected" );
|
||||
if( use_ret == -(POLARSSL_ERR_PEM_MALLOC_FAILED) )
|
||||
|
@ -229,6 +229,8 @@ void error_strerror( int ret, char *buf, size_t buflen )
|
|||
snprintf( buf, buflen, "PEM - Given private key password does not allow for correct decryption" );
|
||||
if( use_ret == -(POLARSSL_ERR_PEM_FEATURE_UNAVAILABLE) )
|
||||
snprintf( buf, buflen, "PEM - Unavailable feature, e.g. hashing/encryption combination" );
|
||||
if( use_ret == -(POLARSSL_ERR_PEM_BAD_INPUT_DATA) )
|
||||
snprintf( buf, buflen, "PEM - Bad input parameters to function" );
|
||||
#endif /* POLARSSL_PEM_C */
|
||||
|
||||
#if defined(POLARSSL_RSA_C)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue