Commit Graph
263 Commits
Author SHA1 Message Date
Sosthène Guédon 9aad0641ac Delete all empty parent directories if they are empty
This saves a lot of memory since each directory takes at least one block
We are starting to see this as an issue because the filesystems are now
much deeper due to the SE050
2024-12-11 18:02:55 +01:00
sosthene-nitrokey a39c6705f5 Merge pull request #45 from trussed-dev/main
Add secp256k1 to mechanism enum
2024-10-28 16:18:04 +01:00
Sosthène Guédon ccbbe3b39e Add secp256k1 to mechanism enum 2024-10-28 16:13:26 +01:00
Robin Krahl 92dd7f010e Merge branch 'main' into nitrokey-main 2024-10-25 11:11:04 +02:00
Robin Krahl 046478b7a4 Update littlefs2 to v0.5.0 2024-10-25 11:06:51 +02:00
Robin Krahl 1a54da2482 Avoid unnecessary path allocation 2024-10-24 20:02:18 +02:00
Robin Krahl 629ecb1bcc types: Add Id::hex_path helper function 2024-10-24 20:02:17 +02:00
Robin Krahl 6a7c43835c store: Use DynFilesystem::create_dir_all
Instead of re-implementing the same functionality in Trussed, use the
DynFilesystem::create_dir_all implementation from littlefs2.
2024-10-24 20:02:17 +02:00
Robin Krahl be5fa72073 Merge remote-tracking branch 'upstream/main' into nitrokey-main 2024-10-24 19:16:00 +02:00
Robin Krahl 721d1eb5b6 Update cbor-smol to v0.5.0 2024-10-22 14:27:20 +02:00
Robin Krahl a566b63586 Remove unused code 2024-08-13 15:44:16 +02:00
Sosthène Guédon 7b065dd316 Remove old unused types
These types are here from the first commit of trussed and are never used
2024-08-06 10:04:13 +02:00
Sosthène Guédon 732877eaba Remove unused Extensions struct
This structure is meant to be used with the attestation feature,
It is therefore unused, and unuseable due to a missing contructor and
being commented out in the `TbsCertificate` struct

If needed we can add it back in the future.
2024-08-06 10:04:13 +02:00
Sosthène Guédon d26a9a74e7 Remove doc warning 2024-08-06 10:04:13 +02:00
Sosthène Guédon 329d77d610 Remove cfg semihosting feature reference 2024-08-06 10:04:13 +02:00
Sosthène Guédon 3e031006df key deletion: delete first the faster volatile storage and test public keys first
Most key deletions are for volatile public keys (temporary keys for FIDO pin protocol, PIN keys from trussed-auth etc...).
In any cases, persistent keys are more rarely deleted, and volatile is the fastest storage,
so it being first is overall a performance improvement.

I think long term (once we have the builder-pattern based syscall implementation maybe?)
we should add optional location and secrecy arguments to the syscall. It is rare that the caller
would not know the kind of key it is deleting.
2024-08-05 14:00:34 +02:00
sosthene-nitrokey 66e8fa7293 Merge pull request #43 from trussed-dev/main
Merge Upstream Trussed
2024-07-31 11:58:05 +02:00
Sosthène Guédon 8b8beee0fa Add brainpool mechanisms 2024-07-26 15:25:40 +02:00
Sosthène Guédon 31095c519c Fix clippy warnings 2024-07-26 15:25:40 +02:00
Sosthène Guédon 85972abcb7 Add support for p384 and p521 nist curves 2024-07-26 15:25:40 +02:00
sosthene-nitrokey 40e312859a Merge pull request #41 from trussed-dev/main
Merge upstream
2024-06-07 11:06:16 +02:00
Sosthène Guédon c12172b804 Fix warning 2024-06-07 10:16:23 +02:00
Sosthène Guédon a055e4f79a Service: add (mut) getter for the dispatcher 2024-06-06 09:10:19 +02:00
Sosthène Guédon bfae7c1eca Fix p256 tests not running
The p256 tests were not running due to a typo
2024-04-19 11:47:43 +02:00
Robin Krahl 83cf940ac4 Reduce wildcard imports
This patch removes some wildcard imports to make the dependencies
between modules clearer and to refactoring easier.
2024-04-03 22:28:03 +02:00
Robin Krahl 20b0acb958 Remove unnecessary qualifications 2024-04-03 21:48:41 +02:00
Robin Krahl 667d60c019 Add OptionalBackend wrapper
Backends can be activated at runtime depending on the configuration or
execution environment.  This patch adds an OptionalBackend wrapper that
implements Backend and ExtensionImpl but returns a RequestNotAvailable
error if the inner backend is not set.
2024-04-02 16:16:09 +02:00
Sosthène Guédon 06d0c6fc47 not_before: introduce enum to clarify API 2024-03-28 16:47:20 +01:00
Sosthène Guédon 2950600ad5 read_dir_first: stop at the first file that is alphabetically "after" not_before
In fido-authenticator, if we change the paths of RK  to be:
"rp_id.rk_id" instead of the current "rp_id/rk_id", we still want to be able
to iterate over the keys even though we only  know the "rp_id" and not the
"rk_id". Therefore we need to be able to stop at "rp_id.***" when giving "rp_id" in `not_before`

