AES
AES utilities. More...
Modules |
|
Types | |
AES data types.
|
|
Functions |
|
void | gos_aes128_buffer_encrypt_init ( gos_aes128_crypt_context_t *aes_context, const uint8_t *key) |
Initialize AES-128 buffer encryption context.
More...
|
|
void | gos_aes128_buffer_decrypt_init ( gos_aes128_crypt_context_t *aes_context, uint8_t *iv, const uint8_t *key) |
Initialize AES-128 buffer decryption context.
More...
|
|
void | gos_aes128_buffer_encrypt ( gos_aes128_crypt_context_t *aes_context, uint8_t *buffer, uint16_t length) |
Encrypt buffer using AES-128 CBC.
More...
|
|
void | gos_aes128_buffer_decrypt ( gos_aes128_crypt_context_t *aes_context, uint8_t *buffer, uint16_t length) |
Decrypt AES-128 CBC encoded buffer.
More...
|
|
int | gos_aes_setkey_enc ( gos_aes_context_t *ctx, const unsigned char *key, uint32_t keysize_bits) |
AES key schedule (encryption)
More...
|
|
int | gos_aes_setkey_dec ( gos_aes_context_t *ctx, const unsigned char *key, uint32_t keysize_bits) |
AES key schedule (decryption)
More...
|
|
int | gos_aes_encrypt_ecb ( gos_aes_context_t *ctx, const unsigned char input[16], unsigned char output[16]) |
AES-ECB block encryption.
More...
|
|
int | gos_aes_decrypt_ecb ( gos_aes_context_t *ctx, const unsigned char input[16], unsigned char output[16]) |
AES-ECB block decryption.
More...
|
|
int | gos_aes_encrypt_cbc ( gos_aes_context_t *ctx, unsigned char iv[16], const gos_buffer_t *input, gos_buffer_t *output) |
AES-CBC buffer encryption.
More...
|
|
int | gos_aes_decrypt_cbc ( gos_aes_context_t *ctx, unsigned char iv[16], const gos_buffer_t *input, gos_buffer_t *output) |
AES-CBC buffer encryption.
More...
|
|
Detailed Description
AES utilities.
Function Documentation
◆ gos_aes128_buffer_decrypt()
void gos_aes128_buffer_decrypt | ( | gos_aes128_crypt_context_t * |
aes_context,
|
uint8_t * |
buffer,
|
||
uint16_t |
length
|
||
) |
Decrypt AES-128 CBC encoded buffer.
This is a helper API to perform AES-128 CBC decryption on the supplied buffer.
- Note
- gos_aes128_buffer_decrypt_init() must be called first to initialize the context.
This can be called multiple times using the same
aes_context
as the block counter is automatically incremented. If calling multiple times, the provided buffer length must be a multiple of 16 bytes.
For the last call of this API, the block length need NOT be a multiple of 16 bytes.
- Note
- The provided buffer is decrypted in-place
- This is a helper function only. The mBedTLS APIs may be directly used. Refer to Encrypt with AES
- Parameters
-
aes_context
gos_aes128_crypt_context_t pre-initialized context buffer
Buffer to decrypt in-place length
Length of buffer
◆ gos_aes128_buffer_decrypt_init()
void gos_aes128_buffer_decrypt_init | ( | gos_aes128_crypt_context_t * |
aes_context,
|
uint8_t * |
iv,
|
||
const uint8_t * |
key
|
||
) |
Initialize AES-128 buffer decryption context.
This is a helper API to enable AES-128 buffer decrpytion. This must be called before using gos_aes128_buffer_decrypt()
This effectively calls:
- Parameters
-
aes_context
gos_aes128_crypt_context_t context to initialize iv
IV of data to decrypt key
Decryption key
◆ gos_aes128_buffer_encrypt()
void gos_aes128_buffer_encrypt | ( | gos_aes128_crypt_context_t * |
aes_context,
|
uint8_t * |
buffer,
|
||
uint16_t |
length
|
||
) |
Encrypt buffer using AES-128 CBC.
This is a helper API to perform AES-128 CBC encryption on the supplied buffer.
- Note
- gos_aes128_buffer_encrypt_init() must be called first to initialize the context.
This can be called multiple times using the same
aes_context
as the block counter is automatically incremented. If calling multiple times, the provided buffer length must be a multiple of 16 bytes.
For the last call of this API, the block length need NOT be a multiple of 16 bytes.
- Note
- The provided buffer is encrypted in-place
- This is a helper function only. The mBedTLS APIs may be directly used. Refer to Encrypt with AES
- Parameters
-
aes_context
gos_aes128_crypt_context_t pre-initialized context buffer
Buffer to encrypt in-place length
Length of buffer
◆ gos_aes128_buffer_encrypt_init()
void gos_aes128_buffer_encrypt_init | ( | gos_aes128_crypt_context_t * |
aes_context,
|
const uint8_t * |
key
|
||
) |
Initialize AES-128 buffer encryption context.
This is a helper API to enable AES-128 buffer encrpytion. This must be called before using gos_aes128_buffer_encrypt()
This effectively calls:
- Parameters
-
aes_context
gos_aes128_crypt_context_t context to initialize key
Encryption key
◆ gos_aes_decrypt_cbc()
int gos_aes_decrypt_cbc | ( | gos_aes_context_t * |
ctx,
|
unsigned char |
iv[16],
|
||
const gos_buffer_t * |
input,
|
||
gos_buffer_t * |
output
|
||
) |
AES-CBC buffer encryption.
This effectively calls:
- Parameters
-
ctx
AES context iv
initialization vector (updated after use) input
buffer holding the input data output
buffer holding the output data
◆ gos_aes_decrypt_ecb()
int gos_aes_decrypt_ecb | ( | gos_aes_context_t * |
ctx,
|
const unsigned char |
input[16],
|
||
unsigned char |
output[16]
|
||
) |
AES-ECB block decryption.
This effectively calls:
- Parameters
-
ctx
AES context input
16-byte input block output
16-byte output block
◆ gos_aes_encrypt_cbc()
int gos_aes_encrypt_cbc | ( | gos_aes_context_t * |
ctx,
|
unsigned char |
iv[16],
|
||
const gos_buffer_t * |
input,
|
||
gos_buffer_t * |
output
|
||
) |
AES-CBC buffer encryption.
This effectively calls:
- Parameters
-
ctx
AES context iv
initialization vector (updated after use) input
buffer holding the input data output
buffer holding the output data
- Examples:
- file/file_encrypt/crypto_utils.c , and file/log_file_encrypted/crypto_utils.c .
◆ gos_aes_encrypt_ecb()
int gos_aes_encrypt_ecb | ( | gos_aes_context_t * |
ctx,
|
const unsigned char |
input[16],
|
||
unsigned char |
output[16]
|
||
) |
AES-ECB block encryption.
This effectively calls:
- Parameters
-
ctx
AES context input
16-byte input block output
16-byte output block
◆ gos_aes_setkey_dec()
int gos_aes_setkey_dec | ( | gos_aes_context_t * |
ctx,
|
const unsigned char * |
key,
|
||
uint32_t |
keysize_bits
|
||
) |
AES key schedule (decryption)
This effectively calls:
- Parameters
-
ctx
AES context to be initialized key
decryption key keysize_bits
must be 128, 192 or 256
◆ gos_aes_setkey_enc()
int gos_aes_setkey_enc | ( | gos_aes_context_t * |
ctx,
|
const unsigned char * |
key,
|
||
uint32_t |
keysize_bits
|
||
) |
AES key schedule (encryption)
This effectively calls:
- Parameters
-
ctx
AES context to be initialized key
encryption key keysize_bits
must be 128, 192 or 256