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
1 changed files with 10 additions and 7 deletions
|
@ -9685,23 +9685,26 @@ void generate_key_rsa(int bits_arg,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Test the key information */
|
/* 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));
|
PSA_ASSERT(psa_get_key_attributes(key, &attributes));
|
||||||
TEST_EQUAL(psa_get_key_type(&attributes), type);
|
TEST_EQUAL(psa_get_key_type(&attributes), type);
|
||||||
TEST_EQUAL(psa_get_key_bits(&attributes), bits);
|
TEST_EQUAL(psa_get_key_bits(&attributes), bits);
|
||||||
PSA_ASSERT(psa_get_key_domain_parameters(&attributes,
|
psa_status_t status = psa_get_key_domain_parameters(&attributes,
|
||||||
e_read_buffer, e_read_size,
|
e_read_buffer, e_read_size,
|
||||||
&e_read_length));
|
&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) {
|
if (is_default_public_exponent) {
|
||||||
TEST_EQUAL(e_read_length, 0);
|
TEST_EQUAL(e_read_length, 0);
|
||||||
} else {
|
} else {
|
||||||
|
TEST_EQUAL(status, PSA_SUCCESS);
|
||||||
TEST_MEMORY_COMPARE(e_read_buffer, e_read_length, e_arg->x, e_arg->len);
|
TEST_MEMORY_COMPARE(e_read_buffer, e_read_length, e_arg->x, e_arg->len);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
(void) e_read_length;
|
|
||||||
(void) is_default_public_exponent;
|
(void) is_default_public_exponent;
|
||||||
|
TEST_EQUAL(status, PSA_ERROR_NOT_SUPPORTED);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Do something with the key according to its type and permitted usage. */
|
/* Do something with the key according to its type and permitted usage. */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue