29#define MBEDTLS_GCM_ENCRYPT 1
30#define MBEDTLS_GCM_DECRYPT 0
33#define MBEDTLS_ERR_GCM_AUTH_FAILED -0x0012
35#define MBEDTLS_ERR_GCM_BAD_INPUT -0x0014
37#define MBEDTLS_ERR_GCM_BUFFER_TOO_SMALL -0x0016
43#if !defined(MBEDTLS_GCM_ALT)
98 const unsigned char *key,
99 unsigned int keybits);
155 const unsigned char *iv,
157 const unsigned char *add,
159 const unsigned char *input,
160 unsigned char *output,
199 const unsigned char *iv,
201 const unsigned char *add,
203 const unsigned char *tag,
205 const unsigned char *input,
206 unsigned char *output);
223 const unsigned char *iv,
247 const unsigned char *add,
302 const unsigned char *input,
size_t input_length,
303 unsigned char *output,
size_t output_size,
304 size_t *output_length);
340 unsigned char *output,
size_t output_size,
341 size_t *output_length,
342 unsigned char *tag,
size_t tag_len);
353#if defined(MBEDTLS_SELF_TEST)
This file contains an abstraction interface for use with the cipher primitives provided by the librar...
mbedtls_cipher_id_t
Supported cipher types.
int mbedtls_gcm_update(mbedtls_gcm_context *ctx, const unsigned char *input, size_t input_length, unsigned char *output, size_t output_size, size_t *output_length)
This function feeds an input buffer into an ongoing GCM encryption or decryption operation.
int mbedtls_gcm_finish(mbedtls_gcm_context *ctx, unsigned char *output, size_t output_size, size_t *output_length, unsigned char *tag, size_t tag_len)
This function finishes the GCM operation and generates the authentication tag.
int mbedtls_gcm_crypt_and_tag(mbedtls_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)
This function performs GCM encryption or decryption of a buffer.
int mbedtls_gcm_update_ad(mbedtls_gcm_context *ctx, const unsigned char *add, size_t add_len)
This function feeds an input buffer as associated data (authenticated but not encrypted data) in a GC...
int mbedtls_gcm_starts(mbedtls_gcm_context *ctx, int mode, const unsigned char *iv, size_t iv_len)
This function starts a GCM encryption or decryption operation.
void mbedtls_gcm_init(mbedtls_gcm_context *ctx)
This function initializes the specified GCM context, to make references valid, and prepares the conte...
int mbedtls_gcm_setkey(mbedtls_gcm_context *ctx, mbedtls_cipher_id_t cipher, const unsigned char *key, unsigned int keybits)
This function associates a GCM context with a cipher algorithm and a key.
int mbedtls_gcm_self_test(int verbose)
The GCM checkup routine.
void mbedtls_gcm_free(mbedtls_gcm_context *ctx)
This function clears a GCM context and the underlying cipher sub-context.
int mbedtls_gcm_auth_decrypt(mbedtls_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)
This function performs a GCM authenticated decryption of a buffer.
Build-time configuration info.
Macro wrapper for struct's members.
#define MBEDTLS_PRIVATE(member)
The GCM context structure.