rename aes-xous to aes, and change version number

this allows us to patch AES for external crates, too,
such as aes_gcm_siv
This commit is contained in:
bunnie 2021-11-07 05:17:34 +08:00
parent fabc84aaf6
commit 7208a86fdb
11 changed files with 20 additions and 18 deletions

View file

@ -116,6 +116,8 @@ xous-macros = {path = "macros"}
# prefer hardware-accelerated versions of services
[patch.crates-io.sha2]
path = "services/engine-sha512"
[patch.crates-io.aes]
path = "services/aes"
[patch.crates-io.curve25519-dalek]
git="https://github.com/betrusted-io/curve25519-dalek.git"

View file

@ -1,6 +1,6 @@
[package]
name = "aes-xous"
version = "0.1.0"
name = "aes"
version = "0.7.5"
authors = ["bunnie <bunnie@kosagi.com>"]
edition = "2018"
description = "AES library for Xous"
@ -13,7 +13,7 @@ cipher = "0.3"
ctr = { version = "0.7", optional = true }
opaque-debug = "0.3"
hex-literal = "0.2"
zeroize = "1.4.1"
zeroize = "1"
[features]
compact = [] # Reduce code size at the cost of slower performance

View file

@ -22,7 +22,7 @@ xous-ipc = {path = "../../xous-ipc"}
num-derive = {version = "0.3", default-features = false}
num-traits = {version = "0.2", default-features = false}
rkyv = {version = "0.4.3", default-features = false, features = ["const_generics"]}
zeroize = "1.4.1"
zeroize = "1"
# bcrypt
cipher = "0.3"
@ -42,7 +42,7 @@ jtag = {path = "../jtag"}
#sha2 = {version = "0.9.5", default-features = false, features = []}
sha2 = {path = "../engine-sha512"}
digest = "0.9"
aes-xous={path="../aes"}
aes={path="../aes"}
engine-25519 = {path="../engine-25519"}
# hardware acceleration adaptations are inserted into a fork of the main branch.
rand_core = "0.5"

View file

@ -23,7 +23,7 @@ use graphics_server::BulkRead;
use core::mem::size_of;
use core::cell::RefCell;
use aes_xous::{Aes256, NewBlockCipher, BlockDecrypt, BlockEncrypt};
use aes::{Aes256, NewBlockCipher, BlockDecrypt, BlockEncrypt};
use cipher::generic_array::GenericArray;
use crate::{SignatureResult, GatewareRegion, MetadataInFlash};

View file

@ -3,7 +3,7 @@ use crate::bitflip;
use core::convert::TryInto;
use aes_xous::{Aes256, NewBlockCipher, BlockDecrypt, BlockEncrypt};
use aes::{Aes256, NewBlockCipher, BlockDecrypt, BlockEncrypt};
use cipher::generic_array::GenericArray;
#[derive(Debug, Copy, Clone)]

View file

@ -26,7 +26,7 @@ codec = {path = "../codec"}
#engine-sha512 = {path="../engine-sha512"}
sha2 = {path="../engine-sha512"}
digest = "0.9"
aes-xous={path="../aes"}
aes={path="../aes"}
cipher = "0.3"
engine-25519 = {path="../engine-25519"}
spinor = {path="../spinor"}

View file

@ -91,7 +91,7 @@ mod backlight; use backlight::*;
mod accel; use accel::*;
mod sha; use sha::*;
mod ecup; use ecup::*;
mod aes; use aes::*;
mod aes_cmd; use aes_cmd::*;
mod trng_cmd; use trng_cmd::*;
mod engine; use engine::*;
mod console; use console::*;

View file

