1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-07-02 20:42:25 +03:00
Commit Graph

18895 Commits

Author SHA1 Message Date
764c2d3013 PSA test case generation: dependency inference class: operation fail
Use psa_information.TestCase for operation failure test cases.

This changes the generated output in two ways:

* Not-implemented mechanisms now have a `DEPENDENCY_NOT_IMPLEMENTED_YET_xxx`
  dependency in addition to the never-fulfilled `PSA_WANT_xxx` dependency.
  This does not affect when test cases run.
* ECC test cases now have correct dependency symbols, e.g.
  `PSA_WANT_ECC_SECP_R1_192` instead of `PSA_WANT_ECC_FAMILY_SECP_R1`. This
  is a bug fix: ECC test cases were formerly never executed because of
  incorrect dependency symbols.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-04-11 22:00:54 +02:00
1ae57ec203 PSA test case generation: dependency inference class: key not supported
Use psa_information.TestCase for not-supported test cases for key import and
generation.

No change to the generated output.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-04-11 22:00:54 +02:00
6281cf432f PSA test case generation: dependency inference class: key generation
Use psa_information.TestCase for positive test cases for key generation.

The caller remains responsible for tweaking dependencies for some key
types (public keys for which the test is a negative case, RSA which requires
an additional dependency).

No change to the generated output.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-04-11 22:00:54 +02:00
d3286af1b7 hack_dependencies_not_implemented: apply to positive test cases
In automatically generated PSA test cases, annotate the test cases that are
expected to be never executed due to a dependency that is not implemented.
This was already done for not-supported test cases and for key generation,
but not for positive test cases of key usage.

You can audit which mechanisms are detected as not-implemented with
```
grep -hEo 'DEPENDENCY_NOT_IMPLEMENTED_YET_\w+' tests/suites/*.data | sort -u
```

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-04-11 22:00:54 +02:00
c113b42fc1 hack_dependencies_not_implemented: Also read inferred PSA_WANT symbols
To determine PSA mechanisms that are not implemented, also read PSA_WANT
symbols that cannot (or are not intended to) be configured independently,
and thus are not listed in psa/crypto_config.h. Find those symbols in
the config adjustment header mbedtls/config_psa.h.

No impact on generated files yet, because hack_dependencies_not_implemented
is currently only used on key types that have explicit dependencies. This
will allow using hack_dependencies_not_implemented in other places, for
example to handle algorithm variants like PSA_WANT_ALG_ECDSA_ANY which is
inferred from PSA_WANT_ALG_ECDSA.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-04-11 22:00:54 +02:00
c7b58d53fc PSA test case generation: dependency inference class: base case
Create a class for test cases with automatically inferred dependencies,
suitable for PSA crypto API test cases. As of this commit, only basic cases
that use a key are supported. Subsequent commits will address negative tests
and key generation tests that require fancier handling of dependencies.

No change to the generated output.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-04-11 22:00:54 +02:00
c3b261a4fc Sort dependencies in automatically generated PSA test cases
The output is less nice, since it no longer mostly matches the order in
which symbols are used in the test case arguments. But this makes the output
more canonical, so it will be easier to notice if semantic changes occur in
subsequent commits.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-04-11 22:00:54 +02:00
c6fe12a155 hack_dependencies_not_implemented: more verbose indication
Indicate which dependencies are not implemented. This makes it feasible to
audit the not-implemented detection.

The generated test cases that are detected as never-executed now have one or
more `DEPENDENCY_NOT_IMPLEMENTED_YET_PSA_WANT_xxx` instead of a single
`DEPENDENCY_NOT_IMPLEMENTED`. This does not affect when the test cases run.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-04-11 22:00:54 +02:00
9fb48dab2d Remove leftover debugging printf
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-04-11 10:32:02 +02:00
de05197829 compat.sh: properly skip single-DES and DTLS 1.2
Skipping DTLS 1.2 with old versions was already done, but now properly
test support only once and use the results.

Skipping single-DES with new versions is new, but helps finding the right
incantation.

