mbed TLS v2.6.0
cmac.h
Go to the documentation of this file.
1 
26 #ifndef MBEDTLS_CMAC_H
27 #define MBEDTLS_CMAC_H
28 
29 #include "mbedtls/cipher.h"
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 #define MBEDTLS_AES_BLOCK_SIZE 16
36 #define MBEDTLS_DES3_BLOCK_SIZE 8
37 
38 #if defined(MBEDTLS_AES_C)
39 #define MBEDTLS_CIPHER_BLKSIZE_MAX 16 /* longest used by CMAC is AES */
40 #else
41 #define MBEDTLS_CIPHER_BLKSIZE_MAX 8 /* longest used by CMAC is 3DES */
42 #endif
43 
48 {
51 
55 
58 };
59 
77  const unsigned char *key, size_t keybits );
78 
94  const unsigned char *input, size_t ilen );
95 
109  unsigned char *output );
110 
122 
136 int mbedtls_cipher_cmac( const mbedtls_cipher_info_t *cipher_info,
137  const unsigned char *key, size_t keylen,
138  const unsigned char *input, size_t ilen,
139  unsigned char *output );
140 
141 #if defined(MBEDTLS_AES_C)
142 
154 int mbedtls_aes_cmac_prf_128( const unsigned char *key, size_t key_len,
155  const unsigned char *input, size_t in_len,
156  unsigned char output[16] );
157 #endif /* MBEDTLS_AES_C */
158 
159 #if defined(MBEDTLS_SELF_TEST) && ( defined(MBEDTLS_AES_C) || defined(MBEDTLS_DES_C) )
160 
165 int mbedtls_cmac_self_test( int verbose );
166 #endif /* MBEDTLS_SELF_TEST && ( MBEDTLS_AES_C || MBEDTLS_DES_C ) */
167 
168 #ifdef __cplusplus
169 }
170 #endif
171 
172 #endif /* MBEDTLS_CMAC_H */
#define MBEDTLS_CIPHER_BLKSIZE_MAX
Definition: cmac.h:41
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:47
Generic cipher context.
Definition: cipher.h:221
Cipher information.
Definition: cipher.h:189
unsigned char state[MBEDTLS_CIPHER_BLKSIZE_MAX]
Internal state of the CMAC algorithm.
Definition: cmac.h:50
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:54
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:57
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.