From 64f4c98a0ed265bed8a2bbb8c3522e7a7301d375 Mon Sep 17 00:00:00 2001 From: Maxwell Moyer-McKee Date: Tue, 25 Aug 2026 17:55:34 +0000 Subject: [PATCH 1/2] Skip unsupported EC curves in tests --- CMakeLists.txt | 2 +- test/KeysInUseTest/KeysInUseTest.cpp | 23 +++++++++++++++++++---- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index db024f5e..097238b3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.13.0) include(CheckIncludeFile) project(SymCrypt-OpenSSL - VERSION 1.11.0 + VERSION 1.11.1 DESCRIPTION "The SymCrypt engine and provider for OpenSSL (SCOSSL)" HOMEPAGE_URL "https://github.com/microsoft/SymCrypt-OpenSSL") diff --git a/test/KeysInUseTest/KeysInUseTest.cpp b/test/KeysInUseTest/KeysInUseTest.cpp index ed8932d1..1b5fa4fd 100644 --- a/test/KeysInUseTest/KeysInUseTest.cpp +++ b/test/KeysInUseTest/KeysInUseTest.cpp @@ -91,9 +91,7 @@ static KEYSINUSE_TEST_KEY testKeys[] = { {EVP_PKEY_RSA, 2048, nullptr, nullptr, 0, {}}, {EVP_PKEY_RSA, 3072, nullptr, nullptr, 0, {}}, {EVP_PKEY_RSA, 4096, nullptr, nullptr, 0, {}}, -#ifdef NID_X9_62_prime192v1 // This curve is not available on Azure Linux 3 {EVP_PKEY_EC, NID_X9_62_prime192v1, nullptr, nullptr, 0, {}}, -#endif {EVP_PKEY_EC, NID_secp224r1, nullptr, nullptr, 0, {}}, {EVP_PKEY_EC, NID_X9_62_prime256v1, nullptr, nullptr, 0, {}}, {EVP_PKEY_EC, NID_secp384r1, nullptr, nullptr, 0, {}}, @@ -1626,13 +1624,24 @@ SCOSSL_STATUS keysinuse_test_generate_keys() { if (EVP_PKEY_CTX_set_ec_paramgen_curve_nid(ctx, testKeys[i].keygenParams) <= 0) { - TEST_LOG_OPENSSL_ERROR("EVP_PKEY_CTX_set_ec_paramgen_curve_nid failed") - goto cleanup; + printf("Skipping unsupported curve %s\n", OBJ_nid2sn(testKeys[i].keygenParams)); + ERR_clear_error(); + EVP_PKEY_CTX_free(ctx); + ctx = NULL; + continue; } } if (EVP_PKEY_keygen(ctx, &testKeys[i].pkey) <= 0) { + if (testKeys[i].keyType == EVP_PKEY_EC) + { + printf("Skipping unsupported curve %s\n", OBJ_nid2sn(testKeys[i].keygenParams)); + ERR_clear_error(); + EVP_PKEY_CTX_free(ctx); + ctx = NULL; + continue; + } TEST_LOG_OPENSSL_ERROR("EVP_PKEY_keygen failed") goto cleanup; } @@ -1963,6 +1972,12 @@ int main(int argc, char** argv) for (KEYSINUSE_TEST_KEY testKey : testKeys) { + if (testKey.pkey == NULL) + { + // Key generation was skipped for this entry (unsupported curve). + continue; + } + if (testKey.keyType == EVP_PKEY_RSA) { printf("Testing RSA sign with size %d\n", testKey.keygenParams); From aa6b9153441c9b2e76d81b8139a1e0fd0b366622 Mon Sep 17 00:00:00 2001 From: Maxwell Moyer-McKee Date: Wed, 26 Aug 2026 20:13:07 +0000 Subject: [PATCH 2/2] PR comments --- test/KeysInUseTest/KeysInUseTest.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/test/KeysInUseTest/KeysInUseTest.cpp b/test/KeysInUseTest/KeysInUseTest.cpp index 1b5fa4fd..7a13f728 100644 --- a/test/KeysInUseTest/KeysInUseTest.cpp +++ b/test/KeysInUseTest/KeysInUseTest.cpp @@ -13,6 +13,7 @@ #include "scossl_helpers.h" #include "keysinuse.h" +#include #include #if OPENSSL_VERSION_MAJOR == 3 #include @@ -1622,26 +1623,27 @@ SCOSSL_STATUS keysinuse_test_generate_keys() } else if (testKeys[i].keyType == EVP_PKEY_EC) { - if (EVP_PKEY_CTX_set_ec_paramgen_curve_nid(ctx, testKeys[i].keygenParams) <= 0) + EC_GROUP *ecGroup = EC_GROUP_new_by_curve_name(testKeys[i].keygenParams); + if (ecGroup == NULL) { - printf("Skipping unsupported curve %s\n", OBJ_nid2sn(testKeys[i].keygenParams)); + const char *curveName = OBJ_nid2sn(testKeys[i].keygenParams); + printf("Skipping unsupported curve %s\n", curveName != NULL ? curveName : ""); ERR_clear_error(); EVP_PKEY_CTX_free(ctx); ctx = NULL; continue; } + EC_GROUP_free(ecGroup); + + if (EVP_PKEY_CTX_set_ec_paramgen_curve_nid(ctx, testKeys[i].keygenParams) <= 0) + { + TEST_LOG_OPENSSL_ERROR("EVP_PKEY_CTX_set_ec_paramgen_curve_nid failed") + goto cleanup; + } } if (EVP_PKEY_keygen(ctx, &testKeys[i].pkey) <= 0) { - if (testKeys[i].keyType == EVP_PKEY_EC) - { - printf("Skipping unsupported curve %s\n", OBJ_nid2sn(testKeys[i].keygenParams)); - ERR_clear_error(); - EVP_PKEY_CTX_free(ctx); - ctx = NULL; - continue; - } TEST_LOG_OPENSSL_ERROR("EVP_PKEY_keygen failed") goto cleanup; }