Add interruptible to psa_op_fail tests

Signed-off-by: Paul Elliott <paul.elliott@arm.com>
This commit is contained in:
Paul Elliott 2022-12-16 14:44:11 +00:00
parent 9100797cb3
commit 4cec2f60dc

View file

@ -221,6 +221,13 @@ void sign_fail(int key_type_arg, data_t *key_data,
uint8_t input[1] = { 'A' };
uint8_t output[PSA_SIGNATURE_MAX_SIZE] = { 0 };
size_t length = SIZE_MAX;
psa_sign_hash_interruptible_operation_t sign_operation =
psa_sign_hash_interruptible_operation_init();
psa_verify_hash_interruptible_operation_t verify_operation =
psa_verify_hash_interruptible_operation_init();
PSA_INIT();
@ -237,6 +244,15 @@ void sign_fail(int key_type_arg, data_t *key_data,
psa_sign_hash(key_id, alg,
input, sizeof(input),
output, sizeof(output), &length));
if (PSA_KEY_TYPE_IS_ECC(key_type)) {
TEST_STATUS(expected_status,
psa_sign_hash_start(&sign_operation, key_id, alg,
input, sizeof(input)));
PSA_ASSERT(psa_sign_hash_abort(&sign_operation));
}
if (!private_only) {
/* Determine a plausible signature size to avoid an INVALID_SIGNATURE
* error based on this. */
@ -253,6 +269,15 @@ void sign_fail(int key_type_arg, data_t *key_data,
psa_verify_hash(key_id, alg,
input, sizeof(input),
output, output_length));
if (PSA_KEY_TYPE_IS_ECC(key_type)) {
TEST_STATUS(expected_status,
psa_verify_hash_start(&verify_operation, key_id, alg,
input, sizeof(input),
output, output_length));
PSA_ASSERT(psa_verify_hash_abort(&verify_operation));
}
}
exit: