API参考
载入中...
搜索中...
未找到
auth_pake.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
21
22#ifndef AUTH_PAKE_H
23#define AUTH_PAKE_H
24
25#include <stdint.h>
26#include "crypt_algid.h"
27#include "bsl_types.h"
28#include "crypt_eal_provider.h"
29#include "bsl_obj.h"
30#include "crypt_eal_kdf.h"
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
37
38typedef enum {
39 HITLS_AUTH_PAKE_INVALID = 0,
40 HITLS_AUTH_PAKE_SPAKE2PLUS = 1,
41} HITLS_AUTH_PAKE_Type;
42
43typedef enum {
44 HITLS_AUTH_PAKE_REQ = 0,
45 HITLS_AUTH_PAKE_RESP = 1,
46} HITLS_AUTH_PAKE_Role;
47
48typedef struct {
49 HITLS_AUTH_PAKE_Type type;
50 union {
51 struct {
53 CRYPT_MD_AlgId hash;
54 CRYPT_KDF_HKDF_AlgId kdf;
56 } spake2plus;
57 } params;
59
60typedef struct {
61 CRYPT_KDF_AlgId algId;
62 union {
63 struct {
65 int32_t iteration;
66 BSL_Buffer salt;
67 } pbkdf2;
68 }param;
70
71typedef enum {
72 HITLS_AUTH_PAKE_REQ_REGISTER = 0x1001,
73 HITLS_AUTH_PAKE_RESP_REGISTER = 0x1002,
74} HITLS_AUTH_PAKE_CtrlCmd;
75
92HITLS_AUTH_PakeCtx *HITLS_AUTH_PakeNewCtx(CRYPT_EAL_LibCtx *libCtx, const char *attrName,
93 HITLS_AUTH_PAKE_Type type, HITLS_AUTH_PAKE_Role role,
94 HITLS_AUTH_PAKE_CipherSuite cipherSuite, BSL_Buffer password, BSL_Buffer prover,
95 BSL_Buffer verifier, BSL_Buffer context);
96
104
105
120int32_t HITLS_AUTH_Pake_Ctrl(HITLS_AUTH_PakeCtx *ctx, HITLS_AUTH_PAKE_CtrlCmd cmd, CRYPT_EAL_KdfCtx *kdfctx,
121 BSL_Buffer in0, BSL_Buffer in1, BSL_Buffer in2);
122
135
150 BSL_Buffer *out0, BSL_Buffer *out1);
151
166 BSL_Buffer *out0, BSL_Buffer *out1);
167
180
191#ifdef __cplusplus
192}
193#endif // __cplusplus
194
195#endif // AUTH_PAKE_H
int32_t HITLS_AUTH_PakeRespSetup(HITLS_AUTH_PakeCtx *ctx, BSL_Buffer in0, BSL_Buffer in1, BSL_Buffer *out0, BSL_Buffer *out1)
Perform PAKE responder setup phase
定义 pake.c:233
int32_t HITLS_AUTH_PakeRespDerive(HITLS_AUTH_PakeCtx *ctx, BSL_Buffer in0, BSL_Buffer *out0)
Derive session keys for PAKE responder
定义 pake.c:285
int32_t HITLS_AUTH_PakeReqDerive(HITLS_AUTH_PakeCtx *ctx, BSL_Buffer in0, BSL_Buffer in1, BSL_Buffer *out0, BSL_Buffer *out1)
Derive session keys for PAKE requester
定义 pake.c:259
int32_t HITLS_AUTH_PakeReqSetup(HITLS_AUTH_PakeCtx *ctx, BSL_Buffer in, BSL_Buffer *out)
Perform PAKE requester setup phase
定义 pake.c:209
HITLS_AUTH_PakeCtx * HITLS_AUTH_PakeNewCtx(CRYPT_EAL_LibCtx *libCtx, const char *attrName, HITLS_AUTH_PAKE_Type type, HITLS_AUTH_PAKE_Role role, HITLS_AUTH_PAKE_CipherSuite cipherSuite, BSL_Buffer password, BSL_Buffer prover, BSL_Buffer verifier, BSL_Buffer context)
Create a new PAKE context
定义 pake.c:66
int32_t HITLS_AUTH_Pake_Ctrl(HITLS_AUTH_PakeCtx *ctx, HITLS_AUTH_PAKE_CtrlCmd cmd, CRYPT_EAL_KdfCtx *kdfctx, BSL_Buffer in0, BSL_Buffer in1, BSL_Buffer in2)
Register pre-computed parameters for PAKE requester
定义 pake.c:178
CRYPT_EAL_KdfCtx * HITLS_AUTH_PakeGetKdfCtx(HITLS_AUTH_PakeCtx *ctx, HITLS_AUTH_PAKE_KDF kdf)
Get KDF context for PAKE key derivation
定义 pake.c:310
void HITLS_AUTH_PakeFreeCtx(HITLS_AUTH_PakeCtx *ctx)
Free PAKE context and associated resources
定义 pake.c:42
CRYPT_PKEY_ParaId
定义 crypt_algid.h:208
CRYPT_MD_AlgId
定义 crypt_algid.h:68
CRYPT_MAC_AlgId
定义 crypt_algid.h:91
CRYPT_KDF_AlgId
定义 crypt_algid.h:382
定义 bsl_types.h:40
定义 auth_pake.h:48
定义 auth_pake.h:60
定义 pake.c:29