Skip to content

Commit eef2a2e

Browse files
Merge pull request #9841 from gilles-peskine-arm/psa-storage-test-cases-never-supported-positive-dev
Switch generate_psa_test.py to automatic dependencies for positive test cases
2 parents 272ba23 + 49e48ef commit eef2a2e

File tree

11 files changed

+9
-64
lines changed

11 files changed

+9
-64
lines changed

Makefile

+6-3
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,14 @@ tests: mbedtls_test
4949
mbedtls_test:
5050
$(MAKE) -C tests mbedtls_test
5151

52-
library/%:
52+
.PHONY: FORCE
53+
FORCE:
54+
55+
library/%: FORCE
5356
$(MAKE) -C library $*
54-
programs/%:
57+
programs/%: FORCE
5558
$(MAKE) -C programs $*
56-
tests/%:
59+
tests/%: FORCE
5760
$(MAKE) -C tests $*
5861

5962
.PHONY: generated_files

configs/ext/crypto_config_profile_medium.h

-6
Original file line numberDiff line numberDiff line change
@@ -198,12 +198,6 @@
198198
//#define PSA_WANT_ECC_MONTGOMERY_255 1
199199
//#define PSA_WANT_ECC_MONTGOMERY_448 1
200200
//#define PSA_WANT_ECC_SECP_K1_192 1
201-
/*
202-
* SECP224K1 is buggy via the PSA API in Mbed TLS
203-
* (https://github.com/Mbed-TLS/mbedtls/issues/3541). Thus, do not enable it by
204-
* default.
205-
*/
206-
//#define PSA_WANT_ECC_SECP_K1_224 1
207201
//#define PSA_WANT_ECC_SECP_K1_256 1
208202
//#define PSA_WANT_ECC_SECP_R1_192 1
209203
//#define PSA_WANT_ECC_SECP_R1_224 1

include/mbedtls/check_config.h

-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
defined(MBEDTLS_PSA_ACCEL_ECC_MONTGOMERY_255) || \
4444
defined(MBEDTLS_PSA_ACCEL_ECC_MONTGOMERY_448) || \
4545
defined(MBEDTLS_PSA_ACCEL_ECC_SECP_K1_192) || \
46-
defined(MBEDTLS_PSA_ACCEL_ECC_SECP_K1_224) || \
4746
defined(MBEDTLS_PSA_ACCEL_ECC_SECP_K1_256) || \
4847
defined(MBEDTLS_PSA_ACCEL_ECC_SECP_R1_192) || \
4948
defined(MBEDTLS_PSA_ACCEL_ECC_SECP_R1_224) || \

library/ssl_tls.c

-3
Original file line numberDiff line numberDiff line change
@@ -6251,9 +6251,6 @@ static const struct {
62516251
#if defined(PSA_WANT_ECC_SECP_R1_224)
62526252
{ 21, MBEDTLS_ECP_DP_SECP224R1, PSA_ECC_FAMILY_SECP_R1, 224 },
62536253
#endif
6254-
#if defined(PSA_WANT_ECC_SECP_K1_224)
6255-
{ 20, MBEDTLS_ECP_DP_SECP224K1, PSA_ECC_FAMILY_SECP_K1, 224 },
6256-
#endif
62576254
#if defined(PSA_WANT_ECC_SECP_R1_192)
62586255
{ 19, MBEDTLS_ECP_DP_SECP192R1, PSA_ECC_FAMILY_SECP_R1, 192 },
62596256
#endif

programs/ssl/ssl_test_lib.c

-5
Original file line numberDiff line numberDiff line change
@@ -518,11 +518,6 @@ static const struct {
518518
#else
519519
{ MBEDTLS_SSL_IANA_TLS_GROUP_SECP224R1, "secp224r1", 0 },
520520
#endif
521-
#if defined(MBEDTLS_ECP_DP_SECP224K1_ENABLED) || defined(PSA_WANT_ECC_SECP_K1_224)
522-
{ MBEDTLS_SSL_IANA_TLS_GROUP_SECP224K1, "secp224k1", 1 },
523-
#else
524-
{ MBEDTLS_SSL_IANA_TLS_GROUP_SECP224K1, "secp224k1", 0 },
525-
#endif
526521
#if defined(MBEDTLS_ECP_DP_SECP192R1_ENABLED) || defined(PSA_WANT_ECC_SECP_R1_192)
527522
{ MBEDTLS_SSL_IANA_TLS_GROUP_SECP192R1, "secp192r1", 1 },
528523
#else

scripts/config.py

+1-11
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,8 @@ def realfull_adapter(_name, _value, _active):
6060
'PSA_WANT_KEY_TYPE_RSA_KEY_PAIR'
6161
])
6262

