Commit graph

25635 commits

Author SHA1 Message Date
Dave Rodgman
852b6c30b7 Support MBEDTLS_MD_SHA3_xxx_VIA_PSA
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-07-05 19:47:08 +01:00
Dave Rodgman
76814b6207 fix missing include
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-07-05 19:38:21 +01:00
Dave Rodgman
c0a0990b6e Improve testing of md/PSA alg identifier macro conversions
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-07-05 19:17:50 +01:00
Dave Rodgman
7bb7602a66 Add OID tests for SHA-3
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-07-05 19:03:21 +01:00
Dave Rodgman
3a498a6ccb Add SHA-3 cases in mbedtls_md_type_from_psa_alg, mbedtls_md_psa_alg_from_type
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-07-05 18:58:04 +01:00
Dave Rodgman
527f48f14d Add OID definitions for SHA3
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-07-05 18:57:30 +01:00
Dave Rodgman
47a2ac1c25 Fix incorrectly named macro
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-26 18:39:42 +01:00
Dave Rodgman
5734bb99cc Fix PSA_HMAC_MAX_HASH_BLOCK_SIZE and PSA_HASH_MAX_SIZE definitions
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-26 18:23:08 +01:00
Dave Rodgman
16985d5f98 Fix test dependencies
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-26 11:28:33 +01:00
Dave Rodgman
12cd44b9b3 Fix test dependencies
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-26 11:27:37 +01:00
Dave Rodgman
09822a35f5 code style
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-26 11:11:23 +01:00
Dave Rodgman
f66cd61daa Use more standard PSA macro names
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-26 11:02:12 +01:00
Dave Rodgman
e43076700e Add PSA SHA-3 tests
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-25 23:27:53 +01:00
Dave Rodgman
98083c6a17 Add support for SHA-3 in PSA
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-25 23:27:45 +01:00
Paul Elliott
3048c8c906
Merge pull request #7725 from minosgalanakis/ecp/7268_add_optimised_reduction_setup_3
[Bignum] Add optimised reduction setup
2023-06-22 16:30:39 +01:00
Manuel Pégourié-Gonnard
e25c43bd66
Merge pull request #7791 from valeriosetti/issue7406
driver-only ECC: TLS: avoid use of mbedtls_ecp_write_key() (with USE_PSA)
2023-06-22 11:13:44 +02:00
Minos Galanakis
2a03fd3b7b bignum_mod: Added a typedef for OPT_RED function pointer.
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-06-22 09:14:28 +01:00
Manuel Pégourié-Gonnard
2fb9d00f6d
Merge pull request #7682 from valeriosetti/issue7453
driver-only ECC: ECPf.PK testing
2023-06-22 09:45:57 +02:00
Valerio Setti
6835b4a6ed tls: always zeroize buffer on exit
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-22 09:06:31 +02:00
Valerio Setti
3589a4c644 tls: keep buffer declaration in a single line
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-22 09:02:44 +02:00
Bence Szépkúti
f2154a6e10
Merge pull request #7686 from DemiMarie/do-while
Add a do-while loop around macros.
2023-06-21 11:31:41 +02:00
Valerio Setti
4b3c02b626 test: remove duplicate PK_HAVE_ECC_KEYS dependency in pkparse suite
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-21 11:23:06 +02:00
Manuel Pégourié-Gonnard
edf059747a
Merge pull request #7691 from DemiMarie/test-equal
x509parse tests: Replace TEST_ASSERT with TEST_EQUAL
2023-06-21 11:02:21 +02:00
Gilles Peskine
a3a0025e18
Merge pull request #7806 from paul-elliott-arm/fix_32bit_builds
[Bignum] Fix 32 bit unreachable code build failure
2023-06-20 22:13:06 +02:00
Gilles Peskine
5faccf038b
Merge pull request #7805 from paul-elliott-arm/fix_retval
Pacify clang15 warnings about empty \retval
2023-06-20 22:12:51 +02:00
Paul Elliott
215ed131cf Fix 32 bit unreachable code build failure
Given the size of ciL is set dependant on MBEDTLS_HAVE_INT32 /
MBEDTLS_HAVE_INT64, clang rightfully reports this as unreachable code in
32 bit builds. Fix this by using #define guards instead.

Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-06-20 17:55:15 +01:00
Paul Elliott
458b96b1a7
Merge pull request #7638 from AndrzejKurek/cert-apps-use-ips
Use better IP parsing in x509 apps
2023-06-20 17:21:04 +01:00
Demi Marie Obenour
690b8c9ca7 Add a do-while loop around macros
This is good practice in C.

Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
2023-06-20 11:48:04 -04:00
Paul Elliott
24f4b73ee5 Pacify clang15 warnings about empty /retval
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-06-20 15:51:46 +01:00
Valerio Setti
5bd2523178 test: ignore compressed points' tests when checking coverage without ECP at all
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-20 09:06:12 +02:00
Valerio Setti
e1651360c0 pkwrite: fix wrong guard position for pk_get_opaque_ec_family()
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-19 19:24:05 +02:00
Valerio Setti
a9aab1a85b pk/psa: use PSA guard for mbedtls_ecc_group_to_psa() and mbedtls_ecc_group_of_psa()
This allows also to:
- removing the dependency on ECP_C for these functions and only rely
  on PSA symbols
