From 312a08dff3256c68e71f024045477aaf5212d352 Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Mon, 14 Oct 2024 16:08:11 +0200 Subject: [PATCH] Update littlefs2 to v0.5.0 --- Cargo.toml | 8 +++++--- src/authenticator.rs | 5 +++-- src/state.rs | 5 +++-- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 73eeb5d3..8a262e50 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,6 +17,7 @@ heapless = "0.7" heapless-bytes = "0.3" hex-literal = "0.3" iso7816 = "0.1.3" +littlefs2 = "0.5" serde = { version = "1", default-features = false } trussed = { version = "0.1", features = ["clients-3"] } encrypted_container = { path = "components/encrypted_container" } @@ -53,6 +54,7 @@ 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" } +littlefs2 = { git = "https://github.com/trussed-dev/littlefs2.git", branch = "release-0.5.0" } +littlefs2-core = { git = "https://github.com/trussed-dev/littlefs2.git", branch = "release-0.5.0" } +trussed = { git = "https://github.com/trussed-dev/trussed", branch = "littlefs2" } +trussed-auth = { git = "https://github.com/trussed-dev/trussed-auth", branch = "littlefs2" } diff --git a/src/authenticator.rs b/src/authenticator.rs index 42a523cc..9e0e474d 100644 --- a/src/authenticator.rs +++ b/src/authenticator.rs @@ -11,6 +11,7 @@ use core::time::Duration; use flexiber::EncodableHeapless; use heapless_bytes::Bytes; use iso7816::{Data, Status}; +use littlefs2::path; use trussed::types::Location; use trussed::types::{KeyId, Message}; use trussed::{self, client, syscall, try_syscall}; @@ -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 @@ -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()); diff --git a/src/state.rs b/src/state.rs index ccd937ea..1b636b52 100644 --- a/src/state.rs +++ b/src/state.rs @@ -7,6 +7,7 @@ use core::convert::TryInto; use core::time::Duration; use iso7816::Status; +use littlefs2::path; use serde::de::DeserializeOwned; use serde::Serialize; @@ -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)] @@ -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 {