From d3891c9f16ebb89444e4e5c19a50f948f8624b58 Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Tue, 11 Mar 2025 09:56:58 +0100 Subject: [PATCH] Replace heapless with heapless-bytes --- Cargo.toml | 3 ++- src/chunked/mod.rs | 4 ++-- src/wrap_key_to_file.rs | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 46ec88a..9a2924e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -83,7 +83,8 @@ log-warn = [] log-error = [] [patch.crates-io] -trussed = { git = "https://github.com/trussed-dev/trussed.git", rev = "ac106d63ab5e19021b0e37f0efb4313f8168a110" } +# trussed = { git = "https://github.com/trussed-dev/trussed.git", rev = "ac106d63ab5e19021b0e37f0efb4313f8168a110" } +trussed = { git = "https://github.com/trussed-dev/trussed.git", rev = "refs/pull/207/head" } trussed-chunked = { path = "extensions/chunked" } trussed-hkdf = { path = "extensions/hkdf" } diff --git a/src/chunked/mod.rs b/src/chunked/mod.rs index 669a728..744db47 100644 --- a/src/chunked/mod.rs +++ b/src/chunked/mod.rs @@ -182,7 +182,7 @@ impl ExtensionImpl for super::StagingBackend { }); let nonce: &StreamNonce> = (&nonce).into(); - let aead = ChaCha8Poly1305::new((&*key.material).into()); + let aead = ChaCha8Poly1305::new(key.material.as_slice().into()); let encryptor = EncryptorLE31::::from_aead(aead, nonce); store::start_chunked_write( &store, @@ -210,7 +210,7 @@ impl ExtensionImpl for super::StagingBackend { filestore.read(&request.path, request.location)?; let nonce: &StreamNonce> = (&**nonce).into(); - let aead = ChaCha8Poly1305::new((&*key.material).into()); + let aead = ChaCha8Poly1305::new(key.material.as_slice().into()); let decryptor = DecryptorLE31::::from_aead(aead, nonce); backend_ctx.chunked_io_state = Some(ChunkedIoState::EncryptedRead(EncryptedChunkedReadState { diff --git a/src/wrap_key_to_file.rs b/src/wrap_key_to_file.rs index 81b1a6a..245de44 100644 --- a/src/wrap_key_to_file.rs +++ b/src/wrap_key_to_file.rs @@ -45,7 +45,7 @@ fn wrap_key_to_file( let nonce = (&*nonce).try_into().unwrap(); let key = keystore.load_key(Secrecy::Secret, Some(KIND), &request.wrapping_key)?; - let chachakey: [u8; KEY_LEN] = (&*key.material).try_into().unwrap(); + let chachakey: [u8; KEY_LEN] = key.material.as_slice().try_into().unwrap(); let mut aead = ChaCha8Poly1305::new(&GenericArray::clone_from_slice(&chachakey)); let tag = aead .encrypt_in_place_detached( @@ -90,7 +90,7 @@ fn unwrap_key_from_file( let tag = (&*tag).try_into().unwrap(); let key = keystore.load_key(Secrecy::Secret, Some(KIND), &request.key)?; - let chachakey: [u8; KEY_LEN] = (&*key.material).try_into().unwrap(); + let chachakey: [u8; KEY_LEN] = key.material.as_slice().try_into().unwrap(); let mut aead = ChaCha8Poly1305::new(&GenericArray::clone_from_slice(&chachakey)); if aead .decrypt_in_place_detached(