use crate::{crypto::dummy_impl_call, misc::DefaultArray};
use core::marker::PhantomData;
#[cfg(feature = "crypto-aws-lc-rs")]
mod aws_lc_rs;
pub(crate) mod global;
#[cfg(feature = "crypto-graviola")]
mod graviola;
#[cfg(feature = "crypto-openssl")]
mod openssl;
#[cfg(feature = "crypto-ring")]
mod ring;
pub trait Hmac: Sized {
type Digest: AsRef<[u8]>;
fn from_key(key: &[u8]) -> crate::Result<Self>;
fn update(&mut self, data: &[u8]);
fn digest(self) -> Self::Digest;
fn verify(self, tag: &[u8]) -> crate::Result<()>;
}
#[derive(Clone, Copy, Debug, Default, PartialEq)]
pub struct HmacDummy<D>(PhantomData<D>);
impl<D> Hmac for HmacDummy<D>
where
D: AsRef<[u8]> + DefaultArray,
{
type Digest = D;
#[inline]
fn from_key(_: &[u8]) -> crate::Result<Self> {
dummy_impl_call();
}
#[inline]
fn update(&mut self, _: &[u8]) {}
#[inline]
fn digest(self) -> Self::Digest {
dummy_impl_call();
}
#[inline]
fn verify(self, _: &[u8]) -> crate::Result<()> {
dummy_impl_call();
}
}