This is technically a breaking change because now, given the files:

- "aaa"
- "aaabbb"

 "read_dir_first"  with "aaa" as `not_before` would only yield "aaa"
due to https://github.com/littlefs-project/littlefs/issues/923.
Now this will yield both files, and yield "aaabbb" first.

I beleive this behaviour is technically more correct as it is likely what
would be expected to be yield expecting alphabetical order
(though the order of the entries is still incorrect).
2024-03-28 16:47:20 +01:00
Sosthène Guédon 2fbe0c9504 Fix pipeline
We will want to get rid of the static mut altogether,
But that will be done when moving to Rust 2024. For now just fix the CI
2024-03-28 16:16:05 +01:00
Sosthène Guédon 2d0e667087 ClientFilestore: make the dat folder optional 2024-03-28 15:40:52 +01:00
Robin Krahl cff2e66384 Use nonce as IV for Aes256Cbc mechanism 2024-03-01 17:24:49 +01:00
Robin Krahl 6492abafb6 Add nonce to wrap_key and unwrap_key syscalls
This patch adds a nonce argument to the wrap_key and unwrap_key syscalls
to be able to use the Aes256Cbc mechanism with a non-zero IV in the
future.
2024-03-01 17:20:22 +01:00
Sosthène Guédon 2a2b209159 Add must_use attributes on futures.
Prior to that there would be no warning when forgetting to use `(try_)syscall`.
2024-02-21 12:01:40 +01:00
Sosthène Guédon 7f4e12db5a Fix clippy warnings 2024-02-21 11:44:42 +01:00
Sosthène Guédon 1012a9beb5 Run cargo fmt
Older version of Rust failed to format `service.rs` file.
2024-02-21 11:44:42 +01:00
Robin Krahl 45ed62ba97 Use DynFilesystem trait for FS operations 2023-12-15 22:01:09 +01:00
Robin Krahl 278cdb567a Put unused syscalls behind features
CounterClient and CryptoClient::attest are not currently used by the
solo2 or nk3 firmwares, but due to the indirect dispatch of Trussed
requests, they cannot be optimized out by the linker.  This patch
introduces feature flags for these syscalls that are enabled by default.
2023-12-15 16:05:41 +01:00
Sosthène Guédon a8013865ca Make store creation lazy
This reduces the need for forking the RNG state of the `Service`.
See https://github.com/trussed-dev/trussed/issues/136 for more details
2023-12-01 15:33:54 +01:00
Sosthène Guédon 91c59a7072 Add Debug, Clone implementation for BackendId 2023-12-01 14:07:27 +01:00
Sosthène Guédon b885afb0fe Fix hex representation of KeyIds 2023-12-01 14:07:27 +01:00
Sosthène Guédon 4c9ca40746 Make KeyId values readable 2023-12-01 14:07:27 +01:00
Sosthène Guédon 1bf42aad8b Add ability to create KeyIds with custom IDs
This can be useful for backends which can use it to encode additional information inside of the KeyId itself (128 bits is a lot)

 This is already possible to acheive through the serde implementation, so this doesn't really add any unavailable functionality.
2023-12-01 14:07:27 +01:00
Robin Krahl b1781805a2 Add rename syscall to FilesystemClient
This patch adds a rename syscall to the FilesystemClient that allows
applications to move a file within the same storage location and within
the client namespace.
2023-11-28 10:47:15 +01:00
Sosthène Guédon f7b65c9e1c Add Clear syscall
This syscall does the same as `delete` for a key.
The only difference is that it is designed to allow re-import of the key
if it was exported with `WrapKey`.

With the core trussed backend this does not change anything, as nothing is needed to
allow the re-import. However the same mechansim in the SE050 work differently, and
being able to differenciate permanent deletion and deletion with intent to re-import is crucial.
2023-11-24 14:27:09 +01:00
Sosthène Guédon 976372331b virt: Add possiblity to run with multiple clients 2023-11-09 16:43:55 +01:00
Sosthène Guédon 00e4d21885 Access the keystore via a path rather than the CoreContext
Similar to 5af424e7ec, this patch updates
the `keystore` method to be able to create a keystore with a custom path.
This can be useful for backends that want to have a keystore distinct from
the core one.
2023-11-09 16:43:38 +01:00
Sosthène Guédon 30a4764ddc Update to salty 0.3.0
This fixes a limitiation where trussed refused to deserialize a non-canonical but valid X255 key
2023-10-30 09:01:35 +01:00
Sosthène Guédon a60b4f507a Fix keystore delete-all counting 2023-10-30 09:01:20 +01:00
Sosthène Guédon 7943fa39a8 Upgrade bitflags 2023-09-13 09:54:12 +02:00