WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
载入中...
搜索中...
未找到
ed_ec_fp.h 文件参考
ed_ec_fp.h 的引用(Include)关系图:
此图展示该文件直接或间接的被哪些文件引用了:

浏览源代码.

函数

td_s32 ed_ecfp_mul_naf (const drv_pke_ecc_curve *ecc, const drv_pke_data *k, const drv_pke_ecc_point *p, const drv_pke_ecc_point *r CIPHER_CHECK_WORD)
 R = k * G, point multiplication.
 
td_s32 ed_ecfp_mul_naf_cal (td_u32 work_len, const drv_pke_data *k)
 R = k * G, point multiplication. ed inner function, while the G is the default point G(gx, gy). And before call this function, the curve init parameters should have been set into PKE DRAM.
 
td_s32 point_mul_compress (const drv_pke_data *k, const drv_pke_ecc_point *u, const drv_pke_data *p, const drv_pke_ecc_point *r)
 R = k * u, point multiplication with point compress.
 
td_s32 ed_secret_to_public (const drv_pke_ecc_curve *ecc, const drv_pke_data *priv_key, const drv_pke_ecc_point *pub_key)
 Qu = d * G, get public key from private key.
 
td_s32 sha512_modq (const drv_pke_data *q, const drv_pke_data *in1, const drv_pke_data *in2, const drv_pke_data *in3, const drv_pke_data *out)
 calculate the sha512 result of three segment buffer and modulo the result by q.
 
td_s32 ed_ecfn_sign_s (const drv_pke_data *sk, const drv_pke_data *r, const drv_pke_data *h, const drv_pke_data *n, const drv_pke_data *s)
 multi-multiplication to calculate the signature s. s = (r + h * sk) mod n.
 
td_s32 ed_mul_sub (const drv_pke_ecc_curve *ecc, const drv_pke_data *s, const drv_pke_data *h, const drv_pke_ecc_point *a, const drv_pke_ecc_point *r)
 calculate sB - hA for ed verify. the result is in ed_addr_cx, ed_addr_cy and ed_addr_cz, which is in Jacobin coordinate.
 
td_s32 secret_expand (const td_u8 *secret, td_u8 *a, td_u8 *prefix, const td_u32 len)
 private key expand function. from 32 byte private key get 64 byte output. (a, prefix) = sha512(secret).
 
td_s32 point_decompress (const drv_pke_data *enc_pkey, const drv_pke_data *p, const drv_pke_ecc_point *pkey)
 point decompress, from little endian data get real point by curve equation.
 

函数说明

◆ ed_ecfn_sign_s()

td_s32 ed_ecfn_sign_s ( const drv_pke_data sk,
const drv_pke_data r,
const drv_pke_data h,
const drv_pke_data n,
const drv_pke_data s 
)

multi-multiplication to calculate the signature s. s = (r + h * sk) mod n.

参数
skthe first 32 bytes of the decoded private key.
rthe result of sha512 modulo L, r = sha512(prefix || msg) mod n.
hthe result of sha512 modulo L, h = sha512(R || A || msg) mod n. R and A is the encoded rG and pubkey.
nthe group order of G.
sthe signature result.
返回
td_s32 TD_SUCCESS or others.

◆ ed_ecfp_mul_naf()

td_s32 ed_ecfp_mul_naf ( const drv_pke_ecc_curve ecc,
const drv_pke_data k,
const drv_pke_ecc_point p,
const drv_pke_ecc_point *r  CIPHER_CHECK_WORD 
)

R = k * G, point multiplication.

Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2022-2022. All rights reserved. Description: ed25519 related functions head file.

Create: 2022-10-31

参数
eccinput ecc curve param.
kthe scalar.
pthe input point.
rthe output point.
CIPHER_CHECK_WORDifdef SEC_ENHANCE, the value is XOR result of parameters, otherwise it doesn't exist.
返回
td_s32 TD_SUCCESS or others.

◆ ed_ecfp_mul_naf_cal()

td_s32 ed_ecfp_mul_naf_cal ( td_u32  work_len,
const drv_pke_data k 
)

R = k * G, point multiplication. ed inner function, while the G is the default point G(gx, gy). And before call this function, the curve init parameters should have been set into PKE DRAM.

参数
work_lenwork_len = align_len / ALIGNED_TO_WORK_LEN_IN_BYTE.
kthe scalar.
返回
td_s32 TD_SUCCESS or others.

◆ ed_mul_sub()

td_s32 ed_mul_sub ( const drv_pke_ecc_curve ecc,
const drv_pke_data s,
const drv_pke_data h,
const drv_pke_ecc_point a,
const drv_pke_ecc_point r 
)

calculate sB - hA for ed verify. the result is in ed_addr_cx, ed_addr_cy and ed_addr_cz, which is in Jacobin coordinate.

注意
Need to set rrp and use p to update montgomery parameter first.
参数
eccthe input ed curve parameters.
sthe decoded signature value.
hthe result of sha512 modulo L, h = sha512(R || A || msg) mod n. R and A is the encoded rG and pubkey.
athe decoded public key.
rthe output result.
返回
td_s32 TD_SUCCESS or others.

◆ ed_secret_to_public()

td_s32 ed_secret_to_public ( const drv_pke_ecc_curve ecc,
const drv_pke_data priv_key,
const drv_pke_ecc_point pub_key 
)

Qu = d * G, get public key from private key.

参数
eccthe curve parameter.
priv_keythe input private key.
pub_keythe output public key.

◆ point_decompress()

td_s32 point_decompress ( const drv_pke_data enc_pkey,
const drv_pke_data p,
const drv_pke_ecc_point pkey 
)

point decompress, from little endian data get real point by curve equation.

注意
Need to set rrp and use p to update montgomery parameter first.
参数
enc_pkeythe encoded point value.
pthe module.
pkeythe the decoded point.
返回
td_s32

◆ point_mul_compress()

td_s32 point_mul_compress ( const drv_pke_data k,
const drv_pke_ecc_point u,
const drv_pke_data p,
const drv_pke_ecc_point r 
)

R = k * u, point multiplication with point compress.

参数
kthe scalar.
uthe input point.
pthe modulur.
rthe output point.
返回
td_s32 TD_SUCCESS or others.

◆ secret_expand()

td_s32 secret_expand ( const td_u8 secret,
td_u8 a,
td_u8 prefix,
const td_u32  len 
)

private key expand function. from 32 byte private key get 64 byte output. (a, prefix) = sha512(secret).

参数
secretthe input private key.
athe first 32 byte of the sha512(secret).
prefixthe last 32 byte of the sha512(secret).
lenthe byte length of the input private key.
返回
td_s32

◆ sha512_modq()

td_s32 sha512_modq ( const drv_pke_data q,
const drv_pke_data in1,
const drv_pke_data in2,
const drv_pke_data in3,
const drv_pke_data out 
)

calculate the sha512 result of three segment buffer and modulo the result by q.

参数
qthe modulus.
in1the first segment.
in2the second segment.
in3the third segment.
outthe result.
返回
td_s32 TD_SUCCESS or others.