And export buffer too large test to LMS and LMOTS

Signed-off-by: Raef Coles <raef.coles@arm.com>
This commit is contained in:
Raef Coles 2022-10-13 09:41:39 +01:00
parent 534f66f3f0
commit 6b2c573b3d
No known key found for this signature in database
GPG Key ID: 1AAF1B43DF2086F4
2 changed files with 18 additions and 0 deletions

View File

@ -178,6 +178,15 @@ void lmots_import_export_test ( data_t * pub_key, int expected_import_rc )
MBEDTLS_ERR_LMS_BUFFER_TOO_SMALL );
mbedtls_free(exported_pub_key);
exported_pub_key = NULL;
/* Export into too-large buffer should succeed */
exported_pub_key_buf_size = MBEDTLS_LMOTS_PUBLIC_KEY_LEN(MBEDTLS_LMOTS_SHA256_N32_W8) + 1;
ASSERT_ALLOC( exported_pub_key, exported_pub_key_buf_size);
TEST_EQUAL( mbedtls_lmots_export_public_key( &ctx, exported_pub_key,
exported_pub_key_buf_size, NULL ),
0 );
mbedtls_free(exported_pub_key);
exported_pub_key = NULL;
}
exit:

View File

@ -180,6 +180,15 @@ void lms_import_export_test ( data_t * pub_key, int expected_import_rc )
MBEDTLS_ERR_LMS_BUFFER_TOO_SMALL );
mbedtls_free(exported_pub_key);
exported_pub_key = NULL;
/* Export into too-large buffer should succeed */
exported_pub_key_buf_size = MBEDTLS_LMS_PUBLIC_KEY_LEN(MBEDTLS_LMS_SHA256_M32_H10) + 1;
ASSERT_ALLOC( exported_pub_key, exported_pub_key_buf_size);
TEST_EQUAL( mbedtls_lms_export_public_key( &ctx, exported_pub_key,
exported_pub_key_buf_size, NULL ),
0 );
mbedtls_free(exported_pub_key);
exported_pub_key = NULL;
}
exit: