Skip to main content

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_cfg))]
8
9pub use digest::{self, KeyInit, Mac, block_api::SmallBlockSizeUser};
10
11mod block_api;
12
13use cipher::{AlgorithmName, BlockCipherEncrypt};
14use core::fmt;
15use digest::block_api::CoreProxy;
16
17digest::buffer_fixed!(
18    /// Generic CBC-MAC instance.
19    #[derive(Clone)]
20    pub struct CbcMac<C: BlockCipherEncrypt + SmallBlockSizeUser>(block_api::CbcMacCore<C>);
21    impl: ResetMacTraits InnerInit;
22);
23
24impl<C> AlgorithmName for CbcMac<C>
25where
26    C: BlockCipherEncrypt + SmallBlockSizeUser + AlgorithmName,
27{
28    fn write_alg_name(f: &mut fmt::Formatter<'_>) -> fmt::Result {
29        <Self as CoreProxy>::Core::write_alg_name(f)
30    }
31}