- removing extra header inclusing from crypto_extra.h
- return MBEDTLS_PK_USE_PSA_EC_DATA and MBEDTLS_PK_HAVE_ECC_KEYS to
  their original position in pk.h

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-19 19:24:05 +02:00
Valerio Setti
bc2b1d3288 psa: move mbedtls_ecc_group_to_psa() from inline function to standard one
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-19 19:24:05 +02:00
Valerio Setti
f54ca35b8a build_info: do not enable ECP_LIGHT when PSA_WANT_ALG_ECDSA
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-19 19:24:05 +02:00
Valerio Setti
30fdc03819 pk: remove useless internal function
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-19 19:24:05 +02:00
Valerio Setti
545a0d643f test: replace occurencies of ECP_LIGHT with PK_HAVE_ECC_KEYS
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-19 19:24:05 +02:00
Valerio Setti
81d75127ba library: replace occurencies of ECP_LIGHT with PK_HAVE_ECC_KEYS
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-19 19:24:05 +02:00
Valerio Setti
e489e81437 pk: add new symbol to state that PK has support for EC keys
Note: both MBEDTLS_PK_USE_PSA_EC_DATA and MBEDTLS_PK_HAVE_ECC_KEYS
has been move on top of the pk.h file because we need these symbols
when crypto.h is evaluated otherwise functions like
mbedtls_ecc_group_of_psa() won't be available.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-19 19:24:05 +02:00
Valerio Setti
1814bb785f test: re-enable PK and RSA in component without ECP/ECP_LIGHT
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-19 19:23:53 +02:00
Demi Marie Obenour
16442cc929 x509parse tests: Replace TEST_ASSERT with TEST_EQUAL
The latter gives much more informative errors.

Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
2023-06-19 11:10:27 -04:00
Manuel Pégourié-Gonnard
cd70070c25
Merge pull request #7717 from valeriosetti/issue7442
Driver-only ECC: auto-enable ECP_LIGHT when needed
2023-06-19 14:48:32 +02:00
Valerio Setti
3cd4ef7a7a mbedtls_config: improved description of PK_PARSE_EC_COMPRESSED
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-19 11:35:10 +02:00
Valerio Setti
a18385b197 build_info: improved description of ECP_LIGHT auto-enabling symbols
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-19 11:34:28 +02:00
Valerio Setti
a8dc7fd1a2 test: remove leftover paragraph in test_psa_crypto_config_accel_ecc_ecp_light_only
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-19 10:21:01 +02:00
Valerio Setti
fdf15ddfbe build_info: auto enable PK_PARSE_EC_COMPRESSED when PK_PARSE_C && ECP_C
This helps backward compatibility since compressed points were
always supported in previous releases as long as PK_PARSE_C and
ECP_C were defined.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-16 16:03:47 +02:00
Valerio Setti
15e7044627 test: update depends.py with new dependencies
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-16 16:03:47 +02:00
Valerio Setti
22d0a79bc6 test: fix bug for test without bugnum
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-16 16:03:46 +02:00
Valerio Setti
4922ba132a build_info: complete list of symbols that auto-enable ECP_LIGHT
The comment is also updated accordingly.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-16 16:03:46 +02:00
Valerio Setti
addeee4531 mbedtls_config: add new MBEDTLS_PK_PARSE_EC_COMPRESSED symbol
This includes also:
- auto enabling ECP_LIGHT when MBEDTLS_PK_PARSE_EC_COMPRESSED is
  defined
- replacing ECP_LIGHT guards with PK_PARSE_EC_COMPRESSED in pkparse
- disabling PK_PARSE_EC_COMPRESSED in tests with accelarated EC curves
  (it get disabled also in the reference components because we want
  to achieve test parity)
- remove skipped checks in analyze_outcomes.py

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-16 16:03:46 +02:00
Valerio Setti
aecd32c90a pk: let PK_PARSE_EC_EXTENDED auto-enable ECP_LIGHT
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-16 16:03:46 +02:00