Add test for non-default sized keys in variable key size ciphers
authorMatt Caswell <matt@openssl.org>
Fri, 15 Nov 2019 14:15:09 +0000 (14:15 +0000)
committerMatt Caswell <matt@openssl.org>
Tue, 19 Nov 2019 13:33:54 +0000 (13:33 +0000)
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 <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/10449)

test/recipes/30-test_evp.t
test/recipes/30-test_evp_data/evpciph_bf.txt [new file with mode: 0644]
test/recipes/30-test_evp_data/evpciph_rc4.txt
test/recipes/30-test_evp_data/evpciph_rc5.txt

index a5060971fc1448fd9b512ee7874c0e36d56fc8df..979811b0e665f523ff7f27e4ed5d4241247eb9b9 100644 (file)
@@ -64,6 +64,9 @@ push @defltfiles, @rc2files unless disabled("rc2");
 my @chachafiles = qw( evpciph_chacha.txt );
 push @defltfiles, @chachafiles unless disabled("chacha");
 
 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))
 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 (file)
index 0000000..2f99db1
--- /dev/null
@@ -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
index 4cb068be9bda2db32b110211e0ac222e3e1a5b18..02f231c892fe50ceffd304146230c56a727ec41f 100644 (file)
@@ -60,3 +60,8 @@ Key = ebb46227c6cc8b37641910833222772a
 Plaintext = 00000000000000000000000000000000
 Ciphertext = 720c94b63edf44e131d950ca211a5a30
 
 Plaintext = 00000000000000000000000000000000
 Ciphertext = 720c94b63edf44e131d950ca211a5a30
 
+#Self generated. Long key
+Cipher = RC4
+Key = ebb46227c6cc8b37641910833222772a00000000
+Plaintext = 00000000000000000000000000000000
+Ciphertext = 358b23dba47770e72c7ea8ce5bd68da3
index 300201b7cb8bb3578b423332542cfde2b777c827..17980945b2408bbc15fc653092bcf2a82f0a5176 100644 (file)
@@ -20,6 +20,12 @@ Key = 00000000000000000000000000000000
 Plaintext = 000102030405060708090A0B0C0D0E0F
 Ciphertext = d9d37019aec1161b27d7ad56b21f0f42
 
 Plaintext = 000102030405060708090A0B0C0D0E0F
 Ciphertext = d9d37019aec1161b27d7ad56b21f0f42
 
+#Self generated. Bigger key.
+Cipher = RC5-ECB
+Key = 0000000000000000000000000000000000000000
+Plaintext = 000102030405060708090A0B0C0D0E0F
+Ciphertext = 610084f3e141cbc5455b82e2d56da565
+
 Cipher = RC5-CBC
 Key = 00000000000000000000000000000000
 IV = 0000000000000000
 Cipher = RC5-CBC
 Key = 00000000000000000000000000000000
 IV = 0000000000000000
@@ -32,6 +38,13 @@ IV = 0102030405060708
 Plaintext = 000102030405060708090A0B0C0D0E0F
 Ciphertext = eeebae12d768ac9e5b3d6072a9c76c65
 
 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
 Cipher = RC5-OFB
 Key = 00000000000000000000000000000000
 IV = 0000000000000000
@@ -44,6 +57,13 @@ IV = 0102030405060708
 Plaintext = 000102030405060708090A0B0C0D0E0F
 Ciphertext = c0ad101b40fc7ffdfc386ea5ecf458b7
 
 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
 Cipher = RC5-CFB
 Key = 00000000000000000000000000000000
 IV = 0000000000000000