DoxigAlpha

init

Function parameters

Parameters

#
key:*const [key_length]u8

NIST Special Publication 800-38B - The CMAC Mode for Authentication

Functions

#
Cmac
NIST Special Publication 800-38B - The CMAC Mode for Authentication

Source

Implementation

#
pub fn init(key: *const [key_length]u8) Self {
    const cipher_ctx = BlockCipher.initEnc(key.*);
    const zeros = [_]u8{0} ** block_length;
    var k1: Block = undefined;
    cipher_ctx.encrypt(&k1, &zeros);
    k1 = double(k1);
    return Self{
        .cipher_ctx = cipher_ctx,
        .k1 = k1,
        .k2 = double(k1),
    };
}