From 166550ebdece3c929a927ce5ab3d1cf19c243786 Mon Sep 17 00:00:00 2001 From: Etienne Carriere Date: Tue, 26 Nov 2024 15:09:17 +0100 Subject: [PATCH] xtest: pkcs11_1021: skip CKM_RSA_PKCS test is not supported Skip CKM_RSA_PKCS test in pkcs11_1021 if the mechanism is not supported. This is likely to happen when OP-TEE core is built with CFG_CRYPTO_RSASSA_NA1 disabled as when built with MbedTLS as core crypto library. Signed-off-by: Etienne Carriere Reviewed-by: Jerome Forissier --- host/xtest/pkcs11_1000.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/host/xtest/pkcs11_1000.c b/host/xtest/pkcs11_1000.c index baa092cee..c6b5e4100 100644 --- a/host/xtest/pkcs11_1000.c +++ b/host/xtest/pkcs11_1000.c @@ -6758,6 +6758,10 @@ static int test_rsa_pkcs_operations(ADBG_Case_t *c, signature_len = sizeof(signature); rv = C_SignInit(session, &sign_mechanism, private_key); + if (rv == CKR_MECHANISM_INVALID) { + Do_ADBG_Log("CKM_RSA_PKCS is not supported (CFG_CRYPTO_RSASSA_NA1 maybe disabled), skip test"); + goto non_prehashed_rsa_tests; + } if (!ADBG_EXPECT_CK_OK(c, rv)) goto err_destr_obj; @@ -6777,6 +6781,8 @@ static int test_rsa_pkcs_operations(ADBG_Case_t *c, if (!ADBG_EXPECT_CK_OK(c, rv)) goto err_destr_obj; +non_prehashed_rsa_tests: + for (i = 0; i < ARRAY_SIZE(rsa_pkcs_sign_tests); i++) { /* * Note: this order of end/begin here is just to get ADBG