mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-03-04 22:13:34 +00:00
Always call psa_crypto_init when testing mbedtls_pk_get_psa_attributes
mbedtls_pk_get_psa_attributes() actually works without having initialized the PSA subsystem, because it doesn't call any non-client PSA API functions. But the function is only useful in conjunction with the PSA API: it's meant to be followed by importing a key with the resulting attributes. We don't advertize it to work without an up-and-running PSA subsystem, and there's no need to test it without an up-and-running PSA subsystem as we were (accidentally) doing. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
parent
f8c2cd1489
commit
3da3c0a000
@ -1711,7 +1711,7 @@ void pk_get_psa_attributes(int pk_type, int from_pair,
|
||||
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
|
||||
psa_key_usage_t usage = usage_arg;
|
||||
|
||||
MD_OR_USE_PSA_INIT();
|
||||
PSA_INIT();
|
||||
|
||||
psa_key_type_t expected_psa_type = 0;
|
||||
if (!pk_setup_for_type(pk_type, from_pair, &pk, &expected_psa_type)) {
|
||||
@ -1772,7 +1772,7 @@ void pk_get_psa_attributes(int pk_type, int from_pair,
|
||||
exit:
|
||||
mbedtls_pk_free(&pk);
|
||||
psa_reset_key_attributes(&attributes);
|
||||
MD_OR_USE_PSA_DONE();
|
||||
PSA_DONE();
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
@ -1786,7 +1786,7 @@ void pk_rsa_v21_get_psa_attributes(int md_type, int from_pair,
|
||||
psa_key_usage_t usage = usage_arg;
|
||||
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
|
||||
|
||||
MD_OR_USE_PSA_INIT();
|
||||
PSA_INIT();
|
||||
|
||||
psa_key_type_t expected_psa_type = 0;
|
||||
if (!pk_setup_for_type(MBEDTLS_PK_RSA, from_pair, &pk, &expected_psa_type)) {
|
||||
@ -1833,7 +1833,7 @@ void pk_rsa_v21_get_psa_attributes(int md_type, int from_pair,
|
||||
exit:
|
||||
mbedtls_pk_free(&pk);
|
||||
psa_reset_key_attributes(&attributes);
|
||||
MD_OR_USE_PSA_DONE();
|
||||
PSA_DONE();
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
@ -1847,7 +1847,7 @@ void pk_get_psa_attributes_fail(int pk_type, int from_pair,
|
||||
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
|
||||
psa_key_usage_t usage = usage_arg;
|
||||
|
||||
MD_OR_USE_PSA_INIT();
|
||||
PSA_INIT();
|
||||
|
||||
psa_key_type_t expected_psa_type;
|
||||
if (!pk_setup_for_type(pk_type, from_pair, &pk, &expected_psa_type)) {
|
||||
@ -1860,7 +1860,7 @@ void pk_get_psa_attributes_fail(int pk_type, int from_pair,
|
||||
exit:
|
||||
mbedtls_pk_free(&pk);
|
||||
psa_reset_key_attributes(&attributes);
|
||||
MD_OR_USE_PSA_DONE();
|
||||
PSA_DONE();
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user