HAL_GCM_ALT ¶
MBEDTLS IMPLEMENTATION HAL GCM ALT FUNCTIONS ¶
- group MBEDTLS_IMPLEMENTATION_HAL_GCM_ALT_FUNCTIONS
-
Public API functions for HAL GCM alternate implementation.
Functions
-
void
mbedtls_gcm_init
(
mbedtls_gcm_context
*
ctx
)
¶
-
int
mbedtls_gcm_setkey
(
mbedtls_gcm_context
*
ctx
,
mbedtls_cipher_id_t
cipher
,
const
unsigned
char
*
key
,
unsigned
int
keybits
)
¶
-
int
mbedtls_gcm_starts
(
mbedtls_gcm_context
*
ctx
,
int
mode
,
const
unsigned
char
*
iv
,
size_t
iv_len
)
¶
-
int
mbedtls_gcm_update_ad
(
mbedtls_gcm_context
*
ctx
,
const
unsigned
char
*
add
,
size_t
add_len
)
¶
-
Details on the state variables in mbedtls_gcm_context.
mbedtls_gcm_context::bufcontains the partial state of the computation of the authentication tag.mbedtls_gcm_context::add_lenandmbedtls_gcm_context::lenindicate different stages of the computation:len == 0 && add_len == 0: Initial state.len == 0 && add_len % 16 != 0: The firstadd_len % 16bytes have a partial block of AD that has been xored in but not yet multiplied in.len == 0 && add_len % 16 == 0: The authentication tag is correct if the data ends now.len % 16 != 0: The firstlen % 16bytes have a partial block of ciphertext that has been xored in but not yet multiplied in.len > 0 && len % 16 == 0: The authentication tag is correct if the data ends now.
-
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
)
¶
-
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
)
¶
-
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
)
¶
-
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
)
¶
-
void
mbedtls_gcm_free
(
mbedtls_gcm_context
*
ctx
)
¶
-
void
mbedtls_gcm_init
(
mbedtls_gcm_context
*
ctx
)
¶
MBEDTLS IMPLEMENTATION HAL GCM TYPES ¶
- group MBEDTLS_IMPLEMENTATION_HAL_GCM_TYPES
-
This file contains GCM definitions and functions based on STM32 AES hardware crypto accelerator.
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 .
GCM context structure definitions for mbedTLS HAL.
-
struct
mbedtls_gcm_context
¶
-
#include <hal_gcm_alt.h>
AES context structure.
Public Members
-
unsigned
char
y
[
16
]
¶
-
The Y working value.
-
unsigned
char
buf
[
16
]
¶
-
The buf working value.
-
int
mode
¶
-
Mode : encrypt or decrypt
-
uint8_t
aes_key
[
32
]
¶
-
Encryption/Decryption key
-
size_t
aes_key_size
¶
-
Aes Key size
-
cmox_cipher_handle_t
*
cipher_ctx
¶
-
Cipher ctx
-
cmox_gcm_handle_t
gcm_ctx
¶
-
Gcm ctx
-
unsigned
char
y
[
16
]
¶
-
struct
mbedtls_gcm_context
¶