You've already forked trussed-staging
mirror of
https://github.com/trussed-dev/trussed-staging.git
synced 2026-03-11 16:37:18 -07:00
@@ -66,8 +66,8 @@ log-warn = []
|
||||
log-error = []
|
||||
|
||||
[patch.crates-io]
|
||||
trussed = { git = "https://github.com/trussed-dev/trussed.git", rev = "45ed62ba97d994aa6e05e2b61cea013ef131caa4" }
|
||||
littlefs2 = { git = "https://github.com/trussed-dev/littlefs2.git", rev = "ebd27e49ca321089d01d8c9b169c4aeb58ceeeca" }
|
||||
trussed = { git = "https://github.com/trussed-dev/trussed.git", rev = "a055e4f79a10122c8c0c882161442e6e02f0c5c6" }
|
||||
littlefs2 = { git = "https://github.com/trussed-dev/littlefs2.git", rev = "960e57d9fc0d209308c8e15dc26252bbe1ff6ba8" }
|
||||
|
||||
trussed-chunked = { path = "extensions/chunked" }
|
||||
trussed-hkdf = { path = "extensions/hkdf" }
|
||||
|
||||
@@ -89,7 +89,7 @@ fn unwrap_key_from_file(
|
||||
let nonce = (&*nonce).try_into().unwrap();
|
||||
let tag = (&*tag).try_into().unwrap();
|
||||
|
||||
let key = keystore.load_key(key::Secrecy::Secret, Some(KIND), &request.key)?;
|
||||
let key = keystore.load_key(Secrecy::Secret, Some(KIND), &request.key)?;
|
||||
let chachakey: [u8; KEY_LEN] = (&*key.material).try_into().unwrap();
|
||||
let mut aead = ChaCha8Poly1305::new(&GenericArray::clone_from_slice(&chachakey));
|
||||
if aead
|
||||
|
||||
@@ -48,12 +48,13 @@ fn chacha_wrapkey() {
|
||||
let key2 = syscall!(client.generate_secret_key(32, Volatile)).key;
|
||||
|
||||
let wrapped =
|
||||
syscall!(client.wrap_key(Mechanism::Chacha8Poly1305, key, key2, &[])).wrapped_key;
|
||||
syscall!(client.wrap_key(Mechanism::Chacha8Poly1305, key, key2, &[], None)).wrapped_key;
|
||||
let unwrapped = syscall!(client.unwrap_key(
|
||||
Mechanism::Chacha8Poly1305,
|
||||
key,
|
||||
wrapped,
|
||||
&[],
|
||||
&[],
|
||||
StorageAttributes::new()
|
||||
))
|
||||
.key
|
||||
@@ -61,12 +62,14 @@ fn chacha_wrapkey() {
|
||||
assert_key_eq(key2, unwrapped, client);
|
||||
|
||||
let wrapped_ad =
|
||||
syscall!(client.wrap_key(Mechanism::Chacha8Poly1305, key, key2, b"abc")).wrapped_key;
|
||||
syscall!(client.wrap_key(Mechanism::Chacha8Poly1305, key, key2, b"abc", None))
|
||||
.wrapped_key;
|
||||
assert!(syscall!(client.unwrap_key(
|
||||
Mechanism::Chacha8Poly1305,
|
||||
key,
|
||||
wrapped_ad.clone(),
|
||||
&[],
|
||||
&[],
|
||||
StorageAttributes::new()
|
||||
))
|
||||
.key
|
||||
@@ -76,6 +79,7 @@ fn chacha_wrapkey() {
|
||||
key,
|
||||
wrapped_ad,
|
||||
b"abc",
|
||||
&[],
|
||||
StorageAttributes::new()
|
||||
))
|
||||
.key
|
||||
|
||||
Reference in New Issue
Block a user