Skip to content

Commit

Permalink
Use extension crates instead of backends
Browse files Browse the repository at this point in the history
This patch replaces the dependencies on trussed-staging and
trussed-se050-backend with extension crates extracted from these
crates.  See the these PRs for more information:
- trussed-dev/trussed-staging#19
- Nitrokey/trussed-se050-backend#13
  • Loading branch information
robin-nitrokey committed Mar 13, 2024
1 parent 92f11b8 commit 1cc5de8
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 38 deletions.
71 changes: 59 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 10 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ version = "1.7.0-rc.1"
memory-regions = { path = "components/memory-regions" }

# forked
admin-app = { git = "https://github.com/Nitrokey/admin-app.git", tag = "v0.1.0-nitrokey.10" }
admin-app = { git = "https://github.com/Nitrokey/admin-app.git", branch = "extensions" }
cbor-smol = { git = "https://github.com/Nitrokey/cbor-smol.git", tag = "v0.4.0-nitrokey.1" }
fido-authenticator = { git = "https://github.com/Nitrokey/fido-authenticator.git", tag = "v0.1.1-nitrokey.12" }
fido-authenticator = { git = "https://github.com/Nitrokey/fido-authenticator.git", branch = "extensions" }
flexiber = { git = "https://github.com/Nitrokey/flexiber", tag = "0.1.1.nitrokey" }
lpc55-hal = { git = "https://github.com/Nitrokey/lpc55-hal", tag = "v0.3.0-nitrokey.2" }
serde-indexed = { git = "https://github.com/nitrokey/serde-indexed.git", tag = "v0.1.0-nitrokey.2" }
Expand All @@ -37,14 +37,18 @@ p256-cortex-m4 = { git = "https://github.com/ycrypto/p256-cortex-m4.git", rev =
# unreleased crates
secrets-app = { git = "https://github.com/Nitrokey/trussed-secrets-app", tag = "v0.13.0-rc2" }
webcrypt = { git = "https://github.com/nitrokey/nitrokey-websmartcard-rust", rev = "b1502d72035ecde0f16f9fff5c8da06139b90d11" }
opcard = { git = "https://github.com/Nitrokey/opcard-rs", rev = "1c844b74aa5bf245cd8223bc63b74b3a1f1f7b0f" }
piv-authenticator = { git = "https://github.com/Nitrokey/piv-authenticator", tag = "v0.3.4" }
trussed-staging = { git = "https://github.com/trussed-dev/trussed-staging.git", rev = "1240154c269cc3875552c46ddcbde2c9aeea5e51" }
opcard = { git = "https://github.com/Nitrokey/opcard-rs", branch = "extensions" }
piv-authenticator = { git = "https://github.com/Nitrokey/piv-authenticator.git", branch = "extensions" }
trussed-chunked = { git = "https://github.com/Nitrokey/trussed-staging.git", branch = "extensions" }
trussed-manage = { git = "https://github.com/Nitrokey/trussed-staging.git", branch = "extensions" }
trussed-wrap-key-to-file = { git = "https://github.com/Nitrokey/trussed-staging.git", branch = "extensions" }
trussed-staging = { git = "https://github.com/Nitrokey/trussed-staging.git", branch = "extensions" }
trussed-auth = { git = "https://github.com/trussed-dev/trussed-auth", rev = "4b8191f248c26cb074cdac887c7f3f48f9c449a4" }
trussed-hkdf = { git = "https://github.com/Nitrokey/trussed-hkdf-backend.git", tag = "v0.1.0" }
trussed-rsa-alloc = { git = "https://github.com/trussed-dev/trussed-rsa-backend.git", rev = "9732a9a3e98af72112286afdc9b7174c66c2869a" }
trussed-usbip = { git = "https://github.com/Nitrokey/pc-usbip-runner.git", tag = "v0.0.1-nitrokey.3" }
trussed-se050-backend = { git = "https://github.com/Nitrokey/trussed-se050-backend.git", tag = "v0.2.0" }
trussed-se050-backend = { git = "https://github.com/Nitrokey/trussed-se050-backend.git", branch = "extensions" }
trussed-se050-manage = { git = "https://github.com/Nitrokey/trussed-se050-backend.git", branch = "extensions" }

[profile.release]
codegen-units = 1
Expand Down
14 changes: 10 additions & 4 deletions components/apps/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ edition = "2021"
apdu-dispatch = "0.1"
bitflags = "2"
ctaphid-dispatch = "0.1"
embedded-hal = "0.2.7"
heapless = "0.7"
se05x = { version = "0.1.1", optional = true}
serde = { version = "1.0.180", default-features = false }
trussed = { version = "0.1", features = ["serde-extensions"]}
trussed-usbip = { version = "0.0.1", default-features = false, features = ["ctaphid"], optional = true }
Expand All @@ -20,8 +22,15 @@ littlefs2 = "0.4"
trussed-auth = { version = "0.2.2", optional = true }
trussed-hkdf = { version = "0.1.0" }
trussed-rsa-alloc = { version = "0.1.0", optional = true }
trussed-se050-backend = { version = "0.2.0", optional = true }
trussed-staging = { version = "0.1.0", features = ["wrap-key-to-file", "chunked", "encrypted-chunked", "manage"] }

# Extensions
trussed-chunked = "0.1.0"
trussed-manage = "0.1.0"
trussed-se050-manage = { version = "0.1.0", optional = true }
trussed-wrap-key-to-file = "0.1.0"

# apps
admin-app = "0.1.0"
fido-authenticator = { version = "0.1.1", features = ["chunked", "dispatch"], optional = true }
Expand All @@ -31,9 +40,6 @@ secrets-app = { version = "0.13.0", features = ["apdu-dispatch", "ctaphid"], opt
opcard = { version = "1.1.1", features = ["apdu-dispatch", "delog", "rsa2048-gen", "rsa4096", "admin-app"], optional = true }
piv-authenticator = { version = "0.3.1", features = ["apdu-dispatch", "delog", "rsa"], optional = true }
provisioner-app = { path = "../provisioner-app", optional = true }
se05x = { version = "0.1.1", optional = true}
trussed-se050-backend = { version = "0.2.0", optional = true }
embedded-hal = "0.2.7"

[dev-dependencies]
cbor-smol = "0.4"
Expand Down Expand Up @@ -61,7 +67,7 @@ webcrypt = ["dep:webcrypt", "backend-auth", "backend-rsa"]
fido-authenticator = ["dep:fido-authenticator", "usbd-ctaphid"]
opcard = ["dep:opcard", "backend-rsa", "backend-auth"]
piv-authenticator = ["dep:piv-authenticator", "backend-rsa", "backend-auth"]
se050 = ["dep:se05x", "trussed-se050-backend", "admin-app/se050"]
se050 = ["dep:se05x", "trussed-se050-backend", "trussed-se050-manage", "admin-app/se050"]

# backends
backend-auth = ["trussed-auth"]
Expand Down
32 changes: 16 additions & 16 deletions components/apps/src/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,21 @@ use embedded_hal::blocking::delay::DelayUs;
#[cfg(feature = "se050")]
use se05x::{se05x::Se05X, t1::I2CForT1};
#[cfg(feature = "se050")]
use trussed_se050_backend::{
manage::ManageExtension as Se050ManageExtension, Context as Se050Context, Se050Backend,
};
use trussed_se050_backend::{Context as Se050Context, Se050Backend};
#[cfg(feature = "se050")]
use trussed_se050_manage::Se050ManageExtension;

#[cfg(feature = "backend-auth")]
use trussed_auth::{AuthBackend, AuthContext, AuthExtension, MAX_HW_KEY_LEN};

#[cfg(feature = "backend-rsa")]
use trussed_rsa_alloc::SoftwareRsa;

use trussed_chunked::ChunkedExtension;
use trussed_hkdf::{HkdfBackend, HkdfExtension};
use trussed_staging::{
manage::ManageExtension, streaming::ChunkedExtension, wrap_key_to_file::WrapKeyToFileExtension,
StagingBackend, StagingContext,
};
use trussed_manage::ManageExtension;
use trussed_staging::{StagingBackend, StagingContext};
use trussed_wrap_key_to_file::WrapKeyToFileExtension;

#[cfg(feature = "webcrypt")]
use webcrypt::hmacsha256p256::{
Expand Down Expand Up @@ -328,15 +328,15 @@ impl<T: Twi, D: Delay> ExtensionDispatch for Dispatch<T, D> {
resources,
)
}
Extension::Se050Manage => ExtensionImpl::<
trussed_se050_backend::manage::ManageExtension,
>::extension_request_serialized(
self.se050.as_mut().ok_or(TrussedError::GeneralError)?,
&mut ctx.core,
&mut ctx.backends.se050,
request,
resources,
),
Extension::Se050Manage => {
ExtensionImpl::<Se050ManageExtension>::extension_request_serialized(
self.se050.as_mut().ok_or(TrussedError::GeneralError)?,
&mut ctx.core,
&mut ctx.backends.se050,
request,
resources,
)
}
_ => Err(TrussedError::RequestNotAvailable),
},
_ => Err(TrussedError::RequestNotAvailable),
Expand Down

0 comments on commit 1cc5de8

Please sign in to comment.