Skip to content

Commit

Permalink
Add unit tests for the new functions in bignum_new.c XXX IN PROGRESS …
Browse files Browse the repository at this point in the history
…XXX ONE MISSING

mbedtls_mpi_core_add_if(), mbedtls_mpi_core_sub(), mbedtls_mpi_core_mla() and
XXX TODO mbedtls_mpi_core_montmul XXX WILL UPDATE THIS COMMIT WHEN THAT IS DONE

The test cases for mbedtls_mpi_core_add_if() and mbedtls_mpi_core_sub() use
the following MPI values.

For mbedtls_mpi_core_add_if() the .data file only includes those (a, b) values
where a <= b, and gives the sum unconditionally; the test code exercises a >= b
and cond == 0 using these values. The .data file gives two values for the carry out,
which are for when sizeof(mbedtls_mpi_uint) == 4 or 8.

For mbedtls_mpi_core_sub() the .data file includes two results, for the cases when
sizeof(mbedtls_mpi_uint) == 4 or 8.

    0 1 3 f fe ff 100 ff00 fffe ffff 10000
    fffffffe ffffffff 100000000 1fffffffffffff 20000000000000 20000000000001
    fefefefefefefefe fffffffffffffffe ffffffffffffffff 10000000000000000
    1234567890abcdef0
    fffffffffffffffffefefefefefefefe fffffffffffffffffffffffffffffffe
    ffffffffffffffffffffffffffffffff 100000000000000000000000000000000
    1234567890abcdef01234567890abcdef0
    fffffffffffffffffffffffffffffffffffffffffffffffffefefefefefefefe
    fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe
    ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
    10000000000000000000000000000000000000000000000000000000000000000
    1234567890abcdef01234567890abcdef01234567890abcdef01234567890abcdef0
    4df72d07b4b71c8dacb6cffa954f8d88254b6277099308baf003fab73227f34029643b5a263f66e0d3c3fa297ef71755efd53b8fb6cb812c6bbf7bcf179298bd9947c4c8b14324140a2c0f5fad7958a69050a987a6096e9f055fb38edf0c5889eca4a0cfa99b45fbdeee4c696b328ddceae4723945901ec025076b12b

The test cases for mbedtls_mpi_core_mla() use the following MPIs:

    0 1 fffe ffffffff 100000000 20000000000000 ffffffffffffffff
    10000000000000000 1234567890abcdef0 fffffffffffffffffefefefefefefefe
    100000000000000000000000000000000 1234567890abcdef01234567890abcdef0
    ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
    1234567890abcdef01234567890abcdef01234567890abcdef01234567890abcdef0
    4df72d07b4b71c8dacb6cffa954f8d88254b6277099308baf003fab73227f34029643b5a263f66e0d3c3fa297ef71755efd53b8fb6cb812c6bbf7bcf179298bd9947c4c8b14324140a2c0f5fad7958a69050a987a6096e9f055fb38edf0c5889eca4a0cfa99b45fbdeee4c696b328ddceae4723945901ec025076b12b

and the following scalars. The .data files include two sets of results (final
accumulator and carry) for the cases sizeof(mbedtls_mpi_uint) == 4 or 8.

    0 3 fe ff ffff 10000 ffffffff 100000000 1fffffffffffff 20000000000001
    fffffffffffffffe

Signed-off-by: Tom Cosgrove <[email protected]>
  • Loading branch information
tom-cosgrove-arm committed Aug 1, 2022
1 parent 6b30a94 commit e88aa1a
Show file tree
Hide file tree
Showing 2 changed files with 12,664 additions and 0 deletions.
Loading

0 comments on commit e88aa1a

Please sign in to comment.