mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-08 04:56:43 +00:00
fix API to reflect that the 0-state is the most permissive state
This commit is contained in:
parent
12d0728582
commit
d91c2e7671
2 changed files with 7 additions and 5 deletions
|
|
@ -213,7 +213,8 @@ pub enum RwPerms {
|
|||
/// Specifies what partitions can access a given slot. Some common patterns are
|
||||
/// provided, a Custom field is also provided for other odd combinations.
|
||||
pub enum PartitionAccess {
|
||||
None,
|
||||
/// Open disables not just PartitionAccess but also all other security controls
|
||||
Open,
|
||||
All,
|
||||
Boot0,
|
||||
Boot1,
|
||||
|
|
@ -235,7 +236,7 @@ impl PartitionAccess {
|
|||
// The bitfield coding is fw1:fw0:boot1:boot0 from MSB to LSB.
|
||||
let code: u4 = u4::new(((raw >> 20) & 0xF) as u8);
|
||||
match code.value() {
|
||||
0b0000 => Self::None,
|
||||
0b0000 => Self::Open,
|
||||
0b1111 => Self::All,
|
||||
0b0001 => Self::Boot0,
|
||||
0b0010 => Self::Boot1,
|
||||
|
|
@ -251,7 +252,7 @@ impl PartitionAccess {
|
|||
// can be shifted into place.
|
||||
fn to_raw_u4(&self) -> u4 {
|
||||
match self {
|
||||
Self::None => u4::new(0b0000 & 0xF),
|
||||
Self::Open => u4::new(0b0000 & 0xF),
|
||||
Self::All => u4::new(0b1111 & 0xF),
|
||||
Self::Boot0 => u4::new(0b0001 & 0xF),
|
||||
Self::Boot1 => u4::new(0b0010 & 0xF),
|
||||
|
|
|
|||
|
|
@ -168,8 +168,9 @@ pub const SERIAL_NUMBER: SlotIndex = SlotIndex::Data(0, PartitionAccess::All, Rw
|
|||
|
||||
/// `UUID` is a 256-bit random number that can be used as a UUID for the chip. It is publicly
|
||||
/// readable and generated by a TRNG. This is suitable for putting into a KDF and generating
|
||||
/// salts for algorithms that require such a parameter.
|
||||
pub const UUID: SlotIndex = SlotIndex::Data(1, PartitionAccess::All, RwPerms::ReadOnly);
|
||||
/// salts for algorithms that require such a parameter. The UUID is changeable, but changing
|
||||
/// will cause all derived keys to be changed as well.
|
||||
pub const UUID: SlotIndex = SlotIndex::Data(1, PartitionAccess::Open, RwPerms::ReadWrite);
|
||||
|
||||
/// `IFR_HASH` is a provisional slot for a hash of the IFR region. Whether the hash is meaningful
|
||||
/// or not depends on if the chip is booted before it is sealed. At the time of writing, it's
|
||||
|
|
|
|||
Loading…
Reference in a new issue