mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-15 08:30:02 +00:00
cleanup warnings and unused code
This commit is contained in:
parent
6e34659a33
commit
73f3ef827c
9 changed files with 22 additions and 135 deletions
7
apps/vault/cert.csr
Normal file
7
apps/vault/cert.csr
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
-----BEGIN CERTIFICATE REQUEST-----
|
||||
MIHRMHkCAQAwFzEVMBMGA1UEAwwMUHJlY3Vyc29yIENBMFkwEwYHKoZIzj0CAQYI
|
||||
KoZIzj0DAQcDQgAEpEOaIr4DP5DooWDd1bNVJjXz2VHSZySj5FPIQ4+y+cwyx45B
|
||||
MyPEONJ2ouOwgb4Rj1FsTny2RFXEa1pLvKhdBKAAMAoGCCqGSM49BAMCA0gAMEUC
|
||||
IQDn+gUQRYU0LMsz/Lobd8IyZspuc54RIc1qr2GUlZE6nAIgLD0KMSs2CZHGbcEB
|
||||
JxoEsNDO9E3JRqw5BZ8v1aW/h8I=
|
||||
-----END CERTIFICATE REQUEST-----
|
||||
BIN
apps/vault/cert.der
Normal file
BIN
apps/vault/cert.der
Normal file
Binary file not shown.
8
apps/vault/ec_key.key
Normal file
8
apps/vault/ec_key.key
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
-----BEGIN EC PARAMETERS-----
|
||||
BggqhkjOPQMBBw==
|
||||
-----END EC PARAMETERS-----
|
||||
-----BEGIN EC PRIVATE KEY-----
|
||||
MHcCAQEEIEl7IAZC5x5O2Sk1mhmqcBtC86MEvX55xKJbWvJjWy2xoAoGCCqGSM49
|
||||
AwEHoUQDQgAEpEOaIr4DP5DooWDd1bNVJjXz2VHSZySj5FPIQ4+y+cwyx45BMyPE
|
||||
ONJ2ouOwgb4Rj1FsTny2RFXEa1pLvKhdBA==
|
||||
-----END EC PRIVATE KEY-----
|
||||
BIN
apps/vault/key.hex
Normal file
BIN
apps/vault/key.hex
Normal file
Binary file not shown.
|
|
@ -894,7 +894,7 @@ where
|
|||
fn process_reset(
|
||||
&mut self,
|
||||
cid: ChannelID,
|
||||
now: ClockValue,
|
||||
_now: ClockValue,
|
||||
) -> Result<ResponseData, Ctap2StatusCode> {
|
||||
// Resets are only possible in the first 10 seconds after booting.
|
||||
// TODO(kaczmarczyck) 2.1 allows Reset after Reset and 15 seconds?
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ impl U2fUserPresenceState {
|
|||
}
|
||||
|
||||
// Granting user presence is ignored if it needs activation, but waits. Also cleans up.
|
||||
#[allow(dead_code)]
|
||||
pub fn grant_up(&mut self, _now: ClockValue) {
|
||||
// this is a NOP because it's handled by another thread
|
||||
}
|
||||
|
|
@ -82,6 +83,7 @@ impl U2fUserPresenceState {
|
|||
}
|
||||
|
||||
// Returns if user presence was requested. Also cleans up.
|
||||
#[allow(dead_code)]
|
||||
pub fn is_up_needed(&mut self, _now: ClockValue) -> bool {
|
||||
// this is not used by Xous
|
||||
false
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ use usbd_human_interface_device::device::fido::*;
|
|||
use std::thread;
|
||||
|
||||
mod ctap;
|
||||
use ctap::hid::{ChannelID, CtapHid, KeepaliveStatus, ProcessedPacket};
|
||||
use ctap::hid::{ChannelID, CtapHid};
|
||||
use ctap::status_code::Ctap2StatusCode;
|
||||
use ctap::CtapState;
|
||||
mod shims;
|
||||
|
|
@ -66,9 +66,6 @@ pub(crate) enum VaultOp {
|
|||
Quit,
|
||||
}
|
||||
|
||||
// This name should be (1) unique (2) under 64 characters long and (3) ideally descriptive.
|
||||
pub(crate) const SERVER_NAME_VAULT: &str = "Key Vault";
|
||||
|
||||
fn main() -> ! {
|
||||
log_server::init_wait().unwrap();
|
||||
log::set_max_level(log::LevelFilter::Debug);
|
||||
|
|
@ -180,92 +177,3 @@ fn check_user_presence(_cid: ChannelID) -> Result<(), Ctap2StatusCode> {
|
|||
log::warn!("check user presence called, but not implemented!");
|
||||
Ok(())
|
||||
}
|
||||
const KEEPALIVE_DELAY_MS: i64 = 100;
|
||||
const KEEPALIVE_DELAY: Duration<i64> = Duration::from_ms(KEEPALIVE_DELAY_MS);
|
||||
const SEND_TIMEOUT: Duration<i64> = Duration::from_ms(1000);
|
||||
|
||||
/*
|
||||
// Returns whether the keepalive was sent, or false if cancelled.
|
||||
fn send_keepalive_up_needed(
|
||||
cid: ChannelID,
|
||||
timeout: Duration<i64>,
|
||||
) -> Result<(), Ctap2StatusCode> {
|
||||
let keepalive_msg = CtapHid::keepalive(cid, KeepaliveStatus::UpNeeded);
|
||||
for mut pkt in keepalive_msg {
|
||||
let status = usb_ctap_hid::send_or_recv_with_timeout(&mut pkt, timeout);
|
||||
match status {
|
||||
None => {
|
||||
#[cfg(feature = "debug_ctap")]
|
||||
writeln!(Console::new(), "Sending a KEEPALIVE packet timed out").unwrap();
|
||||
// TODO: abort user presence test?
|
||||
}
|
||||
Some(usb_ctap_hid::SendOrRecvStatus::Error) => panic!("Error sending KEEPALIVE packet"),
|
||||
Some(usb_ctap_hid::SendOrRecvStatus::Sent) => {
|
||||
#[cfg(feature = "debug_ctap")]
|
||||
writeln!(Console::new(), "Sent KEEPALIVE packet").unwrap();
|
||||
}
|
||||
Some(usb_ctap_hid::SendOrRecvStatus::Received) => {
|
||||
// We only parse one packet, because we only care about CANCEL.
|
||||
let (received_cid, processed_packet) = CtapHid::process_single_packet(&pkt);
|
||||
if received_cid != &cid {
|
||||
#[cfg(feature = "debug_ctap")]
|
||||
writeln!(
|
||||
Console::new(),
|
||||
"Received a packet on channel ID {:?} while sending a KEEPALIVE packet",
|
||||
received_cid,
|
||||
)
|
||||
.unwrap();
|
||||
return Ok(());
|
||||
}
|
||||
match processed_packet {
|
||||
ProcessedPacket::InitPacket { cmd, .. } => {
|
||||
if cmd == CtapHid::COMMAND_CANCEL {
|
||||
// We ignore the payload, we can't answer with an error code anyway.
|
||||
#[cfg(feature = "debug_ctap")]
|
||||
writeln!(Console::new(), "User presence check cancelled").unwrap();
|
||||
return Err(Ctap2StatusCode::CTAP2_ERR_KEEPALIVE_CANCEL);
|
||||
} else {
|
||||
#[cfg(feature = "debug_ctap")]
|
||||
writeln!(
|
||||
Console::new(),
|
||||
"Discarded packet with command {} received while sending a KEEPALIVE packet",
|
||||
cmd,
|
||||
)
|
||||
.unwrap();
|
||||
}
|
||||
}
|
||||
ProcessedPacket::ContinuationPacket { .. } => {
|
||||
#[cfg(feature = "debug_ctap")]
|
||||
writeln!(
|
||||
Console::new(),
|
||||
"Discarded continuation packet received while sending a KEEPALIVE packet",
|
||||
)
|
||||
.unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn check_user_presence(cid: ChannelID) -> Result<(), Ctap2StatusCode> {
|
||||
// The timeout is N times the keepalive delay.
|
||||
const TIMEOUT_ITERATIONS: usize = ctap::TOUCH_TIMEOUT_MS as usize / KEEPALIVE_DELAY_MS as usize;
|
||||
|
||||
/*
|
||||
This should do the following:
|
||||
- call send_keepalive_up_needed(cid, KEEPALIVE_DELAY) once every KEEPALIVE_DELAY interval
|
||||
- pop up a dialog box for TOUCH_TIMEOUT_MS asking to approve "something"
|
||||
- if TOUCH_TIMEOUT_MS has elapsed and no user approval is received:
|
||||
- return Err(Ctap2StatusCode::CTAP2_ERR_USER_ACTION_TIMEOUT)
|
||||
- else return Ok(())
|
||||
*/
|
||||
send_keepalive_up_needed(cid, KEEPALIVE_DELAY)?;
|
||||
if false {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(Ctap2StatusCode::CTAP2_ERR_USER_ACTION_TIMEOUT)
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
|
@ -1,9 +1,7 @@
|
|||
use super::*;
|
||||
use gam::UxRegistration;
|
||||
use graphics_server::{Gid, Point, Rectangle, TextBounds, TextView, DrawStyle, PixelColor};
|
||||
use graphics_server::api::GlyphStyle;
|
||||
use graphics_server::{Gid, Point, Rectangle, DrawStyle, PixelColor};
|
||||
use xous::MessageEnvelope;
|
||||
use core::fmt::Write;
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub(crate) struct Repl {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use std::thread;
|
||||
use std::sync::{Arc, atomic::AtomicU32, atomic::Ordering};
|
||||
use num_traits::*;
|
||||
use xous::{msg_scalar_unpack, send_message, Message, msg_blocking_scalar_unpack};
|
||||
use xous::{msg_scalar_unpack, send_message, Message};
|
||||
use xous_ipc::Buffer;
|
||||
use locales::t;
|
||||
use crate::ctap::hid::{CtapHid, KeepaliveStatus};
|
||||
|
|
@ -39,26 +39,7 @@ enum UxState {
|
|||
}
|
||||
|
||||
static SELF_CID: AtomicU32 = AtomicU32::new(0);
|
||||
/*
|
||||
/// This must be proceeded by a call to request permission, to set up the scenario
|
||||
pub(crate) fn poll_consume_permission() -> bool {
|
||||
if SELF_CID.load(Ordering::SeqCst) == 0 {
|
||||
log::error!("internal error: ux thread not started");
|
||||
return false;
|
||||
}
|
||||
match send_message(SELF_CID.load(Ordering::SeqCst),
|
||||
Message::new_blocking_scalar(UxOp::ConsumePermission.to_usize.unwrap(), 0, 0, 0, 0)
|
||||
).expect("couldn't query ux thread") {
|
||||
xous::Result::Scalar1(r) => {
|
||||
if r == 1 {
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
_ => log::error!("Internal error: wrong return type"),
|
||||
}
|
||||
}*/
|
||||
|
||||
pub(crate) fn set_durations(prompt: i64, presence: i64) {
|
||||
if SELF_CID.load(Ordering::SeqCst) == 0 {
|
||||
log::error!("internal error: ux thread not started");
|
||||
|
|
@ -151,23 +132,6 @@ pub(crate) fn start_ux_thread() {
|
|||
buffer.replace(fido_request).unwrap();
|
||||
}
|
||||
}),
|
||||
/*
|
||||
// this is a polled request, used by legacy u2f transactions
|
||||
Some(UxOp::ConsumePermission) => msg_blocking_scalar_unpack!(msg, _, _, _, _, {
|
||||
match ux_state {
|
||||
UxState::Idle | UxState::Prompt(_) => {
|
||||
// 0 = not present
|
||||
xous::return_scalar(msg.sender, 0).unwrap();
|
||||
},
|
||||
UxState::Present(_) => {
|
||||
// 1 = present
|
||||
xous::return_scalar(msg.sender, 1).unwrap();
|
||||
ux_state = UxState::Idle;
|
||||
// these two paths shouldn't be mixed-and-matched, but let's just enforce that.
|
||||
assert!(deferred_req.is_none(), "polled request succeeded when a blocking request was also in progress");
|
||||
}
|
||||
}
|
||||
}), */
|
||||
// this can set up either a blocking request (deferred = true), or a polled request (deferred = false)
|
||||
// u2f polls; fido2 seems to require blocking requests. This difference causes a lot of complications.
|
||||
Some(UxOp::RequestPermission) => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue