Improve PSA_RAW_KEY_AGREEMENT_OUTPUT_SIZE validation
We want to check: 1. actual output <= PSA_RAW_KEY_AGREEMENT_OUTPUT_SIZE (the output fits if the caller uses the key-specific buffer size macro) 2. actual output <= PSA_RAW_KEY_AGREEMENT_OUTPUT_MAX_SIZE (the output fits if the caller uses the generic buffer size macro) 3. PSA_RAW_KEY_AGREEMENT_OUTPUT_SIZE <= PSA_RAW_KEY_AGREEMENT_OUTPUT_MAX_SIZE (consistency in the calculation) We were only testing (1) and (2). Test (3) as well. (1) and (3) together imply (2) so there's no need to test (2). Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
parent
992bee8b6e
commit
d4a258a08f
1 changed files with 1 additions and 1 deletions
|
@ -7574,7 +7574,7 @@ void raw_key_agreement( int alg_arg,
|
|||
expected_output->x, expected_output->len );
|
||||
TEST_ASSERT( output_length <=
|
||||
PSA_RAW_KEY_AGREEMENT_OUTPUT_SIZE( our_key_type, key_bits ) );
|
||||
TEST_ASSERT( output_length <=
|
||||
TEST_ASSERT( PSA_RAW_KEY_AGREEMENT_OUTPUT_SIZE( our_key_type, key_bits ) <=
|
||||
PSA_RAW_KEY_AGREEMENT_OUTPUT_MAX_SIZE );
|
||||
mbedtls_free( output );
|
||||
output = NULL;
|
||||
|
|
Loading…
Reference in a new issue