Conditionally check the attribute of generated RSA key
`psa_get_key_attributes` depends on some built-in implementation of RSA. Guard the check with coresponding macros. Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
This commit is contained in:
parent
f1cacad870
commit
9e976f3649
2 changed files with 8 additions and 1 deletions
|
@ -7342,7 +7342,7 @@ PSA generate key: RSA, e=1
|
|||
generate_key_rsa:PSA_VENDOR_RSA_GENERATE_MIN_KEY_BITS:"01":PSA_ERROR_INVALID_ARGUMENT
|
||||
|
||||
PSA generate key: RSA, e=2
|
||||
generate_key_rsa:PSA_VENDOR_RSA_GENERATE_MIN_KEY_BITS:"01":PSA_ERROR_INVALID_ARGUMENT
|
||||
generate_key_rsa:PSA_VENDOR_RSA_GENERATE_MIN_KEY_BITS:"02":PSA_ERROR_INVALID_ARGUMENT
|
||||
|
||||
PSA generate key: FFDH, 2048 bits, good
|
||||
depends_on:PSA_WANT_ALG_FFDH:PSA_WANT_KEY_TYPE_DH_KEY_PAIR_GENERATE
|
||||
|
|
|
@ -9685,6 +9685,9 @@ void generate_key_rsa(int bits_arg,
|
|||
}
|
||||
|
||||
/* Test the key information */
|
||||
#if (defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR_IMPORT) && \
|
||||
defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR_EXPORT)) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_PUBLIC_KEY)
|
||||
PSA_ASSERT(psa_get_key_attributes(key, &attributes));
|
||||
TEST_EQUAL(psa_get_key_type(&attributes), type);
|
||||
TEST_EQUAL(psa_get_key_bits(&attributes), bits);
|
||||
|
@ -9696,6 +9699,10 @@ void generate_key_rsa(int bits_arg,
|
|||
} else {
|
||||
TEST_MEMORY_COMPARE(e_read_buffer, e_read_length, e_arg->x, e_arg->len);
|
||||
}
|
||||
#else
|
||||
(void) e_read_length;
|
||||
(void) is_default_public_exponent;
|
||||
#endif
|
||||
|
||||
/* Do something with the key according to its type and permitted usage. */
|
||||
if (!mbedtls_test_psa_exercise_key(key, usage, alg)) {
|
||||
|
|
Loading…
Reference in a new issue