Commit Graph

7032 Commits

Author SHA1 Message Date
Thomas Daubney
c7cb810c22 Remove MBEDTLS_GCM_ALT
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2024-07-12 16:15:07 +01:00
Thomas Daubney
b4914cfeb5 Remove MBEDTLS_CCM_ALT
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2024-07-12 16:15:04 +01:00
Thomas Daubney
4137609776 Remove MBEDTLS_AES_ALT
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2024-07-12 16:13:37 +01:00
Bence Szépkúti
3f2d9b6a4d
Merge pull request #9268 from tom-daubney-arm/remove_symmetric_crypto_alt_interface
Remove symmetric crypto alt interface
2024-07-12 13:27:04 +00:00
Wenxing Hou
b4d03cc179 Fix some typo for include folder
Signed-off-by: Wenxing Hou <wenxing.hou@intel.com>
2024-07-12 15:16:33 +08:00
Elena Uziunaite
4e6a3681e1 Replace MBEDTLS_MD_CAN_SHA256 in md.h, ssl.h, and entropy.h
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-07-11 11:13:35 +03:00
Thomas Daubney
f60ff02cf3 Remove MBEDTLS_CHACHA20_ALT
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2024-07-11 09:13:28 +01:00
Thomas Daubney
af28a17bb6 Remove MBEDTLS_CHACHAPOLY_ALT
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2024-07-11 09:13:28 +01:00
Thomas Daubney
f7ca94aea6 Remove MBEDTLS_POLY1305_ALT
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2024-07-11 09:13:28 +01:00
Thomas Daubney
9da1769237 Remove MBEDTLS_ECP_ALT and associated options
Also removed are all options of the form
MBEDTLS_ECP_XXX_ALT as well as
MBEDTLS_ECP_NO_FALLBACK.

Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2024-07-05 14:35:10 +01:00
Thomas Daubney
e647d8f77a Remove MBEDTLS_ECJPAKE_ALT
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2024-07-05 14:35:10 +01:00
Thomas Daubney
5edad7f89f Remove MBEDTLS_DHM_ALT
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2024-07-05 14:35:10 +01:00
Thomas Daubney
f47b66eca5 Remove MBEDTLS_RSA_ALT
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2024-07-05 14:35:10 +01:00
Elena Uziunaite
cf5e3dd9f0 Replace MBEDTLS_MD_CAN_SHA384 in md.h and ssl.h
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-07-03 10:20:48 +01:00
Gilles Peskine
868d2524b8 Document that MBEDTLS_PSA_HMAC_DRBG_MD_TYPE does not force HMAC
MBEDTLS_PSA_HMAC_DRBG_MD_TYPE was documented and announced as causing the
PSA DRBG to be HMAC_DRBG. However, that was never actually implemented:
CTR_DRBG is prioritized if enabled.

Since there is a simple workaround of disabling MBEDTLS_CTR_DRBG_C if you
want to use HMAC_DRBG, we have decided to accept the actual behavior and fix
the documentation.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-07-02 16:31:28 +02:00
Ronald Cron
550a18d4d6 Move Mbed TLS crypto headers
Move all the header files (roughly the crypto
and platform ones) necessary to build the
crypto library to
tf-psa-crypto/drivers/builtin/include/mbedtls.

Exceptions:
. some configuration related files that will not
be necessary anymore when the work on the
configuration file(s) is completed.
. build_info.h as TF-PSA-Crypto will have its
own when we had its CMake build system.

