From badd89f525ed1410477ad37b36d67bc11599f5be Mon Sep 17 00:00:00 2001 From: John Durkop Date: Fri, 9 Oct 2020 07:06:29 -0700 Subject: [PATCH] Added specific key size values for a test driver Replaced generic values for the test driver with specific ones for a 256-bit ECC private/public key pair. Signed-off-by: John Durkop --- tests/include/test/drivers/size.h | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tests/include/test/drivers/size.h b/tests/include/test/drivers/size.h index 4e5b5918e2..831adbbd7e 100644 --- a/tests/include/test/drivers/size.h +++ b/tests/include/test/drivers/size.h @@ -38,20 +38,26 @@ typedef struct { * This macro returns the base size for the key context. It should include * the size for any driver context information stored with each key. */ -#define TEST_DRIVER_KEY_CONTEXT_BASE_SIZE sizeof(test_driver_key_context_t) +#define TEST_DRIVER_KEY_CONTEXT_BASE_SIZE sizeof( test_driver_key_context_t ) /** \def TEST_DRIVER_KEY_CONTEXT_KEY_PAIR_SIZE * * Number of bytes included in every key context for a key pair. + * + * This pair size is for an ECC 256-bit private/public key pair. + * Based on this value, the size of the private key can be derived by + * subtracting the public key size below from this one. */ -#define TEST_DRIVER_KEY_CONTEXT_KEY_PAIR_SIZE 0 +#define TEST_DRIVER_KEY_CONTEXT_KEY_PAIR_SIZE 65 /** \def TEST_DRIVER_KEY_CONTEXT_PUBLIC_KEY_SIZE * * Number of bytes included in every key context for a public key. + * + * For ECC public keys, it needs 257 bits so 33 bytes. */ -#define TEST_DRIVER_KEY_CONTEXT_PUBLIC_KEY_SIZE 0 +#define TEST_DRIVER_KEY_CONTEXT_PUBLIC_KEY_SIZE 33 /** \def TEST_DRIVER_KEY_CONTEXT_SYMMETRIC_FACTOR * @@ -63,8 +69,10 @@ typedef struct { * * If this is true for a key pair, the key context includes space for the public key. * If this is false, no additional space is added for the public key. + * + * For this instance, store the public key with the private one. */ -#define TEST_DRIVER_KEY_CONTEXT_STORE_PUBLIC_KEY 0 +#define TEST_DRIVER_KEY_CONTEXT_STORE_PUBLIC_KEY 1 /** \def TEST_DRIVER_KEY_CONTEXT_SIZE_FUNCTION *