mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-04-03 10:20:36 +00:00
Test mbedtls_mpi_core_bitlen
Copy the test data for mbedtls_mpi_bitlen except for 0-length and negative cases. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
parent
e943283f2f
commit
b50e433b66
@ -441,6 +441,33 @@ mpi_lsb:"24":2
|
|||||||
Base test mbedtls_mpi_lsb #4
|
Base test mbedtls_mpi_lsb #4
|
||||||
mpi_lsb:"2000":13
|
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
|
Test mbedtls_mpi_bitlen 764-bit
|
||||||
mpi_bitlen:"941379d00fed1491fe15df284dfde4a142f68aa8d412023195cee66883e6290ffe703f4ea5963bf212713cee46b107c09182b5edcd955adac418bf4918e2889af48e1099d513830cec85c26ac1e158b52620e33ba8692f893efbb2f958b4424":764
|
mpi_bitlen:"941379d00fed1491fe15df284dfde4a142f68aa8d412023195cee66883e6290ffe703f4ea5963bf212713cee46b107c09182b5edcd955adac418bf4918e2889af48e1099d513830cec85c26ac1e158b52620e33ba8692f893efbb2f958b4424":764
|
||||||
|
|
||||||
|
@ -664,6 +664,20 @@ exit:
|
|||||||
}
|
}
|
||||||
/* END_CASE */
|
/* 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 */
|
/* BEGIN_CASE */
|
||||||
void mpi_bitlen( char * input_X, int nr_bits )
|
void mpi_bitlen( char * input_X, int nr_bits )
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user