63-
PSA_UNSTABLE_FEATURE = frozenset([
64-
'PSA_WANT_ECC_SECP_K1_224'
65-
])
66-
6763
EXCLUDE_FROM_CRYPTO = PSA_UNSUPPORTED_FEATURE | \
68-
PSA_DEPRECATED_FEATURE | \
69-
PSA_UNSTABLE_FEATURE
64+
PSA_DEPRECATED_FEATURE
7065

7166
# The goal of the full configuration is to have everything that can be tested
7267
# together. This includes deprecated or insecure options. It excludes:
@@ -114,7 +109,6 @@ def realfull_adapter(_name, _value, _active):
114109
'MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE', # only relevant for embedded devices
115110
*PSA_UNSUPPORTED_FEATURE,
116111
*PSA_DEPRECATED_FEATURE,
117-
*PSA_UNSTABLE_FEATURE
118112
])
119113

120114
def is_seamless_alt(name):
@@ -367,8 +361,6 @@ def set(self, name, value='1'):
367361

368362
if name in PSA_UNSUPPORTED_FEATURE:
369363
raise ValueError(f'Feature is unsupported: \'{name}\'')
370-
if name in PSA_UNSTABLE_FEATURE:
371-
raise ValueError(f'Feature is unstable: \'{name}\'')
372364

373365
if name not in self.settings:
374366
self._get_configfile().templates.append((name, '', '#define ' + name + ' '))
@@ -417,8 +409,6 @@ def set(self, name, value=None):
417409
if configfile == self.crypto_configfile:
418410
if name in PSA_UNSUPPORTED_FEATURE:
419411
raise ValueError(f'Feature is unsupported: \'{name}\'')
420-
if name in PSA_UNSTABLE_FEATURE:
421-
raise ValueError(f'Feature is unstable: \'{name}\'')
422412

423413
# The default value in the crypto config is '1'
424414
if not value and re.match(self._crypto_regexp, name):

tests/Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ generated_psa_test_data: ../framework/scripts/mbedtls_framework/crypto_knowledge
127127
generated_psa_test_data: ../framework/scripts/mbedtls_framework/macro_collector.py
128128
generated_psa_test_data: ../framework/scripts/mbedtls_framework/psa_information.py
129129
generated_psa_test_data: ../framework/scripts/mbedtls_framework/psa_storage.py
130+
generated_psa_test_data: ../framework/scripts/mbedtls_framework/psa_test_case.py
130131
generated_psa_test_data: ../framework/scripts/mbedtls_framework/test_case.py
131132
generated_psa_test_data: ../framework/scripts/mbedtls_framework/test_data_generation.py
132133
## The generated file only depends on the options that are present in

tests/scripts/analyze_outcomes.py

