SemiDrive SSDK Appication Program Interface PTG3.0
hmac_sm3.h
Go to the documentation of this file.
1/*****************************************************************************
2 *
3 *
4 *Copyright (c) 2021-2029 Semidrive Incorporated. All rights reserved.
5 *Software License Agreement
6 *
7 ******************************************************************************
8 */
9#ifndef HMAC_SM3_H
10#define HMAC_SM3_H
11
12#include "hmac.h"
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
18#ifdef SUPPORT_HASH_SM3
19
20typedef hmac_ctx_t hmac_sm3_ctx_t;
21
22#ifdef HASH_DMA_FUNCTION
23typedef hmac_dma_ctx_t hmac_sm3_dma_ctx_t;
24#endif
25
26uint32_t hmac_sm3_init(hmac_sm3_ctx_t *ctx, uint8_t *key, uint16_t sp_key_idx,
27 uint32_t key_bytes);
28
29uint32_t hmac_sm3_update(hmac_sm3_ctx_t *ctx, const uint8_t *msg,
30 uint32_t msg_bytes);
31
32uint32_t hmac_sm3_final(hmac_sm3_ctx_t *ctx, uint8_t *mac);
33
34uint32_t hmac_sm3(uint8_t *key, uint16_t sp_key_idx, uint32_t key_bytes,
35 uint8_t *msg, uint32_t msg_bytes, uint8_t *mac);
36
37#ifdef HASH_DMA_FUNCTION
38uint32_t hmac_sm3_dma_init(hmac_sm3_dma_ctx_t *ctx, const uint8_t *key,
39 uint16_t sp_key_idx, uint32_t key_bytes,
40 HASH_CALLBACK callback);
41
42uint32_t hmac_sm3_dma_update_blocks(hmac_sm3_dma_ctx_t *ctx, uint32_t *msg,
43 uint32_t msg_words, uint32_t *tmp_iterator);
44
45uint32_t hmac_sm3_dma_final(hmac_sm3_dma_ctx_t *ctx, uint32_t *remainder_msg,
46 uint32_t remainder_bytes, uint32_t *tmp_iterator,
47 uint8_t *mac);
48
49uint32_t hmac_sm3_dma(uint8_t *key, uint16_t sp_key_idx, uint32_t key_bytes,
50 uint32_t *msg, uint32_t msg_bytes, uint32_t *tmp_iterator,
51 uint8_t *mac, HASH_CALLBACK callback);
52#endif
53
54#endif
55
56#ifdef __cplusplus
57}
58#endif
59
60#endif
void(* HASH_CALLBACK)(void)
Definition: hash_basic.h:195
Definition: hmac.h:23