cbc_mac/
lib.rs

1#![no_std]
2#![doc = include_str!("../README.md")]
3#![doc(
4    html_logo_url = "https://raw.githubusercontent.com/RustCrypto/media/26acc39f/logo.svg",
5    html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/media/26acc39f/logo.svg"
6)]
7#![cfg_attr(docsrs, feature(doc_auto_cfg))]
8#![forbid(unsafe_code)]
9#![warn(missing_docs)]
10
11pub use digest::{self, KeyInit, Mac};
12
13mod block_api;
14
15use cipher::{AlgorithmName, BlockCipherEncrypt};
16use core::fmt;
17use digest::block_api::CoreProxy;
18
19digest::buffer_fixed!(
20    /// Generic CBC-MAC instance.
21    pub struct CbcMac<C: BlockCipherEncrypt + Clone>(block_api::CbcMacCore<C>);
22    impl: ResetMacTraits InnerInit;
23);
24
25impl<C> AlgorithmName for CbcMac<C>
26where
27    C: BlockCipherEncrypt + Clone + AlgorithmName,
28{
29    fn write_alg_name(f: &mut fmt::Formatter<'_>) -> fmt::Result {
30        <Self as CoreProxy>::Core::write_alg_name(f)
31    }
32}