WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
载入中...
搜索中...
未找到
PKE

结构体

struct  uapi_drv_cipher_pke_data_t
 PKE通用数据结构体 更多...
 
struct  uapi_drv_cipher_pke_ecc_point_t
 ECC公钥结构体 更多...
 
struct  uapi_drv_cipher_pke_ecc_sig_t
 ECC签名结构体 更多...
 
struct  uapi_drv_cipher_pke_msg_t
 ECC输入消息结构体 更多...
 
struct  uapi_drv_cipher_pke_rsa_priv_key_t
 RSA私钥结构体 更多...
 
struct  uapi_drv_cipher_pke_rsa_pub_key_t
 RSA公钥结构体。 更多...
 

枚举

enum  uapi_drv_cipher_pke_ecc_curve_type_t {
  UAPI_DRV_CIPHER_PKE_ECC_TYPE_RFC5639_P256 = 0 , UAPI_DRV_CIPHER_PKE_ECC_TYPE_RFC5639_P384 , UAPI_DRV_CIPHER_PKE_ECC_TYPE_RFC5639_P512 , UAPI_DRV_CIPHER_PKE_ECC_TYPE_FIPS_P256K ,
  UAPI_DRV_CIPHER_PKE_ECC_TYPE_FIPS_P192R , UAPI_DRV_CIPHER_PKE_ECC_TYPE_FIPS_P224R , UAPI_DRV_CIPHER_PKE_ECC_TYPE_FIPS_P256R , UAPI_DRV_CIPHER_PKE_ECC_TYPE_FIPS_P384R ,
  UAPI_DRV_CIPHER_PKE_ECC_TYPE_FIPS_P521R , UAPI_DRV_CIPHER_PKE_ECC_TYPE_RFC7748 , UAPI_DRV_CIPHER_PKE_ECC_TYPE_RFC7748_448 , UAPI_DRV_CIPHER_PKE_ECC_TYPE_RFC8032 ,
  UAPI_DRV_CIPHER_PKE_ECC_TYPE_SM2 , UAPI_DRV_CIPHER_PKE_ECC_TYPE_MAX , UAPI_DRV_CIPHER_PKE_ECC_TYPE_INVALID = 0xffffffff
}
 ECC曲线类型 更多...
 
enum  uapi_drv_cipher_pke_rsa_scheme_t { UAPI_DRV_CIPHER_PKE_RSA_SCHEME_PKCS1_V15 = 0x00 , UAPI_DRV_CIPHER_PKE_RSA_SCHEME_PKCS1_V21 , UAPI_DRV_CIPHER_PKE_RSA_SCHEME_MAX , UAPI_DRV_CIPHER_PKE_RSA_SCHEME_INVALID = 0xffffffff }
 RSA算法填充方式 更多...
 
enum  uapi_drv_cipher_pke_hash_type_t {
  UAPI_DRV_CIPHER_PKE_HASH_TYPE_SHA1 = 0x00 , UAPI_DRV_CIPHER_PKE_HASH_TYPE_SHA224 , UAPI_DRV_CIPHER_PKE_HASH_TYPE_SHA256 , UAPI_DRV_CIPHER_PKE_HASH_TYPE_SHA384 ,
  UAPI_DRV_CIPHER_PKE_HASH_TYPE_SHA512 , UAPI_DRV_CIPHER_PKE_HASH_TYPE_SM3 , UAPI_DRV_CIPHER_PKE_HASH_TYPE_MAX , UAPI_DRV_CIPHER_PKE_HASH_TYPE_INVALID = 0xffffffff
}
 RSA填充使用的hash算法类型 更多...
 
enum  uapi_drv_cipher_pke_buffer_secure_t { UAPI_DRV_CIPHER_PKE_BUF_NONSECURE = 0x00 , UAPI_DRV_CIPHER_PKE_BUF_SECURE , UAPI_DRV_CIPHER_PKE_BUF_INVALID = 0xffffffff }
 RSA输入消息的缓冲区安全属性 更多...
 

函数

errcode_t uapi_drv_cipher_pke_ecc_gen_key (uapi_drv_cipher_pke_ecc_curve_type_t curve_type, const uapi_drv_cipher_pke_data_t *input_priv_key, const uapi_drv_cipher_pke_data_t *output_priv_key, const uapi_drv_cipher_pke_ecc_point_t *output_pub_key)
 生成ECC秘钥对。
 
