WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
载入中...
搜索中...
未找到
curve_ec_fp.c 文件参考
#include "crypto_osal_adapt.h"
#include "rom_lib.h"
#include "hal_pke_reg.h"
#include "hal_pke.h"
#include "drv_common.h"
#include "drv_pke_inner.h"
#include "drv_common_pke.h"
#include "curve_ec_fp.h"
curve_ec_fp.c 的引用(Include)关系图:

函数

td_s32 curve_ecfp_mont_ladder (const drv_pke_data *k, const drv_pke_data *ux, const drv_pke_data *mod_p)
 curve25519 montgomery point multiplication. Rx = k * ux. Before call this API, you should have set montgomery parameter into register, and set rrp by call set_curve_param.
 
td_s32 curve_ecfp_xz_to_x (const drv_pke_data *mod_p)
 transform X & Z from jacobin coordinate to affine coordinate x. Before call this API, you should have set montgomery parameter into register, and set rrp by call set_curve_param.
 
CRYPTO_STATIC td_s32 curve_ecfp_mul_dot_param_chk (const drv_pke_ecc_curve *ecc, const drv_pke_data *k, const drv_pke_ecc_point *p, const drv_pke_ecc_point *r)
 curve25519 point multiplication parameter check.
 
td_s32 decode_priv_key (td_u8 *output_key, const td_u8 *input_key, td_u32 klen)
 decode the normal k value. In RFC7748, the k value and point on curve are all encoded.
 
td_s32 decode_point_x (td_u8 *output_u_x, const td_u8 *input_u_x, td_u32 ulen)
 decode the x coordinate of the point. In RFC7748, the k value and point on curve are all encoded.
 
td_s32 encode_point_x (td_u8 *output_u_x, const td_u8 *input_u_x, td_u32 ulen)
 encode the x coordinate of the point. In RFC7748, the k value and point on curve are all encoded.
 
td_s32 curve_ecfp_mul (const drv_pke_ecc_curve *ecc, const drv_pke_data *k, const drv_pke_data *ux, const drv_pke_data *rx)
 Rx = k * ux. calculate point multiplication for curve25519 and curve448. before call this API you should have decoded the k value and the x coordinate of the point. after call this API, if you will transfer the rx to user, you should encode the rx by yourself.
 
td_s32 curve_ecfp_mul_dot (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)
 rx = k * px. calculate point multiplication for curve25519 and curve448.
 

函数说明

◆ curve_ecfp_mont_ladder()

td_s32 curve_ecfp_mont_ladder ( const drv_pke_data k,
const drv_pke_data ux,
const drv_pke_data mod_p 
)

curve25519 montgomery point multiplication. Rx = k * ux. Before call this API, you should have set montgomery parameter into register, and set rrp by call set_curve_param.

Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2022-2022. All rights reserved. Description: the curve drv common algorithm emplement. The data will transfor by the func param and will be set into DRAM in the algorithms.

Create: 2022-10-27

参数
kthe input decoded normal k value.
uxthe input decoded point.
mod_pthe input module.
返回
td_s32 TD_SUCCESS or others.

◆ curve_ecfp_mul()

td_s32 curve_ecfp_mul ( const drv_pke_ecc_curve ecc,
const drv_pke_data k,
const drv_pke_data ux,
const drv_pke_data rx 
)

Rx = k * ux. calculate point multiplication for curve25519 and curve448. before call this API you should have decoded the k value and the x coordinate of the point. after call this API, if you will transfer the rx to user, you should encode the rx by yourself.

参数
eccthe ecc curve param.
kthe input decoded normal k value.
uxthe intput decoded x coordinate of the point.
rxthe output without encoded x coordinate of the point.
返回
td_s32 TD_SUCCESS or others.

◆ curve_ecfp_mul_dot()

td_s32 curve_ecfp_mul_dot ( 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 
)

rx = k * px. calculate point multiplication for curve25519 and curve448.

参数
eccThe ecc curve param.
kThe input decoded normal k value.
pThe intput decoded x coordinate of the point.
CIPHER_CHECK_WORDifdef SEC_ENHANCE, the value is XOR result of parameters, otherwise it doesn't exist.
返回
td_s32 TD_SUCCESS or others.

◆ curve_ecfp_mul_dot_param_chk()

CRYPTO_STATIC td_s32 curve_ecfp_mul_dot_param_chk ( const drv_pke_ecc_curve ecc,
const drv_pke_data k,
const drv_pke_ecc_point p,
const drv_pke_ecc_point r 
)

curve25519 point multiplication parameter check.

参数
eccECC curve parameter.
kThe input data.
pThe input point.
rThe output point.
返回
td_s32 TD_SUCCESS or others.

◆ curve_ecfp_xz_to_x()

td_s32 curve_ecfp_xz_to_x ( const drv_pke_data mod_p)

transform X & Z from jacobin coordinate to affine coordinate x. Before call this API, you should have set montgomery parameter into register, and set rrp by call set_curve_param.

参数
mod_pthe modulur.
返回
td_s32 TD_SUCCESS or others.

◆ decode_point_x()

td_s32 decode_point_x ( td_u8 output_u_x,
const td_u8 input_u_x,
td_u32  ulen 
)

decode the x coordinate of the point. In RFC7748, the k value and point on curve are all encoded.

参数
output_u_xthe decoded x coordinate of the point, which can be used in calculation directly.
input_u_xthe input encoded x coordinate of the point.
ulenthe byte length of x coordinate of the point.
返回
td_s32 TD_SUCCESS or others.

◆ decode_priv_key()

td_s32 decode_priv_key ( td_u8 output_key,
const td_u8 input_key,
td_u32  klen 
)

decode the normal k value. In RFC7748, the k value and point on curve are all encoded.

Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2022-2022. All rights reserved. Description: the curve drv common algorithm head file. The data will transfor by the func param and will be set into DRAM in the algorithms.

Create: 2022-10-27

参数
output_keythe decoded k value, which can be used in calculation directly.
input_keythe input encoded k value.
klenthe byte length of k value.
返回
td_s32 TD_SUCCESS or others.

◆ encode_point_x()

td_s32 encode_point_x ( td_u8 output_u_x,
const td_u8 input_u_x,
td_u32  ulen 
)

encode the x coordinate of the point. In RFC7748, the k value and point on curve are all encoded.

参数
output_u_xthe encoded x coordinate of the point, which will be transfered to user.
input_u_xthe input x coordinate of the point.
ulenthe byte length of x coordinate of the point.
返回
td_s32 TD_SUCCESS or others.