Commit cf82f5f78f for openssl.org
commit cf82f5f78f57f56de49a5f346aea6a4baf020c7c
Author: Neil Horman <nhorman@openssl.org>
Date: Tue Jun 30 13:06:52 2026 -0400
Add test to exercise non-caching code paths
Use openssl list, which uses EVP_*_do_all_provided on non-caching
algorithms. The do_all_provided path callbacks expect the algorithms
that are looked up to be saveable via up_ref, so this, when run under
asan, makes for a good test to ensure we don't trigger any use after
free situations when not caching algs.
Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
MergeDate: Thu Jul 2 14:24:17 2026
(Merged from https://github.com/openssl/openssl/pull/31782)
diff --git a/test/recipes/30-test_evp_list_noncache.t b/test/recipes/30-test_evp_list_noncache.t
new file mode 100644
index 0000000000..511bcec628
--- /dev/null
+++ b/test/recipes/30-test_evp_list_noncache.t
@@ -0,0 +1,34 @@
+#! /usr/bin/env perl
+# Copyright 2026 The OpenSSL Project Authors. All Rights Reserved.
+#
+# Licensed under the Apache License 2.0 (the "License"). You may not use
+# this file except in compliance with the License. You can obtain a copy
+# in the file LICENSE in the source distribution or at
+# https://www.openssl.org/source/license.html
+
+use strict;
+use warnings;
+
+
+use OpenSSL::Test qw/:DEFAULT srctop_file srctop_dir bldtop_dir/;
+use OpenSSL::Test::Utils;
+
+setup("test_noncaching_evp_fetch");
+
+plan skip_all => "This test requires provider module support"
+ if disabled("module");
+
+plan tests => 1;
+
+# This tells the p_ossltest provider to request no caching of algs
+$ENV{OSSL_TEST_PROVIDER_NO_CACHE} = "yes";
+
+my $provdir = bldtop_dir("test");
+
+# list all algorithms in p_ossltest, this exercises the EVP_*do_all_provided paths when algorithms
+# are not being cached
+#
+ok(run(app(["openssl", "list", "-provider-path", $provdir, "-provider", "p_ossltest", "-all-algorithms"])),
+ "list provided algs when provider requests no caching");
+
+