Move mpi_core_bitlen tests to bignum_core files

Signed-off-by: Werner Lewis <werner.lewis@arm.com>
This commit is contained in:
Werner Lewis 2022-10-12 17:15:26 +01:00
parent 1b20e7e645
commit ffe4478936
4 changed files with 41 additions and 41 deletions

View file

@ -131,6 +131,33 @@ mpi_core_io_le:"0941379d00fed1491fe15df284dfde4a142f68aa8d412023195cee66883e6290
Test mbedtls_mpi_core_io_le #21 (Buffer and limbs fit, input unaligned, odd number of limbs)
mpi_core_io_le:"de4a142f68aa8d412023195cee66883e6290ffe703f4ea5963bf212713cee46b107c09182b5edcd955adac418bf4918e2889af48e1099d513830cec85c26ac1e158b52620e33ba8692f893efbb2f958b442400":82:21:0:0
Test mbedtls_mpi_core_bitlen 764-bit
mpi_core_bitlen:"941379d00fed1491fe15df284dfde4a142f68aa8d412023195cee66883e6290ffe703f4ea5963bf212713cee46b107c09182b5edcd955adac418bf4918e2889af48e1099d513830cec85c26ac1e158b52620e33ba8692f893efbb2f958b4424":764
Test mbedtls_mpi_core_bitlen 0x18
mpi_core_bitlen:"18":5
Test mbedtls_mpi_core_bitlen 0x18 with leading 0 limb(s)
mpi_core_bitlen:"00000000000000018":5
Test mbedtls_mpi_core_bitlen 0x18 << 64
mpi_core_bitlen:"180000000000000000":69
Test mbedtls_mpi_core_bitlen 0x01
mpi_core_bitlen:"1":1
Test mbedtls_mpi_core_bitlen 0x0f
mpi_core_bitlen:"f":4
Test mbedtls_mpi_core_bitlen 0x10
mpi_core_bitlen:"10":5
Test mbedtls_mpi_core_bitlen 0x0a
mpi_core_bitlen:"a":4
Test mbedtls_mpi_core_bitlen: 0 (1 limb)
mpi_core_bitlen:"0":0
mbedtls_mpi_core_lt_ct: x=y (1 limb)
mpi_core_lt_ct:"2B5":"2B5":0

View file

@ -155,6 +155,20 @@ exit:
}
/* END_CASE */
/* BEGIN_CASE */
void mpi_core_bitlen( char *input_X, int nr_bits )
{
mbedtls_mpi_uint *X = NULL;
size_t limbs;
TEST_EQUAL( mbedtls_test_read_mpi_core( &X, &limbs, input_X ), 0 );
TEST_EQUAL( mbedtls_mpi_core_bitlen( X, limbs ), nr_bits );
exit:
mbedtls_free( X );
}
/* END_CASE */
/* BEGIN_CASE */
void mpi_core_lt_ct( char *input_X, char *input_Y, int exp_ret )
{

View file

@ -139,33 +139,6 @@ mpi_lsb:"24":2
Base test mbedtls_mpi_lsb #4
mpi_lsb:"2000":13
Test mbedtls_mpi_core_bitlen 764-bit
mpi_core_bitlen:"941379d00fed1491fe15df284dfde4a142f68aa8d412023195cee66883e6290ffe703f4ea5963bf212713cee46b107c09182b5edcd955adac418bf4918e2889af48e1099d513830cec85c26ac1e158b52620e33ba8692f893efbb2f958b4424":764
Test mbedtls_mpi_core_bitlen 0x18
mpi_core_bitlen:"18":5
Test mbedtls_mpi_core_bitlen 0x18 with leading 0 limb(s)
mpi_core_bitlen:"00000000000000018":5
Test mbedtls_mpi_core_bitlen 0x18 << 64
mpi_core_bitlen:"180000000000000000":69
Test mbedtls_mpi_core_bitlen 0x01
mpi_core_bitlen:"1":1
Test mbedtls_mpi_core_bitlen 0x0f
mpi_core_bitlen:"f":4
Test mbedtls_mpi_core_bitlen 0x10
mpi_core_bitlen:"10":5
Test mbedtls_mpi_core_bitlen 0x0a
mpi_core_bitlen:"a":4
Test mbedtls_mpi_core_bitlen: 0 (1 limb)
mpi_core_bitlen:"0":0
Test mbedtls_mpi_bitlen 764-bit
mpi_bitlen:"941379d00fed1491fe15df284dfde4a142f68aa8d412023195cee66883e6290ffe703f4ea5963bf212713cee46b107c09182b5edcd955adac418bf4918e2889af48e1099d513830cec85c26ac1e158b52620e33ba8692f893efbb2f958b4424":764

View file

@ -394,20 +394,6 @@ exit:
}
/* END_CASE */
/* BEGIN_CASE */
void mpi_core_bitlen( char *input_X, int nr_bits )
{
mbedtls_mpi_uint *X = NULL;
size_t limbs;
TEST_EQUAL( mbedtls_test_read_mpi_core( &X, &limbs, input_X ), 0 );
TEST_EQUAL( mbedtls_mpi_core_bitlen( X, limbs ), nr_bits );
exit:
mbedtls_free( X );
}
/* END_CASE */
/* BEGIN_CASE */
void mpi_bitlen( char * input_X, int nr_bits )
{