Skip to content

Commit

Permalink
Update littlefs2 to v0.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
robin-nitrokey committed Oct 25, 2024
1 parent afbf6b8 commit fae41aa
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 14 deletions.
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ heapless = "0.7"
heapless-bytes = "0.3"
hex-literal = "0.3"
iso7816 = "0.1.3"
littlefs2-core = "0.1"
serde = { version = "1", default-features = false }
trussed = { version = "0.1", features = ["clients-3"] }
encrypted_container = { path = "components/encrypted_container" }
Expand Down Expand Up @@ -53,6 +54,5 @@ log-error = []
[patch.crates-io]
ctaphid-dispatch = { git = "https://github.com/Nitrokey/ctaphid-dispatch", tag = "v0.1.1-nitrokey.2" }
flexiber = { git = "https://github.com/Nitrokey/flexiber", tag = "0.1.1.nitrokey" }
littlefs2 = { git = "https://github.com/trussed-dev/littlefs2.git", rev = "ebd27e49ca321089d01d8c9b169c4aeb58ceeeca" }
trussed = { git = "https://github.com/Nitrokey/trussed", tag = "v0.1.0-nitrokey.18" }
trussed-auth = { git = "https://github.com/trussed-dev/trussed-auth", tag = "v0.3.0" }
trussed = { git = "https://github.com/trussed-dev/trussed", rev = "046478b7a4f6e2315acf9112d98308379c2e3eee" }
trussed-auth = { git = "https://github.com/trussed-dev/trussed-auth", rev = "c030b82ad3441f337af09afe3a69e8a6da5785ea" }
7 changes: 2 additions & 5 deletions fuzz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,15 @@ doc = false


[patch.crates-io]
littlefs2 = { git = "https://github.com/trussed-dev/littlefs2.git", rev = "ebd27e49ca321089d01d8c9b169c4aeb58ceeeca" }
flexiber = { git = "https://github.com/Nitrokey/flexiber", tag = "0.1.1.nitrokey" }
apdu-dispatch = { git = "https://github.com/trussed-dev/apdu-dispatch.git", rev = "915fc237103fcecc29d0f0b73391f19abf6576de" }

# forked
ctap-types = { git = "https://github.com/trussed-dev/ctap-types.git", rev = "4846817d9cd44604121680a19d46f3264973a3ce" }
trussed = { git = "https://github.com/Nitrokey/trussed", tag = "v0.1.0-nitrokey.18" }
trussed = { git = "https://github.com/trussed-dev/trussed", rev = "046478b7a4f6e2315acf9112d98308379c2e3eee" }

# unreleased upstream changes
ctaphid-dispatch = { git = "https://github.com/Nitrokey/ctaphid-dispatch", tag = "v0.1.1-nitrokey.2" }
serde-indexed = { git = "https://github.com/nitrokey/serde-indexed.git", tag = "v0.1.0-nitrokey.2" }

# unreleased crates
trussed-auth = { git = "https://github.com/trussed-dev/trussed-auth", tag = "v0.3.0" }
trussed-staging = { git = "https://github.com/trussed-dev/trussed-staging.git", tag = "v0.3.0" }
trussed-auth = { git = "https://github.com/trussed-dev/trussed-auth", rev = "c030b82ad3441f337af09afe3a69e8a6da5785ea" }
4 changes: 2 additions & 2 deletions fuzz/fuzz_targets/virt/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use trussed::{
service::ServiceResources,
types::{Bytes, Context, Location},
};
use trussed_auth::{AuthBackend, AuthContext, AuthExtension, MAX_HW_KEY_LEN};
use trussed_auth::{AuthBackend, AuthContext, AuthExtension, FilesystemLayout, MAX_HW_KEY_LEN};

pub const BACKENDS: &[BackendId<Backend>] = &[BackendId::Custom(Backend::Auth), BackendId::Core];

Expand Down Expand Up @@ -50,7 +50,7 @@ pub struct DispatchContext {
impl Dispatch {
pub fn with_hw_key(hw_key: Bytes<MAX_HW_KEY_LEN>) -> Self {
Self {
auth: AuthBackend::with_hw_key(Location::Internal, hw_key),
auth: AuthBackend::with_hw_key(Location::Internal, hw_key, FilesystemLayout::V0),
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/authenticator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use core::time::Duration;
use flexiber::EncodableHeapless;
use heapless_bytes::Bytes;
use iso7816::{Data, Status};
use littlefs2_core::path;
use trussed::types::Location;
use trussed::types::{KeyId, Message};
use trussed::{self, client, syscall, try_syscall};
Expand Down Expand Up @@ -212,7 +213,7 @@ where
+ trussed_auth::AuthClient,
{
fn credential_directory() -> trussed::types::PathBuf {
trussed::types::PathBuf::from("cred")
trussed::types::PathBuf::from(path!("cred"))
}

/// Create new Authenticator instance
Expand Down Expand Up @@ -680,7 +681,7 @@ where
hex_filename[2 * i + 1] = LOOKUP[(value & 0xF) as usize];
}

let filename = trussed::types::PathBuf::from(hex_filename.as_ref());
let filename = trussed::types::PathBuf::try_from(hex_filename.as_ref()).unwrap();
let mut path = Self::credential_directory();
path.push(&filename);
info_now!("filename: {}", path.as_str_ref_with_trailing_nul());
Expand Down
5 changes: 3 additions & 2 deletions src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use core::convert::TryInto;
use core::time::Duration;

use iso7816::Status;
use littlefs2_core::path;
use serde::de::DeserializeOwned;
use serde::Serialize;

Expand All @@ -17,7 +18,7 @@ use trussed::client::FilesystemClient;
use trussed::types::Message;
use trussed::{
syscall, try_syscall,
types::{KeyId, Location, PathBuf},
types::{KeyId, Location, Path, PathBuf},
};

#[derive(Clone, Debug, Eq, PartialEq)]
Expand Down Expand Up @@ -75,7 +76,7 @@ impl Runtime {
impl Persistent {}

impl State {
const FILENAME: &'static str = "state.bin";
const FILENAME: &'static Path = path!("state.bin");

pub fn new(location: Location) -> Self {
Self {
Expand Down

0 comments on commit fae41aa

Please sign in to comment.