API参考
载入中...
搜索中...
未找到
hs.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 HS_H
17#define HS_H
18
19#include "tls.h"
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
32int32_t HS_Init(TLS_Ctx *ctx);
33
39void HS_DeInit(TLS_Ctx *ctx);
40
49int32_t HS_DoHandshake(TLS_Ctx *ctx);
50
51
61int32_t HS_KeyEstablish(TLS_Ctx *ctx, bool isClient);
62
71int32_t HS_ResumeKeyEstablish(TLS_Ctx *ctx);
72
80uint32_t HS_GetState(const TLS_Ctx *ctx);
81
89const char *HS_GetStateStr(uint32_t state);
90
100int32_t HS_CheckKeyUpdateState(TLS_Ctx *ctx, uint32_t updateType);
101
102
110const char *HS_GetServerName(const TLS_Ctx *ctx);
111
119#ifdef HITLS_TLS_PROTO_DTLS12
120int32_t HS_CheckAndProcess2MslTimeout(TLS_Ctx *ctx);
121
132int32_t HS_DtlsSendFragmentHsMsg(TLS_Ctx *ctx, uint32_t maxRecPayloadLen, const uint8_t *msgData);
133#endif
134
142bool IsHsSendState(HITLS_HandshakeState state);
143
144int32_t HS_CheckPostHandshakeAuth(TLS_Ctx *ctx);
145
146#define TLS_IS_FIRST_HANDSHAKE(ctx) ((ctx)->negotiatedInfo.clientVerifyDataSize == 0 \
147 || (ctx)->negotiatedInfo.serverVerifyDataSize == 0)
148
149#ifdef __cplusplus
150}
151#endif
152#endif /* HS_H */