|
WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
|
#include "ecc_ec_fp.h"#include "crypto_drv_common.h"#include "hal_pke_reg.h"#include "hal_pke.h"#include "drv_common_pke.h"
函数 | |
| td_s32 | ecc_ecfp_jac_to_aff (const drv_pke_data *mod_p) |
| Get final calculate result. trans (ecc_addr_cx, ecc_addr_cy, ecc_addr_cz) from jac to aff. aff_x = jac_x * ((jac_z)^-2); aff_y = jac_y * ((jac_z)^-3) | |
| td_s32 | ecc_ecfp_montgomery_data_aff (const drv_pke_ecc_point *in, const drv_pke_data *mod_p, const drv_pke_ecc_point *out CIPHER_CHECK_WORD) |
| montgomery the point coordinate in affine coordinate system. Before call this API, you should have set curve initial parameters into the DRAM. | |
| td_s32 | ecc_ecfp_demontgomery_data_aff (const drv_pke_ecc_point *r, td_u32 work_len) |
| demontgomery data, (ecc_addr_cx, ecc_addr_cy) -> (ecc_addr_cx, ecc_addr_cy). Before calculate demont, you should have set const_1 to ecc_addr_const_1. | |
| td_s32 | update_modulus (const td_u8 *n, const td_u32 n_len CIPHER_CHECK_WORD) |
| update modulus into ecc_addr_m, and set new montgomery parameter into reg. Before call this API, you should have set initial parameters into PKE DRAM. | |
| td_s32 | ecc_ecfn_inv (const drv_pke_data *a, const drv_pke_data *n, const drv_pke_data *c CIPHER_CHECK_WORD) |
| c = ~a mod n, ecc_addr_s = 1/ecc_addr_k. Before call this API, you should have set curve initial parameters into DRAM, which must include ecc_addr_rrn, ecc_addr_mont_1_n. | |
| td_s32 ecc_ecfn_inv | ( | const drv_pke_data * | a, |
| const drv_pke_data * | n, | ||
| const drv_pke_data *c | CIPHER_CHECK_WORD | ||
| ) |
c = ~a mod n, ecc_addr_s = 1/ecc_addr_k. Before call this API, you should have set curve initial parameters into DRAM, which must include ecc_addr_rrn, ecc_addr_mont_1_n.
| a | the input data. |
| n | the modulus. |
| c | the output data. |
| CIPHER_CHECK_WORD | ifdef SEC_ENHANCE, the value is XOR result of parameters, otherwise it doesn't exist. |
| td_s32 ecc_ecfp_demontgomery_data_aff | ( | const drv_pke_ecc_point * | r, |
| td_u32 | work_len | ||
| ) |
demontgomery data, (ecc_addr_cx, ecc_addr_cy) -> (ecc_addr_cx, ecc_addr_cy). Before calculate demont, you should have set const_1 to ecc_addr_const_1.
| r | store the result. |
| work_len | work_len = celing(aligned_len/64). |
| td_s32 ecc_ecfp_jac_to_aff | ( | const drv_pke_data * | mod_p | ) |
Get final calculate result. trans (ecc_addr_cx, ecc_addr_cy, ecc_addr_cz) from jac to aff. aff_x = jac_x * ((jac_z)^-2); aff_y = jac_y * ((jac_z)^-3)
Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. Description: ecc common algorithm implementation
Create: 2023-06-05
| td_s32 ecc_ecfp_montgomery_data_aff | ( | const drv_pke_ecc_point * | in, |
| const drv_pke_data * | mod_p, | ||
| const drv_pke_ecc_point *out | CIPHER_CHECK_WORD | ||
| ) |
montgomery the point coordinate in affine coordinate system. Before call this API, you should have set curve initial parameters into the DRAM.
| in | intput point in affine coordinate system. |
| mod_p | modulus. |
| out | output point in affine coordinate system. |
| CIPHER_CHECK_WORD | ifdef SEC_ENHANCE, the value is XOR result of parameters, otherwise it doesn't exist. |
update modulus into ecc_addr_m, and set new montgomery parameter into reg. Before call this API, you should have set initial parameters into PKE DRAM.
| n | the new modulus |
| n_len | the byte length of new modulus. |
| CIPHER_CHECK_WORD | ifdef SEC_ENHANCE, the value is XOR result of parameters, otherwise it doesn't exist. |