2 * Copyright 2010-2018 The OpenSSL Project Authors. All Rights Reserved.
4 * Licensed under the Apache License 2.0 (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
11 * CMAC low level APIs are deprecated for public use, but still ok for internal
14 #include "internal/deprecated.h"
17 #include "internal/cryptlib.h"
18 #include <openssl/evp.h>
19 #include "crypto/asn1.h"
22 * CMAC "ASN1" method. This is just here to indicate the maximum CMAC output
23 * length and to free up a CMAC key.
26 static int cmac_size(const EVP_PKEY *pkey)
28 return EVP_MAX_BLOCK_LENGTH;
31 static void cmac_key_free(EVP_PKEY *pkey)
33 EVP_MAC_CTX *cmctx = EVP_PKEY_get0(pkey);
34 EVP_MAC *mac = cmctx == NULL ? NULL : EVP_MAC_CTX_mac(cmctx);
36 EVP_MAC_CTX_free(cmctx);
40 const EVP_PKEY_ASN1_METHOD cmac_asn1_meth = {
46 "OpenSSL CMAC method",