@ -103,7 +103,7 @@ macro_rules! block_cipher_test {
use crate::{ShellCmdApi, CommonEnv};
use xous_ipc::String;
use aes_xous::*;
use aes::*;
use cipher::{BlockDecrypt, BlockEncrypt, NewBlockCipher};
use num_traits::*;
@ -179,14 +179,14 @@ pub fn benchmark_thread(sid0: usize, sid1: usize, sid2: usize, sid3: usize) {
for _ in 0..TEST_ITERS {
if hw_mode {
for mut chunk in dataset_op.chunks_exact_mut(aes_xous::BLOCK_SIZE) {
for mut chunk in dataset_op.chunks_exact_mut(aes::BLOCK_SIZE) {
let mut block = GenericArray::clone_from_slice(&mut chunk);
cipher_hw.encrypt_block(&mut block);
for (&src, dst) in block.iter().zip(chunk.iter_mut()) {
*dst = src;
}
}
for mut chunk in dataset_op.chunks_exact_mut(aes_xous::BLOCK_SIZE) {
for mut chunk in dataset_op.chunks_exact_mut(aes::BLOCK_SIZE) {
let mut block = GenericArray::clone_from_slice(&mut chunk);
cipher_hw.decrypt_block(&mut block);
for (&src, dst) in block.iter().zip(chunk.iter_mut()) {
@ -194,14 +194,14 @@ pub fn benchmark_thread(sid0: usize, sid1: usize, sid2: usize, sid3: usize) {
}
}
} else {
for mut chunk in dataset_op.chunks_exact_mut(aes_xous::BLOCK_SIZE) {
for mut chunk in dataset_op.chunks_exact_mut(aes::BLOCK_SIZE) {
let mut block = GenericArray::clone_from_slice(&mut chunk);
cipher_sw.encrypt_block(&mut block);
for (&src, dst) in block.iter().zip(chunk.iter_mut()) {
*dst = src;
}
}
for mut chunk in dataset_op.chunks_exact_mut(aes_xous::BLOCK_SIZE) {
for mut chunk in dataset_op.chunks_exact_mut(aes::BLOCK_SIZE) {
let mut block = GenericArray::clone_from_slice(&mut chunk);
cipher_sw.decrypt_block(&mut block);
for (&src, dst) in block.iter().zip(chunk.iter_mut()) {
@ -293,7 +293,7 @@ impl<'a> ShellCmdApi<'a> for Aes {
xous::send_message(self.benchmark_cid,
xous::Message::new_scalar(BenchOp::StartAesHw.to_usize().unwrap(), 0, 0, 0, 0)
).unwrap();
write!(ret, "Starting Aes hardware benchmark with {} iters of {} blocks", TEST_ITERS, TEST_MAX_LEN / aes_xous::BLOCK_SIZE).unwrap();
write!(ret, "Starting Aes hardware benchmark with {} iters of {} blocks", TEST_ITERS, TEST_MAX_LEN / aes::BLOCK_SIZE).unwrap();
}
"swbench" => {
let start = env.ticktimer.elapsed_ms();
@ -301,7 +301,7 @@ impl<'a> ShellCmdApi<'a> for Aes {
xous::send_message(self.benchmark_cid,
xous::Message::new_scalar(BenchOp::StartAesSw.to_usize().unwrap(), 0, 0, 0, 0)
).unwrap();
write!(ret, "Starting Aes software benchmark with {} iters of {} blocks", TEST_ITERS, TEST_MAX_LEN / aes_xous::BLOCK_SIZE).unwrap();
write!(ret, "Starting Aes software benchmark with {} iters of {} blocks", TEST_ITERS, TEST_MAX_LEN / aes::BLOCK_SIZE).unwrap();
}
"susres" => {
let start = env.ticktimer.elapsed_ms();
@ -331,7 +331,7 @@ impl<'a> ShellCmdApi<'a> for Aes {
xous::msg_scalar_unpack!(msg, pass, hw_mode, keybits, _, {
let end = env.ticktimer.elapsed_ms();
let elapsed: f64 = ((end - self.start_time.unwrap()) as f64) / (TEST_ITERS as f64 * (TEST_MAX_LEN / aes_xous::BLOCK_SIZE) as f64);
let elapsed: f64 = ((end - self.start_time.unwrap()) as f64) / (TEST_ITERS as f64 * (TEST_MAX_LEN / aes::BLOCK_SIZE) as f64);
let modestr = if hw_mode != 0 { &"hw" } else { &"sw" };
if pass != 0 {
write!(ret, "[{}] passed: {:.02}µs/block enc+dec AES{}", modestr, elapsed * 1000.0, keybits).unwrap();

View file

@ -61,7 +61,7 @@ impl<'a> ShellCmdApi<'a> for Keys {
write!(ret, "Provisioning BBRAM").unwrap();
}
"aes" => {
use aes_xous::{BlockEncrypt, BlockDecrypt};
use aes::{BlockEncrypt, BlockDecrypt};
let mut pass = true;
let mut block = Block::clone_from_slice(&[0; 16]);
self.rootkeys.encrypt_block(&mut block);