From fa20b909738203ce0cf93ab044372e83d330c0b0 Mon Sep 17 00:00:00 2001 From: bunnie Date: Sun, 26 Feb 2023 01:01:30 +0800 Subject: [PATCH] add rand_core trait to functions that require fill_bytes() --- services/pddb/Cargo.toml | 1 + services/pddb/src/backend/trngpool.rs | 1 + services/root-keys/Cargo.toml | 2 ++ services/root-keys/src/backups.rs | 1 + services/root-keys/src/implementation.rs | 1 + 5 files changed, 6 insertions(+) diff --git a/services/pddb/Cargo.toml b/services/pddb/Cargo.toml index 58b31025c..36a0a7c7d 100644 --- a/services/pddb/Cargo.toml +++ b/services/pddb/Cargo.toml @@ -29,6 +29,7 @@ aes-gcm-siv = {version = "0.11.1", default-features = false, features = ["alloc" llio = {path="../llio"} subtle = {version = "2.4.1", default-features = false} tts-frontend = {path="../tts"} +rand_core = "0.5.1" # passwords sha2 = {path = "../engine-sha512"} diff --git a/services/pddb/src/backend/trngpool.rs b/services/pddb/src/backend/trngpool.rs index 0b052d893..f70531d2d 100644 --- a/services/pddb/src/backend/trngpool.rs +++ b/services/pddb/src/backend/trngpool.rs @@ -2,6 +2,7 @@ use core::mem::size_of; use aes_gcm_siv::Nonce; use std::convert::TryInto; use core::cell::RefCell; +use rand_core::RngCore; /// Crate-shared resource for TRNGs. pub(crate) struct TrngPool { diff --git a/services/root-keys/Cargo.toml b/services/root-keys/Cargo.toml index 6446118f2..570f9d93b 100644 --- a/services/root-keys/Cargo.toml +++ b/services/root-keys/Cargo.toml @@ -25,6 +25,7 @@ num-derive = {version = "0.3.3", default-features = false} num-traits = {version = "0.2.14", default-features = false} rkyv = {version = "0.4.3", default-features = false, features = ["const_generics"]} zeroize = "1.3.0" +rand_core = "0.5.1" aes-kw = {version = "0.2.1", features = ["alloc"]} @@ -63,6 +64,7 @@ engine-25519 = {path="../engine-25519"} byteorder = "1.4.3" # used by keywrap # hardware acceleration adaptations are inserted into a fork of the main branch. hex = {version = "0.4.3", default-features = false, features = []} + [dependencies.curve25519-dalek] version = "3.1.0" # note this is patched to our fork in ./Cargo.toml default-features = false diff --git a/services/root-keys/src/backups.rs b/services/root-keys/src/backups.rs index a14fc9cb4..3f0cbcf9b 100644 --- a/services/root-keys/src/backups.rs +++ b/services/root-keys/src/backups.rs @@ -7,6 +7,7 @@ use aes_gcm_siv::{ }; use subtle::ConstantTimeEq; use crate::{BackupHeader, BackupOp}; +use rand_core::RngCore; const BACKUP_AAD: &'static str = "PDDB backup v0.1.0"; diff --git a/services/root-keys/src/implementation.rs b/services/root-keys/src/implementation.rs index 5e3184305..b5a6ad7ab 100644 --- a/services/root-keys/src/implementation.rs +++ b/services/root-keys/src/implementation.rs @@ -30,6 +30,7 @@ use core::cell::RefCell; use aes::Aes256; use aes::cipher::{KeyInit, BlockDecrypt, BlockEncrypt}; use cipher::generic_array::GenericArray; +use rand_core::RngCore; use crate::{SignatureResult, GatewareRegion, MetadataInFlash, UpdateType};