Commit graph

31 commits

Author SHA1 Message Date
Gilles Peskine
503d09b52d Fix memory leak if unit test fails
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-10-17 12:27:43 +02: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
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
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
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
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
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
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
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