Go to the documentation of this file.
63 #if !defined(MBEDTLS_CONFIG_FILE)
66 #include MBEDTLS_CONFIG_FILE
73 #define MBEDTLS_GCM_ENCRYPT 1
74 #define MBEDTLS_GCM_DECRYPT 0
76 #define MBEDTLS_ERR_GCM_AUTH_FAILED -0x0012
79 #define MBEDTLS_ERR_GCM_HW_ACCEL_FAILED -0x0013
81 #define MBEDTLS_ERR_GCM_BAD_INPUT -0x0014
87 #if !defined(MBEDTLS_GCM_ALT)
143 const unsigned char *key,
144 unsigned int keybits );
200 const unsigned char *iv,
202 const unsigned char *add,
204 const unsigned char *input,
205 unsigned char *output,
207 unsigned char *tag );
244 const unsigned char *iv,
246 const unsigned char *add,
248 const unsigned char *tag,
250 const unsigned char *input,
251 unsigned char *output );
272 const unsigned char *iv,
274 const unsigned char *add,
304 const unsigned char *input,
305 unsigned char *output );
336 #if defined(MBEDTLS_SELF_TEST)
void mbedtls_gcm_init(mbedtls_gcm_context *ctx)
This function initializes the specified GCM context, to make references valid, and prepares the conte...
void mbedtls_gcm_free(mbedtls_gcm_context *ctx)
This function clears a GCM context and the underlying cipher sub-context.
mbedtls_cipher_id_t
Supported cipher types.
The GCM context structure.
int mbedtls_gcm_self_test(int verbose)
The GCM checkup routine.
int mbedtls_gcm_finish(mbedtls_gcm_context *ctx, unsigned char *tag, size_t tag_len)
This function finishes the GCM operation and generates the authentication tag.
This file contains an abstraction interface for use with the cipher primitives provided by the librar...
int mbedtls_gcm_starts(mbedtls_gcm_context *ctx, int mode, const unsigned char *iv, size_t iv_len, const unsigned char *add, size_t add_len)
This function starts a GCM encryption or decryption operation.
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(mbedtls_gcm_context *ctx, size_t length, const unsigned char *input, unsigned char *output)
This function feeds an input buffer into an ongoing GCM encryption or decryption operation.
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.
Configuration options (set of defines)
struct mbedtls_gcm_context mbedtls_gcm_context
The GCM context structure.
mbedtls_cipher_context_t cipher_ctx
unsigned char base_ectr[16]
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.