Skip to content

Commit 1997abe

Browse files
authored
sha3: backport fix of customized cshake initialization (#836)
This PR is a backport of #834.
1 parent 82c36a4 commit 1997abe

4 files changed

Lines changed: 13 additions & 5 deletions

File tree

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sha3/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## 0.10.9 (UNRELEASED)
9+
### Fixed
10+
- Non-compliant initialization of cSHAKE when serialized length of function name and
11+
customization string is a multiple of the block size ([#836], backport of [#834])
12+
13+
[#834]: https://github.com/RustCrypto/hashes/pull/834
14+
[#836]: https://github.com/RustCrypto/hashes/pull/836
15+
816
## 0.10.8 (2023-04-08)
917
### Fixed
1018
- Performance regression: now uses `p1600` fn ([#472])

sha3/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//! * `SHAKE128`, an extendable output function (XOF)
1010
//! * `SHAKE256`, an extendable output function (XOF)
1111
//! * `Keccak224`, `Keccak256`, `Keccak384`, `Keccak512` (NIST submission
12-
//! without padding changes)
12+
//! without padding changes)
1313
//!
1414
//! Additionally supports `TurboSHAKE`.
1515
//!
@@ -72,7 +72,7 @@ use core::fmt;
7272
#[cfg(feature = "oid")]
7373
use digest::const_oid::{AssociatedOid, ObjectIdentifier};
7474
use digest::{
75-
block_buffer::Eager,
75+
block_buffer::{Eager, LazyBuffer},
7676
consts::{U104, U136, U144, U168, U200, U28, U32, U48, U64, U72},
7777
core_api::{
7878
AlgorithmName, Block, BlockSizeUser, Buffer, BufferKindUser, CoreWrapper,

sha3/src/macros.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ macro_rules! impl_cshake {
394394
};
395395
}
396396

397-
let mut buffer = Buffer::<Self>::default();
397+
let mut buffer = LazyBuffer::<$rate>::default();
398398
let mut b = [0u8; 9];
399399
buffer.digest_blocks(left_encode($rate::to_u64(), &mut b), |blocks| {
400400
for block in blocks {

0 commit comments

Comments
 (0)