This module implements AES-CMAC on top of native AES-CBC using either the WebCrypto API or Node.js' crypto API.
(inner, constant) blockLength
This implementation of CMAC is based on the description of OMAC in http://web.cs.ucdavis.edu/~rogaway/papers/eax.pdf. As per that document:
We have made a small modification to the OMAC algorithm as it was originally presented, changing one of its two constants. Specifically, the constant 4 at line 85 was the constant 1/2 (the multiplicative inverse of 2) in the original definition of OMAC . The OMAC authors indicate that they will promulgate this modification , which slightly simplifies implementations.
(inner) rightXorMut(data, padding)
padding into the end of
data. This function implements "the
operation xor→ [which] xors the shorter string into the end of longer
one". Since data is always as least as long as padding, we can
simplify the implementation.