mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-02-20 21:39:54 +00:00
Add testing valid attributes after aborting an invalid input in iop key generation
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
This commit is contained in:
parent
b16edbef72
commit
005b78c307
@ -10146,9 +10146,21 @@ void generate_key(int type_arg,
|
||||
|
||||
PSA_ASSERT(psa_generate_key_iop_abort(&operation));
|
||||
|
||||
#if defined(MBEDTLS_ECP_RESTARTABLE)
|
||||
/* In case the expected status is a failure test a valid input will succeed after abort */
|
||||
if (expected_status != PSA_SUCCESS) {
|
||||
memset(&attributes, 0, sizeof(attributes));
|
||||
psa_set_key_type(&attributes, PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_FAMILY_SECP_R1));
|
||||
psa_set_key_bits(&attributes, 256);
|
||||
psa_set_key_usage_flags(&attributes,
|
||||
PSA_KEY_USAGE_EXPORT | PSA_KEY_USAGE_SIGN_HASH |
|
||||
PSA_KEY_USAGE_VERIFY_HASH);
|
||||
psa_set_key_algorithm(&attributes, PSA_ALG_ECDSA_ANY);
|
||||
}
|
||||
/* Test that after calling abort operation is reset to it's fresh state */
|
||||
status = psa_generate_key_iop_setup(&operation, &attributes);
|
||||
TEST_EQUAL(status, expected_status);
|
||||
TEST_EQUAL(status, PSA_SUCCESS);
|
||||
#endif
|
||||
|
||||
exit:
|
||||
psa_generate_key_iop_abort(&operation);
|
||||
|
Loading…
x
Reference in New Issue
Block a user