Note that historically, this script's policy was that it's the user's
job to find the right value of -e (EXCLUDE) for their version for
OpenSSL & config. Now it's a weird mix of that and the script doing some
detection and skipping.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-04-10 22:19:01 +02:00
7e5d81d431 compat.sh: no TLS-RSA-WITH-NULL-SHA256 with ssl3
This is officially a 1.2-only ciphersuite, but we also support it with
1.0 and 1.1. However we don't support it with SSLv3 (see definition in
ssl_ciphersuites.c: mininum minor version is 1, that is TLS 1.0).

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-04-10 22:19:01 +02:00
e86e2bc451 compat.sh: properly report skipped tests
Don't just silently continue.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-04-10 12:31:01 +02:00
2e1d2fe875 analyze_outcomes.py: ignore OpenSSL+dtls12+DES
No sure if it'd possible to build a version of OpenSSL that supports
both by tuning the config, but pretty sure improving testing for
single-DES ciphersuites is not the best use of our time in 2024.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-04-10 12:31:01 +02:00
2cd43a7a78 Run compat.sh with non-default ciphers with ssl3 too
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-04-10 12:31:01 +02:00
62910cf47d compat.sh: include ssl3 in --list-test-cases
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-04-10 12:31:01 +02:00
c1685d1c11 compat.sh: use correct names in --list-test-cases
The main fix here is that m->O and m->G should use `M_CIPHERS`. In order
to apply that though, we need to change the structure with a new for
loop and case statement. The new structure matches what's done when
actually running tests.

Note: this issue only exists in 2.28. In 3.x we now use the standard
name for display everywhere, but in 2.28 we use the name as seen by the
client for display.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-04-10 12:31:01 +02:00
826f8da954 compat.sh: fix --list-test-cases for RC4 with DTLS
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-04-10 12:31:01 +02:00
4be89414ab compat.sh: always filter ciphersuites
We always want to call 'filter' regardless of the values of FILTER
and EXCLUDE because it also performs standard-defined filtering like
removing RC4 ciphersuites with DTLS.

(AFAICS, not calling 'filter' when we thought it was not needed was
just a performance optimisation.)

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-04-10 12:29:58 +02:00
c3f5c96a8d Merge pull request #8996 from mpg/fix-wrong-dep-test-case-2.28
[Backport 2.28] Fix wrong dependencies in test cases
2024-04-09 11:34:05 +00:00
1186a1aff3 Fix inconsistency in variable declaration/use
The guards for the declaration and use were not consistent. This could
be resolved either way; I chose the way that matches development.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-04-03 10:03:21 +02:00
70d8fea2dc Finish backporting hits_export_public_key;
A previous commit backported the declaration of this field as part of
conflict resolution in the hope of preventing further conflicts in the
future. But if we backport it we should do it properly. This commit
finishes the job.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-04-03 09:54:49 +02:00
52c2af3ba4 ssl_mail_client: Fix code style issue
Signed-off-by: Mingjie Shen <shen497@purdue.edu>
2024-04-02 17:26:49 -04:00
f5b93c1e95 ssl_mail_client: Check return value of mbedtls_snprintf
The return value of snprintf() is the number of characters (excluding
the null terminator) which would have been written to the buffer if
enough space had been available. Thus, a return value of size or more
means the output was truncated.

Signed-off-by: Mingjie Shen <shen497@purdue.edu>
2024-04-02 17:26:49 -04:00
62d462a487 ssl_mail_client: Replace snprintf with mbedtls_snprintf
Signed-off-by: Mingjie Shen <shen497@purdue.edu>
2024-04-02 17:26:49 -04:00
d3590a8c09 Fix failures in psa_cryto_driver_wrappers suite
- "in-driver" test should depend on the present
  of a driver.
- add new counter in key manangement driver test
  hook which counts the calls of generate_key.
