From 924af6ca2348b8152e069d8d718fcc98df6351ca Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Mon, 27 Apr 2020 22:00:01 +0000 Subject: [PATCH] rust: Add AES192 test vectors --- rust/cryptest/src/main.rs | 40 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/rust/cryptest/src/main.rs b/rust/cryptest/src/main.rs index bb806f2..d354ab6 100644 --- a/rust/cryptest/src/main.rs +++ b/rust/cryptest/src/main.rs @@ -61,7 +61,7 @@ fn main() -> ! { // https://boringssl.googlesource.com/boringssl/+/2214/crypto/cipher/cipher_test.txt // https://github.com/plenluno/openssl/blob/master/openssl/test/evptests.txt // http://csrc.nist.gov/groups/ST/toolkit/BCM/documents/proposedmodes/gcm/gcm-spec.pdf - for tv in &[ + for tv in [ AESTestVec { cipher_mode: cipher_mode::ECB, key: &hex!("000102030405060708090A0B0C0D0E0F"), @@ -152,6 +152,42 @@ fn main() -> ! { aad: &hex!(""), tag: &hex!(""), }, + AESTestVec { + cipher_mode: cipher_mode::ECB, + key: &hex!("8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b"), + pt: &hex!("6bc1bee22e409f96e93d7e117393172a"), + ct: &hex!("bd334f1d6e45f25ff712a214571fa5cc"), + iv: &hex!(""), + aad: &hex!(""), + tag: &hex!(""), + }, + AESTestVec { + cipher_mode: cipher_mode::ECB, + key: &hex!("8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b"), + pt: &hex!("ae2d8a571e03ac9c9eb76fac45af8e51"), + ct: &hex!("974104846d0ad3ad7734ecb3ecee4eef"), + iv: &hex!(""), + aad: &hex!(""), + tag: &hex!(""), + }, + AESTestVec { + cipher_mode: cipher_mode::ECB, + key: &hex!("8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b"), + pt: &hex!("30c81c46a35ce411e5fbc1191a0a52ef"), + ct: &hex!("ef7afd2270e2e60adce0ba2face6444e"), + iv: &hex!(""), + aad: &hex!(""), + tag: &hex!(""), + }, + AESTestVec { + cipher_mode: cipher_mode::ECB, + key: &hex!("8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b"), + pt: &hex!("f69f2445df4f9b17ad2b417be66c3710"), + ct: &hex!("9a4b41ba738d6c72fb16691603c18e0e"), + iv: &hex!(""), + aad: &hex!(""), + tag: &hex!(""), + }, AESTestVec { cipher_mode: cipher_mode::CBC, key: &hex!("2B7E151628AED2A6ABF7158809CF4F3C"), @@ -378,7 +414,7 @@ fn main() -> ! { aad: &hex!(""), tag: &hex!("cac45f60e31efd3b5a43b98a22ce1aa1"), }, - ] { + ].iter() { let mut ct_out = [0u8; 128]; let mut tag_out = [0u8; 16];