mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2026-10-28 18:07:34 +08:00
Fix pkcs8 unencrypted private key parsing with Attributes field
Signed-off-by: Bhanu Prakash <35184675+BhanuPrakash-P@users.noreply.github.com> Signed-off-by: Bhanu Prakash Pathi <bpathi@crestron.com>
This commit is contained in:
parent
1ec69067fa
commit
4d7b40aacb
@ -1417,7 +1417,18 @@ static int pk_parse_key_pkcs8_unencrypted_der(
|
||||
#endif /* MBEDTLS_PK_HAVE_ECC_KEYS */
|
||||
return MBEDTLS_ERR_PK_UNKNOWN_PK_ALG;
|
||||
|
||||
end = p + len;
|
||||
p = p+len;
|
||||
if (p != end) {
|
||||
/*
|
||||
* Is 'attributes' present?
|
||||
*/
|
||||
if ((ret = mbedtls_asn1_get_tag(&p, end, &len,
|
||||
MBEDTLS_ASN1_CONTEXT_SPECIFIC | MBEDTLS_ASN1_CONSTRUCTED |
|
||||
0)) != 0) {
|
||||
return MBEDTLS_ERROR_ADD(MBEDTLS_ERR_PK_KEY_INVALID_FORMAT, ret);
|
||||
}
|
||||
}
|
||||
|
||||
if (end != (key + keylen)) {
|
||||
return MBEDTLS_ERROR_ADD(MBEDTLS_ERR_PK_KEY_INVALID_FORMAT,
|
||||
MBEDTLS_ERR_ASN1_LENGTH_MISMATCH);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user