#include <stddef.h>
#include <stdint.h>
#include "core/keys.h"
#include "core/crypt.h"
#include "core/utils.h"
Go to the source code of this file.
|
| MagmaResult | magma_mac (const unsigned char keys[ITER_KEYS_COUNT][ITER_KEY_LEN], const size_t mac_size, const unsigned char *input, unsigned char *mac, const size_t length) |
| | Processing data to produce a Message Authentication Code (MAC) using the specified keys.
|
| MagmaResult | magma_mac_verify (const unsigned char keys[ITER_KEYS_COUNT][ITER_KEY_LEN], const size_t mac_size, const unsigned char *input, const unsigned char *mac, const size_t length, int *result) |
| | Verifies a Message Authentication Code (MAC) in constant time.
|
| MagmaResult | calc_additional_keys (unsigned char K1_output[MAGMA_BLOCK_SIZE], unsigned char K2_output[MAGMA_BLOCK_SIZE], const unsigned char keys[ITER_KEYS_COUNT][ITER_KEY_LEN]) |
| | Calculates additional keys K1 and K2 used in the MAC generation process.
|
◆ calc_additional_keys()
| MagmaResult calc_additional_keys |
( |
unsigned char | K1_output[MAGMA_BLOCK_SIZE], |
|
|
unsigned char | K2_output[MAGMA_BLOCK_SIZE], |
|
|
const unsigned char | keys[ITER_KEYS_COUNT][ITER_KEY_LEN] ) |
Calculates additional keys K1 and K2 used in the MAC generation process.
- Note
- Using in function magma_mac
- Parameters
-
| K1_output | Pointer to the output buffer for K1. |
| K2_output | Pointer to the output buffer for K2. |
| keys | Expanded iteration keys. |
- Returns
- MAGMA_SUCCESS on success, error code otherwise.
◆ magma_mac()
| MagmaResult magma_mac |
( |
const unsigned char | keys[ITER_KEYS_COUNT][ITER_KEY_LEN], |
|
|
const size_t | mac_size, |
|
|
const unsigned char * | input, |
|
|
unsigned char * | mac, |
|
|
const size_t | length ) |
Processing data to produce a Message Authentication Code (MAC) using the specified keys.
- Parameters
-
| keys | Expanded iteration keys. |
| mac_size | Size of the MAC in bytes. |
| input | Pointer to the input data. |
| mac | Pointer to the output MAC. |
| length | Length of the input data in bytes. |
- Returns
- MAGMA_SUCCESS on success, error code otherwise.
◆ magma_mac_verify()
| MagmaResult magma_mac_verify |
( |
const unsigned char | keys[ITER_KEYS_COUNT][ITER_KEY_LEN], |
|
|
const size_t | mac_size, |
|
|
const unsigned char * | input, |
|
|
const unsigned char * | mac, |
|
|
const size_t | length, |
|
|
int * | result ) |
Verifies a Message Authentication Code (MAC) in constant time.
- Parameters
-
| keys | Expanded iteration keys. |
| mac_size | Size of the MAC in bytes. |
| input | Pointer to the input data. |
| mac | Pointer to the MAC to verify against. |
| length | Length of the input data in bytes. |
| result | Set to 1 if the MAC is valid, 0 otherwise. Only meaningful when MAGMA_SUCCESS is returned. |
- Returns
- MAGMA_SUCCESS on success, error code otherwise.