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]) diff --git a/digest/src/dev/mac.rs b/digest/src/dev/mac.rs index 294704f37..9a3581285 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"); }; + 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 initialized_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();