STCRYPTOLIB_GCM_ALT ¶
MBEDTLS IMPLEMENTATION STCRYPTOLIB GCM ALT FUNCTIONS ¶
- group MBEDTLS_IMPLEMENTATION_STCRYPTOLIB_GCM_ALT_FUNCTIONS
-
Public API functions for STCRYPTOLIB GCM alternate implementation.
NIST SP800-38D compliant GCM implementation
This file implements GCM based on STM32 crypto library.
Functions
-
void
mbedtls_gcm_init
(
mbedtls_gcm_context
*
ctx
)
-
Initialize a context.
-
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
)
-
mbedtls_gcm_context::buf contains the partial state of the computation of the authentication tag.
mbedtls_gcm_context::add_len and mbedtls_gcm_context::len indicate different stages of the computation:
len == 0 && add_len == 0: initial state
len == 0 && add_len % 16 != 0: the first
add_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 first
len % 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 STCRYPTOLIB GCM ALT TYPES ¶
- group MBEDTLS_IMPLEMENTATION_STCRYPTOLIB_GCM_ALT_TYPES
-
GCM context structure definitions for STCRYPTOLIB.
This file contains GCM definitions and functions based on STM32 crypto library.
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 .
-
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