1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-07-30 22:43:08 +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

@ -29,14 +29,9 @@
#if defined(PSA_CRYPTO_DRIVER_TEST)
#include <psa/crypto_driver_common.h>
#if defined(MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS)
#define PSA_CRYPTO_TEST_DRIVER_BUILTIN_AES_KEY_SLOT 0
#define PSA_CRYPTO_TEST_DRIVER_BUILTIN_ECDSA_KEY_SLOT 1
extern const uint8_t test_driver_aes_key[16];
extern const uint8_t test_driver_ecdsa_key[32];
#endif
typedef struct {
/* If non-null, on success, copy this to the output. */
void *forced_output;