rust: Add AES192 test vectors

This commit is contained in:
Wladimir J. van der Laan 2020-04-27 22:00:01 +00:00
parent fbe528d8b6
commit 924af6ca23

View File

@ -61,7 +61,7 @@ fn main() -> ! {
// https://boringssl.googlesource.com/boringssl/+/2214/crypto/cipher/cipher_test.txt // https://boringssl.googlesource.com/boringssl/+/2214/crypto/cipher/cipher_test.txt
// https://github.com/plenluno/openssl/blob/master/openssl/test/evptests.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 // http://csrc.nist.gov/groups/ST/toolkit/BCM/documents/proposedmodes/gcm/gcm-spec.pdf
for tv in &[ for tv in [
AESTestVec { AESTestVec {
cipher_mode: cipher_mode::ECB, cipher_mode: cipher_mode::ECB,
key: &hex!("000102030405060708090A0B0C0D0E0F"), key: &hex!("000102030405060708090A0B0C0D0E0F"),
@ -152,6 +152,42 @@ fn main() -> ! {
aad: &hex!(""), aad: &hex!(""),
tag: &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 { AESTestVec {
cipher_mode: cipher_mode::CBC, cipher_mode: cipher_mode::CBC,
key: &hex!("2B7E151628AED2A6ABF7158809CF4F3C"), key: &hex!("2B7E151628AED2A6ABF7158809CF4F3C"),
@ -378,7 +414,7 @@ fn main() -> ! {
aad: &hex!(""), aad: &hex!(""),
tag: &hex!("cac45f60e31efd3b5a43b98a22ce1aa1"), tag: &hex!("cac45f60e31efd3b5a43b98a22ce1aa1"),
}, },
] { ].iter() {
let mut ct_out = [0u8; 128]; let mut ct_out = [0u8; 128];
let mut tag_out = [0u8; 16]; let mut tag_out = [0u8; 16];