From a5b83aea58f461be60129b9a6ef510065c55fb25 Mon Sep 17 00:00:00 2001 From: Valerio Setti Date: Thu, 2 Jul 2026 14:06:44 +0200 Subject: [PATCH] tests: x509parse: add temporary fallback mechanism for PK error codes Add a temporary fallback mechanism in 'x509parse_crt' while crypto#827 is merged. Signed-off-by: Valerio Setti --- tests/suites/test_suite_x509parse.function | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/suites/test_suite_x509parse.function b/tests/suites/test_suite_x509parse.function index 25d229d6f1..64115a3fe2 100644 --- a/tests/suites/test_suite_x509parse.function +++ b/tests/suites/test_suite_x509parse.function @@ -1136,12 +1136,15 @@ void x509parse_crt(data_t *buf, char *result_str, int result) #else ((void) result_str); #endif - /* Tests whose result is MBEDTLS_ERR_PK_INVALID_PUBKEY might return - * MBEDTLS_ERR_ASN1_UNEXPECTED_TAG until psa#308 is merged. This variable - * is therefore used for backward compatiblity and will be removed in - * mbedtls#10229. */ - int result_back_comp = result; int res; + /* After psa#827 some failing tests that were returning MBEDTLS_ERR_PK_INVALID_PUBKEY + * will return MBEDTLS_ERR_PK_INVALID_ALG instead. We need a temporary + * backward compatibility fix until psa#827 is merged. + */ + int result_back_comp = result; + if (result == MBEDTLS_ERR_PK_INVALID_ALG) { + result_back_comp = MBEDTLS_ERR_PK_INVALID_PUBKEY; + } mbedtls_x509_crt_init(&crt); USE_PSA_INIT();