Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ repository = "https://github.com/trussed-dev/trussed-auth"

[workspace.dependencies]
serde = { version = "1", default-features = false }
trussed-core = { version = "0.1.0-rc.1", features = ["serde-extensions"] }
trussed-core = { version = "0.2", 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 = "0b65280d69be541b8771f7756139826332c7d674" }
admin-app = { git = "https://github.com/Nitrokey/admin-app.git", rev = "46f0c4fd9110b7ab68468c8070a5aa290e9654c7" }
apdu-app = { git = "https://github.com/trussed-dev/apdu-dispatch.git", branch = "release" }
4 changes: 2 additions & 2 deletions backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ rand_core = "0.6.4"
serde-byte-array = "0.1.2"
sha2 = { version = "0.10.6", default-features = false }
subtle = { version = "2.4.1", default-features = false }
trussed = { version = "0.1.0", default-features = false, features = ["serde-extensions"] }
trussed = { version = "0.1.0", default-features = false, features = ["crypto-client", "filesystem-client", "hmac-sha256", "serde-extensions"] }
trussed-auth = "0.4"

[dev-dependencies]
Expand All @@ -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"] }
2 changes: 1 addition & 1 deletion backend/src/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ fn create_app_salt<S: Filestore, R: CryptoRng + RngCore>(
fn load_app_salt<S: Filestore>(fs: &mut S, location: Location) -> Result<Salt, Error> {
fs.read(APP_SALT_PATH, location)
.map_err(|_| Error::ReadFailed)
.and_then(|b: Bytes<SALT_LEN>| (**b).try_into().map_err(|_| Error::ReadFailed))
.and_then(|b: Bytes<SALT_LEN>| (*b).try_into().map_err(|_| Error::ReadFailed))
}

pub fn expand_app_key(salt: &Salt, application_key: &Key, info: &[u8]) -> Key {
Expand Down
8 changes: 5 additions & 3 deletions backend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ impl AuthBackend {
.or(Err(Error::WriteFailed))
.and(Ok(salt))
})
.and_then(|b| (**b).try_into().or(Err(Error::ReadFailed)))
.and_then(|b| (*b).try_into().or(Err(Error::ReadFailed)))
}

fn extract<R: CryptoRng + RngCore>(
Expand All @@ -172,7 +172,7 @@ impl AuthBackend {
ikm: Option<Bytes<MAX_HW_KEY_LEN>>,
rng: &mut R,
) -> Result<&Hkdf<Sha256>, Error> {
let ikm: &[u8] = ikm.as_deref().map(|i| &**i).unwrap_or(&[]);
let ikm: &[u8] = ikm.as_deref().unwrap_or(&[]);
let salt = self.get_global_salt(global_fs, rng)?;
let kdf = Hkdf::new(Some(&*salt), ikm);
self.hw_key = HardwareKey::Extracted(kdf);
Expand Down Expand Up @@ -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(
Expand Down
Loading