Update LMS API to support multiple parameter sets
Parameterise macros to allow variation of sizes
Signed-off-by: Raef Coles <raef.coles@arm.com>
diff --git a/tests/suites/test_suite_lmots.function b/tests/suites/test_suite_lmots.function
index 73c9aff..ce69803 100644
--- a/tests/suites/test_suite_lmots.function
+++ b/tests/suites/test_suite_lmots.function
@@ -17,7 +17,7 @@
{
mbedtls_lmots_public_t pub_ctx;
mbedtls_lmots_private_t priv_ctx;
- unsigned char sig[MBEDTLS_LMOTS_SIG_LEN];
+ unsigned char sig[MBEDTLS_LMOTS_SIG_LEN(MBEDTLS_LMOTS_SHA256_N32_W8)];
mbedtls_entropy_context entropy_ctx;
mbedtls_ctr_drbg_context drbg_ctx;
uint8_t seed[16];
@@ -67,13 +67,14 @@
void lmots_import_export_test ( data_t * pub_key )
{
mbedtls_lmots_public_t ctx;
- uint8_t exported_pub_key[MBEDTLS_LMOTS_PUBLIC_KEY_LEN];
+ uint8_t exported_pub_key[MBEDTLS_LMOTS_PUBLIC_KEY_LEN(MBEDTLS_LMOTS_SHA256_N32_W8)];
mbedtls_lmots_init_public( &ctx );
TEST_ASSERT( mbedtls_lmots_import_public_key( &ctx, pub_key->x, pub_key->len ) == 0 );
TEST_ASSERT( mbedtls_lmots_export_public_key( &ctx, exported_pub_key, sizeof( exported_pub_key ), NULL ) == 0 );
- TEST_ASSERT( memcmp( pub_key->x, exported_pub_key, MBEDTLS_LMOTS_PUBLIC_KEY_LEN ) == 0 );
+ TEST_ASSERT( memcmp( pub_key->x, exported_pub_key,
+ MBEDTLS_LMOTS_PUBLIC_KEY_LEN(MBEDTLS_LMOTS_SHA256_N32_W8) ) == 0 );
exit:
mbedtls_lmots_free_public( &ctx );
@@ -84,7 +85,7 @@
void lmots_reuse_test ( data_t * msg )
{
mbedtls_lmots_private_t ctx;
- unsigned char sig[MBEDTLS_LMOTS_SIG_LEN];
+ unsigned char sig[MBEDTLS_LMOTS_SIG_LEN(MBEDTLS_LMOTS_SHA256_N32_W8)];
mbedtls_entropy_context entropy_ctx;
mbedtls_ctr_drbg_context drbg_ctx;
uint8_t seed[16];