From fe073abea288e44bb58243b85bbe2e9fe9d8b112 Mon Sep 17 00:00:00 2001 From: SalusaSecondus Date: Sun, 5 Apr 2026 12:39:00 -0700 Subject: [PATCH 1/3] Add raw_mac_test to allow testing Macs that don't support KeyInit --- digest/src/dev/mac.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/digest/src/dev/mac.rs b/digest/src/dev/mac.rs index 294704f37..1ba8712a0 100644 --- a/digest/src/dev/mac.rs +++ b/digest/src/dev/mac.rs @@ -31,6 +31,17 @@ pub fn mac_test( return Err("Failed to initialize MAC instance"); }; + raw_mac_test(mac0, input, tag, trunc_side) +} + +/// Run the MAC test directly on an initialized MAC. +/// This is useful for when custom initialization is needed +pub fn raw_mac_test( + mac0: M, + input: &[u8], + tag: &[u8], + trunc_side: MacTruncSide, +) -> Result<(), &'static str> { let mut mac = mac0.clone(); mac.update(input); let result = mac.finalize().into_bytes(); From 9cea1c181dabb5e7878a9fce44d25ebf686101f8 Mon Sep 17 00:00:00 2001 From: SalusaSecondus Date: Mon, 6 Apr 2026 08:01:30 -0700 Subject: [PATCH 2/3] Rename raw_mac_test to initialized_mac_test --- digest/src/dev/mac.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/digest/src/dev/mac.rs b/digest/src/dev/mac.rs index 1ba8712a0..9a3581285 100644 --- a/digest/src/dev/mac.rs +++ b/digest/src/dev/mac.rs @@ -31,12 +31,12 @@ pub fn mac_test( return Err("Failed to initialize MAC instance"); }; - raw_mac_test(mac0, input, tag, trunc_side) + initialized_mac_test(mac0, input, tag, trunc_side) } /// Run the MAC test directly on an initialized MAC. /// This is useful for when custom initialization is needed -pub fn raw_mac_test( +pub fn initialized_mac_test( mac0: M, input: &[u8], tag: &[u8], From 25b1b01bd2b0a427b8ef95ff2ed1798de6756033 Mon Sep 17 00:00:00 2001 From: Artyom Pavlov Date: Tue, 7 Apr 2026 13:16:35 +0300 Subject: [PATCH 3/3] Update changelog --- digest/CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/digest/CHANGELOG.md b/digest/CHANGELOG.md index e513c926c..de9d690e9 100644 --- a/digest/CHANGELOG.md +++ b/digest/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## 0.11.3 (UNRELEASED) +### Added +- `dev::initialized_mac_test` function ([#2367]) + +[#2367]: https://github.com/RustCrypto/traits/pull/2367 + ## 0.11.2 (2026-03-13) ### Changed - Do not implement `Clone` as part of `(Reset)MacTraits` in the `buffer_fixed!` macro ([#2341])