errcode_t uapi_drv_cipher_pke_ecdsa_sign (uapi_drv_cipher_pke_ecc_curve_type_t curve_type, const uapi_drv_cipher_pke_data_t *priv_key, const uapi_drv_cipher_pke_data_t *hash, const uapi_drv_cipher_pke_ecc_sig_t *sig)
 椭圆曲线数字签名。
 
errcode_t uapi_drv_cipher_pke_ecdsa_verify (uapi_drv_cipher_pke_ecc_curve_type_t curve_type, const uapi_drv_cipher_pke_ecc_point_t *pub_key, const uapi_drv_cipher_pke_data_t *hash, const uapi_drv_cipher_pke_ecc_sig_t *sig)
 椭圆曲线数字ECC验签。
 
errcode_t uapi_drv_cipher_pke_eddsa_sign (uapi_drv_cipher_pke_ecc_curve_type_t curve_type, const uapi_drv_cipher_pke_data_t *priv_key, const uapi_drv_cipher_pke_msg_t *msg, const uapi_drv_cipher_pke_ecc_sig_t *sig)
 爱德华兹曲线数字签名。
 
errcode_t uapi_drv_cipher_pke_eddsa_verify (uapi_drv_cipher_pke_ecc_curve_type_t curve_type, const uapi_drv_cipher_pke_ecc_point_t *pub_key, const uapi_drv_cipher_pke_msg_t *msg, const uapi_drv_cipher_pke_ecc_sig_t *sig)
 爱德华兹曲线数字验签。
 
errcode_t uapi_drv_cipher_pke_ecc_gen_ecdh_key (uapi_drv_cipher_pke_ecc_curve_type_t curve_type, const uapi_drv_cipher_pke_ecc_point_t *input_pub_key, const uapi_drv_cipher_pke_data_t *input_priv_key, const uapi_drv_cipher_pke_data_t *output_shared_key)
 椭圆曲线迪菲-赫尔曼秘钥协商。
 
errcode_t uapi_drv_cipher_pke_check_dot_on_curve (uapi_drv_cipher_pke_ecc_curve_type_t curve_type, const uapi_drv_cipher_pke_ecc_point_t *pub_key, bool *is_on_curve)
 检查点是否在椭圆曲线上。
 
errcode_t uapi_drv_cipher_pke_sm2_dsa_hash (const uapi_drv_cipher_pke_data_t *sm2_id, const uapi_drv_cipher_pke_ecc_point_t *pub_key, const uapi_drv_cipher_pke_msg_t *msg, uapi_drv_cipher_pke_data_t *hash)
 SM2杂凑的SM3摘要计算。
 
errcode_t uapi_drv_cipher_pke_sm2_public_encrypt (const uapi_drv_cipher_pke_ecc_point_t *pub_key, const uapi_drv_cipher_pke_data_t *plain_text, const uapi_drv_cipher_pke_data_t *cipher_text)
 SM2公钥加密。
 
errcode_t uapi_drv_cipher_pke_sm2_private_decrypt (const uapi_drv_cipher_pke_data_t *priv_key, const uapi_drv_cipher_pke_data_t *cipher_text, const uapi_drv_cipher_pke_data_t *plain_text)
 SM2私钥解密。
 
errcode_t uapi_drv_cipher_pke_rsa_sign (const uapi_drv_cipher_pke_rsa_priv_key_t *priv_key, uapi_drv_cipher_pke_rsa_scheme_t scheme, uapi_drv_cipher_pke_hash_type_t hash_type, const uapi_drv_cipher_pke_data_t *input_hash, uapi_drv_cipher_pke_data_t *sign)
 RSA签名。
 
errcode_t uapi_drv_cipher_pke_rsa_verify (const uapi_drv_cipher_pke_rsa_pub_key_t *pub_key, uapi_drv_cipher_pke_rsa_scheme_t scheme, uapi_drv_cipher_pke_hash_type_t hash_type, uapi_drv_cipher_pke_data_t *input_hash, const uapi_drv_cipher_pke_data_t *sig)
 RSA验签。
 
