# /space/home/slher/rel/Beken/v6_4_5/macsw/ip/umac/src/hsu/hsu.c File Reference

Hardware Security Unit helper functions. More...

`#include "rwnx_config.h"`
`#include "reg_hsu.h"`
`#include "me_mic.h"`
`#include "trace.h"`

Go to the source code of this file.

## Defines
#define | HSU_SUPPORT(m) (hsu_status & HSU_##m##_BIT)
| True if HSU support feature `m`, false otherwise.
#define | HSU_LOCK()
| Macro unused.
#define | HSU_UNLOCK()
| Macro unused.
#define | HSU_MODE(m) (hsu_mode(HSU_MODE_##m))
| HSU mode value for control register.
#define | HSU_SHA_MAX_LEN 512
| Maximum length in bytes for all input vectors.
## Enumerations
enum | hsu_modes { HSU_MODE_TKIP_MIC = 0, HSU_MODE_AES_128_CMAC = 1, HSU_MODE_IP_CHK = 2, HSU_MODE_SHA_1 = 3, HSU_MODE_SHA_256 = 4, HSU_MODE_SHA_224 = 5, HSU_MODE_HMAC_SHA1 = 6, HSU_MODE_HMAC_SHA256 = 7, HSU_MODE_HMAC_SHA224 = 8, HSU_MODE_SHA_512 = 9, HSU_MODE_SHA_384 = 10, HSU_MODE_HMAC_SHA512 = 11, HSU_MODE_HMAC_SHA384 = 12 }
| Operation modes supported by HSU.
## Functions
__INLINE uint32_t | hsu_mode (int mode)
void | hsu_init (void)
| Checks if HSU is available.
uint64_t | hsu_aes_cmac (uint32_t *key, int nb_elem, uint32_t addr[], int len[])
| Computes AES-CMAC on several vectors using HSU.
static bool | hsu_michael (uint32_t ctrl, struct mic_calc *mic_calc, uint32_t data, uint32_t data_len)
| Computes Michael MIC on the provided buffer using HSU.
bool | hsu_michael_init (struct mic_calc *mic_calc, uint32_t *mic_key, uint32_t *aad)
| Initializes TKIP MIC computation using HSU.
bool | hsu_michael_calc (struct mic_calc *mic_calc, uint32_t data, uint32_t data_len)
| Continues TKIP MIC computation using HSU.
bool | hsu_michael_end (struct mic_calc *mic_calc)
| Ends TKIP MIC computation using HSU.
bool | hsu_ip_checksum (uint32_t addr, uint16_t len, uint16_t *checksum)
| Computes the IP checksum on the buffer provided.
static bool | hsu_sha_x (uint32_t hsu_sha_mode, int nb_elem, const uint8_t *addr[], const size_t *len, int sha_size, uint32_t *sha)
| Generic function for SHA-X computation.
bool | hsu_sha1 (int nb_elem, const uint8_t *addr[], const size_t *len, uint32_t *sha)
| Computes the SHA1 on the buffers provided.
bool | hsu_sha224 (int nb_elem, const uint8_t *addr[], const size_t *len, uint32_t *sha)
| Computes the SHA224 on the buffers provided.
bool | hsu_sha256 (int nb_elem, const uint8_t *addr[], const size_t *len, uint32_t *sha)
| Computes the SHA256 on the buffers provided.
bool | hsu_sha384 (int nb_elem, const uint8_t *addr[], const size_t *len, uint32_t *sha)
| Computes the SHA384 on the buffers provided.
bool | hsu_sha512 (int nb_elem, const uint8_t *addr[], const size_t *len, uint32_t *sha)
| Computes the SHA512 on the buffers provided.
bool | hsu_hmac_sha_x (uint32_t hsu_hmac_mode, const uint8_t key[], const size_t key_len, int nb_elem, const uint8_t *addr[], const size_t *len, int mac_size, uint32_t *mac)
| Generic function for HMAC-SHA-X computation.
bool | hsu_hmac_sha1 (const uint8_t key[], const size_t key_len, int nb_elem, const uint8_t *addr[], const size_t *len, uint32_t *mac)
| Computes the HMAC-SHA1 on the buffers provided.
bool | hsu_hmac_sha224 (const uint8_t key[], const size_t key_len, int nb_elem, const uint8_t *addr[], const size_t *len, uint32_t *mac)
| Computes the HMAC-SHA224 on the buffers provided.
bool | hsu_hmac_sha256 (const uint8_t key[], const size_t key_len, int nb_elem, const uint8_t *addr[], const size_t *len, uint32_t *mac)
| Computes the HMAC-SHA256 on the buffers provided.
bool | hsu_hmac_sha384 (const uint8_t key[], const size_t key_len, int nb_elem, const uint8_t *addr[], const size_t *len, uint32_t *mac)
| Computes the HMAC-SHA384 on the buffers provided.
bool | hsu_hmac_sha512 (const uint8_t key[], const size_t key_len, int nb_elem, const uint8_t *addr[], const size_t *len, uint32_t *mac)
| Computes the HMAC-SHA512 on the buffers provided.
## Variables
static uint32_t | hsu_status = 0
| List features supported by HSU.
static uint8_t | hsu_sha_buf [HSU_SHA_MAX_LEN]
| Intermediate buffer to concatenate input vectors.

## Detailed Description

Hardware Security Unit helper functions.

Copyright (C) RivieraWaves 2017-2019

Definition in file hsu.c.