mirror of
https://github.com/openssl/openssl.git
synced 2024-12-27 06:21:43 +08:00
90409da6a5
Fixes #12405 Fixes #12377 Calling Init()/Update() and then Init()/Update() again gave a different result when using the same key and iv. Cipher modes that were using ctx->num were not resetting this value, this includes OFB, CFB & CTR. The fix is to reset this value during the ciphers einit() and dinit() methods. Most ciphers go thru a generic method so one line fixes most cases. Add test for calling EVP_EncryptInit()/EVP_EncryptUpdate() multiple times for all ciphers. Ciphers should return the same value for both updates. DES3-WRAP does not since it uses a random in the update. CCM modes currently also fail on the second update (This also happens in 1_1_1). Fix memory leak in AES_OCB cipher if EVP_EncryptInit is called multiple times. Fix AES_SIV cipher dup_ctx and init. Calling EVP_CIPHER_init multiple times resulted in a memory leak in the siv. Fixing this leak also showed that the dup ctx was not working for siv mode. Note: aes_siv_cleanup() can not be used by aes_siv_dupctx() as it clears data that is required for the decrypt (e.g the tag). Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/12413)
47 lines
1.4 KiB
Perl
47 lines
1.4 KiB
Perl
#! /usr/bin/env perl
|
|
# Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.
|
|
#
|
|
# Licensed under the Apache License 2.0 (the "License"). You may not use
|
|
# this file except in compliance with the License. You can obtain a copy
|
|
# in the file LICENSE in the source distribution or at
|
|
# https://www.openssl.org/source/license.html
|
|
|
|
use strict;
|
|
use warnings;
|
|
|
|
use OpenSSL::Test qw(:DEFAULT bldtop_dir srctop_dir srctop_file bldtop_file);
|
|
use OpenSSL::Test::Utils;
|
|
|
|
BEGIN {
|
|
setup("test_evp_libctx");
|
|
}
|
|
|
|
my $no_fips = disabled('fips') || ($ENV{NO_FIPS} // 0);
|
|
|
|
use lib srctop_dir('Configurations');
|
|
use lib bldtop_dir('.');
|
|
use platform;
|
|
|
|
my $infile = bldtop_file('providers', platform->dso('fips'));
|
|
# If no fips then run the test with no extra arguments.
|
|
my @test_args = ( );
|
|
|
|
plan tests =>
|
|
($no_fips ? 0 : 2) # FIPS install test
|
|
+ 1;
|
|
|
|
unless ($no_fips) {
|
|
@test_args = ("-config", srctop_file("test","fips.cnf"),
|
|
"-provider", "fips");
|
|
|
|
ok(run(app(['openssl', 'fipsinstall',
|
|
'-out', bldtop_file('providers', 'fipsmodule.cnf'),
|
|
'-module', $infile])),
|
|
"fipsinstall");
|
|
ok(run(test(["evp_libctx_test", @test_args])), "running fips evp_libctx_test");
|
|
}
|
|
|
|
ok(run(test(["evp_libctx_test",
|
|
"-config", srctop_file("test","default-and-legacy.cnf"),])),
|
|
"running default-and-legacy evp_libctx_test");
|