From: Matt Caswell Date: Fri, 15 Nov 2019 14:15:09 +0000 (+0000) Subject: Add test for non-default sized keys in variable key size ciphers X-Git-Tag: openssl-3.0.0-alpha1~932 X-Git-Url: https://git.openssl.org/?p=openssl.git;a=commitdiff_plain;h=1838580037a47b42c5b2326b0b988c50c7c64c3c Add test for non-default sized keys in variable key size ciphers Various ciphers have the ability to support varaible length keys. This adds some test cases for algorithms where we did not test a key length other than the default size. Reviewed-by: Shane Lontis (Merged from https://github.com/openssl/openssl/pull/10449) --- diff --git a/test/recipes/30-test_evp.t b/test/recipes/30-test_evp.t index a5060971fc..979811b0e6 100644 --- a/test/recipes/30-test_evp.t +++ b/test/recipes/30-test_evp.t @@ -64,6 +64,9 @@ push @defltfiles, @rc2files unless disabled("rc2"); my @chachafiles = qw( evpciph_chacha.txt ); push @defltfiles, @chachafiles unless disabled("chacha"); +my @bffiles = qw( evpciph_bf.txt ); +push @defltfiles, @bffiles unless disabled("bf"); + plan tests => ($no_fips ? 0 : 1) # FIPS install test + (scalar(@configs) * scalar(@files)) diff --git a/test/recipes/30-test_evp_data/evpciph_bf.txt b/test/recipes/30-test_evp_data/evpciph_bf.txt new file mode 100644 index 0000000000..2f99db19e0 --- /dev/null +++ b/test/recipes/30-test_evp_data/evpciph_bf.txt @@ -0,0 +1,68 @@ +# +# Copyright 2019 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 + + +Title = Self generated BF test vectors + +Cipher = BF-ECB +Availablein = default +Key = 000102030405060708090a0b0c0d0e0f +Plaintext = 0f0e0c0d0b0a09080706050403020100 +Ciphertext = 079590e0010626685653b9b6c2a406e0 + +#Bigger key +Cipher = BF-ECB +Availablein = default +Key = 000102030405060708090a0b0c0d0e0f00000000 +Plaintext = 0f0e0c0d0b0a09080706050403020100 +Ciphertext = 7a0fe3734ad4785b49e59296b7861789 + +Cipher = BF-CBC +Availablein = default +Key = 000102030405060708090a0b0c0d0e0f +IV = 0101010101010101 +Plaintext = 0f0e0c0d0b0a09080706050403020100 +Ciphertext = 39c65006742b62a49f7a40ff69749c0a + +#Bigger key +Cipher = BF-CBC +Availablein = default +Key = 000102030405060708090a0b0c0d0e0f00000000 +IV = 0101010101010101 +Plaintext = 0f0e0c0d0b0a09080706050403020100 +Ciphertext = 3a5cefdb91e56e7aab45e7ea562bd465 + +Cipher = BF-OFB +Availablein = default +Key = 0001020304050607 +IV = 0101010101010101 +Plaintext = 0f0e0c0d0b0a09080706050403020100 +Ciphertext = 27be8331cdc52dc61724029d302b9358 + +#Bigger key +Cipher = BF-OFB +Availablein = default +Key = 000102030405060700000000 +IV = 0101010101010101 +Plaintext = 0f0e0c0d0b0a09080706050403020100 +Ciphertext = f108f229cc1cbe228aa3b2407979289a + +Cipher = BF-CFB +Availablein = default +Key = 0001020304050607 +IV = 0101010101010101 +Plaintext = 0f0e0c0d0b0a09080706050403020100 +Ciphertext = 27be8331cdc52dc675a93625f90f5db4 + +#Bigger key +Cipher = BF-CFB +Availablein = default +Key = 000102030405060700000000 +IV = 0101010101010101 +Plaintext = 0f0e0c0d0b0a09080706050403020100 +Ciphertext = f108f229cc1cbe2214f00c3a8611cb46 diff --git a/test/recipes/30-test_evp_data/evpciph_rc4.txt b/test/recipes/30-test_evp_data/evpciph_rc4.txt index 4cb068be9b..02f231c892 100644 --- a/test/recipes/30-test_evp_data/evpciph_rc4.txt +++ b/test/recipes/30-test_evp_data/evpciph_rc4.txt @@ -60,3 +60,8 @@ Key = ebb46227c6cc8b37641910833222772a Plaintext = 00000000000000000000000000000000 Ciphertext = 720c94b63edf44e131d950ca211a5a30 +#Self generated. Long key +Cipher = RC4 +Key = ebb46227c6cc8b37641910833222772a00000000 +Plaintext = 00000000000000000000000000000000 +Ciphertext = 358b23dba47770e72c7ea8ce5bd68da3 diff --git a/test/recipes/30-test_evp_data/evpciph_rc5.txt b/test/recipes/30-test_evp_data/evpciph_rc5.txt index 300201b7cb..17980945b2 100644 --- a/test/recipes/30-test_evp_data/evpciph_rc5.txt +++ b/test/recipes/30-test_evp_data/evpciph_rc5.txt @@ -20,6 +20,12 @@ Key = 00000000000000000000000000000000 Plaintext = 000102030405060708090A0B0C0D0E0F Ciphertext = d9d37019aec1161b27d7ad56b21f0f42 +#Self generated. Bigger key. +Cipher = RC5-ECB +Key = 0000000000000000000000000000000000000000 +Plaintext = 000102030405060708090A0B0C0D0E0F +Ciphertext = 610084f3e141cbc5455b82e2d56da565 + Cipher = RC5-CBC Key = 00000000000000000000000000000000 IV = 0000000000000000 @@ -32,6 +38,13 @@ IV = 0102030405060708 Plaintext = 000102030405060708090A0B0C0D0E0F Ciphertext = eeebae12d768ac9e5b3d6072a9c76c65 +#Self generated. Bigger key. +Cipher = RC5-CBC +Key = 0102030405060708090A0B0C0D0E0F1000000000 +IV = 0102030405060708 +Plaintext = 000102030405060708090A0B0C0D0E0F +Ciphertext = af64972111a80ec28871c51dd4bfe8de + Cipher = RC5-OFB Key = 00000000000000000000000000000000 IV = 0000000000000000 @@ -44,6 +57,13 @@ IV = 0102030405060708 Plaintext = 000102030405060708090A0B0C0D0E0F Ciphertext = c0ad101b40fc7ffdfc386ea5ecf458b7 +#Self generated. Bigger key. +Cipher = RC5-OFB +Key = 0102030405060708090A0B0C0D0E0F1000000000 +IV = 0102030405060708 +Plaintext = 000102030405060708090A0B0C0D0E0F +Ciphertext = 66ff8fee03d45533dde93632e8f81f6f + Cipher = RC5-CFB Key = 00000000000000000000000000000000 IV = 0000000000000000