Manuel Pégourié-Gonnard
47b8de834d
Fix usage of ASSERT_ALLOC()
...
The second argument is the number of elements of the type the first
argument is pointing to, so we shouldn't be using sizeof there.
This was resulting in overly large allocations.
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2022-10-14 09:35:55 +02:00
Gilles Peskine
31c2dcb611
Fix file names in reproduction instructions in test data
...
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-10-13 20:48:15 +02:00
Gilles Peskine
2875aa7b01
Fix instructions and test data for pyhsslms interop tests
...
The test data was invalid because it had the extra 4-byte prefix for HSS.
Regenerate it (which produces completely new signatures since it is
randomized).
Rearrange the reproduction instructions for the second test case so that it
shows more clearly how to generate a second signature with the same private
key.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-10-13 20:45:05 +02:00
Raef Coles
8bccc999d9
Don't mention error type in LMS test comments
...
Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 17:57:31 +01:00
Raef Coles
6d7d94a821
Use correct export length in LMS export tests
...
Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 17:55:46 +01:00
Raef Coles
aa9d52bcdc
Rename LMS private key files to match library name
...
Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 17:53:40 +01:00
Raef Coles
f8bfe2783b
Remove bad character from LMS test case
...
Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 17:35:28 +01:00
Raef Coles
d543697092
Fix minor type in LMS test description
...
Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 17:06:42 +01:00
Raef Coles
a2514f622f
Update pyhsslms test instructions with script
...
Due to tool name conflict hampering data reproduction
Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 17:04:21 +01:00
Raef Coles
ce18e528ff
Rename LMS private key files
...
And remove now-unnecessary modification to check_files.py
Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 16:45:05 +01:00
Raef Coles
e4d96b804c
Update LMS and LMOTS test comments
...
Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 16:45:05 +01:00
Raef Coles
493724e3c2
Check correct output size in LMOTS export test
...
Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 15:43:07 +01:00
Raef Coles
ed0e4591dc
Add output length test for LMS export too-big test
...
Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 15:05:47 +01:00
Raef Coles
33f7d66304
Add output check to export too-big buffer tests
...
Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 14:30:36 +01:00
Raef Coles
1d88ea870f
Remove unneeded NULL pointer checks in LMS tests
...
Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 14:30:35 +01:00
Raef Coles
a21671123a
Remove sudo pip3
in LM(OT)S tests instructions
...
Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 14:30:27 +01:00
Raef Coles
1b43a7448d
Clean up LMS and LMOTS feature dependencies
...
Remove SHA256 dependencies from tests, fix incorrect boolean logic in
check_config, and change depends_hashes.pl to disable LMS in one test
Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 14:30:26 +01:00
Raef Coles
6b2c573b3d
And export buffer too large test to LMS and LMOTS
...
Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 14:30:24 +01:00
Raef Coles
534f66f3f0
Fix assert arguments in LMS and LMOTS export tests
...
Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 14:30:23 +01:00
Raef Coles
d1c2a80319
Remove duplicated assert from LMOTS tests
...
Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 14:30:21 +01:00
Raef Coles
20d2e06ca4
Add cleanup frees in LMS and LMOTS tests
...
Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 14:30:20 +01:00
Raef Coles
781f7bedb0
Properly mark LMOTS leak test as failed
...
Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 14:30:18 +01:00
Raef Coles
d137c86125
Don't skip LMS tests due to out of memory error
...
Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 14:30:17 +01:00
Raef Coles
76563399fd
Fix LMS and LMOTS test dependencies
...
Mark them as depending on PSA_WANT_ALG_SHA256 so that
test_depends_hashes_psa doesn't fail
Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 14:30:15 +01:00
Raef Coles
59eb0d0f2b
Fix LMOTS signature leak test dependencies
...
As it requires MBEDTLS_LMS_PRIVATE
Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 14:30:12 +01:00
Raef Coles
d0c701237a
Replace TEST_ASSERT with TEST_EQUAL in LMS tests
...
Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 14:30:09 +01:00
Raef Coles
f9b8502865
Add LMS import/export negative tests
...
Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 14:30:06 +01:00
Raef Coles
9fc303a99a
Add extra LMOTS import negative tests
...
And fix failures that are related to the new tests
Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 14:30:01 +01:00
Raef Coles
71f554b48f
Use real data for negative LMOTS tests
...
To avoid errors caused by the null public keys and signatures
Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 14:30:00 +01:00
Raef Coles
66edf6a833
Use hsslms data for LMOTS import/export test
...
Also, test that export fails when the buffer is too small.
Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 14:29:58 +01:00
Raef Coles
8b55ba623e
Source LMOTS data from hsslms
...
So it can be reproduced
Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 14:29:57 +01:00
Raef Coles
a6b47c0aac
Add LMS hsslms interop tests
...
Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 14:29:55 +01:00
Raef Coles
d6adcb6146
Add negative LMS import/export tests
...
Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 14:29:53 +01:00
Raef Coles
810612e14e
Update LMS and LMOTS to use TEST_EQUAL
...
Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 14:29:51 +01:00
Raef Coles
90e13fc3c6
Add repro instructions for LMS test data
...
Add more interop tests, and use real data for the negative tests
Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 14:29:49 +01:00
Raef Coles
0dc604ed2b
Change how LMS and LMOTS negative tests work
...
Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 14:29:48 +01:00
Raef Coles
7726678b23
Remove debugging code left in LMOTS tests
...
Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 14:29:46 +01:00
Raef Coles
370cc43630
Make LMS public key export part of public key api
...
Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 14:29:28 +01:00
Raef Coles
be3bdd8240
Rename LMS and LMOTS init/free functions
...
To match convention
Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 14:29:18 +01:00
Raef Coles
5127e859d7
Update LMS and LMOTS dependency macros
...
Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 14:29:11 +01:00
Raef Coles
98c504373c
Update LMS test description
...
To correct copy-paste error
Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 14:29:02 +01:00
Raef Coles
40158e11fc
Add LMOTS test hook to header
...
Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 14:28:58 +01:00
Raef Coles
9c9027b1a4
Add extra LMS and LMOTS tests
...
NULL-message and LMOTS signature leak tests
Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 14:28:50 +01:00
Raef Coles
f5919e2997
Update LMS/LMOTS tests
...
Document tests and source of data, use test RNG, pass more parameters
into each test
Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 14:28:43 +01:00
Raef Coles
e9479a0264
Update LMS API to support multiple parameter sets
...
Parameterise macros to allow variation of sizes
Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 14:28:36 +01:00
Raef Coles
ab4f87413a
Add MBEDTLS_LMS_PRIVATE define
...
To enable private key operations
Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 14:28:35 +01:00
Raef Coles
01c71a17b3
Update LMS and LMOTS api
...
Fix function names and parameters. Move macros to be more private.
Update implementation.
Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 14:28:25 +01:00
Raef Coles
c8f9604d7b
Use PSA hashing for LMS and LMOTS
...
Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 14:28:23 +01:00
Raef Coles
7dce69a27a
Make LMOTS a private api
...
Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 14:28:22 +01:00
Raef Coles
8ff6df538c
Add LMS implementation
...
Also an LM-OTS implementation as one is required for LMS.
Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 14:28:15 +01:00
Gilles Peskine
0fe6631486
Merge pull request #6291 from gilles-peskine-arm/platform.h-unconditional-3.2
...
Include platform.h unconditionally
2022-10-13 10:19:22 +02:00
Gilles Peskine
8fd3254cfc
Merge pull request #6374 from mprse/enc_types
...
Test TLS 1.2 builds with each encryption type
2022-10-12 12:45:50 +02:00
Ronald Cron
78317c832b
Merge pull request #6327 from yuhaoth/pr/tls13-psk-after-session-tickets
...
TLS 1.3: PSK and NewSessionTicket: Add support for sending PSK and Ticket together.
2022-10-12 12:39:51 +02:00
Gilles Peskine
b50e433b66
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>
2022-10-10 23:03:47 +02:00
Gilles Peskine
e943283f2f
More mbedtls_mpi_bitlen test cases
...
* with leading zero limb
* with trailing zero limb
* negative
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-10-10 23:03:47 +02:00
Gilles Peskine
24baa81043
Improve mbedtls_mpi_bitlen test descriptions
...
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-10-10 23:03:47 +02:00
Gilles Peskine
c5772a194e
mbedtls_test_read_mpi_core: allow odd number of hex digits
...
Test functions must now take a char* argument rather than data_t*. This does
not affect existing test data.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-10-10 23:03:47 +02:00
Janos Follath
1b5c85c75b
Merge pull request #6386 from gilles-peskine-arm/bignum-mbedtls_test_read_mpi_core
...
Introduce mbedtls_test_read_mpi_core
2022-10-10 15:14:46 +01:00
Gabor Mezei
44ba2f6db9
Add more test cases
...
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2022-10-10 15:32:12 +02:00
Gabor Mezei
a67a1a3ebc
Remove the 'is_fail' parameter from the test functions
...
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2022-10-10 15:25:59 +02:00
Gabor Mezei
d71eb0c3ac
Use better test macro
...
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2022-10-10 13:09:04 +02:00
Gabor Mezei
d6441da4c5
Remove redundant memory initialization
...
When memory is allocated it is also initialized with 0.
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2022-10-10 13:05:16 +02:00
Gabor Mezei
251cb632f1
Remove unused macro definition
...
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2022-10-10 13:02:21 +02:00
Przemek Stekiel
42bb3ff40b
Adapt expected results in ChaCha20-Poly1305 ( invalid tag length)
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2022-10-10 07:28:40 +02:00
Jerry Yu
8897c07075
Add server only guards for psk callback
...
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2022-10-07 10:11:05 +08:00
Gilles Peskine
80ca44f33c
Merge pull request #6325 from gabor-mezei-arm/6308_missing_initialization_in_test
...
Add initialization for structures in test
2022-10-05 11:09:35 +02:00
Gabor Mezei
8fcde5bb8e
Remove duplicate test case
...
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2022-10-04 13:53:33 +02:00
Gabor Mezei
02e5d439db
Add more tests for cond_assign/swap functions
...
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2022-10-03 16:45:11 +02:00
Gabor Mezei
6546a6cc03
Rewrite tests for cond_assign/swap
...
The cond_swap and cond_assign test functions now requires the same limb size
for the MPI parameters.
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2022-10-03 14:56:51 +02:00
Gilles Peskine
5bbdfce44c
Streamline mbedtls_mpi_core_lt_ct unit test
...
Use mbedtls_test_read_mpi_core() to read the test data. Among other
benefits, X and Y are now allocated to their exact size, so analyzers (Asan,
Valgrind, Coverity, ...) have a chance of complaining if the tested function
overflows the buffer.
Remove TEST_CF_PUBLIC calls which are no longer necessary.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-09-30 18:53:04 +02:00
Gilles Peskine
571576fc5c
Move the definition of data_t to a header file
...
This way it can be used in helper functions.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-09-30 18:51:41 +02:00
Gabor Mezei
ec5685f1ee
Use exact-size buffers for inputs and outputs to library functions in tests
...
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2022-09-30 14:48:54 +02:00
Gabor Mezei
f5ca726ce1
Rename variables to match bettr to its purpose
...
The length in bytes is used with the 'len' prefix and
the length in limbs is used with the 'limbs' prefix.
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2022-09-30 14:35:42 +02:00
Gabor Mezei
8b05e3b148
Add memory freeing
...
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2022-09-30 13:36:41 +02:00
Gabor Mezei
a7584888da
Use exact-size buffers for inputs and outputs to library functions in tests
...
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2022-09-30 13:36:41 +02:00
Gabor Mezei
821d15107b
Check true and false condition in the same test case
...
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2022-09-30 13:36:41 +02:00
Gabor Mezei
3eff425b1a
Use only one limb parameter for assign
...
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2022-09-30 13:36:40 +02:00
Gabor Mezei
027d696434
Remove unused code
...
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2022-09-30 13:36:40 +02:00
Gabor Mezei
b2763ef507
Do not read uninitialized memory
...
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2022-09-30 13:36:40 +02:00
Gabor Mezei
cfc0eb8d22
Remove unused parameter
...
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2022-09-30 13:36:39 +02:00
Gabor Mezei
53e455db7b
Remove return value checking from test functions of assign and swap
...
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2022-09-30 13:36:39 +02:00
Gabor Mezei
b27b1c5db0
Add tests for conditional assign and swap functions
...
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2022-09-30 13:36:30 +02:00
Gilles Peskine
845de0898e
Merge pull request #6083 from tom-cosgrove-arm/issue-6015-montgomery-multiplication
...
Montgomery multiplication from bignum prototype
2022-09-30 10:35:21 +02:00
Tom Cosgrove
4386ead662
Correct the aliasing requirements in doc for mbedtls_mpi_core_montmul(), and test them
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2022-09-29 14:40:21 +01:00
Przemek Stekiel
a891a091a3
test_suite_cmac.data: fix bug: use cipher type instead cipher id
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2022-09-29 09:53:20 +02:00
Manuel Pégourié-Gonnard
f3f9e450b6
Merge pull request #6115 from AndrzejKurek/ecjpake-kdf-tls-1-2
...
Ad-hoc KDF for EC J-PAKE in TLS 1.2
2022-09-28 09:47:32 +02:00
Gabor Mezei
0bb138241b
Add initialization for structures
...
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2022-09-27 18:48:44 +02:00
Przemek Stekiel
6f29a6c4b4
test_suite_cipher.function: always include aes.h
...
It is done to have MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH macro available (used in tests)
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2022-09-27 15:04:14 +02:00
Andrzej Kurek
3539f2c90b
Improve readability in ecjpake tests
...
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-09-26 10:56:02 -04:00
Gilles Peskine
12a1e85caa
Merge pull request #6138 from Zaya-dyno/validation_remove_change_key_agree
...
Validation remove change key agree
2022-09-23 17:04:20 +02:00
Gilles Peskine
87953f228f
Merge pull request #6091 from Zaya-dyno/validation_remove_change_pk
...
Validation remove change pk
2022-09-23 17:03:30 +02:00
Gabor Mezei
f29c2a5313
Add initialization for structures
...
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2022-09-23 15:25:27 +02:00
Manuel Pégourié-Gonnard
1475ac49a4
Merge pull request #6107 from Zaya-dyno/validation_remove_change_hash
...
Validation remove change hash
2022-09-22 09:24:44 +02:00
Manuel Pégourié-Gonnard
d5c82fb821
Merge pull request #6085 from Zaya-dyno/validation_remove_change_cipher
...
Validation remove and change in files related to cipher in library
2022-09-22 09:10:13 +02:00
Tom Cosgrove
c573882674
Merge remote-tracking branch 'upstream/development' into issue-6015-montgomery-multiplication
2022-09-21 12:08:43 +01:00
Manuel Pégourié-Gonnard
d433cd7d07
Merge pull request #6283 from mpg/driver-only-hashes-wrap-up
...
Driver only hashes wrap-up
2022-09-21 08:29:46 +02:00
Dave Rodgman
36e1d9ef1d
Merge pull request #6203 from wernerlewis/ecp_group_test
...
Add test for ECP group metadata
2022-09-20 17:35:53 +01:00
Tom Cosgrove
b0b77e1b13
Document and test aliasing of the bignums given to mbedtls_mpi_core_mla()
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2022-09-20 13:33:40 +01:00
Tom Cosgrove
ea45c1d2d4
Document and test aliasing of output for mbedtls_mpi_core_montmul()
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2022-09-20 13:17:51 +01:00
Werner Lewis
05feee1841
Restore vbuf value after modification
...
Signed-off-by: Werner Lewis <werner.lewis@arm.com>
2022-09-20 12:05:58 +01:00