Update trussed

This patch updates trussed to use the updated virtual client
implementation and to replace heapless with heapless-bytes.
This commit is contained in:
Robin Krahl
2025-03-11 10:04:58 +01:00
parent ab6ad84225
commit d786c6bb5b
4 changed files with 19 additions and 15 deletions
+3 -2
View File
@@ -18,5 +18,6 @@ trussed-core = { version = "0.1.0-rc.1", features = ["serde-extensions"] }
[patch.crates-io]
trussed-auth = { path = "extension" }
trussed = { git = "https://github.com/trussed-dev/trussed.git", rev = "6bba8fde36d05c0227769eb63345744e87d84b2b" }
admin-app = { git = "https://github.com/Nitrokey/admin-app.git", tag = "v0.1.0-nitrokey.19" }
# trussed = { git = "https://github.com/trussed-dev/trussed.git", rev = "6bba8fde36d05c0227769eb63345744e87d84b2b" }
trussed = { git = "https://github.com/trussed-dev/trussed.git", rev = "refs/pull/207/head" }
admin-app = { git = "https://github.com/Nitrokey/admin-app.git", tag = "v0.1.0-nitrokey.20" }
+1 -1
View File
@@ -32,4 +32,4 @@ quickcheck = { version = "1.0.3", default-features = false }
rand_core = { version = "0.6.4", default-features = false, features = ["getrandom"] }
serde_cbor = { version = "0.11.2", features = ["std"] }
serde_test = "1.0.176"
trussed = { version = "0.1.0", default-features = false, features = ["clients-1", "crypto-client", "filesystem-client", "hmac-sha256", "serde-extensions", "virt"] }
trussed = { version = "0.1.0", default-features = false, features = ["crypto-client", "filesystem-client", "hmac-sha256", "serde-extensions", "virt"] }
+3 -1
View File
@@ -366,7 +366,9 @@ impl ExtensionImpl<AuthExtension> for AuthBackend {
let app_key = self.get_app_key(client_id, global_fs, ctx, rng)?;
let key_to_wrap =
keystore.load_key(Secrecy::Secret, Some(Kind::Symmetric(32)), &request.key)?;
let key_to_wrap = (&*key_to_wrap.material)
let key_to_wrap = key_to_wrap
.material
.as_slice()
.try_into()
.map_err(|_| Error::ReadFailed)?;
PinData::reset_with_key(
+12 -11
View File
@@ -134,19 +134,17 @@ use littlefs2_core::path;
use rand_core::{OsRng, RngCore as _};
use trussed::{
backend::BackendId,
client::{ClientImplementation, FilesystemClient, HmacSha256},
service::Service,
client::{FilesystemClient, HmacSha256},
syscall, try_syscall,
types::{Bytes, Location, Message, PathBuf},
virt::{self, Ram},
virt::{self, StoreConfig},
};
use trussed_auth::{AuthClient as _, PinId};
use trussed_auth_backend::MAX_HW_KEY_LEN;
use dispatch::{Backend, Dispatch, BACKENDS};
type Platform = virt::Platform<Ram>;
type Client = ClientImplementation<Service<Platform, Dispatch>, Dispatch>;
type Client<'a> = virt::Client<'a, Dispatch>;
enum Pin {
User,
@@ -170,20 +168,20 @@ impl From<Pin> for PinId {
}
}
fn run<F: FnOnce(&mut Client)>(backends: &'static [BackendId<Backend>], f: F) {
virt::with_platform(Ram::default(), |platform| {
fn run<F: FnOnce(&mut Client<'_>)>(backends: &'static [BackendId<Backend>], f: F) {
virt::with_platform(StoreConfig::ram(), |platform| {
platform.run_client_with_backends("test", Dispatch::new(), backends, |mut client| {
f(&mut client)
})
})
}
fn run_with_hw_key<F: FnOnce(&mut Client)>(
fn run_with_hw_key<F: FnOnce(&mut Client<'_>)>(
backends: &'static [BackendId<Backend>],
hw_key: Bytes<{ MAX_HW_KEY_LEN }>,
f: F,
) {
virt::with_platform(Ram::default(), |platform| {
virt::with_platform(StoreConfig::ram(), |platform| {
platform.run_client_with_backends(
"test",
Dispatch::with_hw_key(hw_key),
@@ -193,8 +191,11 @@ fn run_with_hw_key<F: FnOnce(&mut Client)>(
})
}
fn run_with_missing_hw_key<F: FnOnce(&mut Client)>(backends: &'static [BackendId<Backend>], f: F) {
virt::with_platform(Ram::default(), |platform| {
fn run_with_missing_hw_key<F: FnOnce(&mut Client<'_>)>(
backends: &'static [BackendId<Backend>],
f: F,
) {
virt::with_platform(StoreConfig::ram(), |platform| {
platform.run_client_with_backends(
"test",
Dispatch::with_missing_hw_key(),