mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-15 08:30:02 +00:00
services/aes-test: remove kind field and rename struct
Signed-off-by: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
This commit is contained in:
parent
dc528c4bc3
commit
1dbc8700a1
1 changed files with 17 additions and 23 deletions
|
|
@ -8,21 +8,15 @@ mod low_level_tests;
|
|||
|
||||
use hex_literal::hex;
|
||||
|
||||
enum AesKind {
|
||||
ECB,
|
||||
}
|
||||
|
||||
struct AesTest<'a, 'b, 'c> {
|
||||
kind: AesKind,
|
||||
struct AesEcbTest<'a, 'b, 'c> {
|
||||
key: &'a [u8],
|
||||
plaintext: &'b [u8],
|
||||
ciphertext: &'c [u8],
|
||||
}
|
||||
|
||||
impl<'a, 'b, 'c> AesTest<'a, 'b, 'c> {
|
||||
pub fn new_ecb(key: &'a [u8], plaintext: &'b [u8], ciphertext: &'c [u8]) -> Self {
|
||||
AesTest {
|
||||
kind: AesKind::ECB,
|
||||
impl<'a, 'b, 'c> AesEcbTest<'a, 'b, 'c> {
|
||||
pub fn new(key: &'a [u8], plaintext: &'b [u8], ciphertext: &'c [u8]) -> Self {
|
||||
AesEcbTest {
|
||||
key,
|
||||
plaintext,
|
||||
ciphertext,
|
||||
|
|
@ -87,70 +81,70 @@ fn main() -> ! {
|
|||
|
||||
let tests = [
|
||||
// NIST ECB-AES128
|
||||
AesTest::new_ecb(
|
||||
AesEcbTest::new(
|
||||
&hex!("2b7e151628aed2a6abf7158809cf4f3c"),
|
||||
&hex!("6bc1bee22e409f96e93d7e117393172a"),
|
||||
&hex!("3ad77bb40d7a3660a89ecaf32466ef97"),
|
||||
),
|
||||
AesTest::new_ecb(
|
||||
AesEcbTest::new(
|
||||
&hex!("2b7e151628aed2a6abf7158809cf4f3c"),
|
||||
&hex!("ae2d8a571e03ac9c9eb76fac45af8e51"),
|
||||
&hex!("f5d3d58503b9699de785895a96fdbaaf"),
|
||||
),
|
||||
AesTest::new_ecb(
|
||||
AesEcbTest::new(
|
||||
&hex!("2b7e151628aed2a6abf7158809cf4f3c"),
|
||||
&hex!("30c81c46a35ce411e5fbc1191a0a52ef"),
|
||||
&hex!("43b1cd7f598ece23881b00e3ed030688"),
|
||||
),
|
||||
AesTest::new_ecb(
|
||||
AesEcbTest::new(
|
||||
&hex!("2b7e151628aed2a6abf7158809cf4f3c"),
|
||||
&hex!("f69f2445df4f9b17ad2b417be66c3710"),
|
||||
&hex!("7b0c785e27e8ad3f8223207104725dd4"),
|
||||
),
|
||||
// NIST ECB-AES192
|
||||
AesTest::new_ecb(
|
||||
AesEcbTest::new(
|
||||
&hex!("8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b"),
|
||||
&hex!("6bc1bee22e409f96e93d7e117393172a"),
|
||||
&hex!("bd334f1d6e45f25ff712a214571fa5cc"),
|
||||
),
|
||||
AesTest::new_ecb(
|
||||
AesEcbTest::new(
|
||||
&hex!("8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b"),
|
||||
&hex!("ae2d8a571e03ac9c9eb76fac45af8e51"),
|
||||
&hex!("974104846d0ad3ad7734ecb3ecee4eef"),
|
||||
),
|
||||
AesTest::new_ecb(
|
||||
AesEcbTest::new(
|
||||
&hex!("8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b"),
|
||||
&hex!("30c81c46a35ce411e5fbc1191a0a52ef"),
|
||||
&hex!("ef7afd2270e2e60adce0ba2face6444e"),
|
||||
),
|
||||
AesTest::new_ecb(
|
||||
AesEcbTest::new(
|
||||
&hex!("8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b"),
|
||||
&hex!("f69f2445df4f9b17ad2b417be66c3710"),
|
||||
&hex!("9a4b41ba738d6c72fb16691603c18e0e"),
|
||||
),
|
||||
// NIST ECB-AES256
|
||||
AesTest::new_ecb(
|
||||
AesEcbTest::new(
|
||||
&hex!("603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4"),
|
||||
&hex!("6bc1bee22e409f96e93d7e117393172a"),
|
||||
&hex!("f3eed1bdb5d2a03c064b5a7e3db181f8"),
|
||||
),
|
||||
AesTest::new_ecb(
|
||||
AesEcbTest::new(
|
||||
&hex!("603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4"),
|
||||
&hex!("ae2d8a571e03ac9c9eb76fac45af8e51"),
|
||||
&hex!("591ccb10d410ed26dc5ba74a31362870"),
|
||||
),
|
||||
AesTest::new_ecb(
|
||||
AesEcbTest::new(
|
||||
&hex!("603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4"),
|
||||
&hex!("30c81c46a35ce411e5fbc1191a0a52ef"),
|
||||
&hex!("b6ed21b99ca6f4f9f153e7b1beafed1d"),
|
||||
),
|
||||
AesTest::new_ecb(
|
||||
AesEcbTest::new(
|
||||
&hex!("603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4"),
|
||||
&hex!("f69f2445df4f9b17ad2b417be66c3710"),
|
||||
&hex!("23304b7a39f9f3ff067d8d8f9e24ecc7"),
|
||||
),
|
||||
// From the VexRiscv AES test
|
||||
AesTest::new_ecb(
|
||||
AesEcbTest::new(
|
||||
&hex!("706919a040610517f7fff5272b640467c5067a4bba5778ad6cddcbf473031564"),
|
||||
&hex!("0b25f67a11ec9df57305fbe9488ad61b"),
|
||||
&hex!("c4b89f454ed855a8a8630bc814877e94"),
|
||||
|
|
|
|||
Loading…
Reference in a new issue