1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-07-29 11:41:15 +03:00

Refactor opaque key handling in the test driver

Builtin key support for the test driver is always compiled in, and no
  longer guarded by MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS.
Parsing the key slot from the buffer by cast and assign instead of memcmp.
For exporting keys, the test driver no longer reaches into the key
  identifier in order to check whether a key is builtin, but rather
  assumes so based on the key buffer length. It's the driver's
  responsibility to be able to detect the key material it returned as part
  of the get_builtin_key operation.

Signed-off-by: Steven Cooreman <steven.cooreman@silabs.com>
This commit is contained in:
Steven Cooreman
2021-03-18 19:19:53 +01:00
parent e384252cb7
commit 1a0fbacde1
3 changed files with 86 additions and 131 deletions

View File

@ -594,14 +594,10 @@ psa_status_t psa_driver_wrapper_get_builtin_key(
{
#if defined(PSA_CRYPTO_DRIVER_TEST)
case PSA_CRYPTO_TEST_DRIVER_LIFETIME:
#if defined(MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS)
return( test_opaque_get_builtin_key(
slot_number,
attributes,
key_buffer, key_buffer_size, key_buffer_length ) );
#else
return( PSA_ERROR_DOES_NOT_EXIST );
#endif /* MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS */
#endif /* PSA_CRYPTO_DRIVER_TEST */
default:
(void) slot_number;