]> git.ipfire.org Git - thirdparty/openssl.git/blame - crypto/cmac/cm_ameth.c
Change EVP_MAC method from copy to dup
[thirdparty/openssl.git] / crypto / cmac / cm_ameth.c
CommitLineData
0f113f3e 1/*
b8d77c9b 2 * Copyright 2010-2018 The OpenSSL Project Authors. All Rights Reserved.
c8ef656d 3 *
8de396f8 4 * Licensed under the Apache License 2.0 (the "License"). You may not use
4f22f405
RS
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
c8ef656d
DSH
8 */
9
10#include <stdio.h>
b39fc560 11#include "internal/cryptlib.h"
c8ef656d 12#include <openssl/evp.h>
5fe736e5 13#include "internal/asn1_int.h"
c8ef656d 14
0f113f3e
MC
15/*
16 * CMAC "ASN1" method. This is just here to indicate the maximum CMAC output
17 * length and to free up a CMAC key.
c8ef656d
DSH
18 */
19
20static int cmac_size(const EVP_PKEY *pkey)
0f113f3e
MC
21{
22 return EVP_MAX_BLOCK_LENGTH;
23}
c8ef656d
DSH
24
25static void cmac_key_free(EVP_PKEY *pkey)
0f113f3e 26{
b8d77c9b
RL
27 EVP_MAC_CTX *cmctx = EVP_PKEY_get0(pkey);
28 EVP_MAC_CTX_free(cmctx);
0f113f3e 29}
c8ef656d 30
0f113f3e
MC
31const EVP_PKEY_ASN1_METHOD cmac_asn1_meth = {
32 EVP_PKEY_CMAC,
33 EVP_PKEY_CMAC,
34 0,
c8ef656d 35
0f113f3e
MC
36 "CMAC",
37 "OpenSSL CMAC method",
c8ef656d 38
0f113f3e 39 0, 0, 0, 0,
c8ef656d 40
0f113f3e 41 0, 0, 0,
c8ef656d 42
0f113f3e
MC
43 cmac_size,
44 0, 0,
45 0, 0, 0, 0, 0, 0, 0,
c8ef656d 46
0f113f3e
MC
47 cmac_key_free,
48 0,
49 0, 0
50};