API参考
载入中...
搜索中...
未找到
parse_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 PARSER_COMMON_H
17#define PARSER_COMMON_H
18
19#include <stdint.h>
20#include "tls.h"
21#include "hs_msg.h"
22#include "cert_method.h"
23#include "security.h"
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
29typedef struct {
30 TLS_Ctx *ctx;
31 const uint8_t *buf;
32 uint32_t bufLen;
33 uint32_t *bufOffset;
35
45int32_t ParseVersion(ParsePacket *pkt, uint16_t *version);
46
58int32_t ParseRandom(ParsePacket *pkt, uint8_t *random, uint32_t randomSize);
59
72int32_t ParseSessionId(ParsePacket *pkt, uint8_t *idSize, uint8_t **id);
73
86int32_t ParseCookie(ParsePacket *pkt, uint8_t *cookieLen, uint8_t **cookie);
87
96HITLS_TrustedCAList *ParseDNList(const uint8_t *data, uint32_t len);
97
105void FreeDNList(HITLS_TrustedCAList *caList);
106
116int32_t ParseBytesToUint8(ParsePacket *pkt, uint8_t *object);
117
127int32_t ParseBytesToUint16(ParsePacket *pkt, uint16_t *object);
128
138int32_t ParseBytesToUint24(ParsePacket *pkt, uint32_t *object);
139
149int32_t ParseBytesToUint32(ParsePacket *pkt, uint32_t *object);
150
161int32_t ParseOneByteLengthField(ParsePacket *pkt, uint8_t *objectSize, uint8_t **object);
162
173int32_t ParseTwoByteLengthField(ParsePacket *pkt, uint16_t *objectSize, uint8_t **object);
174
185int32_t ParseBytesToArray(ParsePacket *pkt, uint8_t **object, uint32_t length);
186
197int32_t ParseCopyBytesToArray(ParsePacket *pkt, uint8_t *object, uint32_t length);
198
210int32_t ParseErrorProcess(TLS_Ctx *ctx, int32_t err, uint32_t logId, const void *format, ALERT_Description description);
211
221int32_t CheckPeerSignScheme(HITLS_Ctx *ctx, CERT_Pair *peerCert, uint16_t signScheme);
222
223int32_t ParseExtensionCommon(ParsePacket *pkt, uint16_t *exMsgLen);
224#ifdef __cplusplus
225}
226#endif /* end __cplusplus */
227
228#endif /* end PARSER_COMMON_H */
struct BslList HITLS_TrustedCAList
Describes the list of trusted CAs
定义 hitls_cert_type.h:67
struct TlsCtx HITLS_Ctx
HITLS context
定义 hitls_type.h:35
定义 cert_mgr.h:32
定义 parse_common.h:29