1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// SPDX-License-Identifier: MIT OR Apache-2.0
// SPDX-FileCopyrightText: Inria-AIO, Cryspen, and Christian Amsüss
//! Traits that describe how a hardware accelerator can assist in calculating SHA-2 hashes.
//!
//! As support for SHA-2 is commonly split by the variant's block size (SHA-224 and SHA-256 with
//! 512 bit block size use different hardware than SHA-384, SHA-512 and its truncated versions which have
//! 1024 bit block size), they split in [`Sha2Short`] and `Sha2Long` (currently unimplemented).
pub use *;
pub const SHA2SHORT_BLOCK_SIZE: usize = 64;
/// The maximum buffer needed to spool data for hashing through a back-end type.
///
/// This is a free function rather than a provided const method on the [`Hash`] trait simply
/// because const methods do not work in stable Rust.
///
/// This can be 0 if all the back-ends can take arbitrary slices, or if none are supported.
/// Implementations that create something equivalent to a `heapless::Vec` out of this and don't
/// need some minimal buffer internally will suffer some small per-state overhead (an unused size
/// field in their struct). They could avoid this by applying some clever tricks with putting the
/// buffer in a possibly-zero-sized array if that is really an issue.
pub const