Skip to content

Commit

Permalink
Add basic config mechanism for fido2
Browse files Browse the repository at this point in the history
This patch adds a basic config mechanism using the admin app.  The
configuration is loaded and applied during initialization.  The admin
app now has a special role, is constructed first and can no longer be
disabled.  Other applications can receive a reference to the
configuration loaded by the admin app.

To avoid overwriting configuration values for apps that are not enabled
in the current firmware, the components of the Config struct are not
feature-gated.  It could be simplified by using a derive macro but that
seems overcomplicated for a first implementation.

The first use case for the config mechanism is enabling or disabling
skipping the FIDO2 user presence check directly after boot.
  • Loading branch information
robin-nitrokey committed Sep 12, 2023
1 parent 0e23c75 commit 7b45985
Show file tree
Hide file tree
Showing 4 changed files with 162 additions and 82 deletions.
91 changes: 71 additions & 20 deletions Cargo.lock

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

7 changes: 4 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ version = "1.5.0-test.20230704"

[patch.crates-io]
# forked
admin-app = { git = "https://github.com/Nitrokey/admin-app", tag = "v0.1.0-nitrokey.3" }
admin-app = { git = "https://github.com/Nitrokey/admin-app", branch = "config" }
ctap-types = { git = "https://github.com/Nitrokey/ctap-types", tag = "v0.1.2-nitrokey.1" }
fido-authenticator = { git = "https://github.com/Nitrokey/fido-authenticator.git", tag = "v0.1.1-nitrokey.5" }
flexiber = { git = "https://github.com/Nitrokey/flexiber", tag = "0.1.1.nitrokey" }
iso7816 = { git = "https://github.com/sosthene-nitrokey/iso7816.git", rev = "160ca3bbd8e21ec4e4ee1e0748e1eaa53a45c97f"}
lpc55-hal = { git = "https://github.com/Nitrokey/lpc55-hal", tag = "v0.3.0-nitrokey.2" }
trussed = { git = "https://github.com/Nitrokey/trussed", tag = "v0.1.0-nitrokey.12" }

Expand All @@ -30,10 +31,10 @@ secrets-app = { git = "https://github.com/Nitrokey/trussed-secrets-app", tag = "
webcrypt = { git = "https://github.com/Nitrokey/nitrokey-webcrypt-rust", tag = "v0.7.0"}
opcard = { git = "https://github.com/Nitrokey/opcard-rs", tag = "v1.1.1" }
piv-authenticator = { git = "https://github.com/Nitrokey/piv-authenticator", tag = "v0.3.2" }
se05x = { git = "https://github.com/Nitrokey/se05x.git", rev = "db1ddea25cc382355b4292352652da656abc3005"}
trussed-auth = { git = "https://github.com/Nitrokey/trussed-auth", tag = "v0.2.2-nitrokey.1" }
trussed-rsa-alloc = { git = "https://github.com/Nitrokey/trussed-rsa-backend.git", tag = "v0.1.0"}
trussed-staging = { git = "https://github.com/Nitrokey/trussed-staging.git", branch = "hmacsha256p256" }
iso7816 = { git = "https://github.com/Nitrokey/iso7816.git", tag = "v0.1.1-nitrokey.1" }
trussed-usbip = { git = "https://github.com/Nitrokey/pc-usbip-runner.git", tag = "v0.0.1-nitrokey.2" }

[profile.release]
Expand All @@ -51,4 +52,4 @@ inherits = "release"
opt-level = 2

[profile.release-thin-lto.package.salty]
opt-level = 2
opt-level = 2
19 changes: 3 additions & 16 deletions components/apps/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ edition = "2021"
[dependencies]
apdu-dispatch = "0.1"
ctaphid-dispatch = "0.1"
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 }
usbd-ctaphid = { version = "0.1", optional = true }
Expand All @@ -27,14 +28,7 @@ piv-authenticator = { version = "0.3.1", features = ["apdu-dispatch", "delog"],
provisioner-app = { path = "../provisioner-app", optional = true }

[features]
default = [
"admin-app",
"fido-authenticator",
"ndef-app",
"secrets-app",
"opcard",
"trussed/clients-4",
]
default = ["admin-app", "fido-authenticator", "ndef-app", "secrets-app", "opcard", "trussed/clients-4"]
test = ["piv-authenticator", "webcrypt", "trussed/clients-6"]
provisioner = ["provisioner-app", "trussed/clients-5"]

Expand All @@ -50,14 +44,7 @@ backend-auth = ["trussed-auth"]
backend-rsa = ["trussed-rsa-alloc"]
backend-staging = ["trussed-staging"]

log-all = [
"admin-app?/log-all",
"fido-authenticator?/log-all",
"secrets-app?/log-all",
"webcrypt?/log-all",
"opcard?/log-all",
"provisioner-app?/log-all",
]
log-all = ["admin-app?/log-all", "fido-authenticator?/log-all", "secrets-app?/log-all", "webcrypt?/log-all", "opcard?/log-all", "provisioner-app?/log-all"]

trussed-usbip-ccid = ["trussed-usbip/ccid"]

Expand Down
Loading

0 comments on commit 7b45985

Please sign in to comment.