61 #include <openssl/fips.h>
82 static void make_kn(
unsigned char *k1,
unsigned char *l,
int bl)
86 for (i = 0; i < bl; i++)
89 if (i < bl - 1 && l[i + 1] & 0x80)
94 k1[bl - 1] ^= bl == 16 ? 0x87 : 0x1b;
113 FIPS_cmac_ctx_cleanup(ctx);
144 memcpy(out->
k1, in->
k1, bl);
145 memcpy(out->
k2, in->
k2, bl);
146 memcpy(out->
tbl, in->
tbl, bl);
171 return FIPS_cmac_init(ctx, key, keylen, cipher, NULL);
175 if (!key && !cipher && !impl && keylen == 0)
202 make_kn(ctx->
k1, ctx->
tbl, bl);
203 make_kn(ctx->
k2, ctx->
k1, bl);
209 memset(ctx->
tbl, 0, bl);
217 const unsigned char *
data = in;
221 return FIPS_cmac_update(ctx, in, dlen);
266 return FIPS_cmac_final(ctx, out, poutlen);
271 *poutlen = (size_t)bl;
278 for (i = 0; i < bl; i++)
285 memset(ctx->
last_block + lb + 1, 0, bl - lb - 1);
286 for (i = 0; i < bl; i++)