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
1 changed files with 2 additions and 1 deletions
|
@ -854,7 +854,8 @@ int mbedtls_pk_parse_subpubkey(unsigned char **p, const unsigned char *end,
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
/* On success all the input has been consumed by the parsing function. */
|
/* On success all the input has been consumed by the parsing function. */
|
||||||
*p += end - *p;
|
*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. */
|
/* In case of ASN1 error codes add MBEDTLS_ERR_PK_INVALID_PUBKEY. */
|
||||||
ret = MBEDTLS_ERROR_ADD(MBEDTLS_ERR_PK_INVALID_PUBKEY, ret);
|
ret = MBEDTLS_ERROR_ADD(MBEDTLS_ERR_PK_INVALID_PUBKEY, ret);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue