21#include "hitls_build.h"
22#include "hitls_cert_type.h"
23#include "hitls_cert.h"
24#include "hitls_debug.h"
25#include "hitls_config.h"
26#include "hitls_session.h"
28#include "hitls_security.h"
31#include "hitls_alpn.h"
32#include "sal_atomic.h"
33#ifdef HITLS_TLS_FEATURE_PROVIDER
34#include "crypt_eal_provider.h"
53#define HITLS_VERSION_DTLS10 0xfeffu
55#define HITLS_TICKET_KEY_NAME_SIZE 16u
56#define HITLS_TICKET_KEY_SIZE 32u
57#define HITLS_TICKET_IV_SIZE 16u
60#define HITLS_TLS13_TICKET_NUM_DEFAULT 2u
61#define HITLS_MAX_EMPTY_RECORDS 32
62#ifdef HITLS_TLS_FEATURE_MAX_SEND_FRAGMENT
63#define HITLS_MAX_SEND_FRAGMENT_DEFAULT 16384
66#define HITLS_MAX_CERT_LIST_DEFAULT (1024 * 100)
68#define HITLS_ENDPOINT_UNDEFINED 0
69#define HITLS_ENDPOINT_CLIENT 1
70#define HITLS_ENDPOINT_SERVER 2
82 uint32_t sharedkeyLen;
83 uint32_t ciphertextLen;
93 uint16_t signatureScheme;
96 int32_t signHashAlgId;
100 uint32_t certVersionBits;
101 uint32_t chainVersionBits;
104#ifdef HITLS_TLS_FEATURE_PROVIDER
110 CRYPT_EAL_ProvMgrCtx *provMgrCtx;
112#define TLS_CAPABILITY_LIST_MALLOC_SIZE 10
122 HITLS_Lib_Ctx *libCtx;
123 const char *attrName;
124#ifdef HITLS_TLS_FEATURE_PROVIDER_DYNAMIC
126 uint32_t groupInfolen;
127 uint32_t groupInfoSize;
129 uint32_t sigSchemeInfolen;
130 uint32_t sigSchemeInfoSize;
134 uint32_t originVersionMask;
137 uint32_t modeSupport;
139 uint16_t *tls13CipherSuites;
140 uint32_t tls13cipherSuitesSize;
141 uint16_t *cipherSuites;
142 uint32_t cipherSuitesSize;
143 uint8_t *pointFormats;
144 uint32_t pointFormatsSize;
148 uint16_t *signAlgorithms;
149 uint32_t signAlgorithmsSize;
152 uint32_t alpnListSize;
155 void *securityExData;
156 int32_t securityLevel;
159 uint32_t serverNameSize;
162 uint32_t emptyRecordsNum;
165 uint8_t *pskIdentityHint;
175 uint32_t dtlsPostHsTimeoutVal;
177 HITLS_CRYPT_Key *dhTmp;
185 void *recordPaddingArg;
187 uint32_t keyExchMode;
189 uint32_t maxCertList;
192 CERT_MgrCtx *certMgrCtx;
194 uint32_t sessionIdCtxSize;
198 uint16_t maxSendFragment;
199 uint32_t recInbufferSize;
200 TLS_SessionMgr *sessMgr;
205 uint16_t recordSizeLimit;
207 bool needCheckKeyUsage;
208 bool needCheckPmsVersion;
209 bool isSupportRenegotiation;
210 bool allowClientRenegotiate;
211 bool allowLegacyRenegotiate;
212 bool isResumptionOnRenego;
213 bool isSupportDhAuto;
216 bool isSupportClientVerify;
217 bool isSupportNoClientCert;
218 bool isSupportPostHandshakeAuth;
219 bool isSupportVerifyNone;
221 bool isSupportClientOnceVerify;
224 bool isQuietShutdown;
225 bool isEncryptThenMac;
227 bool isSupportDtlsCookieExchange;
228 bool isFlightTransmitEnable;
231 bool isSupportSessionTicket;
232 bool isSupportServerPreference;
248 void *clientHelloCbArg;
252 uint8_t *sessionTicketExt;
253 uint32_t sessionTicketExtSize;
255 void *sessionTicketExtCbArg;
258 bool isMiddleBoxCompat;
260 HITLS_CustomExts *customExts;
263#define LIBCTX_FROM_CONFIG(config) (((config) == NULL) ? NULL : (config)->libCtx)
264#define ATTRIBUTE_FROM_CONFIG(config) (((config) == NULL) ? NULL : (config)->attrName)
int32_t(* HITLS_AlpnSelectCb)(HITLS_Ctx *ctx, uint8_t **selectedProto, uint8_t *selectedProtoSize, uint8_t *clientAlpnList, uint32_t clientAlpnListSize, void *userData)
Callback prototype for selecting the ALPN protocol on the server, which is used to select the applica...
定义 hitls_alpn.h:57
struct BslList HITLS_TrustedCAList
Describes the list of trusted CAs
定义 hitls_cert_type.h:67
void(* HITLS_KeyLogCb)(HITLS_Ctx *ctx, const char *line)
Key logging callback
定义 hitls_cert.h:964
HITLS_CRYPT_Key *(* HITLS_DhTmpCb)(HITLS_Ctx *ctx, int32_t isExport, uint32_t keyLen)
Generate temporary DH key.
定义 hitls_config.h:1522
uint64_t(* HITLS_RecordPaddingCb)(HITLS_Ctx *ctx, int32_t type, uint64_t length, void *arg)
Callback function for handling TLS record padding.
定义 hitls_config.h:1545
void(* HITLS_ConfigUserDataFreeCb)(void *)
UserData free callback
定义 hitls_config.h:1331
int32_t(* HITLS_ClientHelloCb)(HITLS_Ctx *ctx, int32_t *alert, void *arg)
ClientHello callback prototype for the server to process the callback.
定义 hitls_config.h:973
uint32_t(* HITLS_DtlsTimerCb)(HITLS_Ctx *ctx, uint32_t us)
DTLS callback prototype for obtaining the timeout interval
定义 hitls_config.h:993
int32_t(* HITLS_AppVerifyCookieCb)(HITLS_Ctx *ctx, const uint8_t *cookie, uint32_t cookieLen)
The server verifies the cookie callback prototype.
定义 hitls_cookie.h:62
int32_t(* HITLS_AppGenCookieCb)(HITLS_Ctx *ctx, uint8_t *cookie, uint32_t *cookieLen)
Cookie callback prototype generated by the server.
定义 hitls_cookie.h:51
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
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_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_SecurityCb)(const HITLS_Ctx *ctx, const HITLS_Config *config, int32_t option, int32_t bits, int32_t id, void *other, void *exData)
Secure Callback Function Prototype
定义 hitls_security.h:139
int32_t(* HITLS_SessionTicketExtProcessCb)(HITLS_Ctx *ctx, const uint8_t *data, int32_t len, void *arg)
Session ticket extension callback.
定义 hitls_session.h:157
void(* HITLS_SessionRemoveCb)(HITLS_Config *config, HITLS_Session *sess)
Remove a session.
定义 hitls_session.h:132
HITLS_Session *(* HITLS_SessionGetCb)(HITLS_Ctx *ctx, const uint8_t *data, int32_t len, int32_t *copy)
Get a session based on the session ID.
定义 hitls_session.h:145
int32_t(* HITLS_NewSessionCb)(HITLS_Ctx *ctx, HITLS_Session *session)
This callback is called when a new session is negotiated. Users can use sessions.
定义 hitls_session.h:123
#define HITLS_SESSION_ID_CTX_MAX_SIZE
Session id Maximum size of the CTX.
定义 hitls_session.h:40
int32_t(* HITLS_SniDealCb)(HITLS_Ctx *ctx, int *alert, void *arg)
Set the extension prototype for the server to process Client Hello server_name.
定义 hitls_sni.h:102
struct TlsConfig HITLS_Config
config context
定义 hitls_type.h:41
DTLS cookie callback and helper definitions.
定义 custom_extensions.h:35
Group information
定义 tls_config.h:75
Signature scheme information
定义 tls_config.h:91
TLS Global Configuration
定义 tls_config.h:120