mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-04-15 23:42:41 +00:00
Adjuest checks in generate_key_rsa suite
Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
This commit is contained in:
parent
e9efbc2aa5
commit
d90fbf7769
@ -9685,23 +9685,26 @@ 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);
|
||||
PSA_ASSERT(psa_get_key_domain_parameters(&attributes,
|
||||
e_read_buffer, e_read_size,
|
||||
&e_read_length));
|
||||
psa_status_t status = psa_get_key_domain_parameters(&attributes,
|
||||
e_read_buffer, e_read_size,
|
||||
&e_read_length);
|
||||
|
||||
|
||||
#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)
|
||||
if (is_default_public_exponent) {
|
||||
TEST_EQUAL(e_read_length, 0);
|
||||
} else {
|
||||
TEST_EQUAL(status, PSA_SUCCESS);
|
||||
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;
|
||||
TEST_EQUAL(status, PSA_ERROR_NOT_SUPPORTED);
|
||||
#endif
|
||||
|
||||
/* Do something with the key according to its type and permitted usage. */
|
||||
|
Loading…
x
Reference in New Issue
Block a user