Turnstone Operating System
Loading...
Searching...
No Matches
gcm.64.c File Reference

Galois/Counter Mode (GCM) implementation. More...

#include <gcm.h>
#include <aes.h>
#include <memory.h>

Macros

#define GET_UINT32_BE(n, b, i)
 
#define PUT_UINT32_BE(n, b, i)
 

Functions

 MODULE ("turnstone.lib.crypto")
 
int32_t gcm_initialize (void)
 
static void gcm_mult (gcm_context_t *ctx, const uint8_t x[16], uint8_t output[16])
 
int32_t gcm_setkey (gcm_context_t *ctx, const uint8_t *key, const uint32_t keysize)
 
int32_t gcm_start (gcm_context_t *ctx, int32_t mode, const uint8_t *iv, size_t iv_len, const uint8_t *add, size_t add_len)
 
int32_t gcm_update (gcm_context_t *ctx, size_t length, const uint8_t *input, uint8_t *output)
 
int32_t gcm_finish (gcm_context_t *ctx, uint8_t *tag, size_t tag_len)
 
int32_t gcm_crypt_and_tag (gcm_context_t *ctx, int32_t mode, const uint8_t *iv, size_t iv_len, const uint8_t *add, size_t add_len, const uint8_t *input, uint8_t *output, size_t length, uint8_t *tag, size_t tag_len)
 
int32_t gcm_auth_decrypt (gcm_context_t *ctx, const uint8_t *iv, size_t iv_len, const uint8_t *add, size_t add_len, const uint8_t *input, uint8_t *output, size_t length, const uint8_t *tag, size_t tag_len)
 
void gcm_zero_ctx (gcm_context_t *ctx)
 

Variables

static const uint64_t gcm_last4 [16]
 

Detailed Description

Galois/Counter Mode (GCM) implementation.

This work is licensed under TURNSTONE OS Public License. Please read and understand latest version of Licence.

Macro Definition Documentation

◆ GET_UINT32_BE

#define GET_UINT32_BE (   n,
  b,
 
)
Value:
{ \
(n) = ( (uint32_t) (b)[(i) ] << 24 ) \
| ( (uint32_t) (b)[(i) + 1] << 16 ) \
| ( (uint32_t) (b)[(i) + 2] << 8 ) \
| ( (uint32_t) (b)[(i) + 3] ); }
unsigned int uint32_t
Definition: types.h:38

◆ PUT_UINT32_BE

#define PUT_UINT32_BE (   n,
  b,
 
)
Value:
{ \
(b)[(i) ] = (uint8_t) ( (n) >> 24 ); \
(b)[(i) + 1] = (uint8_t) ( (n) >> 16 ); \
(b)[(i) + 2] = (uint8_t) ( (n) >> 8 ); \
(b)[(i) + 3] = (uint8_t) ( (n) ); }
unsigned char uint8_t
Definition: types.h:24

Variable Documentation

◆ gcm_last4

const uint64_t gcm_last4[16]
static
Initial value:
= {
0x0000, 0x1c20, 0x3840, 0x2460, 0x7080, 0x6ca0, 0x48c0, 0x54e0,
0xe100, 0xfd20, 0xd940, 0xc560, 0x9180, 0x8da0, 0xa9c0, 0xb5e0
}