diff --git a/libs/bao1x-api/src/offsets/common.rs b/libs/bao1x-api/src/offsets/common.rs index ba3a31408..9344e1d2d 100644 --- a/libs/bao1x-api/src/offsets/common.rs +++ b/libs/bao1x-api/src/offsets/common.rs @@ -20,6 +20,17 @@ pub const RRAM_STORAGE_LEN: usize = 0x3D_A000; pub const SWAP_START_UF2: usize = 0x7000_0000; pub const SWAP_UF2_LEN: usize = 0x0800_0000; // 128 MiB +#[derive(Clone, Copy, Debug, PartialEq, Eq, num_derive::FromPrimitive, num_derive::ToPrimitive)] +pub enum OneWayErr { + OutOfBounds, + IncFail, + InvalidCoding, + // used to report messaging errors in xous environments + InternalError, + // used to indicate things are OK in xous environments + None, +} + // Define a trait with just the offset pub trait OneWayEncoding: TryFrom { const OFFSET: usize; diff --git a/libs/bao1x-hal/src/acram.rs b/libs/bao1x-hal/src/acram.rs index 8244a6fc9..3c06a45b9 100644 --- a/libs/bao1x-hal/src/acram.rs +++ b/libs/bao1x-hal/src/acram.rs @@ -7,9 +7,9 @@ //! In the case of baremetal targets of course everything is mapped, so these //! restrictions are not a concern. -use bao1x_api::OneWayEncoding; use bao1x_api::bollard; use bao1x_api::offsets::*; +use bao1x_api::{OneWayEncoding, OneWayErr}; #[cfg(feature = "std")] use xous::MemoryRange; @@ -30,17 +30,6 @@ pub const ONEWAY_MAX_VALUE: u32 = 10_0000; /// a single boot attempt. pub const ONEWAY_MAX_DELTA: u32 = 512; -#[derive(Clone, Copy, Debug, PartialEq, Eq, num_derive::FromPrimitive, num_derive::ToPrimitive)] -pub enum OneWayErr { - OutOfBounds, - IncFail, - InvalidCoding, - // used to report messaging errors in xous environments - InternalError, - // used to indicate things are OK in xous environments - None, -} - pub struct OneWayCounter { #[cfg(feature = "std")] mapping: MemoryRange, diff --git a/services/keystore/src/lib.rs b/services/keystore/src/lib.rs index ae623cc8a..434315142 100644 --- a/services/keystore/src/lib.rs +++ b/services/keystore/src/lib.rs @@ -1,4 +1,4 @@ -use bao1x_api::{BackupFlags, OneWayEncoding}; +use bao1x_api::{BackupFlags, OneWayEncoding, OneWayErr}; pub use cipher::{ BlockBackend, BlockCipher, BlockClosure, BlockDecrypt, BlockEncrypt, BlockSizeUser, ParBlocksSizeUser, consts::U16, generic_array::GenericArray, inout::InOut, @@ -10,8 +10,6 @@ use xous_ipc::Buffer; pub(crate) type BatchBlocks = GenericArray; use std::convert::TryInto; -use bao1x_hal::acram::*; - #[derive(Debug)] // there is no confidential information in the external structure; it's safe to Debug it pub struct Keystore { conn: CID, diff --git a/services/keystore/src/platform/baosec/server.rs b/services/keystore/src/platform/baosec/server.rs index 6c3297539..d262421ae 100644 --- a/services/keystore/src/platform/baosec/server.rs +++ b/services/keystore/src/platform/baosec/server.rs @@ -1,5 +1,5 @@ -use bao1x_api::BackupFlags; -use bao1x_hal::acram::{MAX_ONEWAY_COUNTERS, OneWayErr}; +use bao1x_api::{BackupFlags, OneWayErr}; +use bao1x_hal::acram::MAX_ONEWAY_COUNTERS; use bao1x_hal::board::{BOOKEND_END, BOOKEND_START}; use bao1x_hal::rram::Reram; use keystore_api::*;