Manuel Pégourié-Gonnard
b63a9ef09f
Fix buffer sizes in ecjpake_setup test function
...
Also, the error code changed from INSUFFICIENT_MEMORY to INVALID_DATA.
Temporarily remove a test about aborting the operation on error.
Auto-abort will be re-introduced in the next commit in a more systematic
way.
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2022-10-13 13:17:20 +02:00
Manuel Pégourié-Gonnard
ec7012dbc7
Fix I/O format of PSA EC J-PAKE for compliance
...
The format used by the mbedtls_ecjpake_xxx() APIs and that defined by
the PSA Crypto PAKE extension are quite different; the former is
tailored to the needs of TLS while the later is quite generic and plain.
Previously we only addressed some part of this impedance mismatch: the
different number of I/O rounds, but failed to address the part where the
legacy API adds some extras (length bytes, ECParameters) that shouldn't
be present in the PSA Crypto version. See comments in the code.
Add some length testing as well; would have caught the issue.
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2022-10-05 12:52:48 +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
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
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
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
Werner Lewis
ccae25b4bf
Add explicit mbedtls_ecp_tls_read_group_id call
...
Signed-off-by: Werner Lewis <werner.lewis@arm.com>
2022-09-20 10:00:07 +01:00
Werner Lewis
7403d93f8a
Add leading zeros to group metadata
...
Signed-off-by: Werner Lewis <werner.lewis@arm.com>
2022-09-20 09:41:05 +01:00
Werner Lewis
57807308d5
Fix typo in MBEDTLS_ECP_DP_BP512R1
...
Signed-off-by: Werner Lewis <werner.lewis@arm.com>
2022-09-20 09:16:11 +01:00
Tom Cosgrove
f2b3818a69
Test when all three inputs to mbedtls_mpi_core_sub() are aliased
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2022-09-20 09:08:31 +01:00
Manuel Pégourié-Gonnard
1367f40d38
Fix memory corruption in an SSL test function
...
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2022-09-19 11:00:23 +02:00
Andrzej Kurek
2be1689504
Add capacity testing to EC J-PAKE to PMS tests
...
Let the caller restrict the capacity but limit it to 32 bytes.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-09-16 07:14:04 -04:00
Andrzej Kurek
d37850404a
Add derivation step testing to EC J-PAKE to PMS tests
...
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-09-16 06:45:44 -04:00
Manuel Pégourié-Gonnard
07018f97d2
Make legacy_or_psa.h public.
...
As a public header, it should no longer include common.h, just use
build_info.h which is what we actually need anyway.
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2022-09-16 12:02:48 +02:00
Tom Cosgrove
c71ca0cb3c
Remove some unnecessary whitespace (two spaces after commas)
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2022-09-15 15:38:17 +01:00
Tom Cosgrove
dbc156172c
Don't bother to test b + a after testing a + b if a == b
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2022-09-15 15:36:23 +01:00
Tom Cosgrove
17f1fdca0f
Update comments in mpi_core_add_if() test
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2022-09-15 15:23:56 +01:00
Tom Cosgrove
b7438d1f62
Update name of mbedtls_mpi_montg_init()
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2022-09-15 15:05:59 +01:00
Tom Cosgrove
359feb0d2f
Better wording for the reason why we use an input MPI for a scalar value
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2022-09-15 14:52:34 +01:00
Tom Cosgrove
e2159f2083
Use the MAX() macro
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2022-09-15 14:40:10 +01:00
Tom Cosgrove
be7209db1f
Remove unnecessary casts
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2022-09-15 14:32:38 +01:00
Tom Cosgrove
50c477bd6b
Use S and sum (rather than X/expected) in mpi_core_add_if()
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2022-09-15 14:28:30 +01:00
Tom Cosgrove
1feb5ac1b7
Switch to using TEST_LE_S() and TEST_LE_U() in tests
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2022-09-15 14:22:35 +01:00
Tom Cosgrove
2b177926ad
Use ASSERT_ALLOC() in tests
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2022-09-15 14:07:18 +01:00
Manuel Pégourié-Gonnard
18dff1f226
Merge pull request #5871 from superna9999/4153-psa-expose-ec-j-pake
...
Expose ECJPAKE through the PSA Crypto API
2022-09-15 09:25:55 +02:00
Andrzej Kurek
d8705bc7b7
Add tests for the newly created ad-hoc EC J-PAKE KDF
...
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-09-14 08:39:41 -04:00
Przemek Stekiel
40afdd2791
Make use of MBEDTLS_MAX_HASH_SIZE macro
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2022-09-06 14:18:45 +02:00
Neil Armstrong
2a73f21878
Fixup expected status handling in ecjpake_setup() and add more coverage for psa_pake_set_password_key()
...
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2022-09-06 11:34:54 +02:00
Neil Armstrong
78c4e8e9cb
Make ecjpake_do_round() return void and use TEST_ASSERT with a descriptive text instead of returning a value
...
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2022-09-05 18:08:13 +02:00
Neil Armstrong
51009d7297
Add comment in ecjpake_do_round() explaining input errors can be detected any time in the input sequence
...
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2022-09-05 17:59:54 +02:00
Andrzej Kurek
c502210291
Adjust pkparse test dependencies
...
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-09-02 15:33:20 -04:00
Tom Cosgrove
1135b20064
Add mbedtls_mpi_core_add_if() tests for when inputs are aliased
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2022-09-02 11:46:18 +01:00
Tom Cosgrove
42dfac6ae8
Rename variables and update comments in mpi_core_mla test
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2022-09-02 11:27:39 +01:00
Tom Cosgrove
a043aeb95c
Rename variables and update comments in mpi_core_sub test
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2022-09-02 11:27:39 +01:00
Tom Cosgrove
eceb4ccfc3
Rename variables and update comments in mpi_core_add_if test
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2022-09-02 11:27:31 +01:00
Tom Cosgrove
1b2947a614
Remove mbedtls_ prefix from bignum test cases
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2022-09-02 10:24:55 +01:00
Andrzej Kurek
7a32072038
Setup / deinitialize PSA in pk tests only if no MD is used
...
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-09-02 04:07:15 -04:00
Andrzej Kurek
26909f348f
Add PSA initialization and teardown to tests using pkcs5
...
If PSA is defined and there is no MD - an initialization
is required.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-09-02 04:05:37 -04:00
Andrzej Kurek
ed98e95c81
Adjust pkcs5 test dependencies
...
Hashing via PSA is now supported
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-09-02 04:03:25 -04:00
Andrzej Kurek
dd36c76f09
Provide a version of pkcs5_pbkdf2_hmac without MD usage
...
Use the new implementation locally
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-09-02 04:03:25 -04:00