INNER CODE UNIT · Rust
verify_truncated_mac
matrix-org/vodozemac · src/cipher/mod.rs:228
pub fn verify_truncated_mac(&self, message: &[u8], tag: &[u8]) -> Result<(), MacError> {
let mut hmac = self.get_hmac();
hmac.update(message);
hmac.verify_truncated_left(tag)
}
/// A [`Cipher::verify_mac()`] method that always succeeds.
///
/// **Warning**: If you're seeing this comment and are not fuzzing the
/// library, the library is operating with an insecure build-time
/// configuration.
///
/// This mode is intended only for fuzzing vodozemac, as MAC verification
/// typically filters out many inputs early in the process.
#[cfg(fuzzing)]
pub fn verify_mac(&self, _: &[u8], _: &Mac) -> Result<(), MacError> {
Ok(())