Mbed OS Reference
Loading...
Searching...
No Matches
gcm.h File Reference

This file contains GCM definitions and functions. More...

#include "mbedtls/config.h"
#include "mbedtls/cipher.h"
#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  mbedtls_gcm_context
 The GCM context structure. More...
 

Macros

#define MBEDTLS_GCM_ENCRYPT   1
 Encrypt operation. More...
 
#define MBEDTLS_GCM_DECRYPT   0
 Decrypt operation. More...
 
#define MBEDTLS_ERR_GCM_AUTH_FAILED   -0x0012
 Authenticated decryption failed. More...
 
#define MBEDTLS_ERR_GCM_HW_ACCEL_FAILED   -0x0013
 GCM hardware accelerator failed. More...
 
#define MBEDTLS_ERR_GCM_BAD_INPUT   -0x0014
 Bad input parameters to function. More...
 

Typedefs

typedef struct mbedtls_gcm_context mbedtls_gcm_context
 The GCM context structure. More...
 

Functions

void mbedtls_gcm_init (mbedtls_gcm_context *ctx)
 This function initializes the specified GCM context, to make references valid, and prepares the context for mbedtls_gcm_setkey() or mbedtls_gcm_free(). More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
void mbedtls_gcm_free (mbedtls_gcm_context *ctx)
 This function clears a GCM context and the underlying cipher sub-context. More...
 

Detailed Description

This file contains GCM definitions and functions.

The Galois/Counter Mode (GCM) for 128-bit block ciphers is defined in D. McGrew, J. Viega, The Galois/Counter Mode of Operation (GCM), Natl. Inst. Stand. Technol.

For more information on GCM, see NIST SP 800-38D: Recommendation for Block Cipher Modes of Operation: Galois/Counter Mode (GCM) and GMAC.

Definition in file gcm.h.