252#define UAPI_DRV_CIPHER_IV_LEN_IN_BYTES 16
334#define UAPI_DRV_CIPHER_HASH_RESULT_SIZE_MAX_IN_WORD 16
335#define UAPI_DRV_CIPHER_HASH_BLOCK_SIZE_MAX 128
891 uint8_t *prk, uint32_t *prk_length);
911 uint8_t *okm, uint32_t okm_length);
uint32_t errcode_t
Definition of error code.
Definition errcode.h:30
enum uapi_drv_cipher_buffer_secure uapi_drv_cipher_buffer_secure_t
缓冲区的安全属性选择
errcode_t uapi_drv_cipher_hash_update(uint32_t hash_handle, const uapi_drv_cipher_buf_attr_t *src_buf, const uint32_t len)
hash计算
Definition cipher.c:171
uapi_drv_cipher_symc_alg_t
对称加密算法类型
Definition cipher.h:51
enum uapi_drv_hash_type uapi_drv_cipher_hash_type_t
hash算法类型
errcode_t uapi_drv_cipher_symc_detach(uint32_t symc_handle, uint32_t keyslot_handle)
将key的句柄和加解密句柄解关联。
Definition cipher.c:73
errcode_t uapi_drv_cipher_symc_deinit(void)
对称加密去初始化。
Definition cipher.c:22
uapi_drv_cipher_symc_work_mode_t
对称加密算法工作模式
Definition cipher.h:70
struct uapi_drv_cipher_buf_attr uapi_drv_cipher_buf_attr_t
缓冲区的属性结构体
uapi_drv_cipher_buffer_secure
缓冲区的安全属性选择
Definition cipher.h:162
errcode_t uapi_drv_cipher_symc_encrypt(uint32_t symc_handle, const uapi_drv_cipher_buf_attr_t *src_buf, const uapi_drv_cipher_buf_attr_t *dst_buf, uint32_t length)
将源地址数据加密,输出到目的地址。
Definition cipher.c:79
#define UAPI_DRV_CIPHER_HASH_BLOCK_SIZE_MAX
Definition cipher.h:335
errcode_t uapi_drv_cipher_hash_get(uint32_t hash_handle, uapi_drv_cipher_hash_clone_ctx_t *hash_clone_ctx)
获取HASH计算中间结果。
Definition cipher.c:193
#define UAPI_DRV_CIPHER_IV_LEN_IN_BYTES
Definition cipher.h:252
uapi_drv_cipher_symc_key_length_t
对称加密密钥长度
Definition cipher.h:91
errcode_t uapi_drv_cipher_symc_attach(uint32_t symc_handle, uint32_t keyslot_handle)
将key的句柄关联到加解密句柄。
Definition cipher.c:67
errcode_t uapi_drv_cipher_symc_get_tag(uint32_t symc_handle, uint8_t *tag, uint32_t tag_length)
获取CCM或者GCM模式的标签值。
Definition cipher.c:95
uapi_drv_cipher_symc_iv_change_type_t
对称算法初始值标志
Definition cipher.h:137
errcode_t uapi_drv_cipher_mac_finish(uint32_t symc_handle, uint8_t *mac, uint32_t *mac_length)
计算mac值
Definition cipher.c:128
struct uapi_drv_hash_attr uapi_drv_cipher_hash_attr_t
hash通道及算法参数结构体
errcode_t uapi_drv_cipher_pbkdf2(const uapi_drv_cipher_kdf_pbkdf2_param_t *param, uint8_t *out, const uint32_t out_len)
PBKDF2算法派生秘钥。
Definition cipher.c:212
errcode_t uapi_drv_cipher_hash_destroy(uint32_t hash_handle)
销毁hash通道。
Definition cipher.c:205
uapi_drv_cipher_symc_key_parity_t
对称算法密钥奇偶性
Definition cipher.h:107
uapi_drv_cipher_symc_type_t
对称加密通道类型
Definition cipher.h:35
errcode_t uapi_drv_cipher_hkdf_extract(uapi_drv_cipher_hkdf_extract_t *extract_param, uint8_t *prk, uint32_t *prk_length)
提取密钥。
Definition cipher.c:222
errcode_t uapi_drv_cipher_symc_set_config(uint32_t symc_handle, const uapi_drv_cipher_symc_ctrl_t *symc_ctrl)
设置算法参数。
Definition cipher.c:55
errcode_t uapi_drv_cipher_symc_get_config(uint32_t symc_handle, const uapi_drv_cipher_symc_ctrl_t *symc_ctrl)
获取算法参数。
Definition cipher.c:61
errcode_t uapi_drv_cipher_mac_update(uint32_t symc_handle, const uapi_drv_cipher_buf_attr_t *src_buf, uint32_t length)
计算mac值
Definition cipher.c:122
errcode_t uapi_drv_cipher_symc_create(uint32_t *symc_handle, const uapi_drv_cipher_symc_attr_t *symc_attr)
创建symc通道,并设置symc通道属性参数。
Definition cipher.c:28
errcode_t uapi_drv_cipher_symc_decrypt(uint32_t symc_handle, const uapi_drv_cipher_buf_attr_t *src_buf, const uapi_drv_cipher_buf_attr_t *dst_buf, uint32_t length)
将源地址数据解密,输出到目的地址。
Definition cipher.c:87
errcode_t uapi_drv_cipher_hash_set(uint32_t hash_handle, const uapi_drv_cipher_hash_clone_ctx_t *hash_clone_ctx)
设置HASH计算中间结果。
Definition cipher.c:199
uapi_drv_cipher_symc_bit_width_t
对称算法密钥位宽
Definition cipher.h:121
errcode_t uapi_drv_cipher_symc_destroy(uint32_t symc_handle)
销毁symc通道。
Definition cipher.c:48
errcode_t uapi_drv_cipher_hash_finish(uint32_t hash_handle, uint8_t *out, uint32_t *out_len)
HASH计算获取摘要信息,并在计算成功的时候销毁hash句柄。
Definition cipher.c:182
errcode_t uapi_drv_cipher_hash_deinit(void)
Hash计算去初始化。
Definition cipher.c:143
uapi_drv_hash_type
hash算法类型
Definition cipher.h:176
#define UAPI_DRV_CIPHER_HASH_RESULT_SIZE_MAX_IN_WORD
Definition cipher.h:334
struct uapi_drv_cipher_hash_clone_ctx uapi_drv_cipher_hash_clone_ctx_t
hash计算中间结果结构体
errcode_t uapi_drv_cipher_symc_init(void)
对称加密初始化。
Definition cipher.c:16
errcode_t uapi_drv_cipher_hkdf(uapi_drv_cipher_hkdf_t *hkdf_param, uint8_t *okm, uint32_t okm_length)
HKDF,包括提取密钥和拓展密钥两步。
Definition cipher.c:240
errcode_t uapi_drv_cipher_hash_start(uint32_t *hash_handle, const uapi_drv_cipher_hash_attr_t *hash_attr)
创建hash通道,并设置hash通道及算法参数。
Definition cipher.c:149
errcode_t uapi_drv_cipher_mac_start(uint32_t *symc_handle, const uapi_drv_cipher_symc_mac_attr_t *mac_attr)
创建symc通道,并设置symc通道及算法参数。
Definition cipher.c:101
errcode_t uapi_drv_cipher_hash_init(void)
Hash计算初始化。
Definition cipher.c:137
errcode_t uapi_drv_cipher_hkdf_expand(const uapi_drv_cipher_hkdf_expand_t *expand_param, uint8_t *okm, uint32_t okm_length)
拓展密钥。
Definition cipher.c:231
@ UAPI_DRV_CIPHER_SYMC_ALG_DMA
Definition cipher.h:56
@ UAPI_DRV_CIPHER_SYMC_ALG_MAX
Definition cipher.h:57
@ UAPI_DRV_CIPHER_SYMC_ALG_TDES
Definition cipher.h:52
@ UAPI_DRV_CIPHER_SYMC_ALG_LEA
Definition cipher.h:55
@ UAPI_DRV_CIPHER_SYMC_ALG_AES
Definition cipher.h:53
@ UAPI_DRV_CIPHER_SYMC_ALG_SM4
Definition cipher.h:54
@ UAPI_DRV_CIPHER_SYMC_ALG_INVALID
Definition cipher.h:58
@ UAPI_DRV_CIPHER_SYMC_WORK_MODE_CBC
Definition cipher.h:72
@ UAPI_DRV_CIPHER_SYMC_WORK_MODE_CMAC
Definition cipher.h:79
@ UAPI_DRV_CIPHER_SYMC_WORK_MODE_CTR
Definition cipher.h:73
@ UAPI_DRV_CIPHER_SYMC_WORK_MODE_OFB
Definition cipher.h:74
@ UAPI_DRV_CIPHER_SYMC_WORK_MODE_CBC_MAC
Definition cipher.h:78
@ UAPI_DRV_CIPHER_SYMC_WORK_MODE_ECB
Definition cipher.h:71
@ UAPI_DRV_CIPHER_SYMC_WORK_MODE_GCM
Definition cipher.h:77
@ UAPI_DRV_CIPHER_SYMC_WORK_MODE_INVALID
Definition cipher.h:81
@ UAPI_DRV_CIPHER_SYMC_WORK_MODE_MAX
Definition cipher.h:80
@ UAPI_DRV_CIPHER_SYMC_WORK_MODE_CCM
Definition cipher.h:76
@ UAPI_DRV_CIPHER_SYMC_WORK_MODE_CFB
Definition cipher.h:75
@ UAPI_DRV_CIPHER_BUF_SECURE
Definition cipher.h:164
@ UAPI_DRV_CIPHER_BUF_NONSECURE
Definition cipher.h:163
@ UAPI_DRV_CIPHER_SYMC_KEY_256BIT
Definition cipher.h:95
@ UAPI_DRV_CIPHER_SYMC_KEY_128BIT
Definition cipher.h:93
@ UAPI_DRV_CIPHER_SYMC_KEY_LENGTH_MAX
Definition cipher.h:96
@ UAPI_DRV_CIPHER_SYMC_KEY_64BIT
Definition cipher.h:92
@ UAPI_DRV_CIPHER_SYMC_KEY_192BIT
Definition cipher.h:94
@ UAPI_DRV_CIPHER_SYMC_KEY_LENGTH_INVALID
Definition cipher.h:97
@ UAPI_DRV_CIPHER_SYMC_GCM_IV_CHANGE_UPDATE
Definition cipher.h:144
@ UAPI_DRV_CIPHER_SYMC_IV_CHANGE_ONE_PKG
Definition cipher.h:139
@ UAPI_DRV_CIPHER_SYMC_CCM_IV_CHANGE_START
Definition cipher.h:148
@ UAPI_DRV_CIPHER_SYMC_IV_DO_NOT_CHANGE
Definition cipher.h:138
@ UAPI_DRV_CIPHER_SYMC_IV_CHANGE_MAX
Definition cipher.h:151
@ UAPI_DRV_CIPHER_SYMC_CCM_IV_CHANGE_UPDATE
Definition cipher.h:149
@ UAPI_DRV_CIPHER_SYMC_GCM_IV_CHANGE_START
Definition cipher.h:143
@ UAPI_DRV_CIPHER_SYMC_CCM_IV_CHANGE_FINISH
Definition cipher.h:150
@ UAPI_DRV_CIPHER_SYMC_IV_CHANGE_ALL_PKG
Definition cipher.h:140
@ UAPI_DRV_CIPHER_SYMC_GCM_IV_CHANGE_FINISH
Definition cipher.h:145
@ UAPI_DRV_CIPHER_SYMC_GCM_IV_DO_NOT_CHANGE
Definition cipher.h:142
@ UAPI_DRV_CIPHER_SYMC_CCM_IV_DO_NOT_CHANGE
Definition cipher.h:147
@ UAPI_DRV_CIPHER_SYMC_IV_CHANGE_INVALID
Definition cipher.h:152
@ UAPI_DRV_CIPHER_SYMC_KEY_EVEN
Definition cipher.h:108
@ UAPI_DRV_CIPHER_SYMC_KEY_PARITY_MAX
Definition cipher.h:110
@ UAPI_DRV_CIPHER_SYMC_KEY_PARITY_INVALID
Definition cipher.h:111
@ UAPI_DRV_CIPHER_SYMC_KEY_ODD
Definition cipher.h:109
@ UAPI_DRV_CIPHER_SYMC_TYPE_NORMAL
Definition cipher.h:36
@ UAPI_DRV_CIPHER_SYMC_TYPE_MAX
Definition cipher.h:38
@ UAPI_DRV_CIPHER_SYMC_TYPE_INVALID
Definition cipher.h:39
@ UAPI_DRV_CIPHER_SYMC_TYPE_REG
Definition cipher.h:37
@ UAPI_DRV_CIPHER_SYMC_BIT_WIDTH_64BIT
Definition cipher.h:124
@ UAPI_DRV_CIPHER_SYMC_BIT_WIDTH_128BIT
Definition cipher.h:125
@ UAPI_DRV_CIPHER_SYMC_BIT_WIDTH_1BIT
Definition cipher.h:122
@ UAPI_DRV_CIPHER_SYMC_BIT_WIDTH_INVALID
Definition cipher.h:127
@ UAPI_DRV_CIPHER_SYMC_BIT_WIDTH_8BIT
Definition cipher.h:123
@ UAPI_DRV_CIPHER_SYMC_BIT_WIDTH_MAX
Definition cipher.h:126
@ UAPI_DRV_CIPHER_HASH_TYPE_SHA256
Definition cipher.h:179
@ UAPI_DRV_CIPHER_HASH_TYPE_SHA384
Definition cipher.h:180
@ UAPI_DRV_CIPHER_HASH_TYPE_SHA224
Definition cipher.h:178
@ UAPI_DRV_CIPHER_HASH_TYPE_HMAC_SHA384
Definition cipher.h:187
@ UAPI_DRV_CIPHER_HASH_TYPE_SHA512
Definition cipher.h:181
@ UAPI_DRV_CIPHER_HASH_TYPE_HMAC_SHA256
Definition cipher.h:186
@ UAPI_DRV_CIPHER_HASH_TYPE_INVALID
Definition cipher.h:191
@ UAPI_DRV_CIPHER_HASH_TYPE_HMAC_SHA512
Definition cipher.h:188
@ UAPI_DRV_CIPHER_HASH_TYPE_HMAC_SHA1
Definition cipher.h:184
@ UAPI_DRV_CIPHER_HASH_TYPE_SM3
Definition cipher.h:182
@ UAPI_DRV_CIPHER_HASH_TYPE_SHA1
Definition cipher.h:177
@ UAPI_DRV_CIPHER_HASH_TYPE_HMAC_SHA224
Definition cipher.h:185
@ UAPI_DRV_CIPHER_HASH_TYPE_HMAC_SM3
Definition cipher.h:189
unsigned long long uint64_t
Definition osal_types.h:35
缓冲区的属性结构体
Definition cipher.h:201
void * kapi_mem_handle
Definition cipher.h:206
void * virt_addr
Definition cipher.h:210
uintptr_t phys_addr
Definition cipher.h:208
uint64_t uapi_mem_handle
Definition cipher.h:202
uint64_t addr_offset
Definition cipher.h:204
uapi_drv_cipher_buffer_secure_t buf_sec
Definition cipher.h:212
hash计算中间结果结构体
Definition cipher.h:348
uint8_t i_key_pad[128]
Definition cipher.h:360
uint32_t tail_len
Definition cipher.h:353
uapi_drv_cipher_hash_type_t hash_type
Definition cipher.h:355
uint32_t state[16]
Definition cipher.h:351
uint8_t o_key_pad[128]
Definition cipher.h:357
uint32_t length[2]
Definition cipher.h:349
uint8_t tail[128]
Definition cipher.h:363
密钥拓展的参数结构体
Definition cipher.h:417
uint8_t * prk
Definition cipher.h:420
uapi_drv_cipher_hash_type_t hmac_type
Definition cipher.h:418
uint32_t info_length
Definition cipher.h:426
uint32_t prk_length
Definition cipher.h:422
uint8_t * info
Definition cipher.h:424
HKDF参数结构体
Definition cipher.h:437
uint8_t * info
Definition cipher.h:448
uint32_t info_length
Definition cipher.h:450
uint32_t salt_length
Definition cipher.h:442
uint8_t * ikm
Definition cipher.h:444
uapi_drv_cipher_hash_type_t hmac_type
Definition cipher.h:438
uint32_t ikm_length
Definition cipher.h:446
uint8_t * salt
Definition cipher.h:440
PBKDF2算法的参数结构体
Definition cipher.h:375
uint32_t slen
Definition cipher.h:384
uint8_t * password
Definition cipher.h:378
uapi_drv_cipher_hash_type_t hash_type
Definition cipher.h:376
uint8_t * salt
Definition cipher.h:382
uint16_t count
Definition cipher.h:386
uint32_t plen
Definition cipher.h:380
对称加密参数属性结构体
Definition cipher.h:223
uapi_drv_cipher_symc_work_mode_t work_mode
Definition cipher.h:226
uapi_drv_cipher_symc_type_t symc_type
Definition cipher.h:228
bool is_long_term
Definition cipher.h:230
uapi_drv_cipher_symc_alg_t symc_alg
Definition cipher.h:224
CCM和GCM工作模式的参数结构体
Definition cipher.h:241
uint32_t data_len
Definition cipher.h:246
uint32_t aad_len
Definition cipher.h:244
uapi_drv_cipher_buf_attr_t aad_buf
Definition cipher.h:242
uint32_t tag_len
Definition cipher.h:248
对称加密算法的参数
Definition cipher.h:261
uapi_drv_cipher_symc_iv_change_type_t iv_change_flag
Definition cipher.h:272
void * param
Definition cipher.h:278
uapi_drv_cipher_symc_key_parity_t key_parity
Definition cipher.h:268
uint32_t iv_length
Definition cipher.h:276
uapi_drv_cipher_symc_alg_t symc_alg
Definition cipher.h:262
uapi_drv_cipher_symc_work_mode_t work_mode
Definition cipher.h:264
uapi_drv_cipher_symc_key_length_t symc_key_length
Definition cipher.h:266
uapi_drv_cipher_symc_bit_width_t symc_bit_width
Definition cipher.h:270
Attribute structure of cbc_mac and cmac
Definition cipher.h:289
bool is_long_term
Definition cipher.h:290
uapi_drv_cipher_symc_alg_t symc_alg
Definition cipher.h:292
uapi_drv_cipher_symc_work_mode_t work_mode
Definition cipher.h:294
uapi_drv_cipher_symc_key_length_t symc_key_length
Definition cipher.h:296
uint32_t keyslot_chn
Definition cipher.h:298
hash通道及算法参数结构体
Definition cipher.h:309
bool is_keyslot
Definition cipher.h:327
uapi_drv_cipher_hash_type_t hash_type
Definition cipher.h:324
uint8_t * key
Definition cipher.h:310
uint32_t key_len
Definition cipher.h:315
uint32_t keyslot_handle
Definition cipher.h:321
bool is_long_term
Definition cipher.h:329
unsigned int uintptr_t
Definition td_type.h:65