mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-03-24 01:43:33 +00:00
pkparse: fix check for ASN1 errors in mbedtls_pk_parse_subpubkey()
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
This commit is contained in:
parent
fc590dd361
commit
5a19892528
@ -854,7 +854,8 @@ int mbedtls_pk_parse_subpubkey(unsigned char **p, const unsigned char *end,
|
||||
if (ret == 0) {
|
||||
/* On success all the input has been consumed by the parsing function. */
|
||||
*p += end - *p;
|
||||
} else if (ret & 0x7f) {
|
||||
} else if ((ret <= MBEDTLS_ERR_ASN1_OUT_OF_DATA) &&
|
||||
(ret >= MBEDTLS_ERR_ASN1_BUF_TOO_SMALL)) {
|
||||
/* In case of ASN1 error codes add MBEDTLS_ERR_PK_INVALID_PUBKEY. */
|
||||
ret = MBEDTLS_ERROR_ADD(MBEDTLS_ERR_PK_INVALID_PUBKEY, ret);
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user