summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorBernd Edlinger <bernd.edlinger@hotmail.de>2022-04-02 13:41:12 +0200
committerTomas Mraz <tomas@openssl.org>2022-11-22 18:02:46 +0100
commit872dd0a21f22724abe4a02808c3dfbb0abf661a2 (patch)
treecf9335c4636022933f6f94030e08fb80420f8ee1 /test
parente4d8eaac7e2af4719adfc58397b7c7115d45b0bb (diff)
Add a test case for the engine crash with AES-256-CTR
Implement the AES-256-CTR cipher in the dasync engine. Use that to reproduce the reported problems with the devcrypto engine in our normal test environment. See #17995 and #17532 for details. Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19386) (cherry picked from commit bd363ef32403d58a8b41553b5abd602b30073b10)
Diffstat (limited to 'test')
-rw-r--r--test/recipes/05-test_rand.t23
1 files changed, 22 insertions, 1 deletions
diff --git a/test/recipes/05-test_rand.t b/test/recipes/05-test_rand.t
index 4da1e64cb6..3f352db9df 100644
--- a/test/recipes/05-test_rand.t
+++ b/test/recipes/05-test_rand.t
@@ -11,9 +11,30 @@ use warnings;
use OpenSSL::Test;
use OpenSSL::Test::Utils;
-plan tests => 3;
+plan tests => 5;
setup("test_rand");
ok(run(test(["rand_test"])));
ok(run(test(["drbgtest"])));
ok(run(test(["rand_status_test"])));
+
+SKIP: {
+ skip "engine is not supported by this OpenSSL build", 2
+ if disabled("engine") || disabled("dynamic-engine");
+
+ my $success;
+ my @randdata;
+ my $expected = '0102030405060708090a0b0c0d0e0f10';
+
+ @randdata = run(app(['openssl', 'rand', '-engine', 'ossltest', '-hex', '16' ]),
+ capture => 1, statusvar => \$success);
+ chomp(@randdata);
+ ok($success and $randdata[0] eq $expected,
+ "rand with ossltest: Check rand output is as expected");
+
+ @randdata = run(app(['openssl', 'rand', '-engine', 'dasync', '-hex', '16' ]),
+ capture => 1, statusvar => \$success);
+ chomp(@randdata);
+ ok($success and length($randdata[0]) == 32,
+ "rand with dasync: Check rand output is of expected length");
+}