Dave Rodgman
1b8a3b16c4
Add casts for enums in cipher.c
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-24 17:33:14 +01:00
Dave Rodgman
2e8f6aabc2
Fix direct use of cipher_info->type
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-24 17:32:18 +01:00
Dave Rodgman
ef2f3697ec
Fix direct reference to cipher_info->key_bitlen
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-24 17:31:08 +01:00
Dave Rodgman
e59b9d44b1
Fix some compiler type warnings
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-24 16:53:13 +01:00
Dave Rodgman
77049b8b6c
Dependency fixes
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-24 14:39:47 +01:00
Dave Rodgman
85a88133aa
Use fewer bits for block_size
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-24 13:37:28 +01:00
Dave Rodgman
3b46b77cf1
code style
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-24 13:37:28 +01:00
Dave Rodgman
de3de773e6
Use look-up table for base
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-24 12:59:31 +01:00
Dave Rodgman
0ffb68ee3f
Use fewer bits for iv_size
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-24 12:59:31 +01:00
Dave Rodgman
bb521fdbc9
Don't directly access iv_size
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-24 12:59:31 +01:00
Dave Rodgman
6c6c84212e
Use fewer bits for key_bitlen
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-24 11:14:34 +01:00
Dave Rodgman
9282d4f13a
Don't directly access key_bitlen
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-24 11:07:40 +01:00
Dave Rodgman
3319ae9679
Re-order mbedtls_cipher_info_t
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-24 10:55:04 +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
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
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
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