From 933666a67b30821e8923de7ce7699d174d6dad3e Mon Sep 17 00:00:00 2001 From: bunnie Date: Mon, 8 Jan 2024 02:23:23 +0800 Subject: [PATCH] add an implementation for new_with_strategy() on sha512trunc256 this is needed to unbreak hosted mode. The strategy in hosted mode is *always* to use software as there is no hardware hashing engine. --- services/engine-sha512/src/sha512_hosted.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/services/engine-sha512/src/sha512_hosted.rs b/services/engine-sha512/src/sha512_hosted.rs index 300693f36..d9e034760 100644 --- a/services/engine-sha512/src/sha512_hosted.rs +++ b/services/engine-sha512/src/sha512_hosted.rs @@ -1,5 +1,6 @@ //! SHA-512 use crate::consts::{H384, H512, H512_TRUNC_224, H512_TRUNC_256, STATE_LEN}; +use crate::FallbackStrategy; use block_buffer::BlockBuffer; use core::slice::from_ref; use digest::consts::{U128, U28, U32, U48, U64}; @@ -136,7 +137,13 @@ impl Reset for Sha384 { pub struct Sha512Trunc256 { engine: Engine512, } - +impl Sha512Trunc256 { + pub fn new_with_strategy(_strat: FallbackStrategy) -> Self { + Sha512Trunc256 { + engine: Engine512::new(&H512_TRUNC_256), + } + } +} impl Default for Sha512Trunc256 { fn default() -> Self { Sha512Trunc256 {