Commit 59a8cf3d86 for openssl.org

commit 59a8cf3d86324a6c774c23a7341158f02d96f6fc
Author: Jakub Zelenka <jakub.zelenka@openssl.foundation>
Date:   Tue Jul 7 20:21:27 2026 +0200

    apps: add test coverage for dgst -list

    Exercise the previously uncovered show_digests() path in dgst app by
    adding a subtest that runs "openssl dgst -list". It checks the header
    and that sha256 and sha512 are listed, without assuming the full set of
    digests which depends on the build configuration.

    Assisted-by: Claude:claude-opus-4-8

    Reviewed-by: Paul Dale <paul.dale@oracle.com>
    Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
    MergeDate: Mon Jul 13 15:05:45 2026
    (Merged from https://github.com/openssl/openssl/pull/31886)

diff --git a/test/recipes/20-test_dgst.t b/test/recipes/20-test_dgst.t
index e287bd32ff..6cabaf3be5 100644
--- a/test/recipes/20-test_dgst.t
+++ b/test/recipes/20-test_dgst.t
@@ -18,7 +18,7 @@ use Cwd qw(abs_path);

 setup("test_dgst");

-plan tests => 25;
+plan tests => 26;

 sub tsignverify {
     my $testtext = shift;
@@ -424,6 +424,19 @@ subtest "signing with xoflen is not supported `dgst` CLI" => sub {
                  "Generating signature with xoflen should fail");
 };

+subtest "Listing supported digests with `dgst` CLI" => sub {
+    plan tests => 3;
+
+    my @listdata = run(app(['openssl', 'dgst', '-list']), capture => 1);
+    chomp(@listdata);
+    my $listing = join("\n", @listdata);
+
+    ok($listing =~ /Supported digests:/, "LIST: Check header is printed");
+    # Only check digests that are always present, each printed as "-<name>"
+    ok($listing =~ /-sha256\b/, "LIST: Check sha256 is listed");
+    ok($listing =~ /-sha512\b/, "LIST: Check sha512 is listed");
+};
+
 subtest "signing using the nonce-type sigopt" => sub {
     if (disabled("ec")) {
         plan tests => 1;