API参考
载入中...
搜索中...
未找到
sm9_ecp.h
1/*
2 * This file is part of the openHiTLS project.
3 *
4 * openHiTLS is licensed under the Mulan PSL v2.
5 * You can use this software according to the terms and conditions of the Mulan PSL v2.
6 * You may obtain a copy of Mulan PSL v2 at:
7 *
8 * http://license.coscl.org.cn/MulanPSL2
9 *
10 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
11 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
12 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
13 * See the Mulan PSL v2 for more details.
14 */
15
16#ifndef _SM9_ECP_H_
17#define _SM9_ECP_H_
18
19#include "hitls_build.h"
20#ifdef HITLS_CRYPTO_SM9
21
22#include "sm9_fp.h"
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28void SM9_Ecp_A_Reset(SM9_ECP_A *pECP_A);
29void SM9_Ecp_J_Reset(SM9_ECP_J *pECP_J);
30
31void SM9_Ecp_A_Assign(SM9_ECP_A *pPointA, SM9_ECP_A *pPointB);
32
33void SM9_Ecp_A_ToJ(SM9_ECP_J *pJ_Point, SM9_ECP_A *pA_Point);
34void SM9_Ecp_J_ToA(SM9_ECP_A *pAp, SM9_ECP_J *pJp);
35
36void SM9_Ecp_J_AddA(SM9_ECP_J *pJ_Sum, SM9_ECP_J *pJp, SM9_ECP_A *pAp);
37void SM9_Ecp_J_DoubleJ(SM9_ECP_J *pJp_Result, SM9_ECP_J *pJp);
38void SM9_Ecp_KP(SM9_ECP_A *pKP, SM9_ECP_A *pAp, uint32_t *pwK);
39
40void SM9_Fp_ECP_KPAddAToA(SM9_ECP_A *pKP, SM9_ECP_A *pAp, uint32_t *pwK, SM9_ECP_A *pBp, SM9_Sys_Para *pSysPara);
41
42// Read ECP point32_t from byte string and convert to MontMode
43void SM9_Ecp_A_ReadBytes(SM9_ECP_A *dst, const uint8_t *src);
44
45int32_t SM9_Fp_ECP_A_ReadBytesWithPC(SM9_ECP_A *dst, uint8_t PC, const uint8_t *src);
46
47// Convert to NormMode and write to byte string
48void SM9_Ecp_A_WriteBytes(uint8_t *dst, SM9_ECP_A *src);
49
50int32_t SM9_Fp_ECP_A_WriteBytesWithPC(uint8_t *dst, uint8_t PC, SM9_ECP_A *src);
51
52int32_t SM9_Ecp_A_Check(SM9_ECP_A *pAp);
53
54#ifdef __cplusplus
55}
56#endif
57
58#endif // HITLS_CRYPTO_SM9
59
60#endif // !_SM9_ECP_H_
61