- We only care about the hits when processing
  `psa_generate_key`.

Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-04-02 12:09:32 +02:00
108fe17956 Add missing dependency of fallback test in driver wrappers suite
To pass a fallback test, we need a dependency on built-in
implementation.

Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-04-02 12:09:32 +02:00
57cd7a8292 Add missing definition of AT_LEAST_ONE_BUILTIN_KDF
Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-04-02 12:09:32 +02:00
3ee4e648db Remove dependency on X509(_REMOVE)_INFO
- MBEDTS_X509_INFO is incorrect in all branches: the macro is called
REMOVE_INFO and also starts with MBEDTLS not MBEDTS... this caused the
test to be always skipped.
- !MBEDTLS_X509_REMOVE_INFO is the correct way to express this but info
functions are not optional in the 2.28 branch. Since this is a negative
dependency, I don't think it was causing the test to be skipped, but I'm
removing it anyway for clarity's sake.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-04-02 12:09:32 +02:00
6766a19027 Merge pull request #8875 from stevenwdv/mbedtls-2.28
[backport] Fix compilation on macOS without apple-clang
2024-03-29 13:59:14 +00:00
194e5a2aa0 Merge pull request #1217 from Mbed-TLS/mbedtls-2.28.8-mergeback
Mbedtls 2.28.8 mergeback
2024-03-28 14:30:17 +00:00
5a764e5555 Merge pull request #1214 from Mbed-TLS/mbedtls-2.28.8rc0-pr
Mbedtls 2.28.8 Release Candidate
v2.28.8 mbedtls-2.28.8
2024-03-22 17:26:27 +00:00
c58cb5992c Fix some Changelog typos
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2024-03-22 10:22:18 +00:00
6fe0ae026f Version bump for 2.28.8
./scripts/bump_version.sh --version 2.28.8

Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2024-03-21 17:52:54 +00:00
677b3a22d9 Merge pull request #8956 from mpg/backport-8586
[Backport 2.28] Fix fake cases listed of compat.sh
2024-03-21 15:58:02 +00:00
8698211008 Assemble Changelog
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2024-03-21 15:47:24 +00:00
e262aa95ac Merge branch 'mbedtls-2.28-restricted' into mbedtls-2.28.8rc0-pr
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2024-03-21 15:44:39 +00:00
f438f8f086 Merge pull request #8959 from daverodgman/branches-3.6lts-2.28
Update BRANCHES for 3.6 - 2.28 backport
2024-03-21 13:56:27 +00:00
09ed985bee Remove debugging code
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-03-21 11:07:14 +01:00
ebfcf58dc7 Always list TLS-RSA-WITH-NULL-SHA256, but skip conditionally with GnuTLS
TLS-RSA-WITH-NULL-SHA256 is officially a cipher suite only since TLS 1.2,
but Mbed TLS allows it in 1.0/1.1, and so did ancient versions of GnuTLS.
This script was only considering it for GnuTLS interoperability if the
running version of GnuTLS supported it with older protocol versions.

Change to always considering it, and in particular always including it with
--list-test-cases, but skipping it at runtime if GnuTLS doesn't support it.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-03-21 10:11:16 +01:00
ba2fe3e224 Merge pull request #1210 from Mbed-TLS/dev/minosgalanakis/mbedtls-2.28-restricted-merge-19032024
Merge mbedtls2.28 on restricted 10/03/2024
2024-03-20 18:25:42 +00:00
12f8126594 Replace references to master with main
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2024-03-20 12:40:22 +00:00
ac0b350504 Remove the workarround for G->m dtls12 tests
Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-03-20 11:35:39 +01:00
8fa06dc6fa Align the case listing with case running in compat.sh
Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-03-20 11:35:19 +01:00
d4b3fe7597 Merge branch 'mbedtls-2.28' into 'mbedtls-2.28-restricted' 2024-03-20 09:27:24 +00:00
f7acf91e5f Check C/C++ compilers separately for AppleClang ranlib
Signed-off-by: Steven WdV <swdv@cs.ru.nl>
2024-03-19 11:39:22 +01:00
a8215a604f Merge pull request #8931 from waleed-elmelegy-arm/fix-alpn-nego-bug
Backport 2.28: Fix bug in ALPN loading from serialised session
2024-03-15 15:57:58 +00:00
98ebf488f5 Fix bug in ALPN loading from serialized session
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2024-03-15 14:29:24 +00:00
14b5459faf Fix misspelled dependency: there is no MBEDTLS_PEM_C
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-03-14 18:41:16 +01:00
eb7e2f50ee Fix never-executed key agreement test cases
These test cases were backported from 3.x and use FFDH. 2.28 doesn't have
FFDH. 2.28 doesn't have a key agreement other than ECDH, so use 0 in the
policy, which still allows the key to be created.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-03-14 18:38:58 +01:00
9908b522f6 Remove misspelled unnecessary dependency
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-03-14 18:21:27 +01:00