|
WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
|
#include "crypto_osal_adapt.h"#include "crypto_hash_struct.h"#include "hal_pke.h"#include "hal_hash.h"#include "hal_cipher_trng.h"#include "crypto_security.h"#include "security_rom_table.h"
函数 | |
| td_s32 | hal_pke_init (void) |
| td_s32 | hal_pke_deinit (void) |
| td_s32 | hal_pke_lock (void) |
| void | hal_pke_unlock (void) |
| void | hal_pke_enable_noise (void) |
| void | hal_pke_disable_noise (void) |
| td_s32 | hal_pke_pre_process (void) |
| set mask random into registerfor set_ram and get_ram. | |
| td_s32 | hal_pke_check_free (void) |
| check PKE busy, if success, then do next steps. | |
| td_void | hal_pke_set_ram (td_u32 ram_section, const td_u8 *data, td_u32 data_len, td_u32 aligned_len CIPHER_CHECK_WORD) |
| set data to PKE DRAM. | |
| td_void | hal_pke_get_ram (td_u32 ram_section, td_u8 *data, td_u32 data_len CIPHER_CHECK_WORD) |
| get result data in PKE DRAM | |
| td_s32 | hal_pke_clean_ram (void) |
| clear the data in DRAM as random value. Only need to clear at the last calculate. | |
| td_s32 | hal_pke_set_mode (pke_mode mode, td_u32 single_instr, const rom_lib *batch_instr, pke_data_work_len work_len CIPHER_CHECK_WORD) |
| set calculate mode, work_len and instr to register. | |
| td_s32 | hal_pke_start (pke_mode mode CIPHER_CHECK_WORD) |
| start PKE calculate | |
| td_s32 | hal_pke_wait_done (void) |
| PKE wait calculation finish | |
| td_s32 | hal_pke_get_align_val (const td_u32 len, td_u32 *aligned_len) |
| Get the align val object of PKE, which depending on the chip version. | |
| td_s32 | hal_pke_set_mont_para (td_u32 low_bit, td_u32 high_bit CIPHER_CHECK_WORD) |
| Set the montgomery parameter for modular multiplication. | |
| td_s32 | hal_pke_set_ecc_param (const pke_ecc_init_param *init_param, const drv_pke_ecc_curve *ecc_curve) |
| td_s32 | hal_pke_set_init_param (const pke_ecc_init_param *init_param, const drv_pke_ecc_curve *ecc_curve) |
| set the initial parameters into DRAM. | |
| td_s32 | hal_cipher_trng_init (td_void) |
| td_s32 | hal_cipher_trng_get_random (td_u32 *randnum) |
| td_s32 | hal_cipher_hash_init (td_void) |
| td_s32 | hal_hash_lock (td_u32 chn_num) |
| td_s32 | hal_hash_unlock (td_u32 chn_num) |
| td_s32 | hal_cipher_hash_config (td_u32 chn_num, crypto_hash_type hash_type, const td_u32 *state) |
| td_s32 | hal_cipher_hash_add_in_node (td_u32 chn_num, td_phys_addr_t data_phys, td_u32 data_len, in_node_type_e in_node_type) |
| td_s32 | hal_cipher_hash_start (td_u32 chn_num, td_bool is_wait) |
| td_s32 | hal_cipher_hash_wait_done (td_u32 chn_num, td_u32 *state, td_u32 state_size) |
| td_s32 hal_cipher_hash_add_in_node | ( | td_u32 | chn_num, |
| td_phys_addr_t | data_phys, | ||
| td_u32 | data_len, | ||
| in_node_type_e | in_node_type | ||
| ) |
| td_s32 hal_cipher_hash_config | ( | td_u32 | chn_num, |
| crypto_hash_type | hash_type, | ||
| const td_u32 * | state | ||
| ) |
Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved.
Description: hal hash header.
History:
2023-03-22, Create file.
Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved.
Description: hal trng header.
History:
2023-03-22, Create file.
| td_s32 hal_pke_check_free | ( | void | ) |
check PKE busy, if success, then do next steps.
| td_s32 hal_pke_clean_ram | ( | void | ) |
clear the data in DRAM as random value. Only need to clear at the last calculate.
| td_s32 hal_pke_deinit | ( | void | ) |
| void hal_pke_disable_noise | ( | void | ) |
| void hal_pke_enable_noise | ( | void | ) |
Get the align val object of PKE, which depending on the chip version.
| len | the input data len. |
| aligned_len | the aligned length used to calculate. |
get result data in PKE DRAM
| ram_section | the address of offset block in DRAM for data to get out. |
| data | the data value. |
| data_len | the effective length of data in byte. |
| CIPHER_CHECK_WORD | ifdef SEC_ENHANCE, the value is XOR result of parameters, otherwise it doesn't exist. |
| td_s32 hal_pke_init | ( | void | ) |
Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. Description: Corresponds ROM functions to their implementation ROM addresses.
Create: 2023-05-17
| td_s32 hal_pke_lock | ( | void | ) |
| td_s32 hal_pke_pre_process | ( | void | ) |
set mask random into registerfor set_ram and get_ram.
| td_s32 hal_pke_set_ecc_param | ( | const pke_ecc_init_param * | init_param, |
| const drv_pke_ecc_curve * | ecc_curve | ||
| ) |
| td_s32 hal_pke_set_init_param | ( | const pke_ecc_init_param * | init_param, |
| const drv_pke_ecc_curve * | ecc_curve | ||
| ) |
set the initial parameters into DRAM.
| init_param | the initial parameters. |
| ecc_curve | the ecc curve type. |
| td_s32 hal_pke_set_mode | ( | pke_mode | mode, |
| td_u32 | single_instr, | ||
| const rom_lib * | batch_instr, | ||
| pke_data_work_len work_len | CIPHER_CHECK_WORD | ||
| ) |
set calculate mode, work_len and instr to register.
| mode | calculation mode, see pke_mode. |
| single_instr | If the mode is PKE_SINGLE_INSTR0 or PKE_SINGLE_INSTR1, then set this. Otherwise, set it 0. |
| batch_instr | If the mode is PKE_BATCH_INSTR, then set this. Otherwise, set it TD_NULL. |
| work_len | work_len=ceiling(width/64), width is the data aligned bit width length, or work_len=ceiling(aligned_len/8). |
| CIPHER_CHECK_WORD | ifdef SEC_ENHANCE, the value is XOR result of parameters, otherwise it doesn't exist. |
Set the montgomery parameter for modular multiplication.
| low_bit | the low 32bit data. |
| high_bit | the high 32bit data. |
| CIPHER_CHECK_WORD | ifdef SEC_ENHANCE, the value is XOR result of parameters, otherwise it doesn't exist. |
| td_void hal_pke_set_ram | ( | td_u32 | ram_section, |
| const td_u8 * | data, | ||
| td_u32 | data_len, | ||
| td_u32 aligned_len | CIPHER_CHECK_WORD | ||
| ) |
set data to PKE DRAM.
| ram_section | the address of offset block in DRAM for data to write into. |
| data | the data value. |
| data_len | the effective length of data in byte. |
| aligned_len | the aligned length of data in byte when participate in calculate. In old IP, this is the klen, such as 32(256bit), 48(384bit), 64(512bit), 68(521bit), etc. This API mainly used in RSA calculate, for ecc, the input curve parameters are aligned, no need to process. |
| CIPHER_CHECK_WORD | ifdef SEC_ENHANCE, the value is XOR result of parameters, otherwise it doesn't exist. |
start PKE calculate
| mode | SINGLE_INSTR or BATCH_INSTR |
| CIPHER_CHECK_WORD | ifdef SEC_ENHANCE, the value is XOR result of parameters, otherwise it doesn't exist. |
| void hal_pke_unlock | ( | void | ) |
| td_s32 hal_pke_wait_done | ( | void | ) |
PKE wait calculation finish