]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Skip LMS tests if fetch for the LMS algorithm fails
authorAndrew Dinh <andrewd@openssl.org>
Wed, 17 Sep 2025 01:49:59 +0000 (11:49 +1000)
committerNeil Horman <nhorman@openssl.org>
Tue, 23 Sep 2025 17:58:11 +0000 (13:58 -0400)
Check for specific LMS error

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28580)

(cherry picked from commit 3b00a132291ef83cc349b8f1f27d7daec3b43388)

test/lms_test.c

index 46b4264430261d4323961ba78a5bd2fbfcc2537b..96fff510d4785ce3051ce78db3fd56dbbb7f6c80 100644 (file)
@@ -551,6 +551,7 @@ int setup_tests(void)
 {
     OPTION_CHOICE o;
     char *config_file = NULL;
+    EVP_PKEY_CTX *ctx = NULL;
 
     /* Swap the libctx to test non-default context only */
     propq = "provider=default";
@@ -571,6 +572,11 @@ int setup_tests(void)
     if (!test_get_libctx(&libctx, &nullprov, config_file, &libprov, NULL))
         return 0;
 
+    ctx = EVP_PKEY_CTX_new_from_name(libctx, "LMS", propq);
+    if (ctx == NULL && ERR_get_error() == EVP_R_UNSUPPORTED_ALGORITHM)
+        return TEST_skip("LMS algorithm is not available in provider");
+    EVP_PKEY_CTX_free(ctx);
+
     ADD_TEST(lms_bad_pub_len_test);
     ADD_TEST(lms_key_validate_test);
     ADD_TEST(lms_key_eq_test);