errcode_t uapi_drv_cipher_pke_rsa_public_encrypt (uapi_drv_cipher_pke_rsa_scheme_t scheme, uapi_drv_cipher_pke_hash_type_t hash_type, const uapi_drv_cipher_pke_rsa_pub_key_t *pub_key, const uapi_drv_cipher_pke_data_t *input, const uapi_drv_cipher_pke_data_t *label, uapi_drv_cipher_pke_data_t *output)
 RSA公钥加密。
 
errcode_t uapi_drv_cipher_pke_rsa_private_decrypt (uapi_drv_cipher_pke_rsa_scheme_t scheme, uapi_drv_cipher_pke_hash_type_t hash_type, const uapi_drv_cipher_pke_rsa_priv_key_t *priv_key, const uapi_drv_cipher_pke_data_t *input, const uapi_drv_cipher_pke_data_t *label, const uapi_drv_cipher_pke_data_t *output)
 RSA私钥解密。
 
errcode_t uapi_drv_cipher_pke_dh_gen_key (const uapi_drv_cipher_pke_data_t *g_data, const uapi_drv_cipher_pke_data_t *mod_n, const uapi_drv_cipher_pke_data_t *input_priv_key, const uapi_drv_cipher_pke_data_t *output_priv_key, const uapi_drv_cipher_pke_data_t *output_pub_key)
 DH 公私钥对生成或由私钥生成公钥。
 
errcode_t uapi_drv_cipher_pke_dh_compute_key (const uapi_drv_cipher_pke_data_t *mod_n, const uapi_drv_cipher_pke_data_t *input_priv_key, const uapi_drv_cipher_pke_data_t *input_pub_key, const uapi_drv_cipher_pke_data_t *output_shared_key)
 DH 密钥协商算法。
 
errcode_t uapi_drv_cipher_pke_add_mod (const uapi_drv_cipher_pke_data_t *a, const uapi_drv_cipher_pke_data_t *b, const uapi_drv_cipher_pke_data_t *p, const uapi_drv_cipher_pke_data_t *c)
 模加 c = (a + b) mod p。
 
errcode_t uapi_drv_cipher_pke_sub_mod (const uapi_drv_cipher_pke_data_t *a, const uapi_drv_cipher_pke_data_t *b, const uapi_drv_cipher_pke_data_t *p, const uapi_drv_cipher_pke_data_t *c)
 模减 c = (a - b) mod p。
 
errcode_t uapi_drv_cipher_pke_mul_mod (const uapi_drv_cipher_pke_data_t *a, const uapi_drv_cipher_pke_data_t *b, const uapi_drv_cipher_pke_data_t *p, const uapi_drv_cipher_pke_data_t *c)
 模乘 c = (a * b) mod p。
 
errcode_t uapi_drv_cipher_pke_inv_mod (const uapi_drv_cipher_pke_data_t *a, const uapi_drv_cipher_pke_data_t *p, const uapi_drv_cipher_pke_data_t *c)
 模逆 c = (a^-1) mod p。
 
errcode_t uapi_drv_cipher_pke_mod (const uapi_drv_cipher_pke_data_t *a, const uapi_drv_cipher_pke_data_t *p, const uapi_drv_cipher_pke_data_t *c)
 取模运算 c = a mod p。
 
errcode_t uapi_drv_cipher_pke_mul (const uapi_drv_cipher_pke_data_t *a, const uapi_drv_cipher_pke_data_t *b, const uapi_drv_cipher_pke_data_t *c)
 大数乘 c = a * b。
 
errcode_t uapi_drv_cipher_pke_exp_mod (const uapi_drv_cipher_pke_data_t *n, const uapi_drv_cipher_pke_data_t *k, const uapi_drv_cipher_pke_data_t *in, const uapi_drv_cipher_pke_data_t *out)
 模幂 out = (in ^ k) mod n。
 

详细描述

Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved.

Description: Provides pke driver header
History:
2023-03-14, Create file.

枚举类型说明

◆ uapi_drv_cipher_pke_buffer_secure_t

RSA输入消息的缓冲区安全属性

枚举值
UAPI_DRV_CIPHER_PKE_BUF_NONSECURE 
UAPI_DRV_CIPHER_PKE_BUF_SECURE 
UAPI_DRV_CIPHER_PKE_BUF_INVALID 

