]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[test] Remove dummy initialisation vector for ECB-mode AES tests
authorMichael Brown <mcb30@ipxe.org>
Wed, 7 Feb 2024 21:16:47 +0000 (21:16 +0000)
committerMichael Brown <mcb30@ipxe.org>
Wed, 7 Feb 2024 21:16:47 +0000 (21:16 +0000)
A block cipher in ECB mode has no concept of an initialisation vector,
and any data provided to cipher_setiv() for an ECB cipher will be
ignored.  There is no requirement within our cipher algorithm
abstraction for a dummy initialisation vector to be provided.

Remove the entirely spurious dummy 16-byte initialisation vector from
the ECB test cases.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/tests/aes_test.c

index be119c8d805ccd6ad9a051075a6df847a1fbb95b..46a052a2cc09dee368b35a74b95a721e1901da43 100644 (file)
@@ -63,11 +63,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
              0x2c, 0x07, 0x3b, 0x61, 0x08, 0xd7, 0x2d, 0x98, 0x10,     \
              0xa3, 0x09, 0x14, 0xdf, 0xf4 )
 
-/** Dummy initialisation vector used for NIST ECB-mode test vectors */
-#define AES_IV_NIST_DUMMY                                              \
-       IV ( 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      \
-            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 )
-
 /** Initialisation vector used for NIST CBC-mode test vectors */
 #define AES_IV_NIST_CBC                                                        \
        IV ( 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,      \
@@ -86,7 +81,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
 
 /** AES-128-ECB (same test as AES-128-Core) */
 CIPHER_TEST ( aes_128_ecb, &aes_ecb_algorithm,
-       AES_KEY_NIST_128, AES_IV_NIST_DUMMY, ADDITIONAL(), AES_PLAINTEXT_NIST,
+       AES_KEY_NIST_128, IV(), ADDITIONAL(), AES_PLAINTEXT_NIST,
        CIPHERTEXT ( 0x3a, 0xd7, 0x7b, 0xb4, 0x0d, 0x7a, 0x36, 0x60,
                     0xa8, 0x9e, 0xca, 0xf3, 0x24, 0x66, 0xef, 0x97,
                     0xf5, 0xd3, 0xd5, 0x85, 0x03, 0xb9, 0x69, 0x9d,
@@ -110,7 +105,7 @@ CIPHER_TEST ( aes_128_cbc, &aes_cbc_algorithm,
 
 /** AES-192-ECB (same test as AES-192-Core) */
 CIPHER_TEST ( aes_192_ecb, &aes_ecb_algorithm,
-       AES_KEY_NIST_192, AES_IV_NIST_DUMMY, ADDITIONAL(), AES_PLAINTEXT_NIST,
+       AES_KEY_NIST_192, IV(), ADDITIONAL(), AES_PLAINTEXT_NIST,
        CIPHERTEXT ( 0xbd, 0x33, 0x4f, 0x1d, 0x6e, 0x45, 0xf2, 0x5f,
                     0xf7, 0x12, 0xa2, 0x14, 0x57, 0x1f, 0xa5, 0xcc,
                     0x97, 0x41, 0x04, 0x84, 0x6d, 0x0a, 0xd3, 0xad,
@@ -134,7 +129,7 @@ CIPHER_TEST ( aes_192_cbc, &aes_cbc_algorithm,
 
 /** AES-256-ECB (same test as AES-256-Core) */
 CIPHER_TEST ( aes_256_ecb, &aes_ecb_algorithm,
-       AES_KEY_NIST_256, AES_IV_NIST_DUMMY, ADDITIONAL(), AES_PLAINTEXT_NIST,
+       AES_KEY_NIST_256, IV(), ADDITIONAL(), AES_PLAINTEXT_NIST,
        CIPHERTEXT ( 0xf3, 0xee, 0xd1, 0xbd, 0xb5, 0xd2, 0xa0, 0x3c,
                     0x06, 0x4b, 0x5a, 0x7e, 0x3d, 0xb1, 0x81, 0xf8,
                     0x59, 0x1c, 0xcb, 0x10, 0xd4, 0x10, 0xed, 0x26,