diff options
author | thead_admin <occ_thead@service.alibaba.com> | 2023-01-04 13:12:02 +0800 |
---|---|---|
committer | thead_admin <occ_thead@service.alibaba.com> | 2023-01-04 13:12:02 +0800 |
commit | 02deb8b059118cd2b0fb3c8bbb6d73fd1f87115a (patch) | |
tree | 0392294a5f997b777b05c8373dd2fe062a751296 /lib/sec_library/include/sm3.h | |
parent | 0c8e009c3a52c6a29b00cf70d368d5c082639197 (diff) |
Linux_SDK_V1.0.3Linux_SDK_V1.0.3
Diffstat (limited to 'lib/sec_library/include/sm3.h')
-rw-r--r-- | lib/sec_library/include/sm3.h | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/lib/sec_library/include/sm3.h b/lib/sec_library/include/sm3.h index 9d5fc2c3..1f63f15e 100644 --- a/lib/sec_library/include/sm3.h +++ b/lib/sec_library/include/sm3.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2021 Alibaba Group Holding Limited + * Copyright (C) 2017-2020 Alibaba Group Holding Limited */ /****************************************************************************** @@ -14,17 +14,20 @@ #define _DRV_SM3_H_ #include <stdint.h> -#include <drv/common.h> -#include <drv/dma.h> +#include "common.h" #ifdef __cplusplus extern "C" { #endif +#define SM3_DATAIN_BLOCK_SIZE 64 +#define SM3_DIGEST_OUT_SIZE 32 + typedef struct { - uint32_t total[2]; ///< Number of bytes processed - uint32_t state[16]; ///< Intermediate digest state - uint8_t buffer[64]; ///< Data block beingprocessed + uint32_t total[2]; ///< Number of bytes processed + uint32_t state[16]; ///< Intermediate digest state + uint8_t buffer[SM3_DATAIN_BLOCK_SIZE]; ///< Data block beingprocessed + uint8_t result[SM3_DIGEST_OUT_SIZE]; ///< Data block has processed } csi_sm3_context_t; /****** SM3 State ******/ @@ -36,20 +39,21 @@ typedef struct { /****** SM3 Event ******/ typedef enum { - SM3_EVENT_COMPLETE = 0U, ///< Calculate completed - SM3_EVENT_ERROR ///< Calculate error + SM3_EVENT_COMPLETE = 0U, ///< Calculate completed + SM3_EVENT_UPDATE, + SM3_EVENT_START, + SM3_EVENT_ERROR ///< Calculate error } csi_sm3_event_t; typedef struct csi_sm3_t csi_sm3_t; struct csi_sm3_t { - csi_dev_t dev; ///< SM3 hw-device info - void (*callback)(csi_sm3_t *sm3, csi_sm3_event_t event, - void *arg); ///< SM3 event callback for user - void * arg; ///< SM3 custom designed param passed to evt_cb - csi_dma_ch_t * dma_in; ///< SM3 in dma handle param - csi_sm3_state_t state; ///< SM3 state - void * priv; + csi_dev_t dev; ///< SM3 hw-device info + void (*callback)(csi_sm3_t *sm3, csi_sm3_event_t event, + void *arg); ///< SM3 event callback for user + void * arg; ///< SM3 custom designed param passed to evt_cb + csi_sm3_state_t state; ///< SM3 state + void * priv; }; // Function documentation @@ -152,4 +156,4 @@ void csi_sm3_disable_pm(csi_sm3_t *sm3); extern "C" { #endif -#endif //_DRV_SM3_H +#endif //_DRV_SM3_H
\ No newline at end of file |