mbed TLS v1.3.11
ccm.h
Go to the documentation of this file.
1 
24 #ifndef POLARSSL_CCM_H
25 #define POLARSSL_CCM_H
26 
27 #include "cipher.h"
28 
29 #define POLARSSL_ERR_CCM_BAD_INPUT -0x000D
30 #define POLARSSL_ERR_CCM_AUTH_FAILED -0x000F
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
39 typedef struct {
41 }
43 
54 int ccm_init( ccm_context *ctx, cipher_id_t cipher,
55  const unsigned char *key, unsigned int keysize );
56 
62 void ccm_free( ccm_context *ctx );
63 
89 int ccm_encrypt_and_tag( ccm_context *ctx, size_t length,
90  const unsigned char *iv, size_t iv_len,
91  const unsigned char *add, size_t add_len,
92  const unsigned char *input, unsigned char *output,
93  unsigned char *tag, size_t tag_len );
94 
112 int ccm_auth_decrypt( ccm_context *ctx, size_t length,
113  const unsigned char *iv, size_t iv_len,
114  const unsigned char *add, size_t add_len,
115  const unsigned char *input, unsigned char *output,
116  const unsigned char *tag, size_t tag_len );
117 
118 #if defined(POLARSSL_SELF_TEST) && defined(POLARSSL_AES_C)
119 
124 int ccm_self_test( int verbose );
125 #endif /* POLARSSL_SELF_TEST && POLARSSL_AES_C */
126 
127 #ifdef __cplusplus
128 }
129 #endif
130 
131 #endif /* POLARSSL_CGM_H */
Generic cipher context.
Definition: cipher.h:267
int ccm_auth_decrypt(ccm_context *ctx, size_t length, const unsigned char *iv, size_t iv_len, const unsigned char *add, size_t add_len, const unsigned char *input, unsigned char *output, const unsigned char *tag, size_t tag_len)
CCM buffer authenticated decryption.
CCM context structure.
Definition: ccm.h:39
Generic cipher wrapper.
int ccm_init(ccm_context *ctx, cipher_id_t cipher, const unsigned char *key, unsigned int keysize)
CCM initialization (encryption and decryption)
int ccm_self_test(int verbose)
Checkup routine.
cipher_id_t
Definition: cipher.h:72
void ccm_free(ccm_context *ctx)
Free a CCM context and underlying cipher sub-context.
int ccm_encrypt_and_tag(ccm_context *ctx, size_t length, const unsigned char *iv, size_t iv_len, const unsigned char *add, size_t add_len, const unsigned char *input, unsigned char *output, unsigned char *tag, size_t tag_len)
CCM buffer encryption.
cipher_context_t cipher_ctx
Definition: ccm.h:40