API参考
载入中...
搜索中...
未找到
conn_common.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 CONN_COMMON_H
17#define CONN_COMMON_H
18
19#include <stdint.h>
20#include "hitls_build.h"
21#include "tls.h"
22#include "hitls_type.h"
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28#define MAX_ALERT_COUNT 5u
29#define GET_GROUPS_CNT (-1)
30
31typedef int32_t (*ManageEventProcess)(HITLS_Ctx *ctx);
32
33typedef int32_t (*WriteEventProcess)(HITLS_Ctx *ctx, const uint8_t *data, uint32_t dataLen, uint32_t *writeLen);
34
35typedef int32_t (*ReadEventProcess)(HITLS_Ctx *ctx, uint8_t *data, uint32_t bufSize, uint32_t *readLen);
36
37static inline CM_State GetConnState(const HITLS_Ctx *ctx)
38{
39 return ctx->state;
40}
41#ifdef HITLS_TLS_FEATURE_PHA
42int32_t CommonCheckPostHandshakeAuth(TLS_Ctx *ctx);
43#endif
48int32_t CommonEventInAlertingState(HITLS_Ctx *ctx);
49
54int32_t CommonEventInHandshakingState(HITLS_Ctx *ctx);
55
62int32_t AlertEventProcess(HITLS_Ctx *ctx);
63
64void ChangeConnState(HITLS_Ctx *ctx, CM_State state);
65
66void ConnCleanSensitiveData(TLS_Ctx *ctx);
67
68#ifdef HITLS_TLS_FEATURE_RENEGOTIATION
78int32_t CommonEventInRenegotiationState(HITLS_Ctx *ctx);
79
88void InnerRenegotiationProcess(HITLS_Ctx *ctx);
89#endif
90
91#ifdef __cplusplus
92}
93#endif
94
95#endif
struct TlsCtx HITLS_Ctx
HITLS context
定义 hitls_type.h:35