Skip to content

Commit db56a00

Browse files
author
Ben Taylor
committed
remove MBEDTLS_USE_PSA_CRYPTO from tests
Signed-off-by: Ben Taylor <[email protected]>
1 parent 977db0c commit db56a00

File tree

2 files changed

+1
-37
lines changed

2 files changed

+1
-37
lines changed

tests/include/test/psa_crypto_helpers.h

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -368,11 +368,6 @@ uint64_t mbedtls_test_parse_binary_string(data_t *bin_string);
368368
#else /* MBEDTLS_VERSION_MAJOR < 4 */
369369

370370
/** \def USE_PSA_INIT
371-
*
372-
* Call this macro to initialize the PSA subsystem if #MBEDTLS_USE_PSA_CRYPTO
373-
* or #MBEDTLS_SSL_PROTO_TLS1_3 (In contrast to TLS 1.2 implementation, the
374-
* TLS 1.3 one uses PSA independently of the definition of
375-
* #MBEDTLS_USE_PSA_CRYPTO) is enabled and do nothing otherwise.
376371
*
377372
* If the initialization fails, mark the test case as failed and jump to the
378373
* \p exit label.
@@ -384,25 +379,8 @@ uint64_t mbedtls_test_parse_binary_string(data_t *bin_string);
384379
* This is like #PSA_DONE except it does nothing under the same conditions as
385380
* #USE_PSA_INIT.
386381
*/
387-
#if defined(MBEDTLS_USE_PSA_CRYPTO)
388382
#define USE_PSA_INIT() PSA_INIT()
389383
#define USE_PSA_DONE() PSA_DONE()
390-
#elif defined(MBEDTLS_SSL_PROTO_TLS1_3)
391-
/* TLS 1.3 must work without having called psa_crypto_init(), for backward
392-
* compatibility with Mbed TLS <= 3.5 when connecting with a peer that
393-
* supports both TLS 1.2 and TLS 1.3. See mbedtls_ssl_tls13_crypto_init()
394-
* and https://github.com/Mbed-TLS/mbedtls/issues/9072 . */
395-
#define USE_PSA_INIT() ((void) 0)
396-
/* TLS 1.3 may have initialized the PSA subsystem. Shut it down cleanly,
397-
* otherwise Asan and Valgrind would notice a resource leak. */
398-
#define USE_PSA_DONE() PSA_DONE()
399-
#else /* MBEDTLS_USE_PSA_CRYPTO || MBEDTLS_SSL_PROTO_TLS1_3 */
400-
/* Define empty macros so that we can use them in the preamble and teardown
401-
* of every test function that uses PSA conditionally based on
402-
* MBEDTLS_USE_PSA_CRYPTO. */
403-
#define USE_PSA_INIT() ((void) 0)
404-
#define USE_PSA_DONE() ((void) 0)
405-
#endif /* !MBEDTLS_USE_PSA_CRYPTO && !MBEDTLS_SSL_PROTO_TLS1_3 */
406384

407385
/** \def MD_PSA_INIT
408386
*
@@ -452,10 +430,6 @@ uint64_t mbedtls_test_parse_binary_string(data_t *bin_string);
452430

453431

454432
/** \def MD_OR_USE_PSA_INIT
455-
*
456-
* Call this macro to initialize the PSA subsystem if MD uses a driver,
457-
* or if #MBEDTLS_USE_PSA_CRYPTO or #MBEDTLS_SSL_PROTO_TLS1_3 is enabled,
458-
* and do nothing otherwise.
459433
*
460434
* If the initialization fails, mark the test case as failed and jump to the
461435
* \p exit label.
@@ -544,19 +518,11 @@ uint64_t mbedtls_test_parse_binary_string(data_t *bin_string);
544518

545519
/* Helper macro for the PK module to check whether MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE
546520
* is large enough to contain 4096-bit RSA key pairs. Of course this check is only
547-
* necessary if PK relies on PSA (i.e. MBEDTLS_USE_PSA_CRYPTO) to store and manage
521+
* necessary if PK relies on PSA to store and manage
548522
* the key. */
549-
#if defined(MBEDTLS_USE_PSA_CRYPTO)
550-
551523
#if !defined(MBEDTLS_PSA_STATIC_KEY_SLOTS) || \
552524
defined(MBEDTLS_TEST_STATIC_KEY_SLOTS_SUPPORT_RSA_4096)
553525
#define MBEDTLS_TEST_PK_ALLOW_RSA_KEY_PAIR_4096
554526
#endif
555527

556-
#else /* MBEDTLS_USE_PSA_CRYPTO */
557-
558-
#define MBEDTLS_TEST_PK_ALLOW_RSA_KEY_PAIR_4096
559-
560-
#endif /* MBEDTLS_USE_PSA_CRYPTO */
561-
562528
#endif /* PSA_CRYPTO_HELPERS_H */

tests/src/psa_exercise_key.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1430,7 +1430,6 @@ int mbedtls_test_key_consistency_psa_pk(mbedtls_svc_key_id_t psa_key,
14301430
break;
14311431
#endif /* PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY && !MBEDTLS_PK_USE_PSA_EC_DATA */
14321432

1433-
#if defined(MBEDTLS_USE_PSA_CRYPTO)
14341433
case MBEDTLS_PK_OPAQUE:
14351434
PSA_ASSERT(psa_get_key_attributes(pk->priv_id, &pk_attributes));
14361435
psa_key_type_t pk_psa_type = psa_get_key_type(&pk_attributes);
@@ -1442,7 +1441,6 @@ int mbedtls_test_key_consistency_psa_pk(mbedtls_svc_key_id_t psa_key,
14421441
&pk_public_length));
14431442
pk_public = pk_public_buffer;
14441443
break;
1445-
#endif /* MBEDTLS_USE_PSA_CRYPTO */
14461444

14471445
default:
14481446
TEST_FAIL("pk type not supported");

0 commit comments

Comments
 (0)