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
Dave Rodgman
b70ea9fb64
Merge remote-tracking branch 'origin/development' into safer-ct5
2023-06-20 16:12:00 +01: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
Manuel Pégourié-Gonnard
ee7a758b85
MD: isolate strings to separate table
...
In the long term, we don't really want those strings in the library.
Start with isolating them in a separate table rather than having them in
the main md_info structure.
This way, the table can easily be garbage-collected by the linker if
none of the two functions using it are called.
Also, simplify the implementation of mbedtls_md_info_from_string().
This saves 151 bytes with MD_C, and 141 with MD_LIGHT only.
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com >
2023-06-20 12:12:22 +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
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
Marek Jansta
8bde649c0b
Fixed AlgorithmIdentifier parameters when used with ECDSA signature algorithm in x509 certificate
...
Signed-off-by: Marek Jansta <jansta@2n.cz >
2023-06-19 12:49:27 +02:00
Dave Rodgman
086e137dc4
code style
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com >
2023-06-16 20:21:39 +01:00
Dave Rodgman
96a9e6a9dd
Address test review comments
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com >
2023-06-16 20:18:36 +01:00
Dave Rodgman
e1dd6e9e8f
Merge remote-tracking branch 'origin/development' into prefer-intrinsics
2023-06-16 17:46:16 +01:00
Dave Rodgman
4ad81ccdae
Only force O2 when hw acceleration available
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com >
2023-06-16 15:04:04 +01: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
Dave Rodgman
b2814bd089
Only enable gcc -Os fix if we have AES hw support
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com >
2023-06-16 14:50:33 +01:00
Dave Rodgman
73b0c0b051
Improve comment
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com >
2023-06-16 14:48:14 +01:00
Przemek Stekiel
f595c5b69a
Use valid guard for filling group list with EC groups
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com >
2023-06-16 15:45:37 +02:00
Dave Rodgman
bd1add94c0
Respect -Os for everything except XTS
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com >
2023-06-16 13:50:14 +01:00
Minos Galanakis
de87461c23
ecp_curves: Updated the optimised reduction function pointer.
...
This patch modifies the `mbedtls_mpi_opt_red_struct` to use an
mpi_uint * pointer and size_t limps arguments.
The methods interacting with this pointer have been updated
accordingly:
- mbedtls_mpi_mod_optred_modulus_setup
- mbedtls_ecp_modulus_setup
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com >
2023-06-16 13:48:47 +01:00
Minos Galanakis
5c238d80cd
bignum_mod: Updated documentation.
...
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com >
2023-06-16 13:48:47 +01:00
Minos Galanakis
65210952ec
ecp_curves: Updated mbedtls_ecp_modulus_setup to use optimised reduction.
...
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com >
2023-06-16 13:48:47 +01:00
Minos Galanakis
1d3e332986
ecp_curves: Updated input argument for mbedtls_ecp_modulus_setup.
...
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com >
2023-06-16 13:48:47 +01:00
Minos Galanakis
be1bf15f76
bignum_mod: Updated optred_modulus_setup to use function input.
...
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com >
2023-06-16 13:48:47 +01:00
Minos Galanakis
c6e68ed85d
bignum_mod: Added mbedtls_mpi_opt_red_struct structure.
...
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com >
2023-06-16 13:48:47 +01:00
Minos Galanakis
0f718c9ed0
bignum_mod: Fixed code-style
...
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com >
2023-06-16 13:48:47 +01:00
Minos Galanakis
f055ad61dc
bignum_mod: Added static standard_modulus_setup().
...
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com >
2023-06-16 13:48:47 +01:00
Minos Galanakis
88e16dfa2a
bignum_mod: Refactored mbedtls_mpi_mod_modulus_setup()
...
This patch removes the `int_rep` input parameter for modular
setup, aiming to align it with the optred variant.
Test and test-suite helper functions have been updated
accordingly.
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com >
2023-06-16 13:48:47 +01:00
Minos Galanakis
bbe9db4b29
binum_mod: Added mbedtls_mpi_mod_optred_modulus_setup().
...
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com >
2023-06-16 13:48:47 +01: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
Steve Lhomme
eb0f18acbc
Don't use inet_pton() before Windows Vista
...
On runtime it will attempt to get inet_pton() from ws2_32.dll
but it's not there and the DLL/program containing mbedtls will not load.
Signed-off-by: Steve Lhomme <robux4@ycbcr.xyz >
2023-06-16 14:34:11 +02:00
Steve Lhomme
d50a8cc77c
Don't force the default windows version down
...
The _WIN32_WINNT value will pick the default value for the SDK when
including windows.h.
Signed-off-by: Steve Lhomme <robux4@ycbcr.xyz >
2023-06-16 14:34:11 +02:00
Steve Lhomme
954553f5b1
Don't call wincrypt on builds older than Windows XP
...
On runtime it will attempt to get CryptAcquireContext() from advapi32.dll
but it's not there and the DLL/program containing mbedtls will not load.
Signed-off-by: Steve Lhomme <robux4@ycbcr.xyz >
2023-06-16 14:34:11 +02:00
Dave Rodgman
e07c670e47
Allow all.sh to override intrinsics vs asm selection
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com >
2023-06-16 13:21:28 +01:00
Valerio Setti
b46217d5c1
tls: never destroy a priavte key that is not owned/created by TLS module
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no >
2023-06-16 13:18:52 +02: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
Valerio Setti
0813b6f28d
tls: optimize code in ssl_get_ecdh_params_from_cert()
...
When MBEDTLS_PK_USE_PSA_EC_DATA is defined, opaque and non-opaque keys
are basically stored in the same way (only a diffferent ownership for
the key itself), so they should be treated similarly in the code.
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no >
2023-06-16 12:18:53 +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
Dave Rodgman
9bb7e6f4ce
Rename MBEDTLS_OPTIMIZE_ALWAYS
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com >
2023-06-16 09:41:21 +01:00
Dave Rodgman
48fd2ab5d5
Improve readability of unrolled AESCE code
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com >
2023-06-16 09:36:50 +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
Dave Rodgman
2dd15b3ab5
code style
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com >
2023-06-15 20:27:53 +01:00
Dave Rodgman
660cd378e1
Use MBEDTLS_OPTIMIZE_ALWAYS for gcm
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com >
2023-06-15 18:53:35 +01:00
Dave Rodgman
9149c32192
Use MBEDTLS_OPTIMIZE_ALWAYS for ccm
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com >
2023-06-15 18:50:21 +01:00
Dave Rodgman
f88a68cf51
Use MBEDTLS_OPTIMIZE_ALWAYS in aesce
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com >
2023-06-15 18:46:41 +01:00
Dave Rodgman
6cfd9b54ae
use MBEDTLS_OPTIMIZE_ALWAYS in AES-XTS
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com >
2023-06-15 18:46:23 +01:00
Dave Rodgman
a0b166e11e
Use mbedtls_xor_no_simd from cmac and cbc
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com >
2023-06-15 18:44:16 +01:00