]>
Commit | Line | Data |
---|---|---|
596d6b7e | 1 | #! /usr/bin/env perl |
33388b44 | 2 | # Copyright 2015-2020 The OpenSSL Project Authors. All Rights Reserved. |
596d6b7e | 3 | # |
909f1a2e | 4 | # Licensed under the Apache License 2.0 (the "License"). You may not use |
596d6b7e RS |
5 | # this file except in compliance with the License. You can obtain a copy |
6 | # in the file LICENSE in the source distribution or at | |
7 | # https://www.openssl.org/source/license.html | |
8 | ||
12fb8c3d RS |
9 | use strict; |
10 | use warnings; | |
11 | use OpenSSL::Test; | |
7d615e21 | 12 | use OpenSSL::Test::Utils; |
894025c6 | 13 | |
bd363ef3 | 14 | plan tests => 5; |
12fb8c3d | 15 | setup("test_rand"); |
894025c6 | 16 | |
d4dfd983 | 17 | ok(run(test(["rand_test"]))); |
12fb8c3d | 18 | ok(run(test(["drbgtest"]))); |
4516bf74 | 19 | ok(run(test(["rand_status_test"]))); |
bd363ef3 BE |
20 | |
21 | SKIP: { | |
22 | skip "engine is not supported by this OpenSSL build", 2 | |
23 | if disabled("engine") || disabled("dynamic-engine"); | |
24 | ||
25 | my $success; | |
26 | my @randdata; | |
27 | my $expected = '0102030405060708090a0b0c0d0e0f10'; | |
28 | ||
29 | @randdata = run(app(['openssl', 'rand', '-engine', 'ossltest', '-hex', '16' ]), | |
30 | capture => 1, statusvar => \$success); | |
31 | chomp(@randdata); | |
715242b1 | 32 | ok($success && $randdata[0] eq $expected, |
bd363ef3 BE |
33 | "rand with ossltest: Check rand output is as expected"); |
34 | ||
ae9fe65d NH |
35 | @randdata = run(app(['openssl', 'rand', '-hex', '2K' ]), |
36 | capture => 1, statusvar => \$success); | |
37 | chomp(@randdata); | |
38 | ||
bd363ef3 BE |
39 | @randdata = run(app(['openssl', 'rand', '-engine', 'dasync', '-hex', '16' ]), |
40 | capture => 1, statusvar => \$success); | |
41 | chomp(@randdata); | |
715242b1 | 42 | ok($success && length($randdata[0]) == 32, |
bd363ef3 BE |
43 | "rand with dasync: Check rand output is of expected length"); |
44 | } |