For the time being all headers are kept public
but eventually all headers in
tf-psa-crypto/drivers/builtin/include/mbedtls
will be private and the ones that remain
public (e.g. lms.h, pk.h probably ...) will be
moved to tf-psa-crypto/include/tf-psa-crypto/.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-07-01 14:59:35 +02:00
Ronald Cron
f0481f562a
Merge pull request #9258 from tom-daubney-arm/drop_padlock_support
Drop support for VIA Padlock
2024-06-26 07:36:04 +00:00
Thomas Daubney
4e5d183d78 Correct pluralisation errors in comments
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2024-06-25 15:21:48 +01:00
Manuel Pégourié-Gonnard
82658eb90c
Merge pull request #9138 from valeriosetti/issue9126
Do not perform adjustments on legacy crypto from PSA, when MBEDTLS_PSA_CRYPTO_CLIENT && !MBEDTLS_PSA_CRYPTO_C
2024-06-24 07:30:32 +00:00
Thomas Daubney
0d915a90ea Remove final references to padlock
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2024-06-20 16:45:51 +01:00
Ronald Cron
de0d7e6cd0
Merge pull request #9247 from ronald-cron-arm/move-psa-headers
Move PSA headers to a new tf-psa-crypto directory
2024-06-18 18:48:24 +00:00
Valerio Setti
0c0e418d63 config_psa: do not update legacy symbols in client-only PSA build
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-06-14 16:44:12 +02:00
Thomas Daubney
62af02c063 Drop support for VIA Padlock
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2024-06-14 10:37:13 +01:00
Ronald Cron
2581d91fda Adapt libraries installation
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-06-13 09:02:30 +02:00
Ronald Cron
d80134b56d Move PSA headers
Move PSA headers to tf-psa-crypto
directory.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-06-12 15:22:26 +02:00
Sam Berry
3504c88916 Fix incorrect array length in function prototype
Issue #9179 (MBEDTLS_SSL_CID_OUT_LEN_MAX changed to
MBEDTLS_SSL_CID_IN_LEN_MAX in library\ssl.h and library\ssl_tls.c)

Signed-off-by: Sam Berry <sam.berry@arm.com>
2024-06-11 14:46:31 +01:00
Tom Cosgrove
98ffc8e7c3
Merge pull request #9178 from valeriosetti/fix-psa-cmac
adjust_legacy_crypto: enable CIPHER_C when PSA CMAC is builtin
2024-06-03 15:35:32 +00:00
Valerio Setti
351efa0ece crypto.h: fix documentation for some functions
Some functions has input parameters which are erroneously
reported as "param[out]" in the documentation. This commit
fixes them.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-06-03 11:17:37 +02:00
Gilles Peskine
c8d45cd3fc Error on unexpectedly defined symbols
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-05-29 09:44:20 +02:00
Gilles Peskine
9df7806b37 Tweak wording
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-05-29 09:44:20 +02:00
Gilles Peskine
690fb5e0b0 Warn if mbedtls_config.h is included manually
Some projects using Mbed TLS have migrated their configuration
file (config.h -> mbedtls_config.h, or MBEDTLS_CONFIG_FILE) from Mbed TLS
2.x, and kept including check_config.h. This is unnecessary since Mbed TLS
3.0, and increasingly in 3.x it may report spurious errors because the
configuration adjustments have not been done yet.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-05-29 09:44:20 +02:00
Gilles Peskine
0b8ece6beb Error out if *adjust* headers are included manually
Some projects using Mbed TLS have migrated their configuration
file (config.h -> mbedtls_config.h, or MBEDTLS_CONFIG_FILE) from Mbed TLS
2.x, and kept including check_config.h. This is unnecessary since Mbed TLS
3.0, and increasingly in 3.x it may report spurious errors because the
configuration adjustments have not been done yet. This has led some
projects to include configuration adjustment headers manually, but only
partially or in the wrong order, which can result in silent inconsistencies.
Error out if this happens, with a message mentioning check_config.h since
that's the likely root cause.

```
perl -i -pe '$name = $ARGV; $name =~ s!include/!!; $name =~ s!_adjust_.*!_adjust_*.h!; $_ .= "\n#if !defined(MBEDTLS_CONFIG_FILES_READ)\n#error \"Do not include $name manually! This can lead to problems, \" \\\n    \"up to and including runtime errors such as buffer overflows. \" \\\n    \"If you're trying to fix a complaint from check_config.h, just remove it \" \\\n    \"from your configuration file: since Mbed TLS 3.0, it is included \" \\\n    \"automatically at the right time.\"\n#endif /* !MBEDTLS_CONFIG_FILES_READ */\n" if /^#define .*_H$/' include/*/*adjust*.h
```

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-05-29 09:44:20 +02:00
Gilles Peskine
d33eb55cce Macros to indicate the finalization level of the configuration
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-05-29 09:44:20 +02:00
Gilles Peskine
975e74cb1f Document check-config.h and *adjust*.h as internal headers
Including *adjust*.h directly is likely to cause them to be applied at the
wrong time, resulting in an invalid or unintended configuration.

