mbed TLS v2.4.2
cmac.h
Go to the documentation of this file.
1 
24 #ifndef MBEDTLS_CMAC_H
25 #define MBEDTLS_CMAC_H
26 
27 #include "mbedtls/cipher.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 #define MBEDTLS_AES_BLOCK_SIZE 16
34 #define MBEDTLS_DES3_BLOCK_SIZE 8
35 
36 #if defined(MBEDTLS_AES_C)
37 #define MBEDTLS_CIPHER_BLKSIZE_MAX 16 /* longest used by CMAC is AES */
38 #else
39 #define MBEDTLS_CIPHER_BLKSIZE_MAX 8 /* longest used by CMAC is 3DES */
40 #endif
41 
46 {
49 
53 
56 };
57 
75  const unsigned char *key, size_t keybits );
76 
92  const unsigned char *input, size_t ilen );
93 
107  unsigned char *output );
108 
120 
134 int mbedtls_cipher_cmac( const mbedtls_cipher_info_t *cipher_info,
135  const unsigned char *key, size_t keylen,
136  const unsigned char *input, size_t ilen,
137  unsigned char *output );
138 
139 #if defined(MBEDTLS_AES_C)
140 
152 int mbedtls_aes_cmac_prf_128( const unsigned char *key, size_t key_len,
153  const unsigned char *input, size_t in_len,
154  unsigned char output[16] );
155 #endif /* MBEDTLS_AES_C */
156 
157 #if defined(MBEDTLS_SELF_TEST) && ( defined(MBEDTLS_AES_C) || defined(MBEDTLS_DES_C) )
158 
163 int mbedtls_cmac_self_test( int verbose );
164 #endif /* MBEDTLS_SELF_TEST && ( MBEDTLS_AES_C || MBEDTLS_DES_C ) */
165 
166 #ifdef __cplusplus
167 }
168 #endif
169 
170 #endif /* MBEDTLS_CMAC_H */
#define MBEDTLS_CIPHER_BLKSIZE_MAX
Definition: cmac.h:39
int mbedtls_cipher_cmac_reset(mbedtls_cipher_context_t *ctx)
Prepare to authenticate a new message with the same key.
int mbedtls_cipher_cmac_starts(mbedtls_cipher_context_t *ctx, const unsigned char *key, size_t keybits)
Set the CMAC key and prepare to authenticate the input data.
CMAC context structure - Contains internal state information only.
Definition: cmac.h:45
Generic cipher context.
Definition: cipher.h:219
Cipher information.
Definition: cipher.h:187
unsigned char state[MBEDTLS_CIPHER_BLKSIZE_MAX]
Internal state of the CMAC algorithm.
Definition: cmac.h:48
Generic cipher wrapper.
unsigned char unprocessed_block[MBEDTLS_CIPHER_BLKSIZE_MAX]
Unprocessed data - either data that was not block aligned and is still pending to be processed...
Definition: cmac.h:52
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)
Output = Generic_CMAC( cmac key, input buffer )
size_t unprocessed_len
Length of data pending to be processed.
Definition: cmac.h:55
int mbedtls_cipher_cmac_finish(mbedtls_cipher_context_t *ctx, unsigned char *output)
Output CMAC.
int mbedtls_cipher_cmac_update(mbedtls_cipher_context_t *ctx, const unsigned char *input, size_t ilen)
Generic CMAC process buffer.