18822 Commits

Author SHA1 Message Date
Tom Cosgrove
7c5160c491
Merge pull request #1273 from gowthamsk-arm/mem-alloc-cleanup-2.28
Backport 2.28: Fix: Memory allocation cleanup in internal crypto api functions
2024-08-19 15:50:30 +01:00
Gowtham Suresh Kumar
d9e16c4870 Free allocated memory where methods were returning without freeing
Signed-off-by: Sam Berry <sam.berry@arm.com>
Signed-off-by: Gowtham Suresh Kumar <gowtham.sureshkumar@arm.com>
2024-08-19 13:22:35 +01:00
Manuel Pégourié-Gonnard
b492272bab
Merge pull request #1262 from mpg/merge-2.28
[2.28] merge public into 2.28-restricted
2024-08-08 12:25:12 +02:00
Manuel Pégourié-Gonnard
55aa72fe21 Merge remote-tracking branch 'public/mbedtls-2.28' into merge-2.28
* public/mbedtls-2.28: (88 commits)
  tests/ssl_helpers: Check that message queue is popped
  Upgrade python dependencies in requirements file
  Fix some typo for include folder
  Adjust TLS protocol cases for 2.28
  Fix copypasta
  Declare the new generated files
  Add generated config tests
  Remove some settings that don't exist in 2.28
  Adjust generate_config_tests.py for 2.28
  Terminology: use "dependencies" for a list of settings
  Terminology: consistently use "setting", not "option"
  Explain why we require TLS client and server simultaneously
  Fix missing negation
  Pacify mypy
  Detect sub-options
  Generate config test cases for single options
  Anchor relative paths
  New test suite to report configuration options
  Recognize that a double-inclusion guard is not a config setting
  Add and update some .gitignore files
  ...
2024-08-08 10:03:24 +02:00
Bence Szépkúti
6c3ad6aa36
Merge pull request #9440 from sezrab/mbedtls_test_ssl_message_queue_pop_info-2.28
[Backport 2.28] tests/ssl_helpers: Check that message queue is popped
2024-08-01 18:38:38 +00:00
Tomás González
a526528de3 tests/ssl_helpers: Check that message queue is popped
mbedtls_test_mock_tcp_recv_msg is currently popping a message
queue and does not check if this was done correctly.

This extra check makes the test more complete/robust.

