Test little endian core I/O with odd limbs
Signed-off-by: Janos Follath <janos.follath@arm.com>
This commit is contained in:
parent
1cb3b976c3
commit
9dfb5621ff
2 changed files with 35 additions and 27 deletions
|
@ -151,34 +151,34 @@ Test mbedtls_mpi_core_io_be #21 (Buffer and limbs fit, input unaligned, odd numb
|
|||
mbedtls_mpi_core_io_be:"00de4a142f68aa8d412023195cee66883e6290ffe703f4ea5963bf212713cee46b107c09182b5edcd955adac418bf4918e2889af48e1099d513830cec85c26ac1e158b52620e33ba8692f893efbb2f958b4424":82:21:0:0
|
||||
|
||||
Test mbedtls_mpi_core_io_le #1 (Buffer and limbs just fit, input limb-aligned)
|
||||
mbedtls_mpi_core_io_le:"0941379d00fed1491fe15df284dfde4a142f68aa8d412023195cee66883e6290ffe703f4ea5963bf212713cee46b107c09182b5edcd955adac418bf4918e2889af48e1099d513830cec85c26ac1e158b52620e33ba8692f893efbb2f958b4424":96:12:0:0
|
||||
mbedtls_mpi_core_io_le:"0941379d00fed1491fe15df284dfde4a142f68aa8d412023195cee66883e6290ffe703f4ea5963bf212713cee46b107c09182b5edcd955adac418bf4918e2889af48e1099d513830cec85c26ac1e158b52620e33ba8692f893efbb2f958b4424":96:24:0:0
|
||||
|
||||
Test mbedtls_mpi_core_io_le #2 (Buffer and limbs just fit, input unaligned)
|
||||
mbedtls_mpi_core_io_le:"0941379d00fed1491fe15df284dfde4a142f68aa8d412023195cee66883e6290ffe703f4ea5963bf212713cee46b107c09182b5edcd955adac418bf4918e2889af48e1099d513830cec85c26ac1e158b52620e33ba8692f893efbb2f958b":94:12:0:0
|
||||
mbedtls_mpi_core_io_le:"0941379d00fed1491fe15df284dfde4a142f68aa8d412023195cee66883e6290ffe703f4ea5963bf212713cee46b107c09182b5edcd955adac418bf4918e2889af48e1099d513830cec85c26ac1e158b52620e33ba8692f893efbb2f958b":94:24:0:0
|
||||
|
||||
Test mbedtls_mpi_core_io_le #3 (Buffer just fits, extra limbs, input limb-aligned)
|
||||
mbedtls_mpi_core_io_le:"0941379d00fed1491fe15df284dfde4a142f68aa8d412023195cee66883e6290ffe703f4ea5963bf212713cee46b107c09182b5edcd955adac418bf4918e2889af48e1099d513830cec85c26ac1e158b52620e33ba8692f893efbb2f958b4424":96:14:0:0
|
||||
mbedtls_mpi_core_io_le:"0941379d00fed1491fe15df284dfde4a142f68aa8d412023195cee66883e6290ffe703f4ea5963bf212713cee46b107c09182b5edcd955adac418bf4918e2889af48e1099d513830cec85c26ac1e158b52620e33ba8692f893efbb2f958b4424":96:28:0:0
|
||||
|
||||
Test mbedtls_mpi_core_io_le #4 (Buffer just fits, extra limbs, input unaligned)
|
||||
mbedtls_mpi_core_io_le:"0941379d00fed1491fe15df284dfde4a142f68aa8d412023195cee66883e6290ffe703f4ea5963bf212713cee46b107c09182b5edcd955adac418bf4918e2889af48e1099d513830cec85c26ac1e158b52620e33ba8692f893efbb2f958b":94:14:0:0
|
||||
mbedtls_mpi_core_io_le:"0941379d00fed1491fe15df284dfde4a142f68aa8d412023195cee66883e6290ffe703f4ea5963bf212713cee46b107c09182b5edcd955adac418bf4918e2889af48e1099d513830cec85c26ac1e158b52620e33ba8692f893efbb2f958b":94:28:0:0
|
||||
|
||||
Test mbedtls_mpi_core_io_le #5 (Extra limbs, buffer aligned to extra limbs, input limb-aligned)
|
||||
mbedtls_mpi_core_io_le:"0941379d00fed1491fe15df284dfde4a142f68aa8d412023195cee66883e6290ffe703f4ea5963bf212713cee46b107c09182b5edcd955adac418bf4918e2889af48e1099d513830cec85c26ac1e158b52620e33ba8692f893efbb2f958b4424":112:14:0:0
|
||||
mbedtls_mpi_core_io_le:"0941379d00fed1491fe15df284dfde4a142f68aa8d412023195cee66883e6290ffe703f4ea5963bf212713cee46b107c09182b5edcd955adac418bf4918e2889af48e1099d513830cec85c26ac1e158b52620e33ba8692f893efbb2f958b4424":112:28:0:0
|
||||
|
||||
Test mbedtls_mpi_core_io_le #6 (Extra limbs, buffer aligned to extra limbs, input unaligned)
|
||||
mbedtls_mpi_core_io_le:"0941379d00fed1491fe15df284dfde4a142f68aa8d412023195cee66883e6290ffe703f4ea5963bf212713cee46b107c09182b5edcd955adac418bf4918e2889af48e1099d513830cec85c26ac1e158b52620e33ba8692f893efbb2f958b":112:14:0:0
|
||||
mbedtls_mpi_core_io_le:"0941379d00fed1491fe15df284dfde4a142f68aa8d412023195cee66883e6290ffe703f4ea5963bf212713cee46b107c09182b5edcd955adac418bf4918e2889af48e1099d513830cec85c26ac1e158b52620e33ba8692f893efbb2f958b":112:28:0:0
|
||||
|
||||
Test mbedtls_mpi_core_io_le #7 (Buffer and limbs just fit, input limb-aligned with leading zeroes)
|
||||
mbedtls_mpi_core_io_le:"1fe15df284dfde4a142f68aa8d412023195cee66883e6290ffe703f4ea5963bf212713cee46b107c09182b5edcd955adac418bf4918e2889af48e1099d513830cec85c26ac1e158b52620e33ba8692f893efbb2f958b44240000000000000000":88:12:0:0
|
||||
mbedtls_mpi_core_io_le:"1fe15df284dfde4a142f68aa8d412023195cee66883e6290ffe703f4ea5963bf212713cee46b107c09182b5edcd955adac418bf4918e2889af48e1099d513830cec85c26ac1e158b52620e33ba8692f893efbb2f958b44240000000000000000":88:24:0:0
|
||||
|
||||
Test mbedtls_mpi_core_io_le #8 (Buffer and limbs just fit, input unaligned with leading zeroes)
|
||||
mbedtls_mpi_core_io_le:"1fe15df284dfde4a142f68aa8d412023195cee66883e6290ffe703f4ea5963bf212713cee46b107c09182b5edcd955adac418bf4918e2889af48e1099d513830cec85c26ac1e158b52620e33ba8692f893efbb2f958b0000000000000000":86:12:0:0
|
||||
mbedtls_mpi_core_io_le:"1fe15df284dfde4a142f68aa8d412023195cee66883e6290ffe703f4ea5963bf212713cee46b107c09182b5edcd955adac418bf4918e2889af48e1099d513830cec85c26ac1e158b52620e33ba8692f893efbb2f958b0000000000000000":86:24:0:0
|
||||
|
||||
Test mbedtls_mpi_core_io_le #9 (Buffer just fits, extra limbs, input limb-aligned with leading zeroes)
|
||||
mbedtls_mpi_core_io_le:"1fe15df284dfde4a142f68aa8d412023195cee66883e6290ffe703f4ea5963bf212713cee46b107c09182b5edcd955adac418bf4918e2889af48e1099d513830cec85c26ac1e158b52620e33ba8692f893efbb2f958b44240000000000000000":88:14:0:0
|
||||
mbedtls_mpi_core_io_le:"1fe15df284dfde4a142f68aa8d412023195cee66883e6290ffe703f4ea5963bf212713cee46b107c09182b5edcd955adac418bf4918e2889af48e1099d513830cec85c26ac1e158b52620e33ba8692f893efbb2f958b44240000000000000000":88:28:0:0
|
||||
|
||||
Test mbedtls_mpi_core_io_le #10 (Buffer just fits, extra limbs, input unaligned with leading zeroes)
|
||||
mbedtls_mpi_core_io_le:"1fe15df284dfde4a142f68aa8d412023195cee66883e6290ffe703f4ea5963bf212713cee46b107c09182b5edcd955adac418bf4918e2889af48e1099d513830cec85c26ac1e158b52620e33ba8692f893efbb2f958b0000000000000000":86:14:0:0
|
||||
mbedtls_mpi_core_io_le:"1fe15df284dfde4a142f68aa8d412023195cee66883e6290ffe703f4ea5963bf212713cee46b107c09182b5edcd955adac418bf4918e2889af48e1099d513830cec85c26ac1e158b52620e33ba8692f893efbb2f958b0000000000000000":86:28:0:0
|
||||
|
||||
Test mbedtls_mpi_core_io_le #11 (Zero)
|
||||
mbedtls_mpi_core_io_le:"00":1:1:0:0
|
||||
|
@ -192,20 +192,28 @@ mbedtls_mpi_core_io_le:"":1:1:0:0
|
|||
Test mbedtls_mpi_core_io_le #14 (One)
|
||||
mbedtls_mpi_core_io_le:"01":1:1:0:0
|
||||
|
||||
Test mbedtls_mpi_core_io_le #14 (One limb)
|
||||
mbedtls_mpi_core_io_le:"00000000000000ff":8:1:0:0
|
||||
Test mbedtls_mpi_core_io_le #15 (One limb)
|
||||
depends_on:MBEDTLS_HAVE_INT32
|
||||
mbedtls_mpi_core_io_le:"000000ff":4:1:0:0
|
||||
|
||||
Test mbedtls_mpi_core_io_le #15 (not enough limbs, input limb-aligned)
|
||||
mbedtls_mpi_core_io_le:"0941379d00fed1491fe15df284dfde4a142f68aa8d412023195cee66883e6290ffe703f4ea5963bf212713cee46b107c09182b5edcd955adac418bf4918e2889af48e1099d513830cec85c26ac1e158b52620e33ba8692f893efbb2f958b4424":96:11:MBEDTLS_ERR_MPI_BUFFER_TOO_SMALL:0
|
||||
Test mbedtls_mpi_core_io_le #16 (One limb)
|
||||
depends_on:MBEDTLS_HAVE_INT64
|
||||
mbedtls_mpi_core_io_le:"00000000000000ff":8:2:0:0
|
||||
|
||||
Test mbedtls_mpi_core_io_le #16 (not enough limbs, input unaligned)
|
||||
mbedtls_mpi_core_io_le:"0941379d00fed1491fe15df284dfde4a142f68aa8d412023195cee66883e6290ffe703f4ea5963bf212713cee46b107c09182b5edcd955adac418bf4918e2889af48e1099d513830cec85c26ac1e158b52620e33ba8692f893efbb2f958b":94:11:MBEDTLS_ERR_MPI_BUFFER_TOO_SMALL:0
|
||||
Test mbedtls_mpi_core_io_le #17 (not enough limbs, input limb-aligned)
|
||||
mbedtls_mpi_core_io_le:"0941379d00fed1491fe15df284dfde4a142f68aa8d412023195cee66883e6290ffe703f4ea5963bf212713cee46b107c09182b5edcd955adac418bf4918e2889af48e1099d513830cec85c26ac1e158b52620e33ba8692f893efbb2f958b4424":96:22:MBEDTLS_ERR_MPI_BUFFER_TOO_SMALL:0
|
||||
|
||||
Test mbedtls_mpi_core_io_le #17 (buffer too small, input limb-aligned)
|
||||
mbedtls_mpi_core_io_le:"0941379d00fed1491fe15df284dfde4a142f68aa8d412023195cee66883e6290ffe703f4ea5963bf212713cee46b107c09182b5edcd955adac418bf4918e2889af48e1099d513830cec85c26ac1e158b52620e33ba8692f893efbb2f958b4424":95:12:0:MBEDTLS_ERR_MPI_BUFFER_TOO_SMALL
|
||||
Test mbedtls_mpi_core_io_le #18 (not enough limbs, input unaligned)
|
||||
mbedtls_mpi_core_io_le:"0941379d00fed1491fe15df284dfde4a142f68aa8d412023195cee66883e6290ffe703f4ea5963bf212713cee46b107c09182b5edcd955adac418bf4918e2889af48e1099d513830cec85c26ac1e158b52620e33ba8692f893efbb2f958b":94:22:MBEDTLS_ERR_MPI_BUFFER_TOO_SMALL:0
|
||||
|
||||
Test mbedtls_mpi_core_io_le #18 (buffer too small, input unaligned)
|
||||
mbedtls_mpi_core_io_le:"0941379d00fed1491fe15df284dfde4a142f68aa8d412023195cee66883e6290ffe703f4ea5963bf212713cee46b107c09182b5edcd955adac418bf4918e2889af48e1099d513830cec85c26ac1e158b52620e33ba8692f893efbb2f958b":93:12:0:MBEDTLS_ERR_MPI_BUFFER_TOO_SMALL
|
||||
Test mbedtls_mpi_core_io_le #19 (buffer too small, input limb-aligned)
|
||||
mbedtls_mpi_core_io_le:"0941379d00fed1491fe15df284dfde4a142f68aa8d412023195cee66883e6290ffe703f4ea5963bf212713cee46b107c09182b5edcd955adac418bf4918e2889af48e1099d513830cec85c26ac1e158b52620e33ba8692f893efbb2f958b4424":95:24:0:MBEDTLS_ERR_MPI_BUFFER_TOO_SMALL
|
||||
|
||||
Test mbedtls_mpi_core_io_le #20 (buffer too small, input unaligned)
|
||||
mbedtls_mpi_core_io_le:"0941379d00fed1491fe15df284dfde4a142f68aa8d412023195cee66883e6290ffe703f4ea5963bf212713cee46b107c09182b5edcd955adac418bf4918e2889af48e1099d513830cec85c26ac1e158b52620e33ba8692f893efbb2f958b":93:24:0:MBEDTLS_ERR_MPI_BUFFER_TOO_SMALL
|
||||
|
||||
Test mbedtls_mpi_core_io_le #21 (Buffer and limbs fit, input unaligned, odd number of limbs)
|
||||
mbedtls_mpi_core_io_le:"de4a142f68aa8d412023195cee66883e6290ffe703f4ea5963bf212713cee46b107c09182b5edcd955adac418bf4918e2889af48e1099d513830cec85c26ac1e158b52620e33ba8692f893efbb2f958b442400":82:21:0:0
|
||||
|
||||
Test mbedtls_mpi_mod_raw_io #1 BE (Buffer and limbs just fit, input limb-aligned)
|
||||
mbedtls_mpi_mod_raw_io:"0941379d00fed1491fe15df284dfde4a142f68aa8d412023195cee66883e6290ffe703f4ea5963bf212713cee46b107c09182b5edcd955adac418bf4918e2889af48e1099d513830cec85c26ac1e158b52620e33ba8692f893efbb2f958b4424":96:12:MBEDTLS_MPI_MOD_EXT_REP_BE:0:0
|
||||
|
|
|
@ -294,7 +294,7 @@ exit:
|
|||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void mbedtls_mpi_core_io_le( data_t *input, int nb_int, int nx_64_int, int iret,
|
||||
void mbedtls_mpi_core_io_le( data_t *input, int nb_int, int nx_32_int, int iret,
|
||||
int oret )
|
||||
{
|
||||
#define BMAX 1024
|
||||
|
@ -311,12 +311,12 @@ void mbedtls_mpi_core_io_le( data_t *input, int nb_int, int nx_64_int, int iret,
|
|||
nb = nb_int;
|
||||
TEST_ASSERT( nb <= BMAX );
|
||||
|
||||
TEST_ASSERT( 0 <= nx_64_int );
|
||||
nx = nx_64_int;
|
||||
/* nx_64_int is the number of 64 bit limbs, if we have 32 bit limbs we need
|
||||
* to double the number of limbs to have the same size. */
|
||||
if( sizeof( mbedtls_mpi_uint ) == 4 )
|
||||
nx *= 2;
|
||||
TEST_ASSERT( 0 <= nx_32_int );
|
||||
nx = nx_32_int;
|
||||
/* nx_32_int is the number of 32 bit limbs, if we have 64 bit limbs we need
|
||||
* to halve the number of limbs to have the same size. */
|
||||
if( sizeof( mbedtls_mpi_uint ) == 8 )
|
||||
nx = nx / 2 + nx % 2;
|
||||
TEST_ASSERT( nx <= XMAX );
|
||||
|
||||
ret = mbedtls_mpi_core_read_le( X, nx, input->x, input->len );
|
||||
|
|
Loading…
Reference in a new issue