2 # Copyright 2017 The OpenSSL Project Authors. All Rights Reserved.
4 # Licensed under the OpenSSL license (the "License"). You may not use
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
9 # ======================================================================
10 # Copyright (c) 2017 Oracle and/or its affiliates. All rights reserved.
16 use File::Spec::Functions qw/catfile/;
18 use File::Compare qw/compare_text/;
20 use OpenSSL::Test qw/:DEFAULT srctop_file/;
22 setup("test_evp_more");
24 my $testsrc = srctop_file("test", "recipes", basename($0));
26 my $cipherlist = undef;
27 my $plaintext = catfile(".", "testdatafile");
32 grep(! /wrap|^$|^[^-]/,
34 run(app([$cmd, "enc", "-ciphers"]), capture => 1)));
36 plan tests => 1 + scalar @ciphers;
38 my $init = ok(copy($testsrc, $plaintext));
41 skip "Not initialized, skipping...", (scalar @ciphers) unless $init;
43 foreach my $cipher (@ciphers) {
44 my $ciphername = substr $cipher, 1;
45 my $cipherfile = "$plaintext.$ciphername.cipher";
46 my $clearfile = "$plaintext.$ciphername.clear";
47 my @common = ( $cmd, "enc", "$cipher", "-k", "test" );
49 ok(run(app([@common, "-e", "-in", $plaintext, "-out", $cipherfile]))
50 && compare_text($plaintext, $cipherfile) != 0
51 && run(app([@common, "-d", "-in", $cipherfile, "-out", $clearfile]))
52 && compare_text($plaintext, $clearfile) == 0
54 unlink $cipherfile, $clearfile;