ensure_fips

Function ensure_fips 

Source
pub const fn ensure_fips<F: Fips>()
Expand description

Ensure the Provided Type is in FIPS scope.

This is a simple no-op, allowing to guard against non-fips compliant algorithms and configurations at compilation time.

§Example

use wolf_crypto::mac::hmac::{Hmac, Sha256, algo::Hash};
use wolf_crypto::ensure_fips;

macro_rules! fips_hmac {
    ($algo:ty, $($key:tt)*) => {{
        ensure_fips::<Hmac<$algo>>();
        Hmac::<$algo>::new($($key)*)
    }}
}

let mut mac = fips_hmac!(Sha256, [42; 32]);
let mut mac = fips_hmac!(Md5, [42; 16]); // does not compile!