◆ uapi_drv_cipher_pke_ecc_curve_type_t

ECC曲线类型

枚举值
UAPI_DRV_CIPHER_PKE_ECC_TYPE_RFC5639_P256 
UAPI_DRV_CIPHER_PKE_ECC_TYPE_RFC5639_P384 
UAPI_DRV_CIPHER_PKE_ECC_TYPE_RFC5639_P512 
UAPI_DRV_CIPHER_PKE_ECC_TYPE_FIPS_P256K 
UAPI_DRV_CIPHER_PKE_ECC_TYPE_FIPS_P192R 
UAPI_DRV_CIPHER_PKE_ECC_TYPE_FIPS_P224R 
UAPI_DRV_CIPHER_PKE_ECC_TYPE_FIPS_P256R 
UAPI_DRV_CIPHER_PKE_ECC_TYPE_FIPS_P384R 
UAPI_DRV_CIPHER_PKE_ECC_TYPE_FIPS_P521R 
UAPI_DRV_CIPHER_PKE_ECC_TYPE_RFC7748 
UAPI_DRV_CIPHER_PKE_ECC_TYPE_RFC7748_448 
UAPI_DRV_CIPHER_PKE_ECC_TYPE_RFC8032 
UAPI_DRV_CIPHER_PKE_ECC_TYPE_SM2 
UAPI_DRV_CIPHER_PKE_ECC_TYPE_MAX 
UAPI_DRV_CIPHER_PKE_ECC_TYPE_INVALID 

◆ uapi_drv_cipher_pke_hash_type_t

RSA填充使用的hash算法类型

枚举值
UAPI_DRV_CIPHER_PKE_HASH_TYPE_SHA1 
UAPI_DRV_CIPHER_PKE_HASH_TYPE_SHA224 
UAPI_DRV_CIPHER_PKE_HASH_TYPE_SHA256 
UAPI_DRV_CIPHER_PKE_HASH_TYPE_SHA384 
UAPI_DRV_CIPHER_PKE_HASH_TYPE_SHA512 
UAPI_DRV_CIPHER_PKE_HASH_TYPE_SM3 
UAPI_DRV_CIPHER_PKE_HASH_TYPE_MAX 
UAPI_DRV_CIPHER_PKE_HASH_TYPE_INVALID 

◆ uapi_drv_cipher_pke_rsa_scheme_t

RSA算法填充方式

枚举值
UAPI_DRV_CIPHER_PKE_RSA_SCHEME_PKCS1_V15 
UAPI_DRV_CIPHER_PKE_RSA_SCHEME_PKCS1_V21 
UAPI_DRV_CIPHER_PKE_RSA_SCHEME_MAX 
UAPI_DRV_CIPHER_PKE_RSA_SCHEME_INVALID 

函数说明

◆ uapi_drv_cipher_pke_add_mod()

errcode_t uapi_drv_cipher_pke_add_mod ( const uapi_drv_cipher_pke_data_t a,
const uapi_drv_cipher_pke_data_t b,
const uapi_drv_cipher_pke_data_t p,
const uapi_drv_cipher_pke_data_t c 
)

模加 c = (a + b) mod p。

◆ uapi_drv_cipher_pke_check_dot_on_curve()

errcode_t uapi_drv_cipher_pke_check_dot_on_curve ( uapi_drv_cipher_pke_ecc_curve_type_t  curve_type,
const uapi_drv_cipher_pke_ecc_point_t pub_key,
bool *  is_on_curve 
)

检查点是否在椭圆曲线上。

◆ uapi_drv_cipher_pke_dh_compute_key()

errcode_t uapi_drv_cipher_pke_dh_compute_key ( const uapi_drv_cipher_pke_data_t mod_n,
const uapi_drv_cipher_pke_data_t input_priv_key,
const uapi_drv_cipher_pke_data_t input_pub_key,
const uapi_drv_cipher_pke_data_t output_shared_key 
)

DH 密钥协商算法。

◆ uapi_drv_cipher_pke_dh_gen_key()

