Merge rust-bitcoin/rust-bitcoin#3545: Add no_std flag to the chacha20-poly1305 crate

26ed97877b Add no_std flag to the chacha20-poly1205 crate (Nick Johnson)

Pull request description:

  I unfortunately forgot to copy over the `no_std` configuration when I promoted the chacha20_poly1305 from an internal module (where it inherited the setting) to the main module of the new crate.

  This crate is using a slightly simpler no_std pattern than some other crates in the org. I like the simple approach, but can update it if consistency is valued in this case.

ACKs for top commit:
  tcharding:
    ACK 26ed97877b
  apoelstra:
    ACK 26ed97877bdbee0b9b67db52ff0d53b706361e08; successfully ran local tests

Tree-SHA512: ffa672b7593daa4148ef8584903939e976302138b0aae1f09de647885629e502bcb1380471b29d8cd28ae52a435e52bd22b231c6631528d17fe3090e7f56add7
This commit is contained in:
merge-script 2024-10-31 22:09:34 +00:00
commit dbb35c0960
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
3 changed files with 9 additions and 0 deletions

View File

@ -326,6 +326,7 @@ fn keystream_at_slice(key: Key, nonce: Nonce, count: u32, seek: usize) -> [u8; 6
#[cfg(test)]
#[cfg(feature = "alloc")]
mod tests {
use alloc::vec::Vec;
use hex::prelude::*;
use super::*;

View File

@ -2,6 +2,12 @@
//! Combine the ChaCha20 stream cipher with the Poly1305 message authentication code
//! to form an authenticated encryption with additional data (AEAD) algorithm.
#![no_std]
#[cfg(feature = "alloc")]
extern crate alloc;
#[cfg(feature = "std")]
extern crate std;
pub mod chacha20;
pub mod poly1305;
@ -143,6 +149,7 @@ fn encode_lengths(aad_len: u64, content_len: u64) -> [u8; 16] {
#[cfg(test)]
#[cfg(feature = "alloc")]
mod tests {
use alloc::vec::Vec;
use hex::prelude::*;
use super::*;

View File

@ -223,6 +223,7 @@ fn _print_acc(num: &[u32; 5]) {
#[cfg(test)]
#[cfg(feature = "alloc")]
mod tests {
use alloc::vec::Vec;
use hex::prelude::*;
use super::*;