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

浏览源代码.

函数

td_s32 rsa_rrn (const td_u8 *n, const td_u32 key_size, const td_u32 aligned_len, td_u8 *rrn)
 rrn = 2^(2*n_bit_len) mod n.
 
td_s32 update_rsa_modulus (const td_u8 *n, const td_u32 n_len, const td_u32 aligned_len CIPHER_CHECK_WORD)
 
td_s32 rsa_regular_mul (const drv_pke_data *a, const drv_pke_data *b, const drv_pke_data *c)
 regular multiplication. c = a * b.
 
td_s32 rsa_mod (const drv_pke_data *a, const drv_pke_data *p, const drv_pke_data *c CIPHER_CHECK_WORD)
 c = a mod p.
 
td_s32 rsa_add_mod (const drv_pke_data *a, const drv_pke_data *b, const drv_pke_data *p, const drv_pke_data *c CIPHER_CHECK_WORD)
 c = (a + b) mod p
 
td_s32 rsa_sub_mod (const drv_pke_data *a, const drv_pke_data *b, const drv_pke_data *p, const drv_pke_data *c CIPHER_CHECK_WORD)
 c = (a - b) mod p. a could be smaller than b.
 
td_s32 rsa_inv_mod (const drv_pke_data *a, const drv_pke_data *p, const drv_pke_data *c CIPHER_CHECK_WORD)
 c = ~a mod p. where a * c mod p = 1 mod p.
 
td_s32 rsa_mul_mod (const drv_pke_data *a, const drv_pke_data *b, const drv_pke_data *p, const drv_pke_data *c CIPHER_CHECK_WORD)
 c = (a * b) mod p use montgomery modular multiplication. before call this API, you should have call rsa_rrn API to set rrn into rsa_addr_rr DRAM.
 
td_s32 rsa_exp_mod (const drv_pke_data *n, const drv_pke_data *k, const drv_pke_data *in, const drv_pke_data *out CIPHER_CHECK_WORD)
 out = in ^ k mod n.
 

函数说明

◆ rsa_add_mod()

td_s32 rsa_add_mod ( const drv_pke_data a,
const drv_pke_data b,
const drv_pke_data p,
const drv_pke_data *c  CIPHER_CHECK_WORD 
)

c = (a + b) mod p

◆ rsa_exp_mod()

td_s32 rsa_exp_mod ( const drv_pke_data n,
const drv_pke_data k,
const drv_pke_data in,
const drv_pke_data *out  CIPHER_CHECK_WORD 
)

out = in ^ k mod n.

参数
nthe input modulo.
kthe exponent.
inthe input data.
outthe output data.
CIPHER_CHECK_WORDifdef SEC_ENHANCE, the value is XOR result of parameters, otherwise it doesn't exist.
返回
td_s32 TD_SUCCESS or others.

◆ rsa_inv_mod()

td_s32 rsa_inv_mod ( const drv_pke_data a,
const drv_pke_data p,
const drv_pke_data *c  CIPHER_CHECK_WORD 
)

c = ~a mod p. where a * c mod p = 1 mod p.

◆ rsa_mod()

td_s32 rsa_mod ( const drv_pke_data a,
const drv_pke_data p,
const drv_pke_data *c  CIPHER_CHECK_WORD 
)

c = a mod p.

参数
athe input data, which bit length shouldn't more than 2 * p->bit_length.
pthe modulus.
cthe output data.
CIPHER_CHECK_WORDifdef SEC_ENHANCE, the value is XOR result of parameters, otherwise it doesn't exist.
返回
td_s32 TD_SUCCESS or others.

◆ rsa_mul_mod()

td_s32 rsa_mul_mod ( const drv_pke_data a,
const drv_pke_data b,
const drv_pke_data p,
const drv_pke_data *c  CIPHER_CHECK_WORD 
)

c = (a * b) mod p use montgomery modular multiplication. before call this API, you should have call rsa_rrn API to set rrn into rsa_addr_rr DRAM.

◆ rsa_regular_mul()

td_s32 rsa_regular_mul ( const drv_pke_data a,
const drv_pke_data b,
const drv_pke_data c 
)

regular multiplication. c = a * b.

参数
ainput data.
binput data.
coutput data.
返回
td_s32 TD_SUCCESS or others.

◆ rsa_rrn()

td_s32 rsa_rrn ( const td_u8 n,
const td_u32  key_size,
const td_u32  aligned_len,
td_u8 rrn 
)

rrn = 2^(2*n_bit_len) mod n.

Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2022-2022. All rights reserved. Description: RSA algorithm header file.

Create: 2022-08-18

参数
nfor rsa n = p * q, for ecc it's prime the order of the base point G.
key_sizersa key length in byte or ecc curve key length in byte.
rrnthe output rrn data. for RSA there is no need to get this data out to reset it into rsa_addr_rr, but for ecc, it's necessary, for there are two different address. which byte length is the same with n.
aligned_lenaligned length for calculate.
返回
td_s32 TD_SUCCESS or others.

◆ rsa_sub_mod()

td_s32 rsa_sub_mod ( const drv_pke_data a,
const drv_pke_data b,
const drv_pke_data p,
const drv_pke_data *c  CIPHER_CHECK_WORD 
)

c = (a - b) mod p. a could be smaller than b.

◆ update_rsa_modulus()

td_s32 update_rsa_modulus ( const td_u8 n,
const td_u32  n_len,
const td_u32 aligned_len  CIPHER_CHECK_WORD 
)