-22
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,6 @@ def _has_word_re(words: typing.Iterable[str],
132132
'Config: PSA_WANT_ALG_CBC_MAC',
133133
# Algorithm declared but not supported.
134134
'Config: PSA_WANT_ALG_XTS',
135-
# Family declared but not supported.
136-
'Config: PSA_WANT_ECC_SECP_K1_224',
137135
# More granularity of key pair type enablement macros
138136
# than we care to test.
139137
# https://github.com/Mbed-TLS/mbedtls/issues/9590
@@ -200,16 +198,6 @@ def _has_word_re(words: typing.Iterable[str],
200198
# https://github.com/Mbed-TLS/mbedtls/issues/9592
201199
re.compile(r'.*ECDSA.*only deterministic supported'),
202200
],
203-
'test_suite_psa_crypto_generate_key.generated': [
204-
# Ignore mechanisms that are not implemented, except
205-
# for public keys for which we always test that
206-
# psa_generate_key() returns PSA_ERROR_INVALID_ARGUMENT
207-
# regardless of whether the specific key type is supported.
208-
_has_word_re((mech
209-
for mech in _PSA_MECHANISMS_NOT_IMPLEMENTED
210-
if not mech.startswith('ECC_PUB')),
211-
exclude=r'ECC_PUB'),
212-
],
213201
'test_suite_psa_crypto_metadata': [
214202
# Algorithms declared but not supported.
215203
# https://github.com/Mbed-TLS/mbedtls/issues/9579
@@ -223,10 +211,6 @@ def _has_word_re(words: typing.Iterable[str],
223211
'MAC: CBC_MAC-AES-256',
224212
],
225213
'test_suite_psa_crypto_not_supported.generated': [
226-
# It is a bug that not-supported test cases aren't getting
227-
# run for never-implemented key types.
228-
# https://github.com/Mbed-TLS/mbedtls/issues/7915
229-
PSA_MECHANISM_NOT_IMPLEMENTED_SEARCH_RE,
230214
# We never test with DH key support disabled but support
231215
# for a DH group enabled. The dependencies of these test
232216
# cases don't really make sense.
@@ -265,12 +249,6 @@ def _has_word_re(words: typing.Iterable[str],
265249
# https://github.com/Mbed-TLS/mbedtls/issues/9592
266250
'PSA sign DETERMINISTIC_ECDSA(SHA_256): !ECDSA but DETERMINISTIC_ECDSA with ECC_KEY_PAIR(SECP_R1)', #pylint: disable=line-too-long
267251
],
268-
'test_suite_psa_crypto_storage_format.current': [
269-
PSA_MECHANISM_NOT_IMPLEMENTED_SEARCH_RE,
270-
],
271-
'test_suite_psa_crypto_storage_format.v0': [
272-
PSA_MECHANISM_NOT_IMPLEMENTED_SEARCH_RE,
273-
],
274252
'tls13-misc': [
275253
# Disabled due to OpenSSL bug.
276254
# https://github.com/openssl/openssl/issues/10714

tests/ssl-opt.sh

-7
Original file line numberDiff line numberDiff line change
@@ -2690,13 +2690,6 @@ requires_config_enabled PSA_WANT_ECC_BRAINPOOL_P_R1_256
26902690
run_test_psa_force_curve "brainpoolP256r1"
26912691
requires_config_enabled PSA_WANT_ECC_SECP_R1_224
26922692
run_test_psa_force_curve "secp224r1"
2693-
## SECP224K1 is buggy via the PSA API
2694-
## (https://github.com/Mbed-TLS/mbedtls/issues/3541),
2695-
## so it is disabled in PSA even when it's enabled in Mbed TLS.
2696-
## The proper dependency would be on PSA_WANT_ECC_SECP_K1_224 but
2697-
## dependencies on PSA symbols in ssl-opt.sh are not implemented yet.
2698-
#requires_config_enabled PSA_WANT_ECC_SECP_K1_224
2699-
#run_test_psa_force_curve "secp224k1"
27002693
requires_config_enabled PSA_WANT_ECC_SECP_R1_192
27012694
run_test_psa_force_curve "secp192r1"
27022695
requires_config_enabled PSA_WANT_ECC_SECP_K1_192

tests/suites/test_suite_ssl.function

-5
Original file line numberDiff line numberDiff line change
@@ -3595,11 +3595,6 @@ void elliptic_curve_get_properties()
35953595
#else
35963596
TEST_UNAVAILABLE_ECC(21, MBEDTLS_ECP_DP_SECP224R1, PSA_ECC_FAMILY_SECP_R1, 224);
35973597
#endif
3598-
#if defined(PSA_WANT_ECC_SECP_K1_224)
3599-
TEST_AVAILABLE_ECC(20, MBEDTLS_ECP_DP_SECP224K1, PSA_ECC_FAMILY_SECP_K1, 224);
3600-
#else
3601-
TEST_UNAVAILABLE_ECC(20, MBEDTLS_ECP_DP_SECP224K1, PSA_ECC_FAMILY_SECP_K1, 224);
3602-
#endif
36033598
#if defined(PSA_WANT_ECC_SECP_R1_192)
36043599
TEST_AVAILABLE_ECC(19, MBEDTLS_ECP_DP_SECP192R1, PSA_ECC_FAMILY_SECP_R1, 192);
36053600
#else

0 commit comments

Comments
 (0)