errcode_t uapi_drv_cipher_pke_dh_gen_key ( const uapi_drv_cipher_pke_data_t g_data,
const uapi_drv_cipher_pke_data_t mod_n,
const uapi_drv_cipher_pke_data_t input_priv_key,
const uapi_drv_cipher_pke_data_t output_priv_key,
const uapi_drv_cipher_pke_data_t output_pub_key 
)

DH 公私钥对生成或由私钥生成公钥。

◆ uapi_drv_cipher_pke_ecc_gen_ecdh_key()

errcode_t uapi_drv_cipher_pke_ecc_gen_ecdh_key ( uapi_drv_cipher_pke_ecc_curve_type_t  curve_type,
const uapi_drv_cipher_pke_ecc_point_t input_pub_key,
const uapi_drv_cipher_pke_data_t input_priv_key,
const uapi_drv_cipher_pke_data_t output_shared_key 
)

椭圆曲线迪菲-赫尔曼秘钥协商。

◆ uapi_drv_cipher_pke_ecc_gen_key()

errcode_t uapi_drv_cipher_pke_ecc_gen_key ( uapi_drv_cipher_pke_ecc_curve_type_t  curve_type,
const uapi_drv_cipher_pke_data_t input_priv_key,
const uapi_drv_cipher_pke_data_t output_priv_key,
const uapi_drv_cipher_pke_ecc_point_t output_pub_key 
)

生成ECC秘钥对。

◆ uapi_drv_cipher_pke_ecdsa_sign()

errcode_t uapi_drv_cipher_pke_ecdsa_sign ( uapi_drv_cipher_pke_ecc_curve_type_t  curve_type,
const uapi_drv_cipher_pke_data_t priv_key,
const uapi_drv_cipher_pke_data_t hash,
const uapi_drv_cipher_pke_ecc_sig_t sig 
)

椭圆曲线数字签名。

◆ uapi_drv_cipher_pke_ecdsa_verify()

errcode_t uapi_drv_cipher_pke_ecdsa_verify ( uapi_drv_cipher_pke_ecc_curve_type_t  curve_type,
const uapi_drv_cipher_pke_ecc_point_t pub_key,
const uapi_drv_cipher_pke_data_t hash,
const uapi_drv_cipher_pke_ecc_sig_t sig 
)

椭圆曲线数字ECC验签。

◆ uapi_drv_cipher_pke_eddsa_sign()

errcode_t uapi_drv_cipher_pke_eddsa_sign ( uapi_drv_cipher_pke_ecc_curve_type_t  curve_type,
const uapi_drv_cipher_pke_data_t priv_key,
const uapi_drv_cipher_pke_msg_t msg,
const uapi_drv_cipher_pke_ecc_sig_t sig 
)

爱德华兹曲线数字签名。

◆ uapi_drv_cipher_pke_eddsa_verify()

errcode_t uapi_drv_cipher_pke_eddsa_verify ( uapi_drv_cipher_pke_ecc_curve_type_t  curve_type,
const uapi_drv_cipher_pke_ecc_point_t pub_key,
const uapi_drv_cipher_pke_msg_t msg,
const uapi_drv_cipher_pke_ecc_sig_t sig 
)

爱德华兹曲线数字验签。

◆ uapi_drv_cipher_pke_exp_mod()

errcode_t uapi_drv_cipher_pke_exp_mod ( const uapi_drv_cipher_pke_data_t n,
const uapi_drv_cipher_pke_data_t k,
const uapi_drv_cipher_pke_data_t in,
const uapi_drv_cipher_pke_data_t out 
)

模幂 out = (in ^ k) mod n。

◆ uapi_drv_cipher_pke_inv_mod()

errcode_t uapi_drv_cipher_pke_inv_mod ( const uapi_drv_cipher_pke_data_t a,
const uapi_drv_cipher_pke_data_t p,
const uapi_drv_cipher_pke_data_t c 
)

模逆 c = (a^-1) mod p。

◆ uapi_drv_cipher_pke_mod()

errcode_t uapi_drv_cipher_pke_mod ( const uapi_drv_cipher_pke_data_t a,
const uapi_drv_cipher_pke_data_t p,
const uapi_drv_cipher_pke_data_t c 
)

取模运算 c = a mod p。

◆ uapi_drv_cipher_pke_mul()

