mbed TLS v2.2.0
cmac_alt.h
Go to the documentation of this file.
1 
21 #ifndef MBEDTLS_CMAC_ALT_H
22 #define MBEDTLS_CMAC_ALT_H
23 
24 #if !defined(MBEDTLS_CONFIG_FILE)
25 #include "config.h"
26 #else
27 #include MBEDTLS_CONFIG_FILE
28 #endif
29 
30 /***************************************************************************/
35 /***************************************************************************/
48 #if defined( MBEDTLS_CMAC_ALT )
49 /* SiliconLabs CRYPTO hardware acceleration implementation */
50 
51 #include "aesdrv.h"
52 #include "sl_crypto.h"
53 #include "cipher.h"
54 #include <stddef.h>
55 
56 #define MBEDTLS_ERR_CMAC_BAD_INPUT ((int)MBEDTLS_ERR_CMAC_BASE | 0x01)
57 #define MBEDTLS_ERR_CMAC_AUTH_FAILED ((int)MBEDTLS_ERR_CMAC_BASE | 0x02)
58 
59 #ifdef __cplusplus
60 extern "C" {
61 #endif
62 
66 typedef struct
67 {
68  AESDRV_Context_t aesdrv_ctx;
69  unsigned int keybits;
70  uint32_t key[8];
71 }
72 mbedtls_cmac_context;
73 
81 void mbedtls_cmac_init( mbedtls_cmac_context *ctx );
82 
101 int mbedtls_cmac_set_device_instance(mbedtls_cmac_context* ctx,
102  unsigned int devno);
103 
121 int mbedtls_cmac_set_device_lock_wait_ticks(mbedtls_cmac_context *ctx,
122  int ticks);
123 
134 int mbedtls_cmac_setkey( mbedtls_cmac_context *ctx,
135  mbedtls_cipher_id_t cipher,
136  const unsigned char *key,
137  unsigned int keybits );
138 
144 void mbedtls_cmac_free( mbedtls_cmac_context *ctx );
145 
165 int mbedtls_cmac_generate_tag( mbedtls_cmac_context *ctx,
166  const unsigned char *data,
167  size_t data_len,
168  unsigned char *tag,
169  size_t tag_len );
170 
186 int mbedtls_cmac_verify_tag( mbedtls_cmac_context *ctx,
187  const unsigned char *data,
188  size_t data_len,
189  unsigned char *tag,
190  size_t tag_len );
191 
192 #if defined(MBEDTLS_SELF_TEST) && defined(MBEDTLS_CMAC_C)
193 
198  int mbedtls_cmac_self_test( int verbose, int device_instance );
199 #endif /* MBEDTLS_SELF_TEST && MBEDTLS_CMAC_C */
200 
201 #ifdef __cplusplus
202 }
203 #endif
204 
205 #endif /* #if defined( MBEDTLS_CMAC_ALT ) */
206 
210 #endif /* MBEDTLS_CMAC_ALT_H */
Compatibility names (set of defines)
Definitions for AES based ciphers with CRYPTO hw acceleration.
mbedtls_cipher_id_t
Definition: cipher.h:68
Generic cipher wrapper.
Silicon Labs specific mbedTLS defintitions.