API参考
载入中...
搜索中...
未找到
hitls_psk.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 HITLS_PSK_H
23#define HITLS_PSK_H
24
25#include "hitls_type.h"
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
35#define HS_PSK_IDENTITY_MAX_LEN 256u
36#ifndef HS_PSK_MAX_LEN
37#define HS_PSK_MAX_LEN 512u
38#endif
39#define HITLS_PSK_FIND_SESSION_CB_SUCCESS 1
40#define HITLS_PSK_FIND_SESSION_CB_FAIL 0
41#define HITLS_PSK_USE_SESSION_CB_SUCCESS 1
42#define HITLS_PSK_USE_SESSION_CB_FAIL 0
43
56typedef uint32_t (*HITLS_PskClientCb)(HITLS_Ctx *ctx, const uint8_t *hint, uint8_t *identity, uint32_t maxIdentityLen,
57 uint8_t *psk, uint32_t maxPskLen);
58
69typedef uint32_t (*HITLS_PskServerCb)(HITLS_Ctx *ctx, const uint8_t *identity, uint8_t *psk, uint32_t maxPskLen);
70
82typedef int32_t (*HITLS_PskFindSessionCb)(HITLS_Ctx *ctx, const uint8_t *identity, uint32_t identityLen,
83 HITLS_Session **session);
84
97typedef int32_t (*HITLS_PskUseSessionCb)(HITLS_Ctx *ctx, uint32_t hashAlgo, const uint8_t **id,
98 uint32_t *idLen, HITLS_Session **session);
99
110int32_t HITLS_CFG_SetPskIdentityHint(HITLS_Config *config, const uint8_t *hint, uint32_t hintSize);
111
122
133
144
155
166int32_t HITLS_SetPskIdentityHint(HITLS_Ctx *ctx, const uint8_t *identityHint, uint32_t identityHintLen);
167
178
189
200
211
212#ifdef __cplusplus
213}
214#endif
215
216#endif
int32_t(* HITLS_PskUseSessionCb)(HITLS_Ctx *ctx, uint32_t hashAlgo, const uint8_t **id, uint32_t *idLen, HITLS_Session **session)
TLS1.3 client PSK negotiation callback
定义 hitls_psk.h:97
int32_t HITLS_CFG_SetPskServerCallback(HITLS_Config *config, HITLS_PskServerCb callback)
Set the PSK callback on the server, which is used to obtain the PSK during PSK negotiation.
uint32_t(* HITLS_PskServerCb)(HITLS_Ctx *ctx, const uint8_t *identity, uint8_t *psk, uint32_t maxPskLen)
Obtain the PSK prototype on the server.
定义 hitls_psk.h:69
uint32_t(* HITLS_PskClientCb)(HITLS_Ctx *ctx, const uint8_t *hint, uint8_t *identity, uint32_t maxIdentityLen, uint8_t *psk, uint32_t maxPskLen)
Obtain the PSK prototype on the client.
定义 hitls_psk.h:56
int32_t HITLS_SetPskFindSessionCallback(HITLS_Ctx *ctx, HITLS_PskFindSessionCb cb)
Set the server callback, which is used to restore the PSK session of TLS1.3, cb can be NULL.
int32_t HITLS_SetPskClientCallback(HITLS_Ctx *ctx, HITLS_PskClientCb cb)
Set the PSK callback function on the client, which is used to obtain the identity and PSK during PSK ...
int32_t HITLS_SetPskUseSessionCallback(HITLS_Ctx *ctx, HITLS_PskUseSessionCb cb)
Set the client callback, which is used to restore the PSK session of TLS1.3, cb can be NULL.
int32_t(* HITLS_PskFindSessionCb)(HITLS_Ctx *ctx, const uint8_t *identity, uint32_t identityLen, HITLS_Session **session)
TLS1.3 server PSK negotiation callback
定义 hitls_psk.h:82
int32_t HITLS_SetPskServerCallback(HITLS_Ctx *ctx, HITLS_PskServerCb cb)
Set the PSK callback on the server, which is used to obtain the PSK during PSK negotiation.
int32_t HITLS_CFG_SetPskFindSessionCallback(HITLS_Config *config, HITLS_PskFindSessionCb callback)
Set the server callback, which is used to restore the PSK session of TLS1.3, cb can be NULL.
int32_t HITLS_CFG_SetPskIdentityHint(HITLS_Config *config, const uint8_t *hint, uint32_t hintSize)
Set the PSK prompt information for PSK negotiation.
int32_t HITLS_CFG_SetPskClientCallback(HITLS_Config *config, HITLS_PskClientCb callback)
Set the PSK callback function on the client, which is used to obtain the identity and PSK during PSK ...
int32_t HITLS_SetPskIdentityHint(HITLS_Ctx *ctx, const uint8_t *identityHint, uint32_t identityHintLen)
Set the PSK identity hint on the server, which is used to provide identity hints for the client durin...
int32_t HITLS_CFG_SetPskUseSessionCallback(HITLS_Config *config, HITLS_PskUseSessionCb callback)
Set the server callback, which is used to restore the PSK session of TLS1.3, cb can be NULL.
struct TlsCtx HITLS_Ctx
HITLS context
定义 hitls_type.h:35
struct TlsConfig HITLS_Config
config context
定义 hitls_type.h:41