Commit graph

11256 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
Gilles Peskine
5760bf77c7
Merge pull request #7641 from valeriosetti/issue7614
Define PSA_WANT_KEY_TYPE_xxx_KEY_PAIR_yyy (step 1)
2023-06-16 16:00:17 +02:00
Paul Elliott
680233dc3f
Merge pull request #7680 from paul-elliott-arm/raw_ecp_mod_p448
[Bignum] Split out raw ECP mod p448
2023-06-16 13:46:25 +01:00
Valerio Setti
01cc88a46b config_psa: replace USE symbols with BASIC one for all KEY_PAIRs
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-16 12:27:02 +02:00
Valerio Setti
b0d9aaee1c psa: move PSA_WANT checks to check_crypto_config
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-16 12:26:26 +02:00
Valerio Setti
8bb5763a85 library: replace deprecated symbols with temporary _LEGACY ones
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-16 12:23:55 +02:00
Janos Follath
a426dc31cc
Merge pull request #7782 from gilles-peskine-arm/mbedtls_ecp_modulus_type-move
Move mbedtls_ecp_modulus_type out of the public headers
2023-06-16 11:12:57 +01:00
Gilles Peskine
f45a5a0ddd
Merge pull request #7700 from silabs-Kusumit/PBKDF2_output_bytes
PBKDF2: Output bytes
2023-06-16 10:08:02 +02:00
Gilles Peskine
637c049349 Move mbedtls_ecp_modulus_type out of the public headers
This is an internal detail of the ECC arithmetic implementation, only
exposed for the sake of the unit tests

Mbed TLS 3.4.0 was released with the type mbedtls_ecp_modulus_type defined
in a public header, but without Doxygen documentation, and without any
public function or data structure using it. So removing it is not an API
break.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-06-15 19:07:41 +02:00
Kusumit Ghoderao
246e51fd0b Add cleanup for intermediate buffer
Signed-off-by: Kusumit Ghoderao <Kusumit.Ghoderao@silabs.com>
2023-06-15 22:15:43 +05:30
Paul Elliott
a2e48f751b Split out mbedtls_ecp_mod_p448_raw()
Switch testing over to using the generic raw functions.

Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-06-15 17:16:38 +01:00
Paul Elliott
b4df176610
Merge pull request #7637 from paul-elliott-arm/fixed_ecp_mod_p448
[Bignum] Fixed width for ecp mod p448
2023-06-15 17:12:02 +01:00
Dave Rodgman
2e7d57270e
Merge pull request #7624 from daverodgman/aes-perf
AES perf improvements
2023-06-15 12:10:06 +01:00
Tom Cosgrove
6edf8b8c7b
Merge pull request #7451 from yanrayw/7376_aes_128bit_only
Introduce config option of 128-bit key only in AES calculation
2023-06-15 10:35:32 +01:00
Kusumit Ghoderao
d07761c19c add return statement
Signed-off-by: Kusumit Ghoderao <Kusumit.Ghoderao@silabs.com>
2023-06-15 12:11:15 +05:30
Dave Rodgman
28a97acb3c code style
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-14 20:15:15 +01:00
Paul Elliott
bed9ac7b2d Optimise final 2 rounds
Final two rounds logic could be significantly simplified.

Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-06-14 19:20:33 +01:00
Dave Rodgman
d05e7f1ab3 Do not use NEON for AES-CBC on aarch64
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-14 18:58:48 +01:00
Dave Rodgman
906c63cf35 Revert "improve cbc encrypt perf"
This reverts commit f1e396c427.

Performance is slightly better with this reverted, especially
for AES-CBC 192.

Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-14 17:55:41 +01:00
Paul Elliott
b8f7305b02 Replace sizeof(mbedtls_mpi_uint) with ciL define
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-06-14 17:52:42 +01:00
Kusumit Ghoderao
257ea00199 Use output block as U_accumulator
Signed-off-by: Kusumit Ghoderao <Kusumit.Ghoderao@silabs.com>
2023-06-14 15:55:11 +05:30
Paul Elliott
3646dc78bc Fix coding style issue
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-06-14 08:51:08 +01:00
Paul Elliott
436f2ad37c Three round solution
Attempt to fix failing test by dealing with overflow with three rounds,
instead of previous subtract modulus solution. Also optimise out shifts
by using memcpy / memmove instead. Remove final sub to return canonical
result, as this is not required here.

Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-06-13 17:39:44 +01:00
Manuel Pégourié-Gonnard
14f65a47c8
Merge pull request #7714 from daverodgman/sha3-update
SHA-3 update
2023-06-12 15:13:30 +02:00
Dave Rodgman
5c394ff203 Use a single fast-path in mbedtls_xor, gains around 1% in benchmarks
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-09 20:10:36 +01:00
Dave Rodgman
159dc099fd Code style
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-09 19:46:07 +01:00
Dave Rodgman
360e04f379 Fix AES-XTS perf regression
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-09 17:23:15 +01:00
Dave Rodgman
f32176c0e3 Remove unnecessary cast
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-09 16:25:49 +01:00
Tom Cosgrove
ef2aa0ecad Fix "unterminated '#pragma clang attribute push'" in sha256/sha512.c
If we're built with MBEDTLS_SHAxxx_USE_A64_CRYPTO_IF_PRESENT but don't have a
way to detect the crypto extensions required, the code turns off _IF_PRESENT
and falls back to C only (with a warning). This was done after the attributes
are pushed, and the pop is done only #if defined(xxx_IF_PRESENT), so this
commit fixes that.

Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-06-09 11:29:50 +01:00
Dave Rodgman
6d4933e54d Replace use of MBEDTLS_SHA3_C with MBEDTLS_MD_CAN_SHA3_xxx
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-08 16:03:54 +01:00
Kusumit Ghoderao
d9ec1afd13 Fix failing Ci
Signed-off-by: Kusumit Ghoderao <Kusumit.Ghoderao@silabs.com>
2023-06-08 20:19:51 +05:30
Gilles Peskine
e5e8ba654e
Merge pull request #7666 from mprse/ip_info
OPC UA: parsing IP's in SubjectAltNames & printing info
2023-06-08 15:23:21 +02:00
Gilles Peskine
95b43a04a9
Merge pull request #7651 from daverodgman/fix-armclang-compile-fail
Fix armclang compile fail
2023-06-08 14:36:18 +02:00
Kusumit Ghoderao
109ee3de36 Use size of buffer for mac_size
Signed-off-by: Kusumit Ghoderao <Kusumit.Ghoderao@silabs.com>
2023-06-08 16:36:45 +05:30
Kusumit Ghoderao
b821a5fd67 Use multipart mac operation for adding salt and counter
Signed-off-by: Kusumit Ghoderao <Kusumit.Ghoderao@silabs.com>
2023-06-08 16:35:55 +05:30
Xiaokang Qian
fcdd0477b3 Replace loop zeroise with memset
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-06-08 10:03:53 +00:00
Janos Follath
035e5fc885 Add comments to 448 optimised reduction
Signed-off-by: Janos Follath <janos.follath@arm.com>
2023-06-08 09:44:30 +00:00