Signed-off-by: Tomás González <tomasagustin.gonzalezorlando@arm.com>
2024-07-31 17:25:40 +01:00
Gilles Peskine
ea178ddd20
Merge pull request #1258 from gilles-peskine-arm/psa-drbg-no-hmac-document-2.28
Backport 2.28: Document that MBEDTLS_PSA_HMAC_DRBG_MD_TYPE does not force HMAC
2024-07-31 16:47:29 +02:00
Gilles Peskine
e752eaf73a Force MBEDTLS_PSA_HMAC_DRBG_MD_TYPE based on CTR_DRBG
If MBEDTLS_CTR_DRBG_C is enabled, force MBEDTLS_PSA_HMAC_DRBG_MD_TYPE to be
disabled. This resolves the former inconsistency in builds where
MBEDTLS_PSA_HMAC_DRBG_MD_TYPE is explicitly defined but MBEDTLS_CTR_DRBG_C
remains enabled, where PSA called the CTR_DRBG functions but other parts of
the code based assumed that HMAC was in use, in particular error code
conversions (leading to a test failure in test_suite_psa_crypto_init).

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-07-25 18:30:51 +02:00
Gilles Peskine
6b32ac74e7 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-25 18:25:30 +02:00
Paul Elliott
9aa9120b9a
Merge pull request #9387 from eleuzi01/backport-9287-2.28
[Backport 2.28] Fix some typo for include folder
2024-07-17 13:11:22 +00:00
Gilles Peskine
b4167a33fc
Merge pull request #9399 from davidhorstmann-arm/upgrade-python-dependencies-2.28
[Backport 2.28] Upgrade python dependencies in requirements file
2024-07-15 17:15:51 +00:00
David Horstmann
0c3c39e38e Upgrade python dependencies in requirements file
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-07-15 16:39:31 +01:00
Wenxing Hou
20e964f1c6 Fix some typo for include folder
Signed-off-by: Wenxing Hou <wenxing.hou@intel.com>
2024-07-12 11:43:33 +03:00
Gilles Peskine
ff2c049eaf
Merge pull request #9270 from sezrab/silence-2.28
[Backport 2.28] Silence gcc 12.2.0 warning
2024-07-04 14:49:34 +00:00
Ronald Cron
3218ccf6ba
Merge pull request #9316 from gilles-peskine-arm/test_suite_config-booleans-2.28
Backport 2.28: Report configuration settings in the outcome file
2024-07-03 13:09:49 +00:00
Gilles Peskine
a76a6ff8df Adjust TLS protocol cases for 2.28
TLS 1.3 is still experimental and partial, and SSL3 is obsolete, so we don't
expect much coverage about them, in particular we don't expect them to be
the sole supported version. TLS 1.0 and 1.1 exist and we expect good
coverage for them.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-07-01 11:32:33 +02:00
Gilles Peskine
93708fe126 Fix copypasta
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-06-28 19:16:25 +02:00
Gilles Peskine
b19fa4e6c7 Declare the new generated files
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-06-26 20:12:34 +02:00
Gilles Peskine
d33c48b407 Add generated config tests
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-06-26 20:12:22 +02:00
Gilles Peskine
cfba2477e6 Remove some settings that don't exist in 2.28
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-06-26 20:11:59 +02:00
Gilles Peskine
744741bf2c Adjust generate_config_tests.py for 2.28
* Move to the correct location.
* Adjust the package name for auxiliary modules.
* Adjust the hack to import a module from scripts.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-06-26 20:05:10 +02:00
Gilles Peskine
1afb70351e Terminology: use "dependencies" for a list of settings
"Super settings" were effectively the dependencies of a setting, so align on
that terminology.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-06-26 20:03:37 +02:00
Gilles Peskine
5454a84772 Terminology: consistently use "setting", not "option"
The two were used interchangeably. Align on "setting", which is what
config.py uses in its documentation.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-06-26 20:03:32 +02:00
Gilles Peskine
f75c70bb81 Explain why we require TLS client and server simultaneously
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-06-26 20:03:27 +02:00
Gilles Peskine
c08d5bfda7 Fix missing negation
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-06-26 20:03:23 +02:00
Gilles Peskine
556249e134 Pacify mypy
I had accidentally reused a variable name inside the same function. Python
copes but mypy doesn't.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-06-26 20:03:18 +02:00
Gilles Peskine
c79ecea42b Detect sub-options
When option A is only meaningful if option B is enabled, when enumerating
single-option test cases, emit A:B and !A:B rather than A and !A. This way
the "!A" case is actually meaningful.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-06-26 20:03:11 +02:00
Gilles Peskine
693611e532 Generate config test cases for single options
Generate option-on and option-off cases for test_suite_config, for all
boolean options (MBEDTLS_xxx and PSA_WANT_xxx, collected from the mbedtls
and PSA config files).

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-06-26 20:02:49 +02:00
Gilles Peskine
ae27ca9e0a Anchor relative paths
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-06-26 19:52:12 +02:00
Gilles Peskine
14f91c9d89 New test suite to report configuration options
Add a test suite intended to report configuration options in the outcome
file: we're only interested in SKIP vs PASS.

Add a few test cases for some interesting combinations of options. The
selection here is just for illustration purposes, more will be added later.

A subsequent commit will automatically generate test cases for single options.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-06-26 19:49:59 +02:00
Gilles Peskine
41ad6601eb Recognize that a double-inclusion guard is not a config setting
Fix PSA_CRYPTO_CONFIG_H being treated as a configuration setting in
include/psa/crypto_config.h.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-06-26 19:49:46 +02:00
Ronald Cron
9250acc8ef
Merge pull request #9277 from ronald-cron-arm/tree-cleanliness-2.28
[Backport 2.28] Partial backport of #9247
2024-06-18 18:47:57 +00:00
Ronald Cron
eee0736d52 Add and update some .gitignore files
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-06-18 09:48:41 +02:00
Ronald Cron
e3bdbd53ec all.sh: Fix clean-up of Makefiles generated by CMake
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-06-18 09:39:51 +02:00
Gilles Peskine
f514f25f88
Merge pull request #9025 from gilles-peskine-arm/psa-storage-test-cases-never-supported-2.28
Backport 2.28: Fix the detection of not-supported mechanisms in systematically generated PSA tests
2024-06-14 18:23:38 +00:00
Patrick Wildt
ed9a4948b9 Silence gcc 12.2.0 warning
Unfortunately this compiler complains about a variable potentially being
used un-initialized.  Silence the warning by initializing it to a sane
default.

