API参考
载入中...
搜索中...
未找到
hitls_custom_extensions.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_CUSTOM_EXTENSIONS_H
23#define HITLS_CUSTOM_EXTENSIONS_H
24
25#include <stdint.h>
26#include "hitls_type.h"
27#include "hitls_cert_type.h"
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33/* Extension context */
34
39#define HITLS_EX_TYPE_CLIENT_HELLO 0x00001
40
45#define HITLS_EX_TYPE_TLS1_2_SERVER_HELLO 0x00002
46
51#define HITLS_EX_TYPE_TLS1_3_SERVER_HELLO 0x00004
52
57#define HITLS_EX_TYPE_HELLO_RETRY_REQUEST 0x00008
58
63#define HITLS_EX_TYPE_ENCRYPTED_EXTENSIONS 0x00010
64
69#define HITLS_EX_TYPE_TLS1_3_CERTIFICATE 0x00020
70
75#define HITLS_EX_TYPE_TLS1_3_CERTIFICATE_REQUEST 0x00040
76
81#define HITLS_EX_TYPE_TLS1_3_NEW_SESSION_TICKET 0x00080
82
83
84#define HITLS_ADD_CUSTOM_EXTENSION_RET_PACK 1
85#define HITLS_ADD_CUSTOM_EXTENSION_RET_PASS HITLS_SUCCESS
86
108typedef int (*HITLS_AddCustomExtCallback) (const HITLS_Ctx *ctx, uint16_t extType, uint32_t context, uint8_t **out,
109 uint32_t *outLen, HITLS_CERT_X509 *cert, uint32_t certIndex, uint32_t *alert, void *addArg);
110
123typedef void (*HITLS_FreeCustomExtCallback) (const HITLS_Ctx *ctx, uint16_t extType, uint32_t context,
124 uint8_t *out, void *addArg);
125
144typedef int (*HITLS_ParseCustomExtCallback) (const HITLS_Ctx *ctx, uint16_t extType, uint32_t context,
145 const uint8_t **in, uint32_t *inLen, HITLS_CERT_X509 *cert, uint32_t certIndex, uint32_t *alert, void *parseArg);
146
147
161
175
189
190#ifdef __cplusplus
191}
192#endif
193
194#endif /* HITLS_CUSTOM_EXTENSIONS_H */
void HITLS_CERT_X509
Describes the x509 certificate
定义 hitls_cert_type.h:37
uint32_t HITLS_AddCustomExtension(HITLS_Ctx *ctx, const HITLS_CustomExtParams *params)
Add a custom extension to the TLS context using a parameter structure.
void(* HITLS_FreeCustomExtCallback)(const HITLS_Ctx *ctx, uint16_t extType, uint32_t context, uint8_t *out, void *addArg)
Callback function to free a custom extension.
定义 hitls_custom_extensions.h:123
uint32_t HITLS_CFG_AddCustomExtension(HITLS_Config *config, const HITLS_CustomExtParams *params)
Add a custom extension to the HITLS configuration using a parameter structure.
int(* HITLS_ParseCustomExtCallback)(const HITLS_Ctx *ctx, uint16_t extType, uint32_t context, const uint8_t **in, uint32_t *inLen, HITLS_CERT_X509 *cert, uint32_t certIndex, uint32_t *alert, void *parseArg)
Callback function to parse a custom extension.
定义 hitls_custom_extensions.h:144
int(* HITLS_AddCustomExtCallback)(const HITLS_Ctx *ctx, uint16_t extType, uint32_t context, uint8_t **out, uint32_t *outLen, HITLS_CERT_X509 *cert, uint32_t certIndex, uint32_t *alert, void *addArg)
Callback function to add a custom extension.
定义 hitls_custom_extensions.h:108
struct TlsCtx HITLS_Ctx
HITLS context
定义 hitls_type.h:35
struct TlsConfig HITLS_Config
config context
定义 hitls_type.h:41
Structure to hold parameters for adding a custom extension.
定义 hitls_custom_extensions.h:152
HITLS_ParseCustomExtCallback parseCb
定义 hitls_custom_extensions.h:158
void * parseArg
定义 hitls_custom_extensions.h:159
uint32_t context
定义 hitls_custom_extensions.h:154
HITLS_FreeCustomExtCallback freeCb
定义 hitls_custom_extensions.h:156
void * addArg
定义 hitls_custom_extensions.h:157
uint16_t extType
定义 hitls_custom_extensions.h:153
HITLS_AddCustomExtCallback addCb
定义 hitls_custom_extensions.h:155