16#ifndef CRYPT_ECC_PKEY_H
17#define CRYPT_ECC_PKEY_H
19#include "hitls_build.h"
20#ifdef HITLS_CRYPTO_ECC
24#include "crypt_algid.h"
25#include "sal_atomic.h"
26#include "bsl_params.h"
33#ifndef CRYPT_ECC_TRY_MAX_CNT
34#define CRYPT_ECC_TRY_MAX_CNT 100
38typedef struct ECC_PkeyCtx {
43 uint32_t useCofactorMode;
44 BSL_SAL_RefCount references;
60ECC_Pkey *ECC_DupCtx(ECC_Pkey *ctx);
68void ECC_FreeCtx(ECC_Pkey *ctx);
79uint32_t ECC_PkeyGetBits(
const ECC_Pkey *ctx);
91int32_t ECC_GetPara(
const ECC_Pkey *pkey,
CRYPT_EccPara *eccPara);
105int32_t ECC_GenPublicKey(ECC_Pkey *ctx);
119int32_t ECC_PkeyGen(ECC_Pkey *ctx);
133int32_t ECC_PkeySetPrvKey(ECC_Pkey *ctx,
const CRYPT_EccPrv *prv);
147int32_t ECC_PkeySetPubKey(ECC_Pkey *ctx,
const CRYPT_EccPub *pub);
160int32_t ECC_PkeyGetPrvKey(
const ECC_Pkey *ctx,
CRYPT_EccPrv *prv);
175int32_t ECC_PkeyGetPubKey(
const ECC_Pkey *ctx,
CRYPT_EccPub *pub);
189int32_t ECC_PkeySetPrvKeyEx(ECC_Pkey *ctx,
const BSL_Param *para);
203int32_t ECC_PkeySetPubKeyEx(ECC_Pkey *ctx,
const BSL_Param *para);
217int32_t ECC_PkeyGetPrvKeyEx(
const ECC_Pkey *ctx, BSL_Param *para);
232int32_t ECC_PkeyGetPubKeyEx(
const ECC_Pkey *ctx, BSL_Param *para);
244int32_t ECC_GetParaEx(
const ECC_Pkey *ctx, BSL_Param *para);
259int32_t ECC_PkeyCtrl(ECC_Pkey *ctx, int32_t opt,
void *val, uint32_t len);
271#ifdef HITLS_CRYPTO_ECC_CMP
286int32_t ECC_PkeyCmp(
const ECC_Pkey *a,
const ECC_Pkey *b);
288#define ECC_PkeyCmp NULL
301int32_t ECC_SetPara(ECC_Pkey *ctx, ECC_Para *para);
303#ifdef HITLS_CRYPTO_ECC_CHECK
316int32_t ECC_PkeyCheck(
const ECC_Pkey *pkey1,
const ECC_Pkey *pkey2, uint32_t checkType);
CRYPT_PKEY_ParaId
定义 crypt_algid.h:208
CRYPT_PKEY_PointFormat
定义 crypt_algid.h:370
CRYPT_MD_AlgId
定义 crypt_algid.h:68
CRYPT_Data CRYPT_EccPub
定义 crypt_types.h:414
CRYPT_Data CRYPT_EccPrv
定义 crypt_types.h:275