Signed-off-by: Patrick Wildt <pwildt@google.com>
2024-06-14 16:29:47 +01:00
Tom Cosgrove
152983bd76
Merge pull request #9246 from lhuang04/mbedtls_2_28_psk_null_back_port
Set psk to NULL in ssl_psk_remove-backport to 2.28
2024-06-12 12:00:23 +00:00
lhuang04
0a2dd6d4eb Set psk to NULL in ssl_psk_remove-backport to 2.28
Summary:
Back port [PR 9241](https://github.com/Mbed-TLS/mbedtls/pull/9241) to
2.28 branch

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
Signed-off-by: lhuang04 <lhuang04@fb.com>
2024-06-11 13:00:28 -07:00
Gilles Peskine
cd84e806ab
Merge pull request #9204 from gilles-peskine-arm/ssl-test-no-skip-all-2.28
Backport 2.28: ssl-opt.sh, compat.sh: Error out if not executing any tests
2024-06-11 13:59:17 +00:00
Tom Cosgrove
3b5e1d8f78
Merge pull request #9222 from valeriosetti/backport-2.28-fix-psa-doc
[Backport 2.28] fix documentation of psa_hash_compare()
2024-06-03 15:34:26 +00:00
Valerio Setti
e5995e292a 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:46:49 +02:00
Gilles Peskine
5a63e2f25f Select more RSA cipher suites
Filtering on cipher suites that have RSA in their name excludes a few old
RSA-based cipher suites whose name doesn't contain RSA.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-05-31 13:36:55 +02:00
Gilles Peskine
8f5722a971 Fix compat.sh not running any tests on config-mini-tls1_1.h
We were only requesting 3DES cipher suites (which is weirdly restrictive
since the configuration also includes AES), but DES is in the default
exclusion list for compat.sh, so we ended up having no acceptable cipher
suites. Fix this.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-05-30 15:17:28 +02:00
Gilles Peskine
2ca5a68ad3 Enable 3DES with GnuTLS
With GnuTLS servers, 3DES-CBC cipher suites are enabled by default under our
GNUTLS_LEGACY (3.3.8), but disabled by default under more recent versions
including the one we use by default on the CI (3.4.6). Even modern
versions (I checked 3.7.2) support 3DES if explicitly enabled. So
unconditionally enable 3DES-CBC for GnuTLS.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-05-30 15:14:40 +02:00
Gilles Peskine
d2c418932a ssl-opt.sh, compat.sh: Error out if not executing any tests
Alert if all tests are filtered out or skipped: that probably indicates a
test script that set up an unintended configuration or an overly strict
filter. You can pass `--min 0` to bypass this check. You can pass `--min`
with a larger value to require that many test cases to run.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-05-29 20:03:12 +02:00
Gilles Peskine
9ebf9aa448
Merge pull request #9153 from gilles-peskine-arm/oid-limits-2.28
2.28 only: Fix the build without check_config.h (inclusion of limits.h)
2024-05-29 16:14:24 +00:00
Gilles Peskine
a8cd2e6421 Fix the build without check_config.h (inclusion of limits.h)
Including `mbedtls/check_config.h` from `mbedtls/config.h` is optional. If
done, `limits.h` gets included. If not done, we were missing the inclusion
of `limits.h` in several source files. Fix this and add a test build that
doesn't include `mbedtls/check_config.h`.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-05-17 19:00:46 +02:00
Gilles Peskine
b86ce2ee36
Merge pull request #9137 from gilles-peskine-arm/ssl-opt-server2-detection-2.28
Backport 2.28: Fix skipped tests in configurations without RSA
2024-05-15 12:06:42 +00:00
Gilles Peskine
0d16d81264 Add missing dependency that isn't autodetected
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-05-14 12:25:53 +02:00
Gilles Peskine
2b08ba0674 Remove redundant RSA dependency
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-05-14 12:25:43 +02:00