mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-21 09:14:34 +00:00
regex search/replace instances of xous_ipc::String to String
more regex results
This commit is contained in:
parent
1d9316f9cd
commit
f2fbc7fafd
13 changed files with 131 additions and 126 deletions
|
|
@ -21,8 +21,9 @@ locales = { path = "../../locales" }
|
||||||
|
|
||||||
num-derive = { version = "0.3.3", default-features = false }
|
num-derive = { version = "0.3.3", default-features = false }
|
||||||
num-traits = { version = "0.2.14", default-features = false }
|
num-traits = { version = "0.2.14", default-features = false }
|
||||||
rkyv = { version = "0.4.3", default-features = false, features = [
|
rkyv = { version = "0.8.8", default-features = false, features = [
|
||||||
"const_generics",
|
"std",
|
||||||
|
"alloc",
|
||||||
] }
|
] }
|
||||||
|
|
||||||
xous-semver = "0.1.2"
|
xous-semver = "0.1.2"
|
||||||
|
|
|
||||||
|
|
@ -63,13 +63,13 @@ pub(crate) enum Opcode {
|
||||||
GpioIntAsFalling, //(u32),
|
GpioIntAsFalling, //(u32),
|
||||||
GpioIntPending,
|
GpioIntPending,
|
||||||
GpioIntEna, //(u32),
|
GpioIntEna, //(u32),
|
||||||
GpioIntSubscribe, //(String<64>), //
|
GpioIntSubscribe, //(String), //
|
||||||
GpioIntHappened,
|
GpioIntHappened,
|
||||||
|
|
||||||
/// set UART mux
|
/// set UART mux
|
||||||
UartMux, //(UartType),
|
UartMux, //(UartType),
|
||||||
|
|
||||||
// InfoLitexId, //(String<64>), // TODO: returns the ASCII string baked into the FPGA that describes the
|
// InfoLitexId, //(String), // TODO: returns the ASCII string baked into the FPGA that describes the
|
||||||
// FPGA build, inside Registration
|
// FPGA build, inside Registration
|
||||||
InfoDna,
|
InfoDna,
|
||||||
InfoGit,
|
InfoGit,
|
||||||
|
|
@ -106,9 +106,9 @@ pub(crate) enum Opcode {
|
||||||
AdcGpio2,
|
AdcGpio2,
|
||||||
|
|
||||||
/// events
|
/// events
|
||||||
EventComSubscribe, //(String<64>),
|
EventComSubscribe, //(String),
|
||||||
//EventRtcSubscribe, //(String<64>),
|
//EventRtcSubscribe, //(String),
|
||||||
EventUsbAttachSubscribe, //(String<64>),
|
EventUsbAttachSubscribe, //(String),
|
||||||
EventComEnable, //(bool),
|
EventComEnable, //(bool),
|
||||||
//EventRtcEnable, //(bool),
|
//EventRtcEnable, //(bool),
|
||||||
EventUsbAttachEnable, //(bool),
|
EventUsbAttachEnable, //(bool),
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,10 @@ susres = { package = "xous-api-susres", version = "0.9.59" }
|
||||||
log = "0.4.14"
|
log = "0.4.14"
|
||||||
num-derive = { version = "0.3.3", default-features = false }
|
num-derive = { version = "0.3.3", default-features = false }
|
||||||
num-traits = { version = "0.2.14", default-features = false }
|
num-traits = { version = "0.2.14", default-features = false }
|
||||||
rkyv = { version = "0.4.3", features = ["const_generics"] }
|
rkyv = { version = "0.8.8", default-features = false, features = [
|
||||||
|
"std",
|
||||||
|
"alloc",
|
||||||
|
] }
|
||||||
trng = { path = "../trng" }
|
trng = { path = "../trng" }
|
||||||
spinor = { path = "../spinor" }
|
spinor = { path = "../spinor" }
|
||||||
aes = { path = "../aes" }
|
aes = { path = "../aes" }
|
||||||
|
|
|
||||||
|
|
@ -264,7 +264,7 @@ pub type ApiToken = [u32; 3];
|
||||||
pub struct PddbBasisList {
|
pub struct PddbBasisList {
|
||||||
/// the first 63 that fit in the list -- generally we anticipate not more than a few being open at a
|
/// the first 63 that fit in the list -- generally we anticipate not more than a few being open at a
|
||||||
/// time, so this should be enough.
|
/// time, so this should be enough.
|
||||||
pub list: [xous_ipc::String<BASIS_NAME_LEN>; 63],
|
pub list: [String<BASIS_NAME_LEN>; 63],
|
||||||
/// total number of basis open. Should be <= 63, but we allow it to be larger to indicate cases where
|
/// total number of basis open. Should be <= 63, but we allow it to be larger to indicate cases where
|
||||||
/// this structure wasn't big enough.
|
/// this structure wasn't big enough.
|
||||||
pub num: u32,
|
pub num: u32,
|
||||||
|
|
@ -298,16 +298,16 @@ impl BasisRetentionPolicy {
|
||||||
}
|
}
|
||||||
#[derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)]
|
#[derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)]
|
||||||
pub struct PddbBasisRequest {
|
pub struct PddbBasisRequest {
|
||||||
pub name: xous_ipc::String<BASIS_NAME_LEN>,
|
pub name: String<BASIS_NAME_LEN>,
|
||||||
pub code: PddbRequestCode,
|
pub code: PddbRequestCode,
|
||||||
pub policy: Option<BasisRetentionPolicy>,
|
pub policy: Option<BasisRetentionPolicy>,
|
||||||
}
|
}
|
||||||
#[derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)]
|
#[derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)]
|
||||||
pub struct PddbDictRequest {
|
pub struct PddbDictRequest {
|
||||||
pub basis_specified: bool,
|
pub basis_specified: bool,
|
||||||
pub basis: xous_ipc::String<BASIS_NAME_LEN>,
|
pub basis: String<BASIS_NAME_LEN>,
|
||||||
pub dict: xous_ipc::String<DICT_NAME_LEN>,
|
pub dict: String<DICT_NAME_LEN>,
|
||||||
pub key: xous_ipc::String<KEY_NAME_LEN>,
|
pub key: String<KEY_NAME_LEN>,
|
||||||
pub index: u32,
|
pub index: u32,
|
||||||
pub token: [u32; 4],
|
pub token: [u32; 4],
|
||||||
pub code: PddbRequestCode,
|
pub code: PddbRequestCode,
|
||||||
|
|
@ -323,9 +323,9 @@ pub struct PddbDictRequest {
|
||||||
#[derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)]
|
#[derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)]
|
||||||
pub struct PddbKeyRequest {
|
pub struct PddbKeyRequest {
|
||||||
pub basis_specified: bool,
|
pub basis_specified: bool,
|
||||||
pub basis: xous_ipc::String<BASIS_NAME_LEN>,
|
pub basis: String<BASIS_NAME_LEN>,
|
||||||
pub dict: xous_ipc::String<DICT_NAME_LEN>,
|
pub dict: String<DICT_NAME_LEN>,
|
||||||
pub key: xous_ipc::String<KEY_NAME_LEN>,
|
pub key: String<KEY_NAME_LEN>,
|
||||||
pub token: Option<ApiToken>,
|
pub token: Option<ApiToken>,
|
||||||
pub create_dict: bool,
|
pub create_dict: bool,
|
||||||
pub create_key: bool,
|
pub create_key: bool,
|
||||||
|
|
@ -350,8 +350,8 @@ pub(crate) const MAX_PDDB_DELETE_LEN: usize = 3800; // approximate limit, might
|
||||||
#[derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)]
|
#[derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)]
|
||||||
pub(crate) struct PddbDeleteList {
|
pub(crate) struct PddbDeleteList {
|
||||||
pub basis_specified: bool,
|
pub basis_specified: bool,
|
||||||
pub basis: xous_ipc::String<BASIS_NAME_LEN>,
|
pub basis: String<BASIS_NAME_LEN>,
|
||||||
pub dict: xous_ipc::String<DICT_NAME_LEN>,
|
pub dict: String<DICT_NAME_LEN>,
|
||||||
pub data: [u8; MAX_PDDB_DELETE_LEN],
|
pub data: [u8; MAX_PDDB_DELETE_LEN],
|
||||||
pub retcode: PddbRetcode,
|
pub retcode: PddbRetcode,
|
||||||
}
|
}
|
||||||
|
|
@ -524,8 +524,8 @@ pub struct PddbKeyAttrIpc {
|
||||||
pub len: u64,
|
pub len: u64,
|
||||||
pub reserved: u64,
|
pub reserved: u64,
|
||||||
pub age: u64,
|
pub age: u64,
|
||||||
pub dict: xous_ipc::String<DICT_NAME_LEN>,
|
pub dict: String<DICT_NAME_LEN>,
|
||||||
pub basis: xous_ipc::String<BASIS_NAME_LEN>,
|
pub basis: String<BASIS_NAME_LEN>,
|
||||||
pub flags: u32,
|
pub flags: u32,
|
||||||
pub index: u32,
|
pub index: u32,
|
||||||
pub token: ApiToken,
|
pub token: ApiToken,
|
||||||
|
|
@ -537,8 +537,8 @@ impl PddbKeyAttrIpc {
|
||||||
len: 0,
|
len: 0,
|
||||||
reserved: 0,
|
reserved: 0,
|
||||||
age: 0,
|
age: 0,
|
||||||
dict: xous_ipc::String::<DICT_NAME_LEN>::new(),
|
dict: String::<DICT_NAME_LEN>::new(),
|
||||||
basis: xous_ipc::String::<BASIS_NAME_LEN>::new(),
|
basis: String::<BASIS_NAME_LEN>::new(),
|
||||||
flags: 0,
|
flags: 0,
|
||||||
index: 0,
|
index: 0,
|
||||||
token,
|
token,
|
||||||
|
|
@ -552,8 +552,8 @@ impl PddbKeyAttrIpc {
|
||||||
len: self.len as usize,
|
len: self.len as usize,
|
||||||
reserved: self.reserved as usize,
|
reserved: self.reserved as usize,
|
||||||
age: self.age as usize,
|
age: self.age as usize,
|
||||||
dict: String::from(self.dict.as_str().unwrap()),
|
dict: String::from(self.dict.as_str()),
|
||||||
basis: String::from(self.basis.as_str().unwrap()),
|
basis: String::from(self.basis.as_str()),
|
||||||
flags: KeyFlags(self.flags),
|
flags: KeyFlags(self.flags),
|
||||||
index: NonZeroU32::new(self.index).unwrap(),
|
index: NonZeroU32::new(self.index).unwrap(),
|
||||||
}
|
}
|
||||||
|
|
@ -564,8 +564,8 @@ impl PddbKeyAttrIpc {
|
||||||
len: attr.len as u64,
|
len: attr.len as u64,
|
||||||
reserved: attr.reserved as u64,
|
reserved: attr.reserved as u64,
|
||||||
age: attr.age as u64,
|
age: attr.age as u64,
|
||||||
dict: xous_ipc::String::<DICT_NAME_LEN>::from_str(&attr.dict),
|
dict: String::<DICT_NAME_LEN>::from_str(&attr.dict),
|
||||||
basis: xous_ipc::String::<BASIS_NAME_LEN>::from_str(&attr.basis),
|
basis: String::<BASIS_NAME_LEN>::from_str(&attr.basis),
|
||||||
flags: attr.flags.0,
|
flags: attr.flags.0,
|
||||||
index: attr.index.get(),
|
index: attr.index.get(),
|
||||||
token,
|
token,
|
||||||
|
|
@ -579,7 +579,7 @@ impl PddbKeyAttrIpc {
|
||||||
#[derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)]
|
#[derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)]
|
||||||
pub struct PddbDangerousDebug {
|
pub struct PddbDangerousDebug {
|
||||||
pub request: DebugRequest,
|
pub request: DebugRequest,
|
||||||
pub dump_name: xous_ipc::String<128>,
|
pub dump_name: String,
|
||||||
}
|
}
|
||||||
#[cfg(not(target_os = "xous"))]
|
#[cfg(not(target_os = "xous"))]
|
||||||
#[derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)]
|
#[derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)]
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ pub enum PddbRekeyOp {
|
||||||
/// system basis keys are encrypted directly by the rootkeys enclave, so changing
|
/// system basis keys are encrypted directly by the rootkeys enclave, so changing
|
||||||
/// its password requires calling a routine in root_keys (that does not exist
|
/// its password requires calling a routine in root_keys (that does not exist
|
||||||
/// at this current time).
|
/// at this current time).
|
||||||
ChangePass(xous_ipc::String<BASIS_NAME_LEN>),
|
ChangePass(String<BASIS_NAME_LEN>),
|
||||||
*/
|
*/
|
||||||
/// Return codes
|
/// Return codes
|
||||||
Success,
|
Success,
|
||||||
|
|
|
||||||
|
|
@ -2777,7 +2777,7 @@ impl PddbOs {
|
||||||
Ok(bname) => {
|
Ok(bname) => {
|
||||||
let name = bname.first().as_str().to_string();
|
let name = bname.first().as_str().to_string();
|
||||||
let request = BasisRequestPassword {
|
let request = BasisRequestPassword {
|
||||||
db_name: xous_ipc::String::from_str(name.to_string()),
|
db_name: String::from(name.to_string()),
|
||||||
plaintext_pw: None,
|
plaintext_pw: None,
|
||||||
};
|
};
|
||||||
let mut buf = Buffer::into_buf(request).unwrap();
|
let mut buf = Buffer::into_buf(request).unwrap();
|
||||||
|
|
@ -2785,7 +2785,7 @@ impl PddbOs {
|
||||||
let retpass = buf.to_original::<BasisRequestPassword, _>().unwrap();
|
let retpass = buf.to_original::<BasisRequestPassword, _>().unwrap();
|
||||||
// 2. validate the name/password combo
|
// 2. validate the name/password combo
|
||||||
let basis_key =
|
let basis_key =
|
||||||
self.basis_derive_key(&name, retpass.plaintext_pw.unwrap().as_str().unwrap());
|
self.basis_derive_key(&name, retpass.plaintext_pw.unwrap().as_str());
|
||||||
// validate the password by finding the root block of the basis. We rely entirely
|
// validate the password by finding the root block of the basis. We rely entirely
|
||||||
// upon the AEAD with key commit to ensure the password is correct.
|
// upon the AEAD with key commit to ensure the password is correct.
|
||||||
let maybe_entry = if let Some(basis_map) =
|
let maybe_entry = if let Some(basis_map) =
|
||||||
|
|
@ -3446,7 +3446,7 @@ impl PddbOs {
|
||||||
{
|
{
|
||||||
Ok(bname) => {
|
Ok(bname) => {
|
||||||
let request = BasisRequestPassword {
|
let request = BasisRequestPassword {
|
||||||
db_name: xous_ipc::String::from_str(bname.first().as_str()),
|
db_name: String::from(bname.first().as_str()),
|
||||||
plaintext_pw: None,
|
plaintext_pw: None,
|
||||||
};
|
};
|
||||||
let mut buf = Buffer::into_buf(request).unwrap();
|
let mut buf = Buffer::into_buf(request).unwrap();
|
||||||
|
|
|
||||||
|
|
@ -280,7 +280,7 @@ impl Pddb {
|
||||||
|
|
||||||
/// return a list of all open bases
|
/// return a list of all open bases
|
||||||
pub fn list_basis(&self) -> Vec<String> {
|
pub fn list_basis(&self) -> Vec<String> {
|
||||||
let list_alloc = PddbBasisList { list: [xous_ipc::String::<BASIS_NAME_LEN>::default(); 63], num: 0 };
|
let list_alloc = PddbBasisList { list: [String::<BASIS_NAME_LEN>::default(); 63], num: 0 };
|
||||||
let mut buf = Buffer::into_buf(list_alloc).expect("Couldn't convert to memory structure");
|
let mut buf = Buffer::into_buf(list_alloc).expect("Couldn't convert to memory structure");
|
||||||
buf.lend_mut(self.conn, Opcode::ListBasis.to_u32().unwrap())
|
buf.lend_mut(self.conn, Opcode::ListBasis.to_u32().unwrap())
|
||||||
.expect("Couldn't execute ListBasis opcode");
|
.expect("Couldn't execute ListBasis opcode");
|
||||||
|
|
@ -293,14 +293,14 @@ impl Pddb {
|
||||||
if index as u32 == list.num {
|
if index as u32 == list.num {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ret.push(name.as_str().expect("name is not valid utf-8").to_string());
|
ret.push(name.as_str().to_string());
|
||||||
}
|
}
|
||||||
ret
|
ret
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The caller of this function will block and return only if the order of Bases has changed.
|
/// The caller of this function will block and return only if the order of Bases has changed.
|
||||||
pub fn monitor_basis(&self) -> Vec<String> {
|
pub fn monitor_basis(&self) -> Vec<String> {
|
||||||
let list_alloc = PddbBasisList { list: [xous_ipc::String::<BASIS_NAME_LEN>::default(); 63], num: 0 };
|
let list_alloc = PddbBasisList { list: [String::<BASIS_NAME_LEN>::default(); 63], num: 0 };
|
||||||
let mut buf = Buffer::into_buf(list_alloc).expect("Couldn't convert to memory structure");
|
let mut buf = Buffer::into_buf(list_alloc).expect("Couldn't convert to memory structure");
|
||||||
buf.lend_mut(self.conn, Opcode::BasisMonitor.to_u32().unwrap())
|
buf.lend_mut(self.conn, Opcode::BasisMonitor.to_u32().unwrap())
|
||||||
.expect("Couldn't execute ListBasis opcode");
|
.expect("Couldn't execute ListBasis opcode");
|
||||||
|
|
@ -313,7 +313,7 @@ impl Pddb {
|
||||||
if index as u32 == list.num {
|
if index as u32 == list.num {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ret.push(name.as_str().expect("name is not valid utf-8").to_string());
|
ret.push(name.as_str().to_string());
|
||||||
}
|
}
|
||||||
ret
|
ret
|
||||||
}
|
}
|
||||||
|
|
@ -322,7 +322,7 @@ impl Pddb {
|
||||||
/// if the PDDB is not mounted, returns None
|
/// if the PDDB is not mounted, returns None
|
||||||
pub fn latest_basis(&self) -> Option<String> {
|
pub fn latest_basis(&self) -> Option<String> {
|
||||||
let mgmt = PddbBasisRequest {
|
let mgmt = PddbBasisRequest {
|
||||||
name: xous_ipc::String::<BASIS_NAME_LEN>::new(),
|
name: String::<BASIS_NAME_LEN>::new(),
|
||||||
code: PddbRequestCode::Uninit,
|
code: PddbRequestCode::Uninit,
|
||||||
policy: None,
|
policy: None,
|
||||||
};
|
};
|
||||||
|
|
@ -331,7 +331,7 @@ impl Pddb {
|
||||||
.expect("Couldn't execute ListBasis opcode");
|
.expect("Couldn't execute ListBasis opcode");
|
||||||
let ret = buf.to_original::<PddbBasisRequest, _>().expect("couldn't restore list structure");
|
let ret = buf.to_original::<PddbBasisRequest, _>().expect("couldn't restore list structure");
|
||||||
match ret.code {
|
match ret.code {
|
||||||
PddbRequestCode::NoErr => Some(ret.name.as_str().expect("name wasn't valid utf-8").to_string()),
|
PddbRequestCode::NoErr => Some(ret.name.as_str().to_string()),
|
||||||
PddbRequestCode::NotMounted => None,
|
PddbRequestCode::NotMounted => None,
|
||||||
_ => {
|
_ => {
|
||||||
log::error!("Invalid return from latest basis call");
|
log::error!("Invalid return from latest basis call");
|
||||||
|
|
@ -345,7 +345,7 @@ impl Pddb {
|
||||||
return Err(Error::new(ErrorKind::InvalidInput, "basis name too long"));
|
return Err(Error::new(ErrorKind::InvalidInput, "basis name too long"));
|
||||||
}
|
}
|
||||||
let mgmt = PddbBasisRequest {
|
let mgmt = PddbBasisRequest {
|
||||||
name: xous_ipc::String::<BASIS_NAME_LEN>::from_str(basis_name),
|
name: String::<BASIS_NAME_LEN>::from_str(basis_name),
|
||||||
code: PddbRequestCode::Create,
|
code: PddbRequestCode::Create,
|
||||||
policy: None,
|
policy: None,
|
||||||
};
|
};
|
||||||
|
|
@ -376,7 +376,7 @@ impl Pddb {
|
||||||
return Err(Error::new(ErrorKind::InvalidInput, "basis name too long"));
|
return Err(Error::new(ErrorKind::InvalidInput, "basis name too long"));
|
||||||
}
|
}
|
||||||
let mgmt = PddbBasisRequest {
|
let mgmt = PddbBasisRequest {
|
||||||
name: xous_ipc::String::<BASIS_NAME_LEN>::from_str(basis_name),
|
name: String::<BASIS_NAME_LEN>::from_str(basis_name),
|
||||||
code: PddbRequestCode::Open,
|
code: PddbRequestCode::Open,
|
||||||
policy,
|
policy,
|
||||||
};
|
};
|
||||||
|
|
@ -404,7 +404,7 @@ impl Pddb {
|
||||||
return Err(Error::new(ErrorKind::InvalidInput, "basis name too long"));
|
return Err(Error::new(ErrorKind::InvalidInput, "basis name too long"));
|
||||||
}
|
}
|
||||||
let mgmt = PddbBasisRequest {
|
let mgmt = PddbBasisRequest {
|
||||||
name: xous_ipc::String::<BASIS_NAME_LEN>::from_str(basis_name),
|
name: String::<BASIS_NAME_LEN>::from_str(basis_name),
|
||||||
code: PddbRequestCode::Close,
|
code: PddbRequestCode::Close,
|
||||||
policy: None,
|
policy: None,
|
||||||
};
|
};
|
||||||
|
|
@ -430,7 +430,7 @@ impl Pddb {
|
||||||
return Err(Error::new(ErrorKind::InvalidInput, "basis name too long"));
|
return Err(Error::new(ErrorKind::InvalidInput, "basis name too long"));
|
||||||
}
|
}
|
||||||
let mgmt = PddbBasisRequest {
|
let mgmt = PddbBasisRequest {
|
||||||
name: xous_ipc::String::<BASIS_NAME_LEN>::from_str(basis_name),
|
name: String::<BASIS_NAME_LEN>::from_str(basis_name),
|
||||||
code: PddbRequestCode::Delete,
|
code: PddbRequestCode::Delete,
|
||||||
policy: None,
|
policy: None,
|
||||||
};
|
};
|
||||||
|
|
@ -477,9 +477,9 @@ impl Pddb {
|
||||||
if bname.len() > BASIS_NAME_LEN - 1 {
|
if bname.len() > BASIS_NAME_LEN - 1 {
|
||||||
return Err(Error::new(ErrorKind::InvalidInput, "basis name too long"));
|
return Err(Error::new(ErrorKind::InvalidInput, "basis name too long"));
|
||||||
}
|
}
|
||||||
xous_ipc::String::<BASIS_NAME_LEN>::from_str(bname)
|
String::<BASIS_NAME_LEN>::from_str(bname)
|
||||||
} else {
|
} else {
|
||||||
xous_ipc::String::<BASIS_NAME_LEN>::new()
|
String::<BASIS_NAME_LEN>::new()
|
||||||
};
|
};
|
||||||
|
|
||||||
if key_changed_cb.is_some() {
|
if key_changed_cb.is_some() {
|
||||||
|
|
@ -492,9 +492,9 @@ impl Pddb {
|
||||||
|
|
||||||
let request = PddbKeyRequest {
|
let request = PddbKeyRequest {
|
||||||
basis_specified: basis_name.is_some(),
|
basis_specified: basis_name.is_some(),
|
||||||
basis: xous_ipc::String::<BASIS_NAME_LEN>::from_str(&bname),
|
basis: String::<BASIS_NAME_LEN>::from_str(&bname),
|
||||||
dict: xous_ipc::String::<DICT_NAME_LEN>::from_str(dict_name),
|
dict: String::<DICT_NAME_LEN>::from_str(dict_name),
|
||||||
key: xous_ipc::String::<KEY_NAME_LEN>::from_str(key_name),
|
key: String::<KEY_NAME_LEN>::from_str(key_name),
|
||||||
create_dict,
|
create_dict,
|
||||||
create_key,
|
create_key,
|
||||||
token: None,
|
token: None,
|
||||||
|
|
@ -524,7 +524,7 @@ impl Pddb {
|
||||||
// i think these fields are redundant, let's save the storage and remove them for
|
// i think these fields are redundant, let's save the storage and remove them for
|
||||||
// now... dict: String::from(dict_name),
|
// now... dict: String::from(dict_name),
|
||||||
//key: String::from(key_name),
|
//key: String::from(key_name),
|
||||||
//basis: if basis_name.is_some() {Some(String::from(bname.as_str().unwrap()))} else
|
//basis: if basis_name.is_some() {Some(String::from(bname.as_str()))} else
|
||||||
// {None},
|
// {None},
|
||||||
pos: 0,
|
pos: 0,
|
||||||
token,
|
token,
|
||||||
|
|
@ -560,9 +560,9 @@ impl Pddb {
|
||||||
if bname.len() > BASIS_NAME_LEN - 1 {
|
if bname.len() > BASIS_NAME_LEN - 1 {
|
||||||
return Err(Error::new(ErrorKind::InvalidInput, "basis name too long"));
|
return Err(Error::new(ErrorKind::InvalidInput, "basis name too long"));
|
||||||
}
|
}
|
||||||
xous_ipc::String::<BASIS_NAME_LEN>::from_str(bname)
|
String::<BASIS_NAME_LEN>::from_str(bname)
|
||||||
} else {
|
} else {
|
||||||
xous_ipc::String::<BASIS_NAME_LEN>::new()
|
String::<BASIS_NAME_LEN>::new()
|
||||||
};
|
};
|
||||||
|
|
||||||
let maybe_cb = self.cb.take();
|
let maybe_cb = self.cb.take();
|
||||||
|
|
@ -571,9 +571,9 @@ impl Pddb {
|
||||||
|
|
||||||
let request = PddbKeyRequest {
|
let request = PddbKeyRequest {
|
||||||
basis_specified: basis_name.is_some(),
|
basis_specified: basis_name.is_some(),
|
||||||
basis: xous_ipc::String::<BASIS_NAME_LEN>::from_str(&bname),
|
basis: String::<BASIS_NAME_LEN>::from_str(&bname),
|
||||||
dict: xous_ipc::String::<DICT_NAME_LEN>::from_str(dict_name),
|
dict: String::<DICT_NAME_LEN>::from_str(dict_name),
|
||||||
key: xous_ipc::String::<KEY_NAME_LEN>::from_str(key_name),
|
key: String::<KEY_NAME_LEN>::from_str(key_name),
|
||||||
create_dict: false,
|
create_dict: false,
|
||||||
create_key: false,
|
create_key: false,
|
||||||
token: None,
|
token: None,
|
||||||
|
|
@ -614,14 +614,14 @@ impl Pddb {
|
||||||
if bname.len() > BASIS_NAME_LEN - 1 {
|
if bname.len() > BASIS_NAME_LEN - 1 {
|
||||||
return Err(Error::new(ErrorKind::InvalidInput, "basis name too long"));
|
return Err(Error::new(ErrorKind::InvalidInput, "basis name too long"));
|
||||||
}
|
}
|
||||||
xous_ipc::String::<BASIS_NAME_LEN>::from_str(bname)
|
String::<BASIS_NAME_LEN>::from_str(bname)
|
||||||
} else {
|
} else {
|
||||||
xous_ipc::String::<BASIS_NAME_LEN>::new()
|
String::<BASIS_NAME_LEN>::new()
|
||||||
};
|
};
|
||||||
let mut request = PddbDeleteList {
|
let mut request = PddbDeleteList {
|
||||||
basis_specified: basis_name.is_some(),
|
basis_specified: basis_name.is_some(),
|
||||||
basis: xous_ipc::String::<BASIS_NAME_LEN>::from_str(&bname),
|
basis: String::<BASIS_NAME_LEN>::from_str(&bname),
|
||||||
dict: xous_ipc::String::<DICT_NAME_LEN>::from_str(dict_name),
|
dict: String::<DICT_NAME_LEN>::from_str(dict_name),
|
||||||
retcode: PddbRetcode::Uninit,
|
retcode: PddbRetcode::Uninit,
|
||||||
data: [0u8; MAX_PDDB_DELETE_LEN],
|
data: [0u8; MAX_PDDB_DELETE_LEN],
|
||||||
};
|
};
|
||||||
|
|
@ -670,9 +670,9 @@ impl Pddb {
|
||||||
if bname.len() > BASIS_NAME_LEN - 1 {
|
if bname.len() > BASIS_NAME_LEN - 1 {
|
||||||
return Err(Error::new(ErrorKind::InvalidInput, "basis name too long"));
|
return Err(Error::new(ErrorKind::InvalidInput, "basis name too long"));
|
||||||
}
|
}
|
||||||
xous_ipc::String::<BASIS_NAME_LEN>::from_str(bname)
|
String::<BASIS_NAME_LEN>::from_str(bname)
|
||||||
} else {
|
} else {
|
||||||
xous_ipc::String::<BASIS_NAME_LEN>::new()
|
String::<BASIS_NAME_LEN>::new()
|
||||||
};
|
};
|
||||||
|
|
||||||
let maybe_cb = self.cb.take();
|
let maybe_cb = self.cb.take();
|
||||||
|
|
@ -681,9 +681,9 @@ impl Pddb {
|
||||||
|
|
||||||
let request = PddbKeyRequest {
|
let request = PddbKeyRequest {
|
||||||
basis_specified: basis_name.is_some(),
|
basis_specified: basis_name.is_some(),
|
||||||
basis: xous_ipc::String::<BASIS_NAME_LEN>::from_str(&bname),
|
basis: String::<BASIS_NAME_LEN>::from_str(&bname),
|
||||||
dict: xous_ipc::String::<DICT_NAME_LEN>::from_str(dict_name),
|
dict: String::<DICT_NAME_LEN>::from_str(dict_name),
|
||||||
key: xous_ipc::String::<KEY_NAME_LEN>::new(),
|
key: String::<KEY_NAME_LEN>::new(),
|
||||||
create_dict: false,
|
create_dict: false,
|
||||||
create_key: false,
|
create_key: false,
|
||||||
token: None,
|
token: None,
|
||||||
|
|
@ -764,9 +764,9 @@ impl Pddb {
|
||||||
if bname.len() > BASIS_NAME_LEN - 1 {
|
if bname.len() > BASIS_NAME_LEN - 1 {
|
||||||
return Err(Error::new(ErrorKind::InvalidInput, "basis name too long"));
|
return Err(Error::new(ErrorKind::InvalidInput, "basis name too long"));
|
||||||
}
|
}
|
||||||
xous_ipc::String::<BASIS_NAME_LEN>::from_str(bname)
|
String::<BASIS_NAME_LEN>::from_str(bname)
|
||||||
} else {
|
} else {
|
||||||
xous_ipc::String::<BASIS_NAME_LEN>::new()
|
String::<BASIS_NAME_LEN>::new()
|
||||||
};
|
};
|
||||||
// this is a two-phase query, because it's quite likely that the number of keys can be very large in a
|
// this is a two-phase query, because it's quite likely that the number of keys can be very large in a
|
||||||
// dict.
|
// dict.
|
||||||
|
|
@ -778,9 +778,9 @@ impl Pddb {
|
||||||
];
|
];
|
||||||
let request = PddbDictRequest {
|
let request = PddbDictRequest {
|
||||||
basis_specified: basis_name.is_some(),
|
basis_specified: basis_name.is_some(),
|
||||||
basis: xous_ipc::String::<BASIS_NAME_LEN>::from_str(&bname),
|
basis: String::<BASIS_NAME_LEN>::from_str(&bname),
|
||||||
dict: xous_ipc::String::<DICT_NAME_LEN>::from_str(dict_name),
|
dict: String::<DICT_NAME_LEN>::from_str(dict_name),
|
||||||
key: xous_ipc::String::<KEY_NAME_LEN>::new(),
|
key: String::<KEY_NAME_LEN>::new(),
|
||||||
index: 0,
|
index: 0,
|
||||||
code: PddbRequestCode::Uninit,
|
code: PddbRequestCode::Uninit,
|
||||||
token,
|
token,
|
||||||
|
|
@ -877,9 +877,9 @@ impl Pddb {
|
||||||
if bname.len() > BASIS_NAME_LEN - 1 {
|
if bname.len() > BASIS_NAME_LEN - 1 {
|
||||||
return Err(Error::new(ErrorKind::InvalidInput, "basis name too long"));
|
return Err(Error::new(ErrorKind::InvalidInput, "basis name too long"));
|
||||||
}
|
}
|
||||||
xous_ipc::String::<BASIS_NAME_LEN>::from_str(bname)
|
String::<BASIS_NAME_LEN>::from_str(bname)
|
||||||
} else {
|
} else {
|
||||||
xous_ipc::String::<BASIS_NAME_LEN>::new()
|
String::<BASIS_NAME_LEN>::new()
|
||||||
};
|
};
|
||||||
// this is a two-phase query, because it's quite likely that the number of keys can be very large in a
|
// this is a two-phase query, because it's quite likely that the number of keys can be very large in a
|
||||||
// dict.
|
// dict.
|
||||||
|
|
@ -891,9 +891,9 @@ impl Pddb {
|
||||||
];
|
];
|
||||||
let request = PddbDictRequest {
|
let request = PddbDictRequest {
|
||||||
basis_specified: basis_name.is_some(),
|
basis_specified: basis_name.is_some(),
|
||||||
basis: xous_ipc::String::<BASIS_NAME_LEN>::from_str(&bname),
|
basis: String::<BASIS_NAME_LEN>::from_str(&bname),
|
||||||
dict: xous_ipc::String::<DICT_NAME_LEN>::new(),
|
dict: String::<DICT_NAME_LEN>::new(),
|
||||||
key: xous_ipc::String::<KEY_NAME_LEN>::new(),
|
key: String::<KEY_NAME_LEN>::new(),
|
||||||
index: 0,
|
index: 0,
|
||||||
code: PddbRequestCode::Uninit,
|
code: PddbRequestCode::Uninit,
|
||||||
token,
|
token,
|
||||||
|
|
@ -918,9 +918,9 @@ impl Pddb {
|
||||||
for index in 0..count {
|
for index in 0..count {
|
||||||
let request = PddbDictRequest {
|
let request = PddbDictRequest {
|
||||||
basis_specified: basis_name.is_some(),
|
basis_specified: basis_name.is_some(),
|
||||||
basis: xous_ipc::String::<BASIS_NAME_LEN>::from_str(&bname),
|
basis: String::<BASIS_NAME_LEN>::from_str(&bname),
|
||||||
dict: xous_ipc::String::<DICT_NAME_LEN>::new(),
|
dict: String::<DICT_NAME_LEN>::new(),
|
||||||
key: xous_ipc::String::<KEY_NAME_LEN>::new(),
|
key: String::<KEY_NAME_LEN>::new(),
|
||||||
index,
|
index,
|
||||||
code: PddbRequestCode::Uninit,
|
code: PddbRequestCode::Uninit,
|
||||||
token,
|
token,
|
||||||
|
|
@ -935,7 +935,7 @@ impl Pddb {
|
||||||
let response = buf.to_original::<PddbDictRequest, _>().unwrap();
|
let response = buf.to_original::<PddbDictRequest, _>().unwrap();
|
||||||
match response.code {
|
match response.code {
|
||||||
PddbRequestCode::NoErr => dict_list
|
PddbRequestCode::NoErr => dict_list
|
||||||
.push(String::from(response.dict.as_str().expect("utf-8 parse error in key name"))),
|
.push(String::from(response.dict.as_str())),
|
||||||
_ => return Err(Error::new(ErrorKind::Other, "Internal error")),
|
_ => return Err(Error::new(ErrorKind::Other, "Internal error")),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1107,9 +1107,9 @@ impl Pddb {
|
||||||
// setup the request arguments
|
// setup the request arguments
|
||||||
let mut request = PddbDictRequest {
|
let mut request = PddbDictRequest {
|
||||||
basis_specified: basis.is_some(),
|
basis_specified: basis.is_some(),
|
||||||
basis: xous_ipc::String::<BASIS_NAME_LEN>::from_str(basis.unwrap_or("")),
|
basis: String::<BASIS_NAME_LEN>::from_str(basis.unwrap_or("")),
|
||||||
dict: xous_ipc::String::<DICT_NAME_LEN>::from_str(dict),
|
dict: String::<DICT_NAME_LEN>::from_str(dict),
|
||||||
key: xous_ipc::String::<KEY_NAME_LEN>::new(),
|
key: String::<KEY_NAME_LEN>::new(),
|
||||||
index: 0,
|
index: 0,
|
||||||
token: [0u32; 4],
|
token: [0u32; 4],
|
||||||
code: PddbRequestCode::BulkRead,
|
code: PddbRequestCode::BulkRead,
|
||||||
|
|
@ -1247,7 +1247,7 @@ impl Pddb {
|
||||||
#[cfg(not(target_os = "xous"))]
|
#[cfg(not(target_os = "xous"))]
|
||||||
pub fn dbg_dump(&self, name: &str) -> Result<()> {
|
pub fn dbg_dump(&self, name: &str) -> Result<()> {
|
||||||
let ipc =
|
let ipc =
|
||||||
PddbDangerousDebug { request: DebugRequest::Dump, dump_name: xous_ipc::String::from_str(name) };
|
PddbDangerousDebug { request: DebugRequest::Dump, dump_name: String::from(name) };
|
||||||
let buf = Buffer::into_buf(ipc).or(Err(Error::new(ErrorKind::Other, "Xous internal error")))?;
|
let buf = Buffer::into_buf(ipc).or(Err(Error::new(ErrorKind::Other, "Xous internal error")))?;
|
||||||
buf.lend(self.conn, Opcode::DangerousDebug.to_u32().unwrap())
|
buf.lend(self.conn, Opcode::DangerousDebug.to_u32().unwrap())
|
||||||
.or(Err(Error::new(ErrorKind::Other, "Xous internal error")))
|
.or(Err(Error::new(ErrorKind::Other, "Xous internal error")))
|
||||||
|
|
@ -1258,7 +1258,7 @@ impl Pddb {
|
||||||
/// It's a cheesy way to test a power cycle, without having to power cycle.
|
/// It's a cheesy way to test a power cycle, without having to power cycle.
|
||||||
#[cfg(not(target_os = "xous"))]
|
#[cfg(not(target_os = "xous"))]
|
||||||
pub fn dbg_remount(&self) -> Result<()> {
|
pub fn dbg_remount(&self) -> Result<()> {
|
||||||
let ipc = PddbDangerousDebug { request: DebugRequest::Remount, dump_name: xous_ipc::String::new() };
|
let ipc = PddbDangerousDebug { request: DebugRequest::Remount, dump_name: String::new() };
|
||||||
let buf = Buffer::into_buf(ipc).or(Err(Error::new(ErrorKind::Other, "Xous internal error")))?;
|
let buf = Buffer::into_buf(ipc).or(Err(Error::new(ErrorKind::Other, "Xous internal error")))?;
|
||||||
buf.lend(self.conn, Opcode::DangerousDebug.to_u32().unwrap())
|
buf.lend(self.conn, Opcode::DangerousDebug.to_u32().unwrap())
|
||||||
.or(Err(Error::new(ErrorKind::Other, "Xous internal error")))
|
.or(Err(Error::new(ErrorKind::Other, "Xous internal error")))
|
||||||
|
|
@ -1268,7 +1268,7 @@ impl Pddb {
|
||||||
/// Forces a basis pruning, for testing the pruning and prune recovery code.
|
/// Forces a basis pruning, for testing the pruning and prune recovery code.
|
||||||
#[cfg(not(target_os = "xous"))]
|
#[cfg(not(target_os = "xous"))]
|
||||||
pub fn dbg_prune(&self) -> Result<()> {
|
pub fn dbg_prune(&self) -> Result<()> {
|
||||||
let ipc = PddbDangerousDebug { request: DebugRequest::Prune, dump_name: xous_ipc::String::new() };
|
let ipc = PddbDangerousDebug { request: DebugRequest::Prune, dump_name: String::new() };
|
||||||
let buf = Buffer::into_buf(ipc).or(Err(Error::new(ErrorKind::Other, "Xous internal error")))?;
|
let buf = Buffer::into_buf(ipc).or(Err(Error::new(ErrorKind::Other, "Xous internal error")))?;
|
||||||
buf.lend(self.conn, Opcode::DangerousDebug.to_u32().unwrap())
|
buf.lend(self.conn, Opcode::DangerousDebug.to_u32().unwrap())
|
||||||
.or(Err(Error::new(ErrorKind::Other, "Xous internal error")))
|
.or(Err(Error::new(ErrorKind::Other, "Xous internal error")))
|
||||||
|
|
@ -1278,7 +1278,7 @@ impl Pddb {
|
||||||
/// Turns on debug spew
|
/// Turns on debug spew
|
||||||
#[cfg(not(target_os = "xous"))]
|
#[cfg(not(target_os = "xous"))]
|
||||||
pub fn dbg_set_debug(&self) -> Result<()> {
|
pub fn dbg_set_debug(&self) -> Result<()> {
|
||||||
let ipc = PddbDangerousDebug { request: DebugRequest::SetDebug, dump_name: xous_ipc::String::new() };
|
let ipc = PddbDangerousDebug { request: DebugRequest::SetDebug, dump_name: String::new() };
|
||||||
let buf = Buffer::into_buf(ipc).or(Err(Error::new(ErrorKind::Other, "Xous internal error")))?;
|
let buf = Buffer::into_buf(ipc).or(Err(Error::new(ErrorKind::Other, "Xous internal error")))?;
|
||||||
buf.lend(self.conn, Opcode::DangerousDebug.to_u32().unwrap())
|
buf.lend(self.conn, Opcode::DangerousDebug.to_u32().unwrap())
|
||||||
.or(Err(Error::new(ErrorKind::Other, "Xous internal error")))
|
.or(Err(Error::new(ErrorKind::Other, "Xous internal error")))
|
||||||
|
|
|
||||||
|
|
@ -413,8 +413,8 @@ const FILE_ID_SERVICES_PDDB_SRC_DICTIONARY: u32 = 1;
|
||||||
|
|
||||||
#[derive(Debug, rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)]
|
#[derive(Debug, rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)]
|
||||||
pub(crate) struct BasisRequestPassword {
|
pub(crate) struct BasisRequestPassword {
|
||||||
db_name: xous_ipc::String<{ crate::api::BASIS_NAME_LEN }>,
|
db_name: String<{ crate::api::BASIS_NAME_LEN }>,
|
||||||
plaintext_pw: Option<xous_ipc::String<{ crate::api::PASSWORD_LEN }>>,
|
plaintext_pw: Option<String<{ crate::api::PASSWORD_LEN }>>,
|
||||||
}
|
}
|
||||||
#[derive(Debug, PartialEq, Eq)]
|
#[derive(Debug, PartialEq, Eq)]
|
||||||
pub(crate) enum PasswordState {
|
pub(crate) enum PasswordState {
|
||||||
|
|
@ -896,14 +896,14 @@ fn wrapped_main() -> ! {
|
||||||
if let Some(pw) = ret.plaintext_pw {
|
if let Some(pw) = ret.plaintext_pw {
|
||||||
match basis_cache.basis_create(
|
match basis_cache.basis_create(
|
||||||
&mut pddb_os,
|
&mut pddb_os,
|
||||||
mgmt.name.as_str().expect("name is not valid utf-8"),
|
mgmt.name.as_str(),
|
||||||
pw.as_str().expect("password was not valid utf-8"),
|
pw.as_str(),
|
||||||
) {
|
) {
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
log::info!(
|
log::info!(
|
||||||
"{}PDDB.CREATEOK,{},{}",
|
"{}PDDB.CREATEOK,{},{}",
|
||||||
xous::BOOKEND_START,
|
xous::BOOKEND_START,
|
||||||
mgmt.name.as_str().unwrap(),
|
mgmt.name.as_str(),
|
||||||
xous::BOOKEND_END
|
xous::BOOKEND_END
|
||||||
);
|
);
|
||||||
mgmt.code = PddbRequestCode::NoErr
|
mgmt.code = PddbRequestCode::NoErr
|
||||||
|
|
@ -940,8 +940,8 @@ fn wrapped_main() -> ! {
|
||||||
if let Some(pw) = ret.plaintext_pw {
|
if let Some(pw) = ret.plaintext_pw {
|
||||||
if let Some(basis) = basis_cache.basis_unlock(
|
if let Some(basis) = basis_cache.basis_unlock(
|
||||||
&mut pddb_os,
|
&mut pddb_os,
|
||||||
mgmt.name.as_str().expect("name is not valid utf-8"),
|
mgmt.name.as_str(),
|
||||||
pw.as_str().expect("password was not valid utf-8"),
|
pw.as_str(),
|
||||||
mgmt.policy.unwrap_or(BasisRetentionPolicy::Persist),
|
mgmt.policy.unwrap_or(BasisRetentionPolicy::Persist),
|
||||||
) {
|
) {
|
||||||
if basis_cache.basis_contains(&basis.name) {
|
if basis_cache.basis_contains(&basis.name) {
|
||||||
|
|
@ -960,7 +960,7 @@ fn wrapped_main() -> ! {
|
||||||
log::info!(
|
log::info!(
|
||||||
"{}PDDB.UNLOCKOK,{},{}",
|
"{}PDDB.UNLOCKOK,{},{}",
|
||||||
xous::BOOKEND_START,
|
xous::BOOKEND_START,
|
||||||
mgmt.name.as_str().unwrap(),
|
mgmt.name.as_str(),
|
||||||
xous::BOOKEND_END
|
xous::BOOKEND_END
|
||||||
);
|
);
|
||||||
if basis_monitor_notifications.len() > 0 {
|
if basis_monitor_notifications.len() > 0 {
|
||||||
|
|
@ -974,7 +974,7 @@ fn wrapped_main() -> ! {
|
||||||
log::info!(
|
log::info!(
|
||||||
"{}PDDB.BADPASS,{},{}",
|
"{}PDDB.BADPASS,{},{}",
|
||||||
xous::BOOKEND_START,
|
xous::BOOKEND_START,
|
||||||
mgmt.name.as_str().unwrap(),
|
mgmt.name.as_str(),
|
||||||
xous::BOOKEND_END
|
xous::BOOKEND_END
|
||||||
);
|
);
|
||||||
modals
|
modals
|
||||||
|
|
@ -1019,7 +1019,7 @@ fn wrapped_main() -> ! {
|
||||||
match mgmt.code {
|
match mgmt.code {
|
||||||
PddbRequestCode::Close => {
|
PddbRequestCode::Close => {
|
||||||
match basis_cache
|
match basis_cache
|
||||||
.basis_unmount(&mut pddb_os, mgmt.name.as_str().expect("name is not valid utf-8"))
|
.basis_unmount(&mut pddb_os, mgmt.name.as_str())
|
||||||
{
|
{
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
mgmt.code = PddbRequestCode::NoErr;
|
mgmt.code = PddbRequestCode::NoErr;
|
||||||
|
|
@ -1050,7 +1050,7 @@ fn wrapped_main() -> ! {
|
||||||
match mgmt.code {
|
match mgmt.code {
|
||||||
PddbRequestCode::Delete => {
|
PddbRequestCode::Delete => {
|
||||||
match basis_cache
|
match basis_cache
|
||||||
.basis_delete(&mut pddb_os, mgmt.name.as_str().expect("name is not valid utf-8"))
|
.basis_delete(&mut pddb_os, mgmt.name.as_str())
|
||||||
{
|
{
|
||||||
Ok(_) => mgmt.code = PddbRequestCode::NoErr,
|
Ok(_) => mgmt.code = PddbRequestCode::NoErr,
|
||||||
Err(e) => match e.kind() {
|
Err(e) => match e.kind() {
|
||||||
|
|
@ -1078,12 +1078,12 @@ fn wrapped_main() -> ! {
|
||||||
unsafe { Buffer::from_memory_message_mut(msg.body.memory_message_mut().unwrap()) };
|
unsafe { Buffer::from_memory_message_mut(msg.body.memory_message_mut().unwrap()) };
|
||||||
let mut req: PddbKeyRequest = buffer.to_original::<PddbKeyRequest, _>().unwrap();
|
let mut req: PddbKeyRequest = buffer.to_original::<PddbKeyRequest, _>().unwrap();
|
||||||
let bname = if req.basis_specified {
|
let bname = if req.basis_specified {
|
||||||
Some(req.basis.as_str().unwrap())
|
Some(req.basis.as_str())
|
||||||
} else {
|
} else {
|
||||||
Some(basis.as_str())
|
Some(basis.as_str())
|
||||||
};
|
};
|
||||||
let dict = req.dict.as_str().expect("dict utf-8 decode error");
|
let dict = req.dict.as_str();
|
||||||
let key = req.key.as_str().expect("key utf-8 decode error");
|
let key = req.key.as_str();
|
||||||
log::debug!("get: {:?} {}", bname, key);
|
log::debug!("get: {:?} {}", bname, key);
|
||||||
#[cfg(feature = "perfcounter")]
|
#[cfg(feature = "perfcounter")]
|
||||||
pddb_os.perf_entry(
|
pddb_os.perf_entry(
|
||||||
|
|
@ -1272,9 +1272,9 @@ fn wrapped_main() -> ! {
|
||||||
let mut buffer =
|
let mut buffer =
|
||||||
unsafe { Buffer::from_memory_message_mut(msg.body.memory_message_mut().unwrap()) };
|
unsafe { Buffer::from_memory_message_mut(msg.body.memory_message_mut().unwrap()) };
|
||||||
let mut req: PddbKeyRequest = buffer.to_original::<PddbKeyRequest, _>().unwrap();
|
let mut req: PddbKeyRequest = buffer.to_original::<PddbKeyRequest, _>().unwrap();
|
||||||
let bname = if req.basis_specified { Some(req.basis.as_str().unwrap()) } else { None };
|
let bname = if req.basis_specified { Some(req.basis.as_str()) } else { None };
|
||||||
let dict = req.dict.as_str().expect("dict utf-8 decode error");
|
let dict = req.dict.as_str();
|
||||||
let key = req.key.as_str().expect("key utf-8 decode error");
|
let key = req.key.as_str();
|
||||||
match basis_cache.key_remove(&mut pddb_os, dict, key, bname, false) {
|
match basis_cache.key_remove(&mut pddb_os, dict, key, bname, false) {
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
let mut evict_list = Vec::<ApiToken>::new();
|
let mut evict_list = Vec::<ApiToken>::new();
|
||||||
|
|
@ -1342,8 +1342,8 @@ fn wrapped_main() -> ! {
|
||||||
}
|
}
|
||||||
log::info!("Deleting key list: {:?}", key_list);
|
log::info!("Deleting key list: {:?}", key_list);
|
||||||
let start = tt.elapsed_ms();
|
let start = tt.elapsed_ms();
|
||||||
let bname = if req.basis_specified { Some(req.basis.as_str().unwrap()) } else { None };
|
let bname = if req.basis_specified { Some(req.basis.as_str()) } else { None };
|
||||||
let dict = req.dict.as_str().expect("dict utf-8 decode error");
|
let dict = req.dict.as_str();
|
||||||
match basis_cache.key_list_remove(&mut pddb_os, dict, key_list, bname) {
|
match basis_cache.key_list_remove(&mut pddb_os, dict, key_list, bname) {
|
||||||
Ok(_) => req.retcode = PddbRetcode::Ok,
|
Ok(_) => req.retcode = PddbRetcode::Ok,
|
||||||
Err(e) => match e.kind() {
|
Err(e) => match e.kind() {
|
||||||
|
|
@ -1367,8 +1367,8 @@ fn wrapped_main() -> ! {
|
||||||
let mut buffer =
|
let mut buffer =
|
||||||
unsafe { Buffer::from_memory_message_mut(msg.body.memory_message_mut().unwrap()) };
|
unsafe { Buffer::from_memory_message_mut(msg.body.memory_message_mut().unwrap()) };
|
||||||
let mut req: PddbKeyRequest = buffer.to_original::<PddbKeyRequest, _>().unwrap();
|
let mut req: PddbKeyRequest = buffer.to_original::<PddbKeyRequest, _>().unwrap();
|
||||||
let bname = if req.basis_specified { Some(req.basis.as_str().unwrap()) } else { None };
|
let bname = if req.basis_specified { Some(req.basis.as_str()) } else { None };
|
||||||
let dict = req.dict.as_str().expect("dict utf-8 decode error");
|
let dict = req.dict.as_str();
|
||||||
log::debug!("attempting to remove dict {} basis {:?}", dict, bname);
|
log::debug!("attempting to remove dict {} basis {:?}", dict, bname);
|
||||||
match basis_cache.dict_remove(&mut pddb_os, dict, bname, false) {
|
match basis_cache.dict_remove(&mut pddb_os, dict, bname, false) {
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
|
|
@ -1464,8 +1464,8 @@ fn wrapped_main() -> ! {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
key_token = Some(req.token);
|
key_token = Some(req.token);
|
||||||
let bname = if req.basis_specified { Some(req.basis.as_str().unwrap()) } else { None };
|
let bname = if req.basis_specified { Some(req.basis.as_str()) } else { None };
|
||||||
let dict = req.dict.as_str().expect("dict utf-8 decode error");
|
let dict = req.dict.as_str();
|
||||||
log::debug!("counting keys in dict {} basis {:?}", dict, bname);
|
log::debug!("counting keys in dict {} basis {:?}", dict, bname);
|
||||||
#[cfg(feature = "perfcounter")]
|
#[cfg(feature = "perfcounter")]
|
||||||
pddb_os.perf_entry(FILE_ID_SERVICES_PDDB_SRC_MAIN, perflib::PERFMETA_NONE, 0, std::line!());
|
pddb_os.perf_entry(FILE_ID_SERVICES_PDDB_SRC_MAIN, perflib::PERFMETA_NONE, 0, std::line!());
|
||||||
|
|
@ -1574,7 +1574,7 @@ fn wrapped_main() -> ! {
|
||||||
}
|
}
|
||||||
dict_token = Some(req.token);
|
dict_token = Some(req.token);
|
||||||
dict_list.clear();
|
dict_list.clear();
|
||||||
let bname = if req.basis_specified { Some(req.basis.as_str().unwrap()) } else { None };
|
let bname = if req.basis_specified { Some(req.basis.as_str()) } else { None };
|
||||||
let list = basis_cache.dict_list(&mut pddb_os, bname);
|
let list = basis_cache.dict_list(&mut pddb_os, bname);
|
||||||
if list.len() > 0 {
|
if list.len() > 0 {
|
||||||
req.index = list.len() as u32;
|
req.index = list.len() as u32;
|
||||||
|
|
@ -1601,7 +1601,7 @@ fn wrapped_main() -> ! {
|
||||||
req.code = PddbRequestCode::InternalError;
|
req.code = PddbRequestCode::InternalError;
|
||||||
} else {
|
} else {
|
||||||
req.dict =
|
req.dict =
|
||||||
xous_ipc::String::<DICT_NAME_LEN>::from_str(&dict_list[req.index as usize]);
|
String::<DICT_NAME_LEN>::from_str(&dict_list[req.index as usize]);
|
||||||
req.code = PddbRequestCode::NoErr;
|
req.code = PddbRequestCode::NoErr;
|
||||||
// the last index requested must be the highest one!
|
// the last index requested must be the highest one!
|
||||||
if req.index == dict_list.len() as u32 - 1 {
|
if req.index == dict_list.len() as u32 - 1 {
|
||||||
|
|
@ -1734,9 +1734,9 @@ fn wrapped_main() -> ! {
|
||||||
// confirm data exists; setup the tracking state
|
// confirm data exists; setup the tracking state
|
||||||
let key_list: Vec<String> = match basis_cache.key_list(
|
let key_list: Vec<String> = match basis_cache.key_list(
|
||||||
&mut pddb_os,
|
&mut pddb_os,
|
||||||
bulk_descriptor.dict.as_str().unwrap(),
|
bulk_descriptor.dict.as_str(),
|
||||||
if bulk_descriptor.basis_specified {
|
if bulk_descriptor.basis_specified {
|
||||||
Some(bulk_descriptor.basis.as_str().unwrap())
|
Some(bulk_descriptor.basis.as_str())
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
},
|
},
|
||||||
|
|
@ -2184,14 +2184,14 @@ fn wrapped_main() -> ! {
|
||||||
let dbg = buffer.to_original::<PddbDangerousDebug, _>().unwrap();
|
let dbg = buffer.to_original::<PddbDangerousDebug, _>().unwrap();
|
||||||
match dbg.request {
|
match dbg.request {
|
||||||
DebugRequest::Dump => {
|
DebugRequest::Dump => {
|
||||||
log::info!("dumping pddb to {}", dbg.dump_name.as_str().unwrap());
|
log::info!("dumping pddb to {}", dbg.dump_name.as_str());
|
||||||
#[cfg(not(feature = "autobasis"))]
|
#[cfg(not(feature = "autobasis"))]
|
||||||
pddb_os.dbg_dump(Some(dbg.dump_name.as_str().unwrap().to_string()), None);
|
pddb_os.dbg_dump(Some(dbg.dump_name.as_str().to_string()), None);
|
||||||
#[cfg(feature = "autobasis")]
|
#[cfg(feature = "autobasis")]
|
||||||
{
|
{
|
||||||
let export_extra = pddb_os.dbg_extra();
|
let export_extra = pddb_os.dbg_extra();
|
||||||
pddb_os.dbg_dump(
|
pddb_os.dbg_dump(
|
||||||
Some(dbg.dump_name.as_str().unwrap().to_string()),
|
Some(dbg.dump_name.as_str().to_string()),
|
||||||
Some(&export_extra),
|
Some(&export_extra),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
use gam::*;
|
use gam::*;
|
||||||
use locales::t;
|
use locales::t;
|
||||||
use num_traits::*;
|
use num_traits::*;
|
||||||
use xous_ipc::String;
|
use String;
|
||||||
|
|
||||||
use crate::api::*;
|
use crate::api::*;
|
||||||
|
|
||||||
|
|
@ -9,21 +9,21 @@ pub(crate) fn pddb_menu(conn: xous::CID) {
|
||||||
let mut menu_items = Vec::<MenuItem>::new();
|
let mut menu_items = Vec::<MenuItem>::new();
|
||||||
|
|
||||||
menu_items.push(MenuItem {
|
menu_items.push(MenuItem {
|
||||||
name: String::from_str(t!("pddb.menu.listbasis", locales::LANG)),
|
name: String::from(t!("pddb.menu.listbasis", locales::LANG)),
|
||||||
action_conn: Some(conn),
|
action_conn: Some(conn),
|
||||||
action_opcode: Opcode::MenuListBasis.to_u32().unwrap(),
|
action_opcode: Opcode::MenuListBasis.to_u32().unwrap(),
|
||||||
action_payload: MenuPayload::Scalar([0, 0, 0, 0]),
|
action_payload: MenuPayload::Scalar([0, 0, 0, 0]),
|
||||||
close_on_select: true,
|
close_on_select: true,
|
||||||
});
|
});
|
||||||
menu_items.push(MenuItem {
|
menu_items.push(MenuItem {
|
||||||
name: String::from_str(t!("pddb.menu.change_unlock_pin", locales::LANG)),
|
name: String::from(t!("pddb.menu.change_unlock_pin", locales::LANG)),
|
||||||
action_conn: Some(conn),
|
action_conn: Some(conn),
|
||||||
action_opcode: Opcode::MenuChangePin.to_u32().unwrap(),
|
action_opcode: Opcode::MenuChangePin.to_u32().unwrap(),
|
||||||
action_payload: MenuPayload::Scalar([0, 0, 0, 0]),
|
action_payload: MenuPayload::Scalar([0, 0, 0, 0]),
|
||||||
close_on_select: true,
|
close_on_select: true,
|
||||||
});
|
});
|
||||||
menu_items.push(MenuItem {
|
menu_items.push(MenuItem {
|
||||||
name: String::from_str(t!("mainmenu.closemenu", locales::LANG)),
|
name: String::from(t!("mainmenu.closemenu", locales::LANG)),
|
||||||
action_conn: None,
|
action_conn: None,
|
||||||
action_opcode: 0,
|
action_opcode: 0,
|
||||||
action_payload: MenuPayload::Scalar([0, 0, 0, 0]),
|
action_payload: MenuPayload::Scalar([0, 0, 0, 0]),
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ pub(crate) fn password_ux_manager(
|
||||||
Some(t!("pddb.password", locales::LANG)),
|
Some(t!("pddb.password", locales::LANG)),
|
||||||
false,
|
false,
|
||||||
Some(
|
Some(
|
||||||
format!("{}'{}'", t!("pddb.password_for", locales::LANG), db_name.as_str().unwrap())
|
format!("{}'{}'", t!("pddb.password_for", locales::LANG), db_name.as_str())
|
||||||
.as_str(),
|
.as_str(),
|
||||||
),
|
),
|
||||||
false,
|
false,
|
||||||
|
|
@ -114,7 +114,7 @@ pub(crate) fn password_ux_manager(
|
||||||
log::info!(
|
log::info!(
|
||||||
"{}PDDB.REQPW,{},{}",
|
"{}PDDB.REQPW,{},{}",
|
||||||
xous::BOOKEND_START,
|
xous::BOOKEND_START,
|
||||||
db_name.as_str().unwrap(),
|
db_name.as_str(),
|
||||||
xous::BOOKEND_END
|
xous::BOOKEND_END
|
||||||
);
|
);
|
||||||
pddb_modal.activate();
|
pddb_modal.activate();
|
||||||
|
|
@ -129,7 +129,7 @@ pub(crate) fn password_ux_manager(
|
||||||
Buffer::from_memory_message_mut(response.body.memory_message_mut().unwrap())
|
Buffer::from_memory_message_mut(response.body.memory_message_mut().unwrap())
|
||||||
};
|
};
|
||||||
let mut request = buffer.to_original::<BasisRequestPassword, _>().unwrap();
|
let mut request = buffer.to_original::<BasisRequestPassword, _>().unwrap();
|
||||||
request.plaintext_pw = Some(xous_ipc::String::from_str(pw.first().as_str()));
|
request.plaintext_pw = Some(String::from(pw.first().as_str()));
|
||||||
// return the password to the caller
|
// return the password to the caller
|
||||||
buffer.replace(request).unwrap();
|
buffer.replace(request).unwrap();
|
||||||
// response goes out of scope here and calls Drop which returns the message
|
// response goes out of scope here and calls Drop which returns the message
|
||||||
|
|
|
||||||
|
|
@ -23,8 +23,9 @@ utralib = { version = "0.1.24", optional = true, default-features = false }
|
||||||
xous-ipc = "0.9.63"
|
xous-ipc = "0.9.63"
|
||||||
num-derive = { version = "0.4.1", default-features = false }
|
num-derive = { version = "0.4.1", default-features = false }
|
||||||
num-traits = { version = "0.2.14", default-features = false }
|
num-traits = { version = "0.2.14", default-features = false }
|
||||||
rkyv = { version = "0.4.3", default-features = false, features = [
|
rkyv = { version = "0.8.8", default-features = false, features = [
|
||||||
"const_generics",
|
"std",
|
||||||
|
"alloc",
|
||||||
] }
|
] }
|
||||||
zeroize = { version = "1.7.0", features = ["zeroize_derive"] }
|
zeroize = { version = "1.7.0", features = ["zeroize_derive"] }
|
||||||
rand_core = "0.6.4"
|
rand_core = "0.6.4"
|
||||||
|
|
|
||||||
|
|
@ -2632,7 +2632,7 @@ impl<'a> RootKeys {
|
||||||
#[cfg(feature = "hazardous-debug")]
|
#[cfg(feature = "hazardous-debug")]
|
||||||
fn debug_print_key(&self, offset: usize, num_bits: usize, name: &str) {
|
fn debug_print_key(&self, offset: usize, num_bits: usize, name: &str) {
|
||||||
use core::fmt::Write;
|
use core::fmt::Write;
|
||||||
let mut debugstr = xous_ipc::String::<4096>::new();
|
let mut debugstr = String::new();
|
||||||
write!(debugstr, "{}", name).unwrap();
|
write!(debugstr, "{}", name).unwrap();
|
||||||
for word in self.sensitive_data.borrow_mut().as_slice::<u32>()
|
for word in self.sensitive_data.borrow_mut().as_slice::<u32>()
|
||||||
[offset..offset as usize + num_bits / (size_of::<u32>() * 8)]
|
[offset..offset as usize + num_bits / (size_of::<u32>() * 8)]
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ use tts_frontend::*;
|
||||||
use xous::{msg_blocking_scalar_unpack, msg_scalar_unpack, send_message};
|
use xous::{msg_blocking_scalar_unpack, msg_scalar_unpack, send_message};
|
||||||
use xous_ipc::Buffer;
|
use xous_ipc::Buffer;
|
||||||
#[cfg(feature = "policy-menu")]
|
#[cfg(feature = "policy-menu")]
|
||||||
use xous_ipc::String;
|
use String;
|
||||||
|
|
||||||
#[cfg(any(feature = "precursor", feature = "renode"))]
|
#[cfg(any(feature = "precursor", feature = "renode"))]
|
||||||
mod implementation;
|
mod implementation;
|
||||||
|
|
@ -612,7 +612,7 @@ fn main() -> ! {
|
||||||
{
|
{
|
||||||
let mut menu_items = Vec::<MenuItem>::new();
|
let mut menu_items = Vec::<MenuItem>::new();
|
||||||
menu_items.push(MenuItem {
|
menu_items.push(MenuItem {
|
||||||
name: String::from_str(t!("rootkeys.policy_keep", locales::LANG)),
|
name: String::from(t!("rootkeys.policy_keep", locales::LANG)),
|
||||||
action_conn: Some(main_cid),
|
action_conn: Some(main_cid),
|
||||||
action_opcode: Opcode::UxPolicyReturn.to_u32().unwrap(),
|
action_opcode: Opcode::UxPolicyReturn.to_u32().unwrap(),
|
||||||
action_payload: MenuPayload::Scalar([
|
action_payload: MenuPayload::Scalar([
|
||||||
|
|
@ -624,7 +624,7 @@ fn main() -> ! {
|
||||||
close_on_select: true,
|
close_on_select: true,
|
||||||
});
|
});
|
||||||
menu_items.push(MenuItem {
|
menu_items.push(MenuItem {
|
||||||
name: String::from_str(t!("rootkeys.policy_suspend", locales::LANG)),
|
name: String::from(t!("rootkeys.policy_suspend", locales::LANG)),
|
||||||
action_conn: Some(main_cid),
|
action_conn: Some(main_cid),
|
||||||
action_opcode: Opcode::UxPolicyReturn.to_u32().unwrap(),
|
action_opcode: Opcode::UxPolicyReturn.to_u32().unwrap(),
|
||||||
action_payload: MenuPayload::Scalar([
|
action_payload: MenuPayload::Scalar([
|
||||||
|
|
@ -636,7 +636,7 @@ fn main() -> ! {
|
||||||
close_on_select: true,
|
close_on_select: true,
|
||||||
});
|
});
|
||||||
menu_items.push(MenuItem {
|
menu_items.push(MenuItem {
|
||||||
name: String::from_str(t!("rootkeys.policy_clear", locales::LANG)),
|
name: String::from(t!("rootkeys.policy_clear", locales::LANG)),
|
||||||
action_conn: Some(main_cid),
|
action_conn: Some(main_cid),
|
||||||
action_opcode: Opcode::UxPolicyReturn.to_u32().unwrap(),
|
action_opcode: Opcode::UxPolicyReturn.to_u32().unwrap(),
|
||||||
action_payload: MenuPayload::Scalar([
|
action_payload: MenuPayload::Scalar([
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue