mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-20 09:03:28 +00:00
add some apis for owc frobbing
This commit is contained in:
parent
53dccf0df2
commit
9452422751
2 changed files with 14 additions and 1 deletions
|
|
@ -30,12 +30,17 @@ pub const ONEWAY_MAX_VALUE: u32 = 10_0000;
|
||||||
/// a single boot attempt.
|
/// a single boot attempt.
|
||||||
pub const ONEWAY_MAX_DELTA: u32 = 512;
|
pub const ONEWAY_MAX_DELTA: u32 = 512;
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, num_derive::FromPrimitive, num_derive::ToPrimitive)]
|
||||||
pub enum OneWayErr {
|
pub enum OneWayErr {
|
||||||
OutOfBounds,
|
OutOfBounds,
|
||||||
IncFail,
|
IncFail,
|
||||||
InvalidCoding,
|
InvalidCoding,
|
||||||
|
// used to report messaging errors in xous environments
|
||||||
|
InternalError,
|
||||||
|
// used to indicate things are OK in xous environments
|
||||||
|
None,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct OneWayCounter {
|
pub struct OneWayCounter {
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
mapping: MemoryRange,
|
mapping: MemoryRange,
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,9 @@ pub enum Opcode {
|
||||||
/// Flag operations
|
/// Flag operations
|
||||||
GetFlags = 512,
|
GetFlags = 512,
|
||||||
SetFlags = 513,
|
SetFlags = 513,
|
||||||
|
/// One way counter operations
|
||||||
|
GetOneWayCounter = 768,
|
||||||
|
IncOneWayCounter = 769,
|
||||||
|
|
||||||
// ----- below are non-cryptographic opcodes but used to manipulate sensitive state -----
|
// ----- below are non-cryptographic opcodes but used to manipulate sensitive state -----
|
||||||
/// Set bootwait parameters
|
/// Set bootwait parameters
|
||||||
|
|
@ -41,3 +44,8 @@ pub enum EphemeralOp {
|
||||||
GetMsb,
|
GetMsb,
|
||||||
SetMsb,
|
SetMsb,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Series of magic numbers not meant for cryptographic authentication,
|
||||||
|
/// but for detecting fat-fingered API implementations.
|
||||||
|
pub const OWC_MAGIC_GET: [usize; 3] = [0x2b46_2ab3, 0xf7e3_1b59, 0x7bba_d222];
|
||||||
|
pub const OWC_MAGIC_INC: [usize; 3] = [0xeb5d_fc81, 0x8b6d_6a90, 0xf720_491a];
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue