PolarSSL v1.3.9
ccm.h
Go to the documentation of this file.
1 
27 #ifndef POLARSSL_CCM_H
28 #define POLARSSL_CCM_H
29 
30 #include "cipher.h"
31 
32 #define POLARSSL_ERR_CCM_BAD_INPUT -0x000D
33 #define POLARSSL_ERR_CCM_AUTH_FAILED -0x000F
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
42 typedef struct {
44 }
46 
57 int ccm_init( ccm_context *ctx, cipher_id_t cipher,
58  const unsigned char *key, unsigned int keysize );
59 
65 void ccm_free( ccm_context *ctx );
66 
92 int ccm_encrypt_and_tag( ccm_context *ctx, size_t length,
93  const unsigned char *iv, size_t iv_len,
94  const unsigned char *add, size_t add_len,
95  const unsigned char *input, unsigned char *output,
96  unsigned char *tag, size_t tag_len );
97 
115 int ccm_auth_decrypt( ccm_context *ctx, size_t length,
116  const unsigned char *iv, size_t iv_len,
117  const unsigned char *add, size_t add_len,
118  const unsigned char *input, unsigned char *output,
119  const unsigned char *tag, size_t tag_len );
120 
121 #if defined(POLARSSL_SELF_TEST) && defined(POLARSSL_AES_C)
122 
127 int ccm_self_test( int verbose );
128 #endif /* POLARSSL_SELF_TEST && POLARSSL_AES_C */
129 
130 #ifdef __cplusplus
131 }
132 #endif
133 
134 #endif /* POLARSSL_CGM_H */