Skip to content

Commit

Permalink
Merge pull request #9067 from gilles-peskine-arm/ssl-opt-server2-dete…
Browse files Browse the repository at this point in the history
…ction

Fix skipped tests in configurations without RSA
  • Loading branch information
gilles-peskine-arm authored May 15, 2024
2 parents f5761ff + fc73aa0 commit bdce657
Show file tree
Hide file tree
Showing 5 changed files with 200 additions and 127 deletions.
2 changes: 2 additions & 0 deletions ChangeLog.d/pk-norsa-warning.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Bugfix
* Fix a compilation warning in pk.c when PSA is enabled and RSA is disabled.
5 changes: 5 additions & 0 deletions docs/driver-only-builds.md
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,11 @@ The same holds for the associated algorithm:
`[PSA_WANT|MBEDTLS_PSA_ACCEL]_ALG_FFDH` allow builds accelerating FFDH and
removing builtin support (i.e. `MBEDTLS_DHM_C`).

Note that the PSA API only supports FFDH with RFC 7919 groups, whereas the
Mbed TLS legacy API supports custom groups. As a consequence, the TLS layer
of Mbed TLS only supports DHE cipher suites if built-in FFDH
(`MBEDTLS_DHM_C`) is present, even when `MBEDTLS_USE_PSA_CRYPTO` is enabled.

RSA
---

Expand Down
3 changes: 1 addition & 2 deletions library/pk.c
Original file line number Diff line number Diff line change
Expand Up @@ -868,7 +868,6 @@ static int copy_from_psa(mbedtls_svc_key_id_t key_id,
psa_status_t status;
psa_key_attributes_t key_attr = PSA_KEY_ATTRIBUTES_INIT;
psa_key_type_t key_type;
psa_algorithm_t alg_type;
size_t key_bits;
/* Use a buffer size large enough to contain either a key pair or public key. */
unsigned char exp_key[PSA_EXPORT_KEY_PAIR_OR_PUBLIC_MAX_SIZE];
Expand Down Expand Up @@ -899,7 +898,6 @@ static int copy_from_psa(mbedtls_svc_key_id_t key_id,
key_type = PSA_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR(key_type);
}
key_bits = psa_get_key_bits(&key_attr);
alg_type = psa_get_key_algorithm(&key_attr);

#if defined(MBEDTLS_RSA_C)
if ((key_type == PSA_KEY_TYPE_RSA_KEY_PAIR) ||
Expand All @@ -919,6 +917,7 @@ static int copy_from_psa(mbedtls_svc_key_id_t key_id,
goto exit;
}

psa_algorithm_t alg_type = psa_get_key_algorithm(&key_attr);
mbedtls_md_type_t md_type = MBEDTLS_MD_NONE;
if (PSA_ALG_GET_HASH(alg_type) != PSA_ALG_ANY_HASH) {
md_type = mbedtls_md_type_from_psa_alg(alg_type);
Expand Down
6 changes: 6 additions & 0 deletions tests/scripts/analyze_outcomes.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,12 @@ def do_analyze_driver_vs_reference(results: Results, outcomes: Outcomes, args) -
'bignum.generated', 'bignum.misc',
],
'ignored_tests': {
'ssl-opt': [
# DHE support in TLS 1.2 requires built-in MBEDTLS_DHM_C
# (because it needs custom groups, which PSA does not
# provide), even with MBEDTLS_USE_PSA_CRYPTO.
re.compile(r'PSK callback:.*\bdhe-psk\b.*'),
],
'test_suite_platform': [
# Incompatible with sanitizers (e.g. ASan). If the driver
# component uses a sanitizer but the reference component
Expand Down
Loading

0 comments on commit bdce657

Please sign in to comment.