API参考
载入中...
搜索中...
未找到
crypt_ecdh.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 CRYPT_ECDH_H
17#define CRYPT_ECDH_H
18
19#include "hitls_build.h"
20#ifdef HITLS_CRYPTO_ECDH
21
22#include <stdint.h>
23#include "crypt_types.h"
24#include "crypt_algid.h"
25#include "crypt_ecc_pkey.h"
26#include "bsl_params.h"
27#include "crypt_params_key.h"
28
29#ifdef __cplusplus
30extern "C" {
31#endif /* __cpluscplus */
32
33/* ECDH key context */
34typedef struct ECC_PkeyCtx CRYPT_ECDH_Ctx;
35
36/* ECDH parameter structure */
37typedef struct EccPara CRYPT_EcdhPara;
38
46CRYPT_ECDH_Ctx *CRYPT_ECDH_NewCtx(void);
47
57CRYPT_ECDH_Ctx *CRYPT_ECDH_NewCtxEx(void *libCtx);
58
68#define CRYPT_ECDH_DupCtx ECC_DupCtx
69
76#define CRYPT_ECDH_FreeCtx ECC_FreeCtx
77
88#define CRYPT_ECDH_NewParaById ECC_NewPara
89
100CRYPT_EcdhPara *CRYPT_ECDH_NewPara(const CRYPT_EccPara *eccPara);
101
110CRYPT_PKEY_ParaId CRYPT_ECDH_GetParaId(const CRYPT_ECDH_Ctx *ctx);
111
118#define CRYPT_ECDH_FreePara ECC_FreePara
119
131int32_t CRYPT_ECDH_SetPara(CRYPT_ECDH_Ctx *ctx, const CRYPT_EccPara *para);
132
144#define CRYPT_ECDH_GetPara ECC_GetPara
145
155#define CRYPT_ECDH_GetBits ECC_PkeyGetBits
156
168#define CRYPT_ECDH_Gen ECC_PkeyGen
169
188int32_t CRYPT_ECDH_ComputeShareKey(const CRYPT_ECDH_Ctx *ctx, const CRYPT_ECDH_Ctx *pubKey,
189 uint8_t *shareKey, uint32_t *shareKeyLen);
190
203#define CRYPT_ECDH_SetPrvKey ECC_PkeySetPrvKey
204
217#define CRYPT_ECDH_SetPubKey ECC_PkeySetPubKey
218
231#define CRYPT_ECDH_GetPrvKey ECC_PkeyGetPrvKey
232
245#define CRYPT_ECDH_GetPubKey ECC_PkeyGetPubKey
246
247#ifdef HITLS_BSL_PARAMS
260#define CRYPT_ECDH_SetPrvKeyEx ECC_PkeySetPrvKeyEx
261
274#define CRYPT_ECDH_SetPubKeyEx ECC_PkeySetPubKeyEx
275
288#define CRYPT_ECDH_GetPrvKeyEx ECC_PkeyGetPrvKeyEx
289
302#define CRYPT_ECDH_GetPubKeyEx ECC_PkeyGetPubKeyEx
303
315#define CRYPT_ECDH_GetParaEx ECC_GetParaEx
316
328int32_t CRYPT_ECDH_SetParaEx(CRYPT_ECDH_Ctx *ctx, const BSL_Param *para);
329#endif
330
346int32_t CRYPT_ECDH_Ctrl(CRYPT_ECDH_Ctx *ctx, int32_t opt, void *val, uint32_t len);
347
358#define CRYPT_ECDH_Cmp ECC_PkeyCmp
359
368int32_t CRYPT_ECDH_GetSecBits(const CRYPT_ECDH_Ctx *ctx);
369
370#ifdef HITLS_CRYPTO_ECDH_CHECK
371
383int32_t CRYPT_ECDH_Check(uint32_t checkType, const CRYPT_ECDH_Ctx *pkey1, const CRYPT_ECDH_Ctx *pkey2);
384
385#endif // HITLS_CRYPTO_ECDH_CHECK
386
387#ifdef __cplusplus
388}
389#endif
390
391#endif // HITLS_CRYPTO_ECDH
392
393#endif // CRYPT_ECDH_H
Parameter identifiers
CRYPT_PKEY_ParaId
定义 crypt_algid.h:208
定义 crypt_types.h:155