errcode_t uapi_drv_cipher_pke_mul ( const uapi_drv_cipher_pke_data_t a,
const uapi_drv_cipher_pke_data_t b,
const uapi_drv_cipher_pke_data_t c 
)

大数乘 c = a * b。

◆ uapi_drv_cipher_pke_mul_mod()

errcode_t uapi_drv_cipher_pke_mul_mod ( const uapi_drv_cipher_pke_data_t a,
const uapi_drv_cipher_pke_data_t b,
const uapi_drv_cipher_pke_data_t p,
const uapi_drv_cipher_pke_data_t c 
)

模乘 c = (a * b) mod p。

◆ uapi_drv_cipher_pke_rsa_private_decrypt()

errcode_t uapi_drv_cipher_pke_rsa_private_decrypt ( uapi_drv_cipher_pke_rsa_scheme_t  scheme,
uapi_drv_cipher_pke_hash_type_t  hash_type,
const uapi_drv_cipher_pke_rsa_priv_key_t priv_key,
const uapi_drv_cipher_pke_data_t input,
const uapi_drv_cipher_pke_data_t label,
const uapi_drv_cipher_pke_data_t output 
)

RSA私钥解密。

◆ uapi_drv_cipher_pke_rsa_public_encrypt()

errcode_t uapi_drv_cipher_pke_rsa_public_encrypt ( uapi_drv_cipher_pke_rsa_scheme_t  scheme,
uapi_drv_cipher_pke_hash_type_t  hash_type,
const uapi_drv_cipher_pke_rsa_pub_key_t pub_key,
const uapi_drv_cipher_pke_data_t input,
const uapi_drv_cipher_pke_data_t label,
uapi_drv_cipher_pke_data_t output 
)

RSA公钥加密。

◆ uapi_drv_cipher_pke_rsa_sign()

errcode_t uapi_drv_cipher_pke_rsa_sign ( const uapi_drv_cipher_pke_rsa_priv_key_t priv_key,
uapi_drv_cipher_pke_rsa_scheme_t  scheme,
uapi_drv_cipher_pke_hash_type_t  hash_type,
const uapi_drv_cipher_pke_data_t input_hash,
uapi_drv_cipher_pke_data_t sign 
)

RSA签名。

◆ uapi_drv_cipher_pke_rsa_verify()

errcode_t uapi_drv_cipher_pke_rsa_verify ( const uapi_drv_cipher_pke_rsa_pub_key_t pub_key,
uapi_drv_cipher_pke_rsa_scheme_t  scheme,
uapi_drv_cipher_pke_hash_type_t  hash_type,
uapi_drv_cipher_pke_data_t input_hash,
const uapi_drv_cipher_pke_data_t sig 
)

RSA验签。

◆ uapi_drv_cipher_pke_sm2_dsa_hash()

errcode_t uapi_drv_cipher_pke_sm2_dsa_hash ( const uapi_drv_cipher_pke_data_t sm2_id,
const uapi_drv_cipher_pke_ecc_point_t pub_key,
const uapi_drv_cipher_pke_msg_t msg,
uapi_drv_cipher_pke_data_t hash 
)

SM2杂凑的SM3摘要计算。

◆ uapi_drv_cipher_pke_sm2_private_decrypt()

errcode_t uapi_drv_cipher_pke_sm2_private_decrypt ( const uapi_drv_cipher_pke_data_t priv_key,
const uapi_drv_cipher_pke_data_t cipher_text,
const uapi_drv_cipher_pke_data_t plain_text 
)

SM2私钥解密。

◆ uapi_drv_cipher_pke_sm2_public_encrypt()

errcode_t uapi_drv_cipher_pke_sm2_public_encrypt ( const uapi_drv_cipher_pke_ecc_point_t pub_key,
const uapi_drv_cipher_pke_data_t plain_text,
const uapi_drv_cipher_pke_data_t cipher_text 
)

SM2公钥加密。

◆ uapi_drv_cipher_pke_sub_mod()

errcode_t uapi_drv_cipher_pke_sub_mod ( const uapi_drv_cipher_pke_data_t a,
const uapi_drv_cipher_pke_data_t b,
const uapi_drv_cipher_pke_data_t p,
const uapi_drv_cipher_pke_data_t c 
)

模减 c = (a - b) mod p。