mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-21 09:14:34 +00:00
root-keys: add explicit discriminants to enums
This ensures this API is stable across builds. Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
parent
19532c5634
commit
a16252e0fb
1 changed files with 50 additions and 50 deletions
|
|
@ -6,74 +6,74 @@ pub(crate) const SIG_VERSION: u32 = 1;
|
||||||
#[derive(num_derive::FromPrimitive, num_derive::ToPrimitive, Debug)]
|
#[derive(num_derive::FromPrimitive, num_derive::ToPrimitive, Debug)]
|
||||||
pub(crate) enum Opcode {
|
pub(crate) enum Opcode {
|
||||||
/// use to check if we've been initialized
|
/// use to check if we've been initialized
|
||||||
KeysInitialized,
|
KeysInitialized = 0,
|
||||||
/// check that the digital signature on the gateware
|
/// check that the digital signature on the gateware
|
||||||
CheckGatewareSignature,
|
CheckGatewareSignature = 1,
|
||||||
/// check if the efuse has been locked down
|
/// check if the efuse has been locked down
|
||||||
IsEfuseSecured,
|
IsEfuseSecured = 2,
|
||||||
/// quick check to see if the JTAG can read its IDCODE
|
/// quick check to see if the JTAG can read its IDCODE
|
||||||
IsJtagWorking,
|
IsJtagWorking = 3,
|
||||||
/// initiate an AES oracle operation
|
/// initiate an AES oracle operation
|
||||||
AesOracle,
|
AesOracle = 4,
|
||||||
/// initiate key wrapper operation
|
/// initiate key wrapper operation
|
||||||
AesKwp,
|
AesKwp = 5,
|
||||||
/// create new FPGA keys; provisioning requires a slave device to be connected that can run the JTAG sequence
|
/// create new FPGA keys; provisioning requires a slave device to be connected that can run the JTAG sequence
|
||||||
BbramProvision,
|
BbramProvision = 6,
|
||||||
/// clear a cached password
|
/// clear a cached password
|
||||||
ClearPasswordCacheEntry,
|
ClearPasswordCacheEntry = 7,
|
||||||
|
|
||||||
TestUx,
|
TestUx = 8,
|
||||||
|
|
||||||
/// attempt to initialize keys on a brand new system. Does nothing if the keys are already provisioned.
|
/// attempt to initialize keys on a brand new system. Does nothing if the keys are already provisioned.
|
||||||
UxTryInitKeys,
|
UxTryInitKeys = 9,
|
||||||
UxInitBootPasswordReturn,
|
UxInitBootPasswordReturn = 10,
|
||||||
UxInitUpdatePasswordReturn,
|
UxInitUpdatePasswordReturn = 11,
|
||||||
|
|
||||||
/// provision a gateware update with our secret data
|
/// provision a gateware update with our secret data
|
||||||
UxUpdateGateware,
|
UxUpdateGateware = 12,
|
||||||
UxUpdateGwPasswordReturn,
|
UxUpdateGwPasswordReturn = 13,
|
||||||
UxUpdateGwRun,
|
UxUpdateGwRun = 14,
|
||||||
|
|
||||||
/// self-sign kernel/loader
|
/// self-sign kernel/loader
|
||||||
UxSelfSignXous,
|
UxSelfSignXous = 15,
|
||||||
UxSignXousPasswordReturn,
|
UxSignXousPasswordReturn = 16,
|
||||||
UxSignXousRun,
|
UxSignXousRun = 17,
|
||||||
|
|
||||||
/// Ux AES calls
|
/// Ux AES calls
|
||||||
UxAesEnsurePassword,
|
UxAesEnsurePassword = 18,
|
||||||
UxAesPasswordPolicy,
|
UxAesPasswordPolicy = 19,
|
||||||
UxAesEnsureReturn,
|
UxAesEnsureReturn = 20,
|
||||||
|
|
||||||
/// Ux BBRAM flow
|
/// Ux BBRAM flow
|
||||||
UxBbramCheckReturn,
|
UxBbramCheckReturn = 21,
|
||||||
UxBbramPasswordReturn,
|
UxBbramPasswordReturn = 22,
|
||||||
UxBbramRun,
|
UxBbramRun = 23,
|
||||||
|
|
||||||
// General Ux calls
|
// General Ux calls
|
||||||
UxGutter, // NOP for UX calls that require a destination
|
UxGutter = 24, // NOP for UX calls that require a destination
|
||||||
#[cfg(feature = "policy-menu")]
|
#[cfg(feature = "policy-menu")]
|
||||||
UxGetPolicy,
|
UxGetPolicy = 25,
|
||||||
#[cfg(feature = "policy-menu")]
|
#[cfg(feature = "policy-menu")]
|
||||||
UxPolicyReturn,
|
UxPolicyReturn = 26,
|
||||||
UxTryReboot,
|
UxTryReboot = 27,
|
||||||
UxDoReboot,
|
UxDoReboot = 28,
|
||||||
|
|
||||||
/// UX opcodes
|
/// UX opcodes
|
||||||
ModalRedraw,
|
ModalRedraw = 29,
|
||||||
ModalKeys,
|
ModalKeys = 30,
|
||||||
ModalDrop,
|
ModalDrop = 31,
|
||||||
|
|
||||||
/// Suspend/resume callback
|
/// Suspend/resume callback
|
||||||
SuspendResume,
|
SuspendResume = 32,
|
||||||
|
|
||||||
Quit
|
Quit = 33,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, num_derive::FromPrimitive, num_derive::ToPrimitive, PartialEq, Eq)]
|
#[derive(Debug, num_derive::FromPrimitive, num_derive::ToPrimitive, PartialEq, Eq)]
|
||||||
pub enum PasswordRetentionPolicy {
|
pub enum PasswordRetentionPolicy {
|
||||||
AlwaysKeep,
|
AlwaysKeep = 0,
|
||||||
EraseOnSuspend,
|
EraseOnSuspend = 1,
|
||||||
AlwaysPurge,
|
AlwaysPurge = 2,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Enumerate the possible password types dealt with by this manager.
|
/// Enumerate the possible password types dealt with by this manager.
|
||||||
|
|
@ -89,10 +89,10 @@ pub enum PasswordType {
|
||||||
#[cfg_attr(not(any(target_os = "none", target_os = "xous")), allow(dead_code))]
|
#[cfg_attr(not(any(target_os = "none", target_os = "xous")), allow(dead_code))]
|
||||||
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
|
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
|
||||||
pub enum RootkeyResult {
|
pub enum RootkeyResult {
|
||||||
AlignmentError,
|
AlignmentError = 0,
|
||||||
KeyError,
|
KeyError = 1,
|
||||||
IntegrityError,
|
IntegrityError = 2,
|
||||||
FlashError,
|
FlashError = 3,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// AES operation definitions
|
/// AES operation definitions
|
||||||
|
|
@ -125,8 +125,8 @@ pub enum AesBlockType {
|
||||||
#[derive(Debug, rkyv::Archive, rkyv::Serialize, rkyv::Deserialize, Zeroize)]
|
#[derive(Debug, rkyv::Archive, rkyv::Serialize, rkyv::Deserialize, Zeroize)]
|
||||||
#[zeroize(drop)]
|
#[zeroize(drop)]
|
||||||
pub enum AesOpType {
|
pub enum AesOpType {
|
||||||
Encrypt,
|
Encrypt = 0,
|
||||||
Decrypt,
|
Decrypt = 1,
|
||||||
}
|
}
|
||||||
#[derive(Debug, rkyv::Archive, rkyv::Serialize, rkyv::Deserialize, Zeroize)]
|
#[derive(Debug, rkyv::Archive, rkyv::Serialize, rkyv::Deserialize, Zeroize)]
|
||||||
#[zeroize(drop)]
|
#[zeroize(drop)]
|
||||||
|
|
@ -158,20 +158,20 @@ impl AesOp {
|
||||||
#[derive(Debug, rkyv::Archive, rkyv::Serialize, rkyv::Deserialize, Zeroize, Eq, PartialEq, Copy, Clone)]
|
#[derive(Debug, rkyv::Archive, rkyv::Serialize, rkyv::Deserialize, Zeroize, Eq, PartialEq, Copy, Clone)]
|
||||||
pub enum KeywrapError {
|
pub enum KeywrapError {
|
||||||
/// Input is too big.
|
/// Input is too big.
|
||||||
TooBig,
|
TooBig = 0,
|
||||||
/// Input is too small.
|
/// Input is too small.
|
||||||
TooSmall,
|
TooSmall = 1,
|
||||||
/// Ciphertext has invalid padding.
|
/// Ciphertext has invalid padding.
|
||||||
Unpadded,
|
Unpadded = 2,
|
||||||
/// The ciphertext is not valid for the expected length.
|
/// The ciphertext is not valid for the expected length.
|
||||||
InvalidExpectedLen,
|
InvalidExpectedLen = 3,
|
||||||
/// The ciphertext couldn't be authenticated.
|
/// The ciphertext couldn't be authenticated.
|
||||||
AuthenticationFailed,
|
AuthenticationFailed = 4,
|
||||||
}
|
}
|
||||||
#[derive(Debug, rkyv::Archive, rkyv::Serialize, rkyv::Deserialize, Zeroize, Eq, PartialEq)]
|
#[derive(Debug, rkyv::Archive, rkyv::Serialize, rkyv::Deserialize, Zeroize, Eq, PartialEq)]
|
||||||
pub enum KeyWrapOp {
|
pub enum KeyWrapOp {
|
||||||
Wrap,
|
Wrap = 0,
|
||||||
Unwrap,
|
Unwrap = 1,
|
||||||
}
|
}
|
||||||
|
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue