From ed0e4591dc5bdf4f709efc8eb6301f8472d95ad0 Mon Sep 17 00:00:00 2001 From: Raef Coles Date: Thu, 13 Oct 2022 15:05:47 +0100 Subject: [PATCH] Add output length test for LMS export too-big test Signed-off-by: Raef Coles --- tests/suites/test_suite_lmots.function | 2 ++ tests/suites/test_suite_lms.function | 2 ++ 2 files changed, 4 insertions(+) diff --git a/tests/suites/test_suite_lmots.function b/tests/suites/test_suite_lmots.function index 13d1ee4cb..616c39fa9 100644 --- a/tests/suites/test_suite_lmots.function +++ b/tests/suites/test_suite_lmots.function @@ -184,6 +184,8 @@ void lmots_import_export_test ( data_t * pub_key, int expected_import_rc ) TEST_EQUAL( mbedtls_lmots_export_public_key( &ctx, exported_pub_key, exported_pub_key_buf_size, NULL ), 0 ); + TEST_EQUAL( exported_pub_key_buf_size, + MBEDTLS_LMOTS_PUBLIC_KEY_LEN(MBEDTLS_LMOTS_SHA256_N32_W8) ); ASSERT_COMPARE( pub_key->x, pub_key->len, exported_pub_key, exported_pub_key_size ); mbedtls_free(exported_pub_key); diff --git a/tests/suites/test_suite_lms.function b/tests/suites/test_suite_lms.function index 1e5ac42a6..baf74abc9 100644 --- a/tests/suites/test_suite_lms.function +++ b/tests/suites/test_suite_lms.function @@ -186,6 +186,8 @@ void lms_import_export_test ( data_t * pub_key, int expected_import_rc ) TEST_EQUAL( mbedtls_lms_export_public_key( &ctx, exported_pub_key, exported_pub_key_buf_size, NULL ), 0 ); + TEST_EQUAL( exported_pub_key_size, + MBEDTLS_LMS_PUBLIC_KEY_LEN(MBEDTLS_LMS_SHA256_M32_H10 ) ); ASSERT_COMPARE( pub_key->x, pub_key->len, exported_pub_key, exported_pub_key_size ); mbedtls_free(exported_pub_key);