mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-21 09:14:34 +00:00
format services/aes-test
This commit is contained in:
parent
dbf8525572
commit
81c5a1da57
3 changed files with 519 additions and 623 deletions
|
|
@ -77,13 +77,7 @@ fn encrypt_test(id: AesId) {
|
||||||
dut = aes_enc_round(dut, tmp as u32, id);
|
dut = aes_enc_round(dut, tmp as u32, id);
|
||||||
reference ^= byte;
|
reference ^= byte;
|
||||||
if dut != reference {
|
if dut != reference {
|
||||||
log::error!(
|
log::error!("Encrypt BUG at index {}, {:?}: dut {:08x} != {:08x} ref\n", idx, id, dut, reference);
|
||||||
"Encrypt BUG at index {}, {:?}: dut {:08x} != {:08x} ref\n",
|
|
||||||
idx,
|
|
||||||
id,
|
|
||||||
dut,
|
|
||||||
reference
|
|
||||||
);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -121,13 +115,7 @@ fn decrypt_test(id: AesId) {
|
||||||
dut = aes_dec_round(dut, tmp as u32, id);
|
dut = aes_dec_round(dut, tmp as u32, id);
|
||||||
reference ^= byte;
|
reference ^= byte;
|
||||||
if dut != reference {
|
if dut != reference {
|
||||||
log::error!(
|
log::error!("Decrypt BUG at index {}, {:?}: dut {:08x} != {:08x} ref\n", idx, id, dut, reference);
|
||||||
"Decrypt BUG at index {}, {:?}: dut {:08x} != {:08x} ref\n",
|
|
||||||
idx,
|
|
||||||
id,
|
|
||||||
dut,
|
|
||||||
reference
|
|
||||||
);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -4,10 +4,9 @@
|
||||||
#[cfg(feature = "low_level_tests")]
|
#[cfg(feature = "low_level_tests")]
|
||||||
mod low_level_tests;
|
mod low_level_tests;
|
||||||
|
|
||||||
use hex_literal::hex;
|
|
||||||
|
|
||||||
use aes::{Aes128, Block};
|
|
||||||
use aes::cipher::{BlockDecrypt, BlockEncrypt, KeyInit};
|
use aes::cipher::{BlockDecrypt, BlockEncrypt, KeyInit};
|
||||||
|
use aes::{Aes128, Block};
|
||||||
|
use hex_literal::hex;
|
||||||
|
|
||||||
struct AesEcbTest<'a> {
|
struct AesEcbTest<'a> {
|
||||||
key: &'a [u8],
|
key: &'a [u8],
|
||||||
|
|
@ -17,11 +16,7 @@ struct AesEcbTest<'a> {
|
||||||
|
|
||||||
impl<'a> AesEcbTest<'a> {
|
impl<'a> AesEcbTest<'a> {
|
||||||
pub fn new(key: &'a [u8], plaintext: &'a [u8], ciphertext: &'a [u8]) -> Self {
|
pub fn new(key: &'a [u8], plaintext: &'a [u8], ciphertext: &'a [u8]) -> Self {
|
||||||
Self {
|
Self { key, plaintext, ciphertext }
|
||||||
key,
|
|
||||||
plaintext,
|
|
||||||
ciphertext,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn test(&self) -> Result<(), &'static str> {
|
pub fn test(&self) -> Result<(), &'static str> {
|
||||||
|
|
@ -59,10 +54,7 @@ impl<'a> AesEcbTest<'a> {
|
||||||
|
|
||||||
fn main() -> ! {
|
fn main() -> ! {
|
||||||
log_server::init_wait().unwrap();
|
log_server::init_wait().unwrap();
|
||||||
log::info!(
|
log::info!("Hello, world! This is the AES client, PID {}", xous::current_pid().unwrap().get());
|
||||||
"Hello, world! This is the AES client, PID {}",
|
|
||||||
xous::current_pid().unwrap().get()
|
|
||||||
);
|
|
||||||
|
|
||||||
// let key: [u8; 32] = [
|
// let key: [u8; 32] = [
|
||||||
// 0x70, 0x69, 0x19, 0xa0, 0x40, 0x61, 0x05, 0x17, 0xf7, 0xff, 0xf5, 0x27, 0x2b, 0x64, 0x04,
|
// 0x70, 0x69, 0x19, 0xa0, 0x40, 0x61, 0x05, 0x17, 0xf7, 0xff, 0xf5, 0x27, 0x2b, 0x64, 0x04,
|
||||||
|
|
@ -158,11 +150,7 @@ fn main() -> ! {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
log::error!(
|
log::error!("{} tests were run and {} errors were encountered", tests.len(), failures);
|
||||||
"{} tests were run and {} errors were encountered",
|
|
||||||
tests.len(),
|
|
||||||
failures
|
|
||||||
);
|
|
||||||
|
|
||||||
#[cfg(feature = "low_level_tests")]
|
#[cfg(feature = "low_level_tests")]
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue