Commit graph

21614 commits

Author SHA1 Message Date
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
1951259a10
Update how lms.c imports platform.h
Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 16:47:13 +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
Ronald Cron
49e4184812
Merge pull request #6299 from xkqian/tls13_add_servername_check
Add server name check when proposing pre-share key
2022-10-13 16:00:59 +02: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
29c490db97
Update LMS calculate_public_key docs
To avoid the word "generate"

Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 14:30:34 +01:00
Raef Coles
cbd02adc6e
Simplify LMS context freeing
Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 14:30:32 +01:00
Raef Coles
d1c1f7f7be
Disable LMS in all.sh tests that lack _WANT_SHA256
Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 14:30:31 +01:00
Raef Coles
07b70d9196
Correct typo in LMS config check
Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 14:30:28 +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
45c4ff93c9
Fix windows requiring explicit cast in LMS calloc
Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 14:30:14 +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
4511055511
Exclude binary LMS keys from file checking
Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 14:30:05 +01:00
Raef Coles
142e577c34
Add extra zeroization to LMS and LMOTS
Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 14:30:03 +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
4829459c90
Validate LMOTS sig length before parsing type
Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 14:29:47 +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
3c4ae77fec
Improve LMS private context documentation
Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 14:29:45 +01:00
Raef Coles
285d44b180
Capitalize "Merkle" in LMS and LMOTS code
As it is a proper noun

Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 14:29:43 +01:00
Raef Coles
faf59babe8
Make LMS verification return VERIFY_FAILED more
To align with PSA error code rules on when VERIFY_FAILED is returned vs
INVALID_ARGUMENT

Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 14:29:42 +01:00
Raef Coles
fbd60ec775
Change LMS and LMOTS init functions to use memset
Instead of zeroize

Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 14:29:40 +01:00
Raef Coles
9b0daf60fb
Improve LMS private function warning
Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-10-13 14:29:38 +01:00