Embedded SDK
Embedded SDK
lcx_aes_siv.h
Go to the documentation of this file.
1 /* @BANNER@ */
2 
18 #if defined(HAVE_AES_SIV)
19 
20 #ifndef LCX_AES_SIV_H
21 #define LCX_AES_SIV_H
22 
23 #include "lcx_cipher.h"
24 
25 #define AES_SIV_MAX_KEY_LEN (32)
26 #define AES_SIV_KEY_NUMBER (2)
27 #define AES_SIV_TAG_LEN (16)
28 
33 typedef struct _cx_aes_siv_context {
34  uint8_t key1[AES_SIV_MAX_KEY_LEN];
35  uint8_t key2[AES_SIV_MAX_KEY_LEN];
36  size_t key_len;
37  uint8_t tag_state[CX_AES_BLOCK_SIZE];
38  cx_cipher_id_t cipher_type;
39  uint32_t mode;
41  *cipher_ctx;
42 
43 } cx_aes_siv_context_t;
44 
56 WARN_UNUSED_RESULT cx_err_t cx_aes_siv_init(cx_aes_siv_context_t *ctx);
57 
67 WARN_UNUSED_RESULT cx_err_t cx_aes_siv_reset(cx_aes_siv_context_t *ctx);
68 
85 WARN_UNUSED_RESULT cx_err_t cx_aes_siv_set_key(cx_aes_siv_context_t *ctx,
86  const uint8_t *key,
87  size_t key_bitlen);
88 
101 WARN_UNUSED_RESULT cx_err_t cx_aes_siv_start(cx_aes_siv_context_t *ctx,
102  uint32_t mode,
103  const uint8_t *iv,
104  size_t iv_len);
105 
114 WARN_UNUSED_RESULT cx_err_t cx_aes_siv_update_aad(cx_aes_siv_context_t *ctx,
115  const uint8_t *aad,
116  size_t aad_len);
117 
118 cx_err_t cx_aes_siv_update_mac(cx_aes_siv_context_t *ctx, const uint8_t *input, size_t in_len);
119 
130 WARN_UNUSED_RESULT cx_err_t cx_aes_siv_update(cx_aes_siv_context_t *ctx,
131  const uint8_t *input,
132  uint8_t *output,
133  size_t len);
134 
146 WARN_UNUSED_RESULT cx_err_t cx_aes_siv_finish(cx_aes_siv_context_t *ctx,
147  const uint8_t *input,
148  size_t in_len,
149  uint8_t *tag);
150 
165 WARN_UNUSED_RESULT cx_err_t cx_aes_siv_encrypt(cx_aes_siv_context_t *ctx,
166  const uint8_t *input,
167  size_t in_len,
168  const uint8_t *aad,
169  size_t aad_len,
170  uint8_t *output,
171  uint8_t *tag);
172 
187 WARN_UNUSED_RESULT cx_err_t cx_aes_siv_decrypt(cx_aes_siv_context_t *ctx,
188  const uint8_t *input,
189  size_t in_len,
190  const uint8_t *aad,
191  size_t aad_len,
192  uint8_t *output,
193  uint8_t *tag);
194 
195 #endif /* LCX_AES_SIV_H */
196 
197 #endif // HAVE_AES_SIV
API for block ciphers.
cx_cipher_id_t
Definition: lcx_cipher.h:36
unsigned char uint8_t
Definition: usbd_conf.h:53