ReactOS 0.4.15-dev-7958-gcd0bb1a
cmac.h
Go to the documentation of this file.
1
9/*
10 * Copyright The Mbed TLS Contributors
11 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
12 *
13 * This file is provided under the Apache License 2.0, or the
14 * GNU General Public License v2.0 or later.
15 *
16 * **********
17 * Apache License 2.0:
18 *
19 * Licensed under the Apache License, Version 2.0 (the "License"); you may
20 * not use this file except in compliance with the License.
21 * You may obtain a copy of the License at
22 *
23 * http://www.apache.org/licenses/LICENSE-2.0
24 *
25 * Unless required by applicable law or agreed to in writing, software
26 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
27 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
28 * See the License for the specific language governing permissions and
29 * limitations under the License.
30 *
31 * **********
32 *
33 * **********
34 * GNU General Public License v2.0 or later:
35 *
36 * This program is free software; you can redistribute it and/or modify
37 * it under the terms of the GNU General Public License as published by
38 * the Free Software Foundation; either version 2 of the License, or
39 * (at your option) any later version.
40 *
41 * This program is distributed in the hope that it will be useful,
42 * but WITHOUT ANY WARRANTY; without even the implied warranty of
43 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
44 * GNU General Public License for more details.
45 *
46 * You should have received a copy of the GNU General Public License along
47 * with this program; if not, write to the Free Software Foundation, Inc.,
48 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
49 *
50 * **********
51 */
52
53#ifndef MBEDTLS_CMAC_H
54#define MBEDTLS_CMAC_H
55
56#if !defined(MBEDTLS_CONFIG_FILE)
57#include "config.h"
58#else
59#include MBEDTLS_CONFIG_FILE
60#endif
61
62#include "cipher.h"
63
64#ifdef __cplusplus
65extern "C" {
66#endif
67
68/* MBEDTLS_ERR_CMAC_HW_ACCEL_FAILED is deprecated and should not be used. */
69#define MBEDTLS_ERR_CMAC_HW_ACCEL_FAILED -0x007A
71#define MBEDTLS_AES_BLOCK_SIZE 16
72#define MBEDTLS_DES3_BLOCK_SIZE 8
73
74#if defined(MBEDTLS_AES_C)
75#define MBEDTLS_CIPHER_BLKSIZE_MAX 16
76#else
77#define MBEDTLS_CIPHER_BLKSIZE_MAX 8
78#endif
79
80#if !defined(MBEDTLS_CMAC_ALT)
81
86{
89
93
96};
97
98#else /* !MBEDTLS_CMAC_ALT */
99#include "cmac_alt.h"
100#endif /* !MBEDTLS_CMAC_ALT */
101
119 const unsigned char *key, size_t keybits );
120
138 const unsigned char *input, size_t ilen );
139
156 unsigned char *output );
157
173
197 const unsigned char *key, size_t keylen,
198 const unsigned char *input, size_t ilen,
199 unsigned char *output );
200
201#if defined(MBEDTLS_AES_C)
219int mbedtls_aes_cmac_prf_128( const unsigned char *key, size_t key_len,
220 const unsigned char *input, size_t in_len,
221 unsigned char output[16] );
222#endif /* MBEDTLS_AES_C */
223
224#if defined(MBEDTLS_SELF_TEST) && ( defined(MBEDTLS_AES_C) || defined(MBEDTLS_DES_C) )
231int mbedtls_cmac_self_test( int verbose );
232#endif /* MBEDTLS_SELF_TEST && ( MBEDTLS_AES_C || MBEDTLS_DES_C ) */
233
234#ifdef __cplusplus
235}
236#endif
237
238#endif /* MBEDTLS_CMAC_H */
This file contains an abstraction interface for use with the cipher primitives provided by the librar...
int mbedtls_cipher_cmac_update(mbedtls_cipher_context_t *ctx, const unsigned char *input, size_t ilen)
This function feeds an input buffer into an ongoing CMAC computation.
int mbedtls_cipher_cmac_reset(mbedtls_cipher_context_t *ctx)
This function prepares the authentication of another message with the same key as the previous CMAC o...
int mbedtls_cipher_cmac_finish(mbedtls_cipher_context_t *ctx, unsigned char *output)
This function finishes the CMAC operation, and writes the result to the output buffer.
#define MBEDTLS_CIPHER_BLKSIZE_MAX
Definition: cmac.h:75
int mbedtls_aes_cmac_prf_128(const unsigned char *key, size_t key_len, const unsigned char *input, size_t in_len, unsigned char output[16])
This function implements the AES-CMAC-PRF-128 pseudorandom function, as defined in RFC-4615: The Adva...
int mbedtls_cipher_cmac_starts(mbedtls_cipher_context_t *ctx, const unsigned char *key, size_t keybits)
This function sets the CMAC key, and prepares to authenticate the input data. Must be called with an ...
int mbedtls_cipher_cmac(const mbedtls_cipher_info_t *cipher_info, const unsigned char *key, size_t keylen, const unsigned char *input, size_t ilen, unsigned char *output)
This function calculates the full generic CMAC on the input buffer with the provided key.
GLenum GLenum GLenum input
Definition: glext.h:9031
#define verbose
Definition: rosglue.h:36
Definition: copy.c:22
unsigned char unprocessed_block[MBEDTLS_CIPHER_BLKSIZE_MAX]
Definition: cmac.h:92
size_t unprocessed_len
Definition: cmac.h:95
unsigned char state[MBEDTLS_CIPHER_BLKSIZE_MAX]
Definition: cmac.h:88