]> git.ipfire.org Git - thirdparty/openssl.git/blame - test/recipes/20-test_enc_more.t
Add ECDSA to providers
[thirdparty/openssl.git] / test / recipes / 20-test_enc_more.t
CommitLineData
227a44b1
P
1#! /usr/bin/env perl
2# Copyright 2017 The OpenSSL Project Authors. All Rights Reserved.
5aba2b6e 3# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
227a44b1 4#
909f1a2e 5# Licensed under the Apache License 2.0 (the "License"). You may not use
227a44b1
P
6# this file except in compliance with the License. You can obtain a copy
7# in the file LICENSE in the source distribution or at
8# https://www.openssl.org/source/license.html
227a44b1
P
9
10
11use strict;
12use warnings;
13
14use File::Spec::Functions qw/catfile/;
15use File::Copy;
16use File::Compare qw/compare_text/;
17use File::Basename;
18use OpenSSL::Test qw/:DEFAULT srctop_file/;
19
20setup("test_evp_more");
21
22my $testsrc = srctop_file("test", "recipes", basename($0));
23
24my $cipherlist = undef;
25my $plaintext = catfile(".", "testdatafile");
26my $fail = "";
27my $cmd = "openssl";
28
30f1c9c4 29my $ciphersstatus = undef;
227a44b1 30my @ciphers =
777f1708 31 grep(! /wrap|^$|^[^-]/,
227a44b1 32 (map { split /\s+/ }
40dfb8c7 33 run(app([$cmd, "enc", "-list"]),
30f1c9c4 34 capture => 1, statusvar => \$ciphersstatus)));
227a44b1 35
30f1c9c4 36plan tests => 2 + scalar @ciphers;
227a44b1
P
37
38SKIP: {
30f1c9c4 39 skip "Problems getting ciphers...", 1 + scalar(@ciphers)
40dfb8c7 40 unless ok($ciphersstatus, "Running 'openssl enc -list'");
30f1c9c4
RL
41 unless (ok(copy($testsrc, $plaintext), "Copying $testsrc to $plaintext")) {
42 diag($!);
43 skip "Not initialized, skipping...", scalar(@ciphers);
44 }
227a44b1
P
45
46 foreach my $cipher (@ciphers) {
47 my $ciphername = substr $cipher, 1;
48 my $cipherfile = "$plaintext.$ciphername.cipher";
49 my $clearfile = "$plaintext.$ciphername.clear";
50 my @common = ( $cmd, "enc", "$cipher", "-k", "test" );
51
52 ok(run(app([@common, "-e", "-in", $plaintext, "-out", $cipherfile]))
53 && compare_text($plaintext, $cipherfile) != 0
54 && run(app([@common, "-d", "-in", $cipherfile, "-out", $clearfile]))
55 && compare_text($plaintext, $clearfile) == 0
56 , $ciphername);
227a44b1
P
57 }
58}