Including check_config.h at the wrong time is likely to cause spurious
errors.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-05-29 09:44:20 +02:00
Valerio Setti
a37ea269a9 adjust_legacy_crypto: enable CIPHER_C when PSA CMAC is builtin
psa_crypto_mac.c uses mbedtls_cipher_xxx() functions to perform
CMAC operations. Therefore we need to enable CIPHER_C when
PSA CMAC is builtin.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-05-24 14:37:05 +02:00
Ronald Cron
b48c8704e6 Fix crypto_adjust_config_dependencies.h documentation
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-05-17 14:34:11 +02:00
Ronald Cron
c4c8bdf32e Fix PBKDF2_AES_CMAC_PRF_128 dependencies
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-05-17 14:34:06 +02:00
Ronald Cron
97f0ea7611 Fix the resolution of dependencies on HMAC
The Mbed TLS implementations of ALG_TLS12_PRF,
ALG_TLS12_PSK_TO_MS, ALG_HKDF, ALG_HKDF_EXTRACT,
ALG_HKDF_EXPAND and ALG_PBKDF2 rely on HMAC
operations through the driver interface. Thus
if one of these algorithms is enabled and not
accelerated, we need ALG_HMAC to be enabled
(PSA_WANT_ALG_HMAC and PSA_WANT_KEY_TYPE_HMAC
defined). As HMAC operations occur through
the driver interface, HMAC operations can be
accelerated even if the caller algorithm
is not.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-05-17 14:33:44 +02:00
Ronald Cron
a33a824d8a Resolve PBKDF2_AES_CMAC_PRF_128 dependencies
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-05-16 08:12:03 +02:00
Ronald Cron
b0c96f47e7 Resolve some HMAC dependencies automatically
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-05-16 08:12:03 +02:00
Valerio Setti
89f5af84af adjust_legacy_crypto: enable ASN1_[PARSE|WRITE]_C when RSA_C
RSA needs ASN1 functions to parse/write private and public keys,
but there is no guards in the code for that. So we need to enable
ASN1 support whenever RSA is enabled.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-04-18 18:47:34 +02:00
Manuel Pégourié-Gonnard
a4b773d3bb
Merge pull request #6955 from inorick/nofa_no_session_tickets
Guard ticket specific TLS 1.3 function with macro
2024-04-08 08:56:17 +00:00
Ronald Cron
fe15d90f72 tls13: Fix doc of mbedtls_ssl_session_set() - 2
Fix documentation of mbedtls_ssl_session_set()
regarding its dependency on MBEDTLS_SSL_SESSION_TICKETS
in TLS 1.3 case.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-04-04 15:52:34 +02:00
Bence Szépkúti
a376f84eb1
Merge pull request #8937 from valeriosetti/issue8712
Clarify the documentation of mbedtls_pk_setup_opaque
2024-04-04 13:40:57 +00:00
Ronald Cron
d85eeae740 tls13: Fix doc of mbedtls_ssl_session_set() - 1
It was eventually decided to not support multiple
tickets in TLS 1.3 ClientHello messages thus
removing the parts in mbedtls_ssl_session_set()
documentation that were anticipating that.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-04-04 15:39:20 +02:00
Ronald Cron
66a206c26c tls13: Fix doc of mbedtls_ssl_session_get() - 2
Fix documentation of mbedtls_ssl_session_get()
regarding its interaction with session
ticket enablement.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-04-04 15:34:22 +02:00
Ronald Cron
81bb589090 tls13: Fix doc of mbedtls_ssl_session_get() - 1
The API has eventually not been changed to
return multiple tickets through multiple
subsequent call to it.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-04-04 15:30:55 +02:00
Ronald Cron
9314df617b tls: Fix doc of mbedtls_ssl_session_save()
Fix documentation of mbedtls_ssl_session_save()
regarding its dependency on MBEDTLS_SSL_SESSION_TICKETS
in TLS 1.3 session case.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-04-04 14:07:50 +02:00
Valerio Setti
1c7f5dea8b pk: fix documentation of mbedtls_pk_setup_opaque()
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-04-04 09:39:12 +02:00
Minos Galanakis
078f823843 Merge pull request #8990 from tom-cosgrove-arm:record-size-limit-support-is-now-released
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2024-03-26 12:32:00 +00:00
Tom Cosgrove
f02c6ef86d Fix typo in psa_key_production_parameters_t doc: 65535 should be 65537
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2024-03-26 12:25:07 +00:00
Tom Cosgrove
1b3b1743f5 Record size limit support is released, so remove warning about only for testing
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2024-03-26 12:23:49 +00:00
Valerio Setti
f9f63edbe4 pk: fix typos in description of mbedtls_pk_setup_opaque()
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-03-25 09:38:05 +01:00
Valerio Setti
ac81e23c33 pk: add check_pair info to mbedtls_pk_setup_opaque() documentation
This also updates use-psa-crypto.md accordingly.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-03-22 14:36:41 +01:00
Minos Galanakis
4492dbd286 Version Bump for 3.6.0
./scripts/bump_version.sh --version 3.6.0 --so-crypto 16 --so-x509 7  --so-tls 21

Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2024-03-22 11:46:25 +00:00
Valerio Setti
42a3954cd3 pk: fix description of mbedtls_pk_setup_opaque for sign_ext()
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-03-21 16:55:24 +01:00
Valerio Setti
fc6b22c95c pk: fix indentation in description of mbedtls_pk_setup_opaque()
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-03-21 16:55:24 +01:00
Valerio Setti
80cd479fe0 pk: fix description of mbedtls_pk_setup_opaque()
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-03-21 16:55:24 +01:00
Valerio Setti
18702d980f pk: update documentation of mbedtls_pk_setup_opaque() based on #8951
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-03-21 16:55:24 +01:00
Valerio Setti
55ed91e0aa pk: fix documentation for mbedtls_pk_setup_opaque()
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-03-21 16:55:24 +01:00
Valerio Setti
622f90597e pk: improve documentation of mbedtls_pk_setup_opaque()
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-03-21 16:55:24 +01:00
Valerio Setti
f5a6e22032 pk: fix documentation for mbedtls_pk_setup_opaque()
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-03-21 16:55:24 +01:00
Minos Galanakis
b70f0fd9a9 Merge branch 'development' into 'development-restricted'
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2024-03-19 22:24:40 +00:00
Manuel Pégourié-Gonnard
af14b89824
Merge pull request #8932 from ronald-cron-arm/enable-tls13-by-default
Enable TLS 1.3 by default
2024-03-19 09:51:49 +00:00
Ronald Cron
27eb68d295 Enable TLS 1.3 by default
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-03-18 13:06:59 +01:00
Dave Rodgman
5ce1577629
Merge pull request #8928 from Ryan-Everett-arm/update-psa-thread-safety-docs
Update psa-thread-safety.md to reflect version 3.6 changes
2024-03-18 12:06:39 +00:00
Paul Elliott
78064ac9e0
Merge pull request #8901 from paul-elliott-arm/make_psa_global_data_safe
Make PSA global_data thread safe
2024-03-15 19:50:01 +00:00
Manuel Pégourié-Gonnard
c9db499299
Merge pull request #8930 from ronald-cron-arm/tls13-doc-update
TLS 1.3: Documentation update for 3.6 release
2024-03-15 16:41:52 +00:00
Ronald Cron
3996ebc037 Fix documentation about anti-replay defenses
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-03-15 15:49:11 +01:00
Ronald Cron
933aec86fd Remove experimental warnings related to early data
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-03-15 14:52:10 +01:00
Bence Szépkúti
567591eec7
Merge pull request #8923 from bensze01/drop-old-compilers
Drop Support for MSVC 2013, 2015 and Arm Compiler 5
2024-03-15 12:56:21 +00:00
Bence Szépkúti
e05b54229f Drop reference to Visual Studio 2013 from config
All supported versions of Visual Studio support AESNI, so drop the
version number.

Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
2024-03-15 12:19:39 +01:00
Ronald Cron
6bee910dbd
Merge pull request #8858 from waleed-elmelegy-arm/add_alpn_to_session
Add ALPN information in session tickets
2024-03-15 09:50:24 +00:00
Ronald Cron
1987a7c068 Document that we do not implement the anti-replay defenses
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-03-15 10:46:04 +01:00
Gilles Peskine
7b333f1e88
Merge pull request #8913 from ronald-cron-arm/tls13-ticket-lifetime
TLS 1.3: Enforce ticket maximum lifetime and discard tickets with 0 lifetime
2024-03-14 15:59:25 +00:00
Ryan Everett
f6f973c235 Document security weakness in concurrent execution of psa_destroy_key
Signed-off-by: Ryan Everett <ryan.everett@arm.com>
2024-03-14 15:54:07 +00:00
David Horstmann
4a48becdba Invert and rename config option
Replace MBEDTLS_PSA_COPY_CALLER_BUFFERS with inverse:
!MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS. This ensures that buffer
protection is enabled by default without any change to the Mbed TLS
config file.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-03-14 14:47:48 +00:00
Manuel Pégourié-Gonnard
93071cfeec
Merge pull request #8920 from valeriosetti/issue8919
Generalize some PK functions from MBEDTLS_PSA_CRYPTO_C to MBEDTLS_PSA_CRYPTO_CLIENT
2024-03-14 11:32:23 +00:00
Waleed Elmelegy
5bc5263b2c Add code improvments and refactoring in dealing with ALPN
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2024-03-13 16:50:01 +00:00
Waleed Elmelegy
883f77cb08 Add mbedtls_ssl_session_set_alpn() function
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2024-03-13 16:50:01 +00:00
Waleed Elmelegy
2824a209bc Add ALPN information in session tickets
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2024-03-13 16:50:01 +00:00
Ronald Cron
40043d03a5
Merge pull request #8884 from ronald-cron-arm/improve-early-data-status
TLS 1.3: CLI: Split early data user status and internal state
2024-03-13 11:59:49 +00:00
Dave Rodgman
60c2f47f98
Merge pull request #8888 from minosgalanakis/features/add_ssl_session_accessor_8529
[MBEDTLS_PRIVATE] Add accessor for session and ciphersuite_id
2024-03-13 10:02:15 +00:00
Paul Elliott
4de4cc4a29
Merge pull request #8891 from Ryan-Everett-arm/document-SE_C-not-threadsafe
Officially document non thread-safety of MBEDTLS_PSA_CRYPTO_SE_C
2024-03-13 09:42:49 +00:00
Valerio Setti
c4c1d3af34 pk: use CRYPTO_CLIENT as guard for PK-PSA bridge functions instead of CRYPTO_C
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-03-13 09:52:36 +01:00
Ronald Cron
840de7ff2f tls13: cli: Rename STATUS_NOT_SENT to STATUS_NOT_INDICATED
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-03-12 17:48:18 +01:00
Ronald Cron
aa3593141b tls13: cli: Move definition of MBEDTLS_SSL_EARLY_DATA_STATE_xyz
Move definition of MBEDTLS_SSL_EARLY_DATA_STATE_xyz
from ssl.h(public) to ssl_misc.h(private) even if
that means we cannot use the enum type for
early_data_state in ssl.h.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-03-12 17:48:18 +01:00
Ronald Cron
894df384f4 tls13: cli: Re-order early data states
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-03-12 17:48:18 +01:00
Ronald Cron
3641df2980 tls13: cli: Rename STATE_SENT to STATE_IND_SENT
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-03-12 17:48:18 +01:00
Ronald Cron
3c5a68339b tls13: cli: Rename STATE_NOT_SENT to STATE_NO_IND_SENT
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-03-12 17:48:18 +01:00
Ronald Cron
0c80dc1ed5 tls13: cli: Rename STATUS_NOT_SENT to STATUS_NO_IND_SENT
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-03-12 17:48:18 +01:00
Ronald Cron
05d7cfbd9c tls13: cli: Rename STATE_UNKNOWN to STATE_IDLE
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-03-12 17:48:18 +01:00
Ronald Cron
d2884662c1 tls13: cli: Split early data user status and internal state
Do not use the return values of
mbedtls_ssl_get_early_data_status()
(MBEDTLS_SSL_EARLY_DATA_STATUS_ macros)
for the state of the negotiation and
transfer of early data during the
handshake.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-03-12 17:48:15 +01:00
Paul Elliott
b8e38e0e27 Add new mutex for PSA global rng data
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2024-03-12 15:36:57 +00:00
Paul Elliott
077fd87748 Add new global mutex for PSA global_data
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2024-03-12 15:36:57 +00:00
David Horstmann
93fa4e1b87 Merge branch 'development' into buffer-sharing-merge 2024-03-12 15:05:06 +00:00
Gilles Peskine
bf69f2e682 New function mbedtls_pk_copy_public_from_psa
Document and implement mbedtls_pk_copy_public_from_psa() to export the
public key of a PSA key into PK.

