Skip to content

Commit

Permalink
Merge pull request #58 from japaric/no-std-rust-crypto
Browse files Browse the repository at this point in the history
no-std-ify hpke-rs-rust-crypto (some more)
  • Loading branch information
franziskuskiefer authored Nov 29, 2023
2 parents 2af956e + 8dc6ad6 commit 8f66bf3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions rust_crypto_provider/src/aead.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use alloc::{format, vec::Vec};

use aes_gcm::{Aes128Gcm as RC_Aes128Gcm, Aes256Gcm as RC_Aes256Gcm};
use chacha20poly1305::{
aead::{Aead, KeyInit, Payload},
Expand Down
2 changes: 2 additions & 0 deletions rust_crypto_provider/src/hkdf.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use alloc::{vec, vec::Vec};

use hkdf::Hkdf;
use hpke_rs_crypto::error::Error;
use sha2::{Sha256, Sha384, Sha512};
Expand Down
6 changes: 5 additions & 1 deletion rust_crypto_provider/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#![doc = include_str!("../Readme.md")]
#![cfg_attr(not(test), no_std)]

extern crate alloc;

use alloc::{string::String, vec::Vec};
use core::fmt::Display;

use hpke_rs_crypto::{
Expand Down Expand Up @@ -163,7 +167,7 @@ impl HpkeCrypto for HpkeRustCrypto {
fn prng() -> Self::HpkePrng {
#[cfg(feature = "deterministic-prng")]
{
let mut fake_rng = vec![0u8; 256];
let mut fake_rng = alloc::vec![0u8; 256];
rand_chacha::ChaCha20Rng::from_entropy().fill_bytes(&mut fake_rng);
HpkeRustCryptoPrng {
fake_rng,
Expand Down

0 comments on commit 8f66bf3

Please sign in to comment.