PolarSSL v1.2.11
gcm.h
Go to the documentation of this file.
1 
27 #ifndef POLARSSL_GCM_H
28 #define POLARSSL_GCM_H
29 
30 #include "aes.h"
31 
32 #ifdef _MSC_VER
33 #include <basetsd.h>
34 typedef UINT64 uint64_t;
35 #else
36 #include <stdint.h>
37 #endif
38 
39 #define GCM_ENCRYPT 1
40 #define GCM_DECRYPT 0
41 
42 #define POLARSSL_ERR_GCM_AUTH_FAILED -0x0012
43 #define POLARSSL_ERR_GCM_BAD_INPUT -0x0014
48 typedef struct {
50  uint64_t HL[16];
51  uint64_t HH[16];
52 }
54 
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58 
68 int gcm_init( gcm_context *ctx, const unsigned char *key, unsigned int keysize );
69 
93  int mode,
94  size_t length,
95  const unsigned char *iv,
96  size_t iv_len,
97  const unsigned char *add,
98  size_t add_len,
99  const unsigned char *input,
100  unsigned char *output,
101  size_t tag_len,
102  unsigned char *tag );
103 
125 int gcm_auth_decrypt( gcm_context *ctx,
126  size_t length,
127  const unsigned char *iv,
128  size_t iv_len,
129  const unsigned char *add,
130  size_t add_len,
131  const unsigned char *tag,
132  size_t tag_len,
133  const unsigned char *input,
134  unsigned char *output );
135 
141 int gcm_self_test( int verbose );
142 
143 #ifdef __cplusplus
144 }
145 #endif
146 
147 #endif /* gcm.h */
int gcm_auth_decrypt(gcm_context *ctx, size_t length, const unsigned char *iv, size_t iv_len, const unsigned char *add, size_t add_len, const unsigned char *tag, size_t tag_len, const unsigned char *input, unsigned char *output)
GCM buffer authenticated decryption using AES.
AES context structure.
Definition: aes.h:54
int gcm_self_test(int verbose)
Checkup routine.
int gcm_crypt_and_tag(gcm_context *ctx, int mode, 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, size_t tag_len, unsigned char *tag)
GCM buffer encryption/decryption using AES.
AES block cipher.
GCM context structure.
Definition: gcm.h:48
aes_context aes_ctx
Definition: gcm.h:49
int gcm_init(gcm_context *ctx, const unsigned char *key, unsigned int keysize)
GCM initialization (encryption)