Unit-test it alongside mbedtls_pk_copy_from_psa().

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-03-12 15:06:45 +01:00
Manuel Pégourié-Gonnard
d7e7f48323
Merge pull request #8774 from valeriosetti/issue8709
Implement mbedtls_pk_copy_from_psa
2024-03-12 13:45:27 +00:00
Manuel Pégourié-Gonnard
fe164aecfc
Merge pull request #8887 from gilles-peskine-arm/pk_import_into_psa-fix_doxygen_code_blocks
Fix intended code blocks that were not suitably indented
2024-03-12 11:27:45 +00:00
Dave Rodgman
9cc01ccbf8
Merge pull request #8831 from yanesca/switch_to_new_exp
Use mpi_core_exp_mod in bignum
2024-03-11 13:40:46 +00:00
Valerio Setti
3b98c640ce pk: fix documentation for mbedtls_pk_copy_from_psa()
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-03-11 11:34:58 +01:00
Valerio Setti
a657ae388a pk: pk_copy_from_psa() performs the conversion even if the algorithm doesn't match
This commit also:
- fixes existing tests and add new ones
- updates documentation.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-03-11 11:34:58 +01:00
Valerio Setti
8fb0fe8e12 pk: fixed documentation of mbedtls_pk_copy_from_psa()
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-03-11 11:34:58 +01:00
Valerio Setti
01ba66d56e pk: replace CRYPTO_CLIENT guards with CRYPTO_C
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-03-11 09:48:40 +01:00
Valerio Setti
070d95e958 pk: add mbedtls_pk_copy_from_psa()
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-03-11 09:47:27 +01:00
Manuel Pégourié-Gonnard
af3e574f5f
Merge pull request #8862 from valeriosetti/issue8825
Improve support of mbedtls_psa_get_random in client-only builds
2024-03-10 20:06:27 +00:00
Jerry Yu
ce79488dd5 tls13: srv: Fail connection if ticket lifetime exceed 7 days
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-03-10 17:42:43 +01:00
Ronald Cron
7e1f9f290f
Merge pull request #8854 from ronald-cron-arm/tls13-srv-max-early-data-size
TLS 1.3: Enforce max_early_data_size on server
2024-03-09 00:16:07 +00:00
Ronald Cron
0050dff6ab ssl_ticket.h: Fix note in API documentation
Since the merge of #8574 it is not the case
anymore that the lifetime of keys is twice
the lifetime of tickets.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-03-08 16:30:26 +01:00
Ryan Everett
32a6458880 Add a warning to the definition of MBEDTLS_PSA_CRYPTO_SE_C
Signed-off-by: Ryan Everett <ryan.everett@arm.com>
2024-03-05 18:16:18 +00:00
Gilles Peskine
71cc260563
Merge pull request #8728 from minosgalanakis/features/add_mbedtls_x509_crt_get_ca_istrue_accesor_6151
[MBEDTLS_PRIVATE] Add mbedtls_x509_crt_get_ca_istrue() accesor
2024-03-05 18:04:06 +00:00
Dave Rodgman
3c4166aef3
Merge pull request #8863 from minosgalanakis/feature/add_ecdh_context_5016
[MBEDTLS_PRIVATE] Add a getter for the ECDH context->grp.id member.
2024-03-05 16:58:13 +00:00
Minos Galanakis
87b4f6d86c x509: Reworded documentation bits.
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2024-03-05 11:05:51 +00:00
Gilles Peskine
8462146d01
Merge pull request #8867 from gilles-peskine-arm/psa_key_attributes-remove_core
Merge psa_core_key_attributes_t back into psa_key_attributes_t
2024-03-05 09:59:24 +00:00
Gilles Peskine
ddbe4ae901 Fix intended code blocks that were not suitably indented
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-03-04 18:30:09 +01:00
Minos Galanakis
40d4708f17 ssl: Added session getter for ciphersuite_id.
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2024-03-04 15:57:41 +00:00
Minos Galanakis
358b448d72 ssl_ciphersuite: Added getter methods for ciphersuite id.
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2024-03-04 15:57:41 +00:00
Minos Galanakis
2c8c364ac2 ssl: Added getter methods for session id and len.
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2024-03-04 15:20:28 +00:00
Gilles Peskine
fad79fcdd9 Merge remote-tracking branch 'development' into ecp-write-ext-3.6
Conflicts:
* library/pk.c: mbedtls_pk_wrap_as_opaque() changed in the feature branch
  and was removed in the target branch.
2024-03-04 08:52:08 +01:00
Minos Galanakis
2abbac74dc x509: Added mbedtls_x509_crt_get_ca_istrue() API accessor.
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2024-03-04 02:22:01 +00:00
Manuel Pégourié-Gonnard
e33b349c90
Merge pull request #8864 from valeriosetti/issue8848
Deprecate or remove mbedtls_pk_wrap_as_opaque
2024-03-01 15:54:32 +00:00
Ronald Cron
19bfe0a631 tls13: Rename early_data_count to total_early_data_size
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-03-01 09:29:16 +01:00
Ronald Cron
26a9811027 ssl: Add early_data_count field
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-03-01 09:03:51 +01:00
Valerio Setti
1a58e9a232 psa_util: change guard for mbedtls_psa_get_random() to CRYPTO_CLIENT
This commit also:
- updates changelog
- add a stub function to be used in component_test_psa_crypto_client()
  test

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-02-29 16:14:29 +01:00
Ronald Cron
9b4e964c2c
Merge pull request #8760 from ronald-cron-arm/tls13-write-early-data
TLS 1.3: Add mbedtls_ssl_write_early_data() API
2024-02-29 14:31:55 +00:00
Minos Galanakis
d753738fc0 echd: Added mbedtls_ecdh_get_grp_id getter.
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2024-02-29 13:31:34 +00:00
Gilles Peskine
b395e74edd mbedtls_ecp_write_key_ext(): make key const
Having a non-const `key` parameter was anotherf defect of
mbedtls_ecp_write_key(). Take this opportunity to fix it.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-02-28 14:18:28 +01:00
Gilles Peskine
04ae479b04 mbedtls_ecp_write_key_ext: document error for no private key set
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-02-28 13:19:42 +01:00
Gilles Peskine
c0f7a8680f mbedtls_ecp_write_key(): deprecate the old function
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-02-28 13:19:42 +01:00
Gilles Peskine
acdc52e154 mbedtls_ecp_write_key_ext(): recommend over the old function in documentation
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-02-28 13:19:42 +01:00
Gilles Peskine
e3fb4ccabf mbedtls_ecp_write_key_ext(): new function
Same as mbedtls_ecp_write_key(), but doesn't require the caller to figure out
the length of the output and possibly distinguish between Weierstrass and
Montgomery curves.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-02-28 13:19:42 +01:00
Manuel Pégourié-Gonnard
7f523bf9eb
Merge pull request #8845 from gilles-peskine-arm/ecp-write-doc-3.6
Document ECP write functions
2024-02-28 11:04:38 +00:00
Gilles Peskine
0eb4e7fb40 Fix code style
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-02-28 10:56:14 +01:00
Gilles Peskine
e92796ef98 Get rid of flags in attributes
The `flags` field in `psa_key_attributes_t` was a general mechanism that
only ever got used for a single flag: to indicate that the `slot_number`
field has been set. We have switched to a dedicated indicator for that, so
we can now remove `flags`.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-02-28 01:56:16 +01:00
Gilles Peskine
972539c241 In attributes, keep track of slot number through a dedicated field
In `psa_key_attributes_t`, keep track of whether `slot_number` has been set
through a dedicated field, rather than using a flag.

This paves the way to removing `flags`, which is not used for anything else.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-02-28 01:49:45 +01:00
Gilles Peskine
2dc2bd7097 Get rid of psa_core_key_attributes_t
The `psa_core_key_attributes_t` structure is no longer used. Remove it.

Switch `psa_key_attributes_t` back to a simple struct, now containing
the fields that were formerly inside its `psa_core_key_attributes_t core`
member. This repairs the build with non-C11 compilers.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-02-28 01:33:49 +01:00
Gilles Peskine
2f107ae000 Don't access psa_key_attributes_t.core
Access the fields of `psa_key_attributes_t` directly rather than through the
`core` field. This makes the `core` field obsolete.

This commit is fully automated:
```
git ls-files '*.h' '*.c' '*.function' '*.jinja' | xargs perl -l -i -pe '$core = qr/\b(core\b|MBEDTLS_PRIVATE\(core\))/; s/->$core\./->/g; s/&(\w+)\.$core\./&$1./g; s/(\w+)\.$core/$1/g'
```

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-02-28 01:30:24 +01:00
Gilles Peskine
7fad3ef3b5 Switch key slots to psa_key_attributes_t
Switch `psa_key_slot_t` to the full `psa_key_attributes_t`, now that this
structure only has psa_core_key_attributes_t`.

To minimize the diff without breaking the build much, temporarily make
`psa_key_attributes_t` contain either the `core` field or all the fields.
This allows both things like `slot->attr.core.type` and `slot->attr.type`
to exist. The build breaks with compilers that don't support anonymous
unions and structs, which are only standard C since C11.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-02-28 01:30:24 +01:00
Gilles Peskine
0f40a41cea psa_key_attributes_t: move slot_number to core structure
Move the `slot_number` field of `psa_key_attributes_t` to
`psa_core_key_attributes_t`. This makes ``psa_core_key_attributes_t` core`
the sole field of `psa_key_attributes_t`. This paves the way to unifying
the two structures.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-02-28 01:29:43 +01:00
Valerio Setti
88ae0ef286 pk: completely remove mbedtls_pk_wrap_as_opaque
Remove instead of deprecating it.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-02-27 13:49:42 +01:00
Manuel Pégourié-Gonnard
5b5faf0898
Merge pull request #8844 from davidhorstmann-arm/restore-x509-functions-to-public
Restore some X509 functions to public headers
2024-02-27 10:55:16 +00:00
Valerio Setti
4c6cea549c pk: deprecate mbedtls_pk_wrap_as_opaque()
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-02-27 10:51:03 +01:00
Gilles Peskine
97c0b2f393 Remove domain parameters from psa_key_attributes_t
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-02-26 16:57:30 +01:00
David Horstmann
ef950ccb1d Un-unrestore mbedtls_x509_string_to_names()
Re-restore mbedtls_x509_string_to_names() to public as our example
programs use it, and it is the reverse of mbedtls_x509_dn_gets().

Add a docstring, so that it is a properly documented public function.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-02-26 13:59:43 +00:00
Valerio Setti
a53e7a5cb5 psa: let mbedtls_psa_get_random() always use psa_generate_random()
It means that mbedtls_psa_get_random() goes through the PSA interface
all the times. Fallbacks to CTR_DRBG or HMAC_DRBG are still possible,
but that depends on how the crypto provider is built.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-02-26 12:03:59 +01:00
Gilles Peskine
ae5eb64705 Remove domain parameters from the public API
Only leave deprecated, minimal non-linkable functions.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-02-26 08:50:53 +01:00
Gilles Peskine
6a2c400b8c typo
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-02-26 08:34:06 +01:00
Gilles Peskine
0f63028809
Merge pull request #8815 from gilles-peskine-arm/psa_generate_key_ext-prototype
Introduce psa_generate_key_ext
2024-02-26 07:16:49 +00:00
Tom Cosgrove
817772a6ca
Merge pull request #8716 from mschulz-at-hilscher/feature/gcm_largetable
Use large GCM tables
2024-02-23 16:25:38 +00:00
Ronald Cron
8f1de7e029 tls13: Improve documentation
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-02-22 12:02:39 +01:00