Also check the RSA length for public keys
Do for public keys what "Fix mbedtls_pk_get_bitlen() for RSA with non-byte-aligned sizes" did for key pairs. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
parent
59d09486dc
commit
069cec1737
1 changed files with 4 additions and 0 deletions
|
@ -100,6 +100,10 @@ void pk_parse_public_keyfile_rsa(char *key_file, int result)
|
|||
rsa = mbedtls_pk_rsa(ctx);
|
||||
TEST_EQUAL(mbedtls_rsa_check_pubkey(rsa), 0);
|
||||
|
||||
size_t bitlen = mbedtls_rsa_get_bitlen(rsa);
|
||||
TEST_EQUAL(mbedtls_pk_get_bitlen(&ctx), bitlen);
|
||||
TEST_EQUAL(mbedtls_pk_get_len(&ctx), (bitlen + 7) / 8);
|
||||
|
||||
#if defined(MBEDTLS_PSA_CRYPTO_C)
|
||||
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
|
||||
TEST_EQUAL(mbedtls_pk_get_psa_attributes(&ctx,
|
||||
|
|
Loading…
Reference in a new issue