You've already forked fido-authenticator
mirror of
https://github.com/trussed-dev/fido-authenticator.git
synced 2026-03-11 16:36:21 -07:00
Use path, not filename, to load RKs
This commit is contained in:
@@ -814,6 +814,7 @@ impl<UP: UserPresence, T: TrussedRequirements> Authenticator for crate::Authenti
|
||||
).ok_or(Error::NoCredentials)?;
|
||||
|
||||
info_now!("found {:?} applicable credentials", num_credentials);
|
||||
info_now!("{:?}", &credential);
|
||||
|
||||
// 6. process any options present
|
||||
|
||||
@@ -900,6 +901,7 @@ impl<UP: UserPresence, T: TrussedRequirements> crate::Authenticator<UP, T>
|
||||
self.state.runtime.active_get_assertion = None;
|
||||
|
||||
if let Some(allow_list) = allow_list {
|
||||
debug_now!("Allowlist passed, filtering");
|
||||
// we will have at most one credential, and an empty cache.
|
||||
|
||||
for credential_id in allow_list {
|
||||
@@ -917,12 +919,13 @@ impl<UP: UserPresence, T: TrussedRequirements> crate::Authenticator<UP, T>
|
||||
return None;
|
||||
} else {
|
||||
// we are only dealing with discoverable credentials.
|
||||
debug_now!("Allowlist not passed, fetching RKs");
|
||||
|
||||
let mut maybe_path = syscall!(self.trussed.read_dir_first(
|
||||
Location::Internal,
|
||||
rp_rk_dir(&rp_id_hash),
|
||||
None,
|
||||
)).entry.map(|entry| PathBuf::try_from(entry.file_name()).unwrap());
|
||||
)).entry.map(|entry| PathBuf::try_from(entry.path()).unwrap());
|
||||
|
||||
use core::str::FromStr;
|
||||
use crate::state::CachedCredential;
|
||||
@@ -943,7 +946,7 @@ impl<UP: UserPresence, T: TrussedRequirements> crate::Authenticator<UP, T>
|
||||
}
|
||||
|
||||
maybe_path = syscall!(self.trussed.read_dir_next())
|
||||
.entry.map(|entry| PathBuf::try_from(entry.file_name()).unwrap());
|
||||
.entry.map(|entry| PathBuf::try_from(entry.path()).unwrap());
|
||||
}
|
||||
|
||||
let num_credentials = self.state.runtime.remaining_credentials();
|
||||
|
||||
@@ -27,7 +27,7 @@ where
|
||||
UP: UserPresence,
|
||||
{
|
||||
debug_now!("handle CTAP1: remaining stack: {} bytes", msp() - 0x2000_0000);
|
||||
debug_now!("1A SP: {:X}", msp());
|
||||
// debug_now!("1A SP: {:X}", msp());
|
||||
match try_handle_ctap1(authenticator, data, response) {
|
||||
Ok(()) => {
|
||||
debug!("U2F response {} bytes", response.len());
|
||||
@@ -41,7 +41,7 @@ where
|
||||
response.extend_from_slice(&code).ok();
|
||||
},
|
||||
}
|
||||
debug_now!("1B SP: {:X}", msp());
|
||||
// debug_now!("1B SP: {:X}", msp());
|
||||
debug_now!("end handle CTAP1");
|
||||
}
|
||||
|
||||
@@ -53,12 +53,12 @@ where
|
||||
UP: UserPresence,
|
||||
{
|
||||
debug_now!("handle CTAP2: remaining stack: {} bytes", msp() - 0x2000_0000);
|
||||
debug_now!("2A SP: {:X}", msp());
|
||||
// debug_now!("2A SP: {:X}", msp());
|
||||
if let Err(error) = try_handle_ctap2(authenticator, data, response) {
|
||||
debug_now!("CTAP2 error: {})", error);
|
||||
response.push(error).ok();
|
||||
}
|
||||
debug_now!("2B SP: {:X}", msp());
|
||||
// debug_now!("2B SP: {:X}", msp());
|
||||
debug_now!("end handle CTAP2");
|
||||
}
|
||||
|
||||
@@ -83,13 +83,13 @@ where
|
||||
let ctap_request = {
|
||||
let command = apdu_dispatch::Command::try_from(data)
|
||||
.map_err(|_| Status::IncorrectDataParameter)?;
|
||||
debug_now!("1a SP: {:X}", msp());
|
||||
// debug_now!("1a SP: {:X}", msp());
|
||||
ctap1::Request::try_from(&command)
|
||||
.map_err(|_| Status::IncorrectDataParameter)?
|
||||
};
|
||||
ctap1::Authenticator::call_ctap1(authenticator, &ctap_request)?
|
||||
};
|
||||
debug_now!("1b SP: {:X}", msp());
|
||||
// debug_now!("1b SP: {:X}", msp());
|
||||
|
||||
ctap_response.serialize(response).ok();
|
||||
Ok(())
|
||||
@@ -129,7 +129,6 @@ where
|
||||
authenticator.state.persistent.load_if_not_initialised(&mut authenticator.trussed);
|
||||
|
||||
debug_now!("try_get CTAP2: remaining stack: {} bytes", msp() - 0x2000_0000);
|
||||
debug_now!("size(Request): {} bytes", core::mem::size_of::<ctap2::Request>());
|
||||
|
||||
// Goal of these nested scopes is to keep stack small.
|
||||
let ctap_request = ctap2::Request::deserialize(data)
|
||||
|
||||
Reference in New Issue
Block a user