Don't skip LMS tests due to out of memory error

Signed-off-by: Raef Coles <raef.coles@arm.com>
This commit is contained in:
Raef Coles 2022-10-12 15:55:25 +01:00
parent 76563399fd
commit d137c86125
No known key found for this signature in database
GPG key ID: 1AAF1B43DF2086F4

View file

@ -14,7 +14,6 @@ void lms_sign_verify_test ( data_t *msg, data_t *seed )
mbedtls_lms_public_t pub_ctx; mbedtls_lms_public_t pub_ctx;
mbedtls_lms_private_t priv_ctx; mbedtls_lms_private_t priv_ctx;
unsigned char sig[MBEDTLS_LMS_SIG_LEN(MBEDTLS_LMS_SHA256_M32_H10, MBEDTLS_LMOTS_SHA256_N32_W8)]; unsigned char sig[MBEDTLS_LMS_SIG_LEN(MBEDTLS_LMS_SHA256_M32_H10, MBEDTLS_LMOTS_SHA256_N32_W8)];
int rc;
mbedtls_lms_public_init( &pub_ctx ); mbedtls_lms_public_init( &pub_ctx );
mbedtls_lms_private_init( &priv_ctx ); mbedtls_lms_private_init( &priv_ctx );
@ -22,12 +21,10 @@ void lms_sign_verify_test ( data_t *msg, data_t *seed )
/* Allocation failure isn't a test failure, since it likely just means /* Allocation failure isn't a test failure, since it likely just means
* there's not enough memory to run the test. * there's not enough memory to run the test.
*/ */
rc = mbedtls_lms_generate_private_key( &priv_ctx, MBEDTLS_LMS_SHA256_M32_H10, TEST_EQUAL( mbedtls_lms_generate_private_key( &priv_ctx, MBEDTLS_LMS_SHA256_M32_H10,
MBEDTLS_LMOTS_SHA256_N32_W8, MBEDTLS_LMOTS_SHA256_N32_W8,
mbedtls_test_rnd_std_rand, NULL, mbedtls_test_rnd_std_rand, NULL,
seed->x, seed->len ); seed->x, seed->len ), 0 );
TEST_ASSUME( rc != MBEDTLS_ERR_LMS_ALLOC_FAILED );
TEST_EQUAL( rc, 0 );
TEST_EQUAL( mbedtls_lms_calculate_public_key( &pub_ctx, &priv_ctx ), 0 ); TEST_EQUAL( mbedtls_lms_calculate_public_key( &pub_ctx, &priv_ctx ), 0 );
@ -50,7 +47,6 @@ void lms_sign_verify_null_msg_test( data_t *seed )
mbedtls_lms_public_t pub_ctx; mbedtls_lms_public_t pub_ctx;
mbedtls_lms_private_t priv_ctx; mbedtls_lms_private_t priv_ctx;
unsigned char sig[MBEDTLS_LMS_SIG_LEN(MBEDTLS_LMS_SHA256_M32_H10, MBEDTLS_LMOTS_SHA256_N32_W8)]; unsigned char sig[MBEDTLS_LMS_SIG_LEN(MBEDTLS_LMS_SHA256_M32_H10, MBEDTLS_LMOTS_SHA256_N32_W8)];
int rc;
mbedtls_lms_public_init( &pub_ctx ); mbedtls_lms_public_init( &pub_ctx );
mbedtls_lms_private_init( &priv_ctx ); mbedtls_lms_private_init( &priv_ctx );
@ -58,12 +54,10 @@ void lms_sign_verify_null_msg_test( data_t *seed )
/* Allocation failure isn't a test failure, since it likely just means /* Allocation failure isn't a test failure, since it likely just means
* there's not enough memory to run the test. * there's not enough memory to run the test.
*/ */
rc = mbedtls_lms_generate_private_key( &priv_ctx, MBEDTLS_LMS_SHA256_M32_H10, TEST_EQUAL( mbedtls_lms_generate_private_key( &priv_ctx, MBEDTLS_LMS_SHA256_M32_H10,
MBEDTLS_LMOTS_SHA256_N32_W8, MBEDTLS_LMOTS_SHA256_N32_W8,
mbedtls_test_rnd_std_rand, NULL, mbedtls_test_rnd_std_rand, NULL,
seed->x, seed->len ); seed->x, seed->len ), 0 );
TEST_ASSUME( rc != MBEDTLS_ERR_LMS_ALLOC_FAILED );
TEST_EQUAL( rc, 0 );
TEST_EQUAL( mbedtls_lms_calculate_public_key( &pub_ctx, &priv_ctx ), 0 ); TEST_EQUAL( mbedtls_lms_calculate_public_key( &pub_ctx, &priv_ctx ), 0 );