mbed TLS v2.16.1
cmac.h
Go to the documentation of this file.
1 
9 /*
10  * Copyright (C) 2015-2018, Arm Limited (or its affiliates), All Rights Reserved
11  * SPDX-License-Identifier: GPL-2.0
12  *
13  * This program is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation; either version 2 of the License, or
16  * (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License along
24  * with this program; if not, write to the Free Software Foundation, Inc.,
25  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26  *
27  * This file is part of Mbed TLS (https://tls.mbed.org)
28  */
29 
30 #ifndef MBEDTLS_CMAC_H
31 #define MBEDTLS_CMAC_H
32 
33 #if !defined(MBEDTLS_CONFIG_FILE)
34 #include "config.h"
35 #else
36 #include MBEDTLS_CONFIG_FILE
37 #endif
38 
39 #include "cipher.h"
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
45 /* MBEDTLS_ERR_CMAC_HW_ACCEL_FAILED is deprecated and should not be used. */
46 #define MBEDTLS_ERR_CMAC_HW_ACCEL_FAILED -0x007A
48 #define MBEDTLS_AES_BLOCK_SIZE 16
49 #define MBEDTLS_DES3_BLOCK_SIZE 8
50 
51 #if defined(MBEDTLS_AES_C)
52 #define MBEDTLS_CIPHER_BLKSIZE_MAX 16
53 #else
54 #define MBEDTLS_CIPHER_BLKSIZE_MAX 8
55 #endif
56 
57 #if !defined(MBEDTLS_CMAC_ALT)
58 
63 {
66 
70 
73 };
74 
75 #else /* !MBEDTLS_CMAC_ALT */
76 #include "cmac_alt.h"
77 #endif /* !MBEDTLS_CMAC_ALT */
78 
96  const unsigned char *key, size_t keybits );
97 
115  const unsigned char *input, size_t ilen );
116 
133  unsigned char *output );
134 
150 
173 int mbedtls_cipher_cmac( const mbedtls_cipher_info_t *cipher_info,
174  const unsigned char *key, size_t keylen,
175  const unsigned char *input, size_t ilen,
176  unsigned char *output );
177 
178 #if defined(MBEDTLS_AES_C)
179 
196 int mbedtls_aes_cmac_prf_128( const unsigned char *key, size_t key_len,
197  const unsigned char *input, size_t in_len,
198  unsigned char output[16] );
199 #endif /* MBEDTLS_AES_C */
200 
201 #if defined(MBEDTLS_SELF_TEST) && ( defined(MBEDTLS_AES_C) || defined(MBEDTLS_DES_C) )
202 
208 int mbedtls_cmac_self_test( int verbose );
209 #endif /* MBEDTLS_SELF_TEST && ( MBEDTLS_AES_C || MBEDTLS_DES_C ) */
210 
211 #ifdef __cplusplus
212 }
213 #endif
214 
215 #endif /* MBEDTLS_CMAC_H */