Skip to content

Commit

Permalink
Fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
sosthene-nitrokey committed Feb 21, 2024
1 parent 1012a9b commit 7f4e12d
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 18 deletions.
6 changes: 1 addition & 5 deletions src/mechanisms/hmacblake2s.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,7 @@ impl DeriveKey for super::HmacBlake2s {
if let Some(additional_data) = &request.additional_data {
mac.update(additional_data);
}
let derived_key: [u8; 32] = mac
.finalize()
.into_bytes()
.try_into()
.map_err(|_| Error::InternalError)?;
let derived_key: [u8; 32] = mac.finalize().into_bytes().into();
let key = keystore.store_key(
request.attributes.persistence,
key::Secrecy::Secret,
Expand Down
6 changes: 1 addition & 5 deletions src/mechanisms/hmacsha1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,7 @@ impl DeriveKey for super::HmacSha1 {
if let Some(additional_data) = &request.additional_data {
mac.update(additional_data);
}
let derived_key: [u8; 20] = mac
.finalize()
.into_bytes()
.try_into()
.map_err(|_| Error::InternalError)?;
let derived_key: [u8; 20] = mac.finalize().into_bytes().into();
let key_id = keystore.store_key(
request.attributes.persistence,
key::Secrecy::Secret,
Expand Down
6 changes: 1 addition & 5 deletions src/mechanisms/hmacsha256.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,7 @@ impl DeriveKey for super::HmacSha256 {
if let Some(additional_data) = &request.additional_data {
mac.update(additional_data);
}
let derived_key: [u8; 32] = mac
.finalize()
.into_bytes()
.try_into()
.map_err(|_| Error::InternalError)?;
let derived_key: [u8; 32] = mac.finalize().into_bytes().into();
let key_id = keystore.store_key(
request.attributes.persistence,
key::Secrecy::Secret,
Expand Down
4 changes: 2 additions & 2 deletions src/mechanisms/hmacsha512.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ impl DeriveKey for super::HmacSha512 {
if let Some(additional_data) = &request.additional_data {
mac.update(additional_data);
}
let mut derived_key = [0u8; 64];
derived_key.copy_from_slice(&mac.finalize().into_bytes()); //.try_into().map_err(|_| Error::InternalError)?;
let derived_key: [u8; 64] = mac.finalize().into_bytes().into();

let key = keystore.store_key(
request.attributes.persistence,
key::Secrecy::Secret,
Expand Down
1 change: 1 addition & 0 deletions src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ impl<P: Platform> ServiceResources<P> {
generator
}

#[cfg(feature = "crypto-client-attest")]
let full_store = self.platform.store();

let keystore = once(|this, ctx| this.keystore(ctx.path.clone()));
Expand Down
1 change: 0 additions & 1 deletion tests/store/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
pub use generic_array::typenum::consts;
use littlefs2::const_ram_storage;
use trussed::types::{LfsResult, LfsStorage};

Expand Down

0 comments on commit 7f4e12d

Please sign in to comment.