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 09e3f60 commit f4ff60b
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 24 deletions.
10 changes: 4 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ serde-byte-array = "0.1.2"
iso7816 = "0.1.1"
hmac = "0.12.1"
rand = { version = "0.8.5", default-features = false }
littlefs2 = "0.4.0"
littlefs2-core = "0.1.0"
cbor-smol = { version = "0.5.0", features = ["heapless-bytes-v0-3"] }
serde_bytes = { version = "0.11.12", default-features = false }
trussed-rsa-alloc = "0.2.1"
Expand All @@ -57,15 +57,13 @@ admin-app = { version = "0.1.0", features = ["migration-tests"] }
serde_test = "1.0.176"

[patch.crates-io]
littlefs2 = { git = "https://github.com/trussed-dev/littlefs2.git", rev = "960e57d9fc0d209308c8e15dc26252bbe1ff6ba8" }
apdu-dispatch = { git = "https://github.com/trussed-dev/apdu-dispatch.git", rev = "915fc237103fcecc29d0f0b73391f19abf6576de" }
ctaphid-dispatch = { git = "https://github.com/trussed-dev/ctaphid-dispatch.git", rev = "57cb3317878a8593847595319aa03ef17c29ec5b" }
trussed = { git = "https://github.com/nitrokey/trussed.git", rev = "540ad725ef44f0d6d3d2da7dd6ec0bacffaeb5bf" }
trussed-auth = { git = "https://github.com/trussed-dev/trussed-auth.git", tag = "v0.3.0"}
trussed = { git = "https://github.com/trussed-dev/trussed.git", rev = "046478b7a4f6e2315acf9112d98308379c2e3eee" }
trussed-auth = { git = "https://github.com/trussed-dev/trussed-auth.git", rev = "c030b82ad3441f337af09afe3a69e8a6da5785ea" }
trussed-manage = { git = "https://github.com/trussed-dev/trussed-staging.git", tag = "manage-v0.1.0" }
trussed-rsa-alloc = { git = "https://github.com/trussed-dev/trussed-rsa-backend.git", tag = "v0.2.1" }
trussed-wrap-key-to-file = { git = "https://github.com/trussed-dev/trussed-staging.git", tag = "wrap-key-to-file-v0.1.0" }
admin-app = { git = "https://github.com/Nitrokey/admin-app.git", tag = "v0.1.0-nitrokey.12" }
admin-app = { git = "https://github.com/Nitrokey/admin-app.git", tag = "v0.1.0-nitrokey.18" }
trussed-hpke = { git = "https://github.com/trussed-dev/trussed-staging.git", rev = "f0babe53813e7882cfe5ce749ebe3a65fc143fd7" }

trussed-se050-manage = { path = "extensions/se050-manage" }
Expand Down
2 changes: 1 addition & 1 deletion src/core_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crypto_bigint::{
};
use embedded_hal::blocking::delay::DelayUs;
use hex_literal::hex;
use littlefs2::{path, path::Path};
use littlefs2_core::{path, Path};
use rand::{CryptoRng, RngCore};
use se05x::{
se05x::{
Expand Down
3 changes: 1 addition & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ use core::ops::Range;

use embedded_hal::blocking::delay::DelayUs;
use hex_literal::hex;
use littlefs2::path;
use littlefs2::path::Path;
use littlefs2_core::{path, Path};
use namespacing::{Namespace, NamespaceValue};
use se05x::{
se05x::{
Expand Down
18 changes: 7 additions & 11 deletions src/migrate.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use littlefs2::{io::Error, object_safe::DynFilesystem, path::Path};
use littlefs2_core::{DynFilesystem, Error, Path};

use crate::BACKEND_DIR;

Expand Down Expand Up @@ -28,7 +28,7 @@ use crate::BACKEND_DIR;

fn migrate_single(fs: &dyn DynFilesystem, path: &Path) -> Result<(), Error> {
match fs.remove_dir_all(path) {
Err(Error::NoSuchEntry) => Ok(()),
Err(Error::NO_SUCH_ENTRY) => Ok(()),
Err(err) => Err(err),
Ok(()) => Ok(()),
}
Expand All @@ -41,16 +41,12 @@ fn migrate_single(fs: &dyn DynFilesystem, path: &Path) -> Result<(), Error> {
/// Migrate does not itself keep track of whether the migration was performed
///
/// ```rust
///# use littlefs2::{fs::Filesystem, const_ram_storage, path};
///# use trussed::types::{LfsResult, LfsStorage};
///# use littlefs2_core::{DynFilesystem, Error, path};
///# use trussed_se050_backend::migrate::migrate_remove_all_dat;
///# const_ram_storage!(Storage, 4096);
///# let mut storage = Storage::new();
///# Filesystem::format(&mut storage);
///# Filesystem::mount_and_then(&mut storage, |fs| {
///# fn test(fs: &dyn DynFilesystem) -> Result<(), Error> {
/// migrate_remove_all_dat(fs, &[path!("secrets"), path!("opcard")])?;
///# Ok(())
///# }).unwrap();
///# Ok(())
///# }
/// ```
pub fn migrate_remove_all_dat(fs: &dyn DynFilesystem, apps: &[&Path]) -> Result<(), Error> {
migrate_single(fs, BACKEND_DIR)?;
Expand All @@ -64,7 +60,7 @@ pub fn migrate_remove_all_dat(fs: &dyn DynFilesystem, apps: &[&Path]) -> Result<
#[cfg(test)]
mod tests {
use admin_app::migrations::test_utils::{test_migration_one, FsValues};
use littlefs2::path;
use littlefs2_core::path;

use crate::trussed_auth_impl::AUTH_DIR;

Expand Down
2 changes: 1 addition & 1 deletion src/namespacing.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use core::ops::Deref;
use littlefs2::path::Path;
use littlefs2_core::Path;
use rand::{CryptoRng, Rng, RngCore};
use se05x::se05x::ObjectId;
use serde::{Deserialize, Serialize};
Expand Down
3 changes: 1 addition & 2 deletions src/trussed_auth_impl.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use core::fmt;
use embedded_hal::blocking::delay::DelayUs;
use hkdf::Hkdf;
use littlefs2::path;
use littlefs2::path::Path;
use littlefs2_core::{path, Path};
use se05x::{
se05x::{
commands::{GetRandom, ReadObject, WriteBinary},
Expand Down
2 changes: 1 addition & 1 deletion src/trussed_auth_impl/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use super::{Error, Key, Salt, HASH_LEN, SALT_LEN};
use embedded_hal::blocking::delay::DelayUs;
use hex_literal::hex;
use hmac::{Hmac, Mac};
use littlefs2::path;
use littlefs2_core::path;
use rand::Rng;
use se05x::{
se05x::{
Expand Down

0 comments on commit f4ff60b

Please sign in to comment.