API参考
载入中...
搜索中...
未找到
hitls.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
17
18#ifndef HITLS_H
19#define HITLS_H
20
21#include <stdint.h>
22#include <stddef.h>
23#include "hitls_type.h"
24#include "hitls_config.h"
25#include "hitls_cert_type.h"
26#include "bsl_uio.h"
27#include "bsl_sal.h"
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
44
52void HITLS_Free(HITLS_Ctx *ctx);
53
61int32_t HITLS_Clear(HITLS_Ctx *ctx);
62
78int32_t HITLS_SetUio(HITLS_Ctx *ctx, BSL_UIO *uio);
79
91
99BSL_UIO *HITLS_GetUio(const HITLS_Ctx *ctx);
100
109
129int32_t HITLS_Connect(HITLS_Ctx *ctx);
130
140int32_t HITLS_SetEndPoint(HITLS_Ctx *ctx, bool isClient);
141
162int32_t HITLS_Accept(HITLS_Ctx *ctx);
163
178int32_t HITLS_Listen(HITLS_Ctx *ctx, BSL_SAL_SockAddr clientAddr);
179
200int32_t HITLS_Read(HITLS_Ctx *ctx, uint8_t *data, uint32_t bufSize, uint32_t *readLen);
201
216int32_t HITLS_Peek(HITLS_Ctx *ctx, uint8_t *data, uint32_t bufSize, uint32_t *readLen);
217
234int32_t HITLS_Write(HITLS_Ctx *ctx, const uint8_t *data, uint32_t dataLen, uint32_t *writeLen);
235
245int32_t HITLS_GetMaxWriteSize(const HITLS_Ctx *ctx, uint32_t *len);
246
257void *HITLS_GetUserData(const HITLS_Ctx *ctx);
258
272int32_t HITLS_SetUserData(HITLS_Ctx *ctx, void *userData);
273
284int32_t HITLS_Close(HITLS_Ctx *ctx);
285
303int32_t HITLS_SetShutdownState(HITLS_Ctx *ctx, uint32_t mode);
304
314int32_t HITLS_GetShutdownState(const HITLS_Ctx *ctx, uint32_t *mode);
315
325int32_t HITLS_GetNegotiatedVersion(const HITLS_Ctx *ctx, uint16_t *version);
326
336int32_t HITLS_GetMaxProtoVersion(const HITLS_Ctx *ctx, uint16_t *maxVersion);
337
347int32_t HITLS_GetMinProtoVersion(const HITLS_Ctx *ctx, uint16_t *minVersion);
348
362int32_t HITLS_SetMinProtoVersion(HITLS_Ctx *ctx, uint16_t version);
363
377int32_t HITLS_SetMaxProtoVersion(HITLS_Ctx *ctx, uint16_t version);
378
388int32_t HITLS_IsAead(const HITLS_Ctx *ctx, bool *isAead);
389
399int32_t HITLS_IsDtls(const HITLS_Ctx *ctx, bool *isDtls);
400
410int32_t HITLS_SetErrorCode(HITLS_Ctx *ctx, int32_t errorCode);
411
419int32_t HITLS_GetErrorCode(const HITLS_Ctx *ctx);
420
430int32_t HITLS_IsHandShakeDone(const HITLS_Ctx *ctx, uint8_t *isDone);
431
441int32_t HITLS_IsServer(const HITLS_Ctx *ctx, bool *isServer);
442
453int32_t HITLS_ReadHasPending(const HITLS_Ctx *ctx, bool *isPending);
454
465uint32_t HITLS_GetReadPendingBytes(const HITLS_Ctx *ctx);
466
476int32_t HITLS_GetPeerSignScheme(const HITLS_Ctx *ctx, HITLS_SignHashAlgo *peerSignScheme);
477
487int32_t HITLS_GetLocalSignScheme(const HITLS_Ctx *ctx, HITLS_SignHashAlgo *localSignScheme);
488
515int32_t HITLS_GetSharedSigAlgs(const HITLS_Ctx *ctx, int32_t idx, uint16_t *signatureScheme, int32_t *keyType,
516 int32_t *paraId);
517
528int32_t HITLS_SetEcGroups(HITLS_Ctx *ctx, uint16_t *lst, uint32_t groupSize);
529
542int32_t HITLS_SetGroupList(HITLS_Ctx *ctx, const char *groups, uint32_t groupNamesLen);
543
554int32_t HITLS_SetSigalgsList(HITLS_Ctx *ctx, const uint16_t *signAlgs, uint16_t signAlgsSize);
555
566int32_t HITLS_SetEcPointFormats(HITLS_Ctx *ctx, const uint8_t *pointFormats, uint32_t pointFormatsSize);
567
578int32_t HITLS_SetClientVerifySupport(HITLS_Ctx *ctx, bool support);
579
594int32_t HITLS_SetNoClientCertSupport(HITLS_Ctx *ctx, bool support);
595
606
616int32_t HITLS_SetVerifyNoneSupport(HITLS_Ctx *ctx, bool support);
617
627int32_t HITLS_SetClientOnceVerifySupport(HITLS_Ctx *ctx, bool support);
628
637const HITLS_Config *HITLS_GetConfig(const HITLS_Ctx *ctx);
638
647
657
670int32_t HITLS_SetCipherSuites(HITLS_Ctx *ctx, const uint16_t *cipherSuites, uint32_t cipherSuitesSize);
671
682int32_t HITLS_GetCipherSuites(HITLS_Ctx *ctx, uint16_t *data, uint32_t dataLen, uint32_t *cipherSuitesSize);
683
694int32_t HITLS_GetClientCipherSuites(HITLS_Ctx *ctx, uint16_t *data, uint32_t dataLen, uint32_t *cipherSuitesSize);
695
705
713HITLS_CIPHER_List *HITLS_GetSupportedCiphers(const HITLS_Ctx *ctx);
714
728int32_t HITLS_GetHsRandom(const HITLS_Ctx *ctx, uint8_t *out, uint32_t *outlen, bool isClient);
729
739int32_t HITLS_GetHandShakeState(const HITLS_Ctx *ctx, uint32_t *state);
740
749const char *HITLS_GetStateString(uint32_t state);
750
760int32_t HITLS_IsHandShaking(const HITLS_Ctx *ctx, bool *isHandShaking);
761
771int32_t HITLS_GetRenegotiationSupport(const HITLS_Ctx *ctx, bool *isSupportRenegotiation);
772
782int32_t HITLS_IsBeforeHandShake(const HITLS_Ctx *ctx, bool *isBefore);
783
794int32_t HITLS_SetLinkMtu(HITLS_Ctx *ctx, uint16_t linkMtu);
795
806int32_t HITLS_SetMtu(HITLS_Ctx *ctx, uint16_t mtu);
807
817int32_t HITLS_SetNoQueryMtu(HITLS_Ctx *ctx, bool noQueryMtu);
818
828int32_t HITLS_GetNeedQueryMtu(HITLS_Ctx *ctx, bool *needQueryMtu);
829
839int32_t HITLS_GetClientVersion(const HITLS_Ctx *ctx, uint16_t *clientVersion);
840
849int32_t HITLS_DoHandShake(HITLS_Ctx *ctx);
850
860int32_t HITLS_IsClient(const HITLS_Ctx *ctx, bool *isClient);
861
871int32_t HITLS_KeyUpdate(HITLS_Ctx *ctx, uint32_t updateType);
872
882
900int32_t HITLS_GetSharedGroup(const HITLS_Ctx *ctx, int32_t nmatch, uint16_t *groupId);
901
911
921int32_t HITLS_GetVersionSupport(const HITLS_Ctx *ctx, uint32_t *version);
922
937int32_t HITLS_SetVersionSupport(HITLS_Ctx *ctx, uint32_t version);
938
953int32_t HITLS_SetVersion(HITLS_Ctx *ctx, uint32_t minVersion, uint32_t maxVersion);
954
964int32_t HITLS_SetVersionForbid(HITLS_Ctx *ctx, uint32_t noVersion);
965
978int32_t HITLS_SetNeedCheckPmsVersion(HITLS_Ctx *ctx, bool needCheck);
979
990int32_t HITLS_SetQuietShutdown(HITLS_Ctx *ctx, int32_t mode);
991
1001int32_t HITLS_GetQuietShutdown(const HITLS_Ctx *ctx, int32_t *mode);
1002
1014int32_t HITLS_SetDhAutoSupport(HITLS_Ctx *ctx, bool support);
1015
1025int32_t HITLS_SetTmpDh(HITLS_Ctx *ctx, HITLS_CRYPT_Key *dhPkey);
1026
1036
1047
1057
1068
1078
1091int32_t HITLS_GetPeerFinishVerifyData(const HITLS_Ctx *ctx, void *buf, uint32_t bufLen, uint32_t *dataLen);
1092
1102int32_t HITLS_SetCheckKeyUsage(HITLS_Ctx *ctx, bool isCheck);
1103
1116int32_t HITLS_GetFinishVerifyData(const HITLS_Ctx *ctx, void *buf, uint32_t bufLen, uint32_t *dataLen);
1117
1127int32_t HITLS_GetSecureRenegotiationSupport(const HITLS_Ctx *ctx, bool *isSecureRenegotiation);
1128
1173
1188int32_t HITLS_GetRenegotiationState(const HITLS_Ctx *ctx, bool *isRenegotiationState);
1189
1190
1201int32_t HITLS_GetRwstate(const HITLS_Ctx *ctx, uint8_t *rwstate);
1202
1212int32_t HITLS_GetClientVerifySupport(HITLS_Ctx *ctx, bool *isSupport);
1213
1224int32_t HITLS_GetNoClientCertSupport(HITLS_Ctx *ctx, bool *isSupport);
1225
1235int32_t HITLS_GetPostHandshakeAuthSupport(HITLS_Ctx *ctx, bool *isSupport);
1236
1246int32_t HITLS_GetVerifyNoneSupport(HITLS_Ctx *ctx, bool *isSupport);
1247
1257int32_t HITLS_GetClientOnceVerifySupport(HITLS_Ctx *ctx, bool *isSupport);
1258
1259
1269int32_t HITLS_ClearRenegotiationNum(HITLS_Ctx *ctx, uint32_t *renegotiationNum);
1270
1280int32_t HITLS_GetNegotiateGroup(const HITLS_Ctx *ctx, uint16_t *group);
1281
1290int32_t HITLS_SetModeSupport(HITLS_Ctx *ctx, uint32_t mode);
1291
1301int32_t HITLS_ClearModeSupport(HITLS_Ctx *ctx, uint32_t mode);
1302
1311int32_t HITLS_GetModeSupport(const HITLS_Ctx *ctx, uint32_t *mode);
1312
1322int32_t HITLS_SetEncryptThenMac(HITLS_Ctx *ctx, bool encryptThenMacType);
1323
1333int32_t HITLS_GetEncryptThenMac(const HITLS_Ctx *ctx, bool *encryptThenMacType);
1334
1345int32_t HITLS_SetServerName(HITLS_Ctx *ctx, uint8_t *serverName, uint32_t serverNameStrlen);
1346
1356int32_t HITLS_SetCipherServerPreference(HITLS_Ctx *ctx, bool isSupport);
1357
1368int32_t HITLS_GetCipherServerPreference(const HITLS_Ctx *ctx, bool *isSupport);
1369
1382int32_t HITLS_SetRenegotiationSupport(HITLS_Ctx *ctx, bool isSupport);
1383
1392int32_t HITLS_SetClientRenegotiateSupport(HITLS_Ctx *ctx, bool isSupport);
1393
1402int32_t HITLS_SetLegacyRenegotiateSupport(HITLS_Ctx *ctx, bool isSupport);
1403
1413int32_t HITLS_SetSessionTicketSupport(HITLS_Ctx *ctx, bool isSupport);
1414
1424int32_t HITLS_GetSessionTicketSupport(const HITLS_Ctx *ctx, bool *isSupport);
1425
1435int32_t HITLS_SetDtlsCookieExangeSupport(HITLS_Ctx *ctx, bool isSupport);
1436
1446int32_t HITLS_GetDtlsCookieExangeSupport(const HITLS_Ctx *ctx, bool *isSupport);
1447
1458int32_t HITLS_SetFlightTransmitSwitch(HITLS_Ctx *ctx, bool isEnable);
1459
1469int32_t HITLS_GetFlightTransmitSwitch(const HITLS_Ctx *ctx, bool *isEnable);
1470
1480int32_t HITLS_SetEmptyRecordsNum(HITLS_Ctx *ctx, uint32_t emptyNum);
1481
1492int32_t HITLS_SetMaxSendFragment(HITLS_Ctx *ctx, uint16_t maxSendFragment);
1493
1504int32_t HITLS_GetMaxSendFragment(const HITLS_Ctx *ctx, uint16_t *maxSendFragment);
1505
1516int32_t HITLS_SetRecInbufferSize(HITLS_Ctx *ctx, uint32_t recInbufferSize);
1517
1527int32_t HITLS_GetRecInbufferSize(const HITLS_Ctx *ctx, uint32_t *recInbufferSize);
1528
1538int32_t HITLS_GetEmptyRecordsNum(const HITLS_Ctx *ctx, uint32_t *emptyNum);
1539
1549int32_t HITLS_SetMaxCertList(HITLS_Ctx *ctx, uint32_t maxSize);
1550
1560int32_t HITLS_GetMaxCertList(const HITLS_Ctx *ctx, uint32_t *maxSize);
1561
1579int32_t HITLS_ExportKeyingMaterial(HITLS_Ctx *ctx, uint8_t *out, size_t outLen, const char *label, size_t labelLen,
1580 const uint8_t *context, size_t contextLen, int32_t useContext);
1581
1593
1602int32_t HITLS_SetKeepPeerCertificate(HITLS_Ctx *ctx, bool isKeepPeerCert);
1603
1614int32_t HITLS_SetRecordSizeLimit(HITLS_Ctx *ctx, uint16_t recordSize);
1615
1625int32_t HITLS_GetRecordSizeLimit(HITLS_Ctx *ctx, uint16_t *recordSize);
1626
1636int32_t HITLS_ClientHelloGetLegacyVersion(HITLS_Ctx *ctx, uint16_t *version);
1637
1649int32_t HITLS_ClientHelloGetRandom(HITLS_Ctx *ctx, uint8_t **out, uint8_t *outlen);
1650
1662int32_t HITLS_ClientHelloGetSessionID(HITLS_Ctx *ctx, uint8_t **out, uint8_t *outlen);
1663
1675int32_t HITLS_ClientHelloGetCiphers(HITLS_Ctx *ctx, uint16_t **out, uint16_t *outlen);
1676
1689int32_t HITLS_ClientHelloGetExtensionsPresent(HITLS_Ctx *ctx, uint16_t **out, uint8_t *outlen);
1690
1703int32_t HITLS_ClientHelloGetExtension(HITLS_Ctx *ctx, uint16_t type, uint8_t **out, uint32_t *outlen);
1704
1715
1726int32_t HITLS_DtlsGetTimeout(HITLS_Ctx *ctx, uint64_t *remainTimeOut);
1727
1737int32_t HITLS_SetMiddleBoxCompat(HITLS_Ctx *ctx, bool isMiddleBox);
1738
1748int32_t HITLS_GetMiddleBoxCompat(HITLS_Ctx *ctx, bool *isMiddleBox);
1749
1759int32_t HITLS_GetOutPendingSize(const HITLS_Ctx *ctx, uint32_t *size);
1760
1770int32_t HITLS_Flush(HITLS_Ctx *ctx);
1771
1782int32_t HITLS_SetExtendedMasterSecretSupport(HITLS_Ctx *ctx, bool support);
1783
1793int32_t HITLS_GetExtendedMasterSecretSupport(HITLS_Ctx *ctx, bool *isSupport);
1794
1804int32_t HITLS_SetExtendedMasterSecretMode(HITLS_Ctx *ctx, int32_t mode);
1805
1815int32_t HITLS_GetExtendedMasterSecretMode(HITLS_Ctx *ctx, int32_t *mode);
1816
1827
1837int32_t HITLS_GetResumptionOnRenegoSupport(HITLS_Ctx *ctx, bool *isSupport);
1838
1847int32_t HITLS_GetClientRenegotiateSupport(HITLS_Ctx *ctx, bool *isSupport);
1848
1849#ifdef __cplusplus
1850}
1851#endif
1852
1853#endif /* HITLS_H */
struct UIO_ControlBlock BSL_UIO
UIO module control structure
定义 bsl_uio.h:37
HITLS_SignHashAlgo
Certificate Signature Algorithm Enumeration
定义 hitls_cert_type.h:177
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
uint32_t(* HITLS_DtlsTimerCb)(HITLS_Ctx *ctx, uint32_t us)
DTLS callback prototype for obtaining the timeout interval
定义 hitls_config.h:993
struct TlsCtx HITLS_Ctx
HITLS context
定义 hitls_type.h:35
struct TlsConfig HITLS_Config
config context
定义 hitls_type.h:41
struct TlsCipherSuiteInfo HITLS_Cipher
cipherSuite information
定义 hitls_type.h:47
int32_t HITLS_GetRecInbufferSize(const HITLS_Ctx *ctx, uint32_t *recInbufferSize)
Obtain the rec inbuffer inital size
BSL_UIO * HITLS_GetReadUio(const HITLS_Ctx *ctx)
Obtain the UIO object of the read data.
定义 conn_create.c:361
int32_t HITLS_GetCipherSuites(HITLS_Ctx *ctx, uint16_t *data, uint32_t dataLen, uint32_t *cipherSuitesSize)
Get the supported cipher suites array.
int32_t HITLS_Renegotiate(HITLS_Ctx *ctx)
Perform renegotiation.
int32_t HITLS_ClientHelloGetExtensionsPresent(HITLS_Ctx *ctx, uint16_t **out, uint8_t *outlen)
Obtain the all extension types from client hello.
int32_t HITLS_GetFlightTransmitSwitch(const HITLS_Ctx *ctx, bool *isEnable)
Obtains the status of whether to send handshake information according to the flight distance.
int32_t HITLS_GetNeedQueryMtu(HITLS_Ctx *ctx, bool *needQueryMtu)
Querying whether the EMSGSIZE error occur and mtu need be modified
int32_t HITLS_SetDhAutoSupport(HITLS_Ctx *ctx, bool support)
Sets whether to support the function of automatically selecting DH parameters. If the value is true,...
int32_t HITLS_DtlsProcessTimeout(HITLS_Ctx *ctx)
Handle the timeout of sending and receiving DTLS messages.
int32_t HITLS_ClearTLS13CipherSuites(HITLS_Ctx *ctx)
Clears the configured TLS1.3 cipher suite.
int32_t HITLS_GetMinProtoVersion(const HITLS_Ctx *ctx, uint16_t *minVersion)
Obtain the latest protocol version.
int32_t HITLS_SetMinProtoVersion(HITLS_Ctx *ctx, uint16_t version)
Set the minimum protocol version based on the specified version.
int32_t HITLS_ClearRenegotiationNum(HITLS_Ctx *ctx, uint32_t *renegotiationNum)
Clears the renegotiation count.
int32_t HITLS_SetNoClientCertSupport(HITLS_Ctx *ctx, bool support)
Set whether to support the function without the client certificate, Takes effect only when the client...
int32_t HITLS_GetFinishVerifyData(const HITLS_Ctx *ctx, void *buf, uint32_t bufLen, uint32_t *dataLen)
Obtain the verification data and length of the local end based on the sent finished message.
int32_t HITLS_SetVerifyNoneSupport(HITLS_Ctx *ctx, bool support)
Set whether to support do not proceed dual-ended verification.
int32_t HITLS_SetEcGroups(HITLS_Ctx *ctx, uint16_t *lst, uint32_t groupSize)
Set the group supported by the hitls object.
定义 conn_create.c:607
int32_t HITLS_GetNegotiatedVersion(const HITLS_Ctx *ctx, uint16_t *version)
Obtain the HiTLS negotiation version.
int32_t HITLS_Listen(HITLS_Ctx *ctx, BSL_SAL_SockAddr clientAddr)
The server statelessly listens for new incoming DTLS connections.
int32_t HITLS_GetVersionSupport(const HITLS_Ctx *ctx, uint32_t *version)
Obtain the supported version number.
int32_t HITLS_GetSharedSigAlgs(const HITLS_Ctx *ctx, int32_t idx, uint16_t *signatureScheme, int32_t *keyType, int32_t *paraId)
Get shared signature algorithms (negotiated)
int32_t HITLS_GetHandShakeState(const HITLS_Ctx *ctx, uint32_t *state)
Obtain the current handshake status.
int32_t HITLS_SetClientVerifySupport(HITLS_Ctx *ctx, bool support)
Set whether to verify the client certificate.
int32_t HITLS_GetVerifyNoneSupport(HITLS_Ctx *ctx, bool *isSupport)
Query if support is available for not performing dual-end verification.
int32_t HITLS_SetPostHandshakeAuthSupport(HITLS_Ctx *ctx, bool support)
Set whether to support post-handshake AUTH.
int32_t HITLS_GetMaxSendFragment(const HITLS_Ctx *ctx, uint16_t *maxSendFragment)
Obtain the max send fragment to restrict the amount of plaintext bytes in any record
int32_t HITLS_SetReadUio(HITLS_Ctx *ctx, BSL_UIO *uio)
Read UIO for the HiTLS context.
int32_t HITLS_SetRenegotiationSupport(HITLS_Ctx *ctx, bool isSupport)
Sets whether to support renegotiation.
定义 conn_ctrl.c:423
const HITLS_Config * HITLS_GetConfig(const HITLS_Ctx *ctx)
Obtain the value of hitlsConfig.
定义 conn_common.c:297
int32_t HITLS_Connect(HITLS_Ctx *ctx)
The client starts the handshake with the TLS server.
定义 conn_establish.c:352
int32_t HITLS_SetExtendedMasterSecretSupport(HITLS_Ctx *ctx, bool support)
Sets whether to forcibly support extended master keys.
定义 conn_common.c:846
int32_t HITLS_GetSessionTicketSupport(const HITLS_Ctx *ctx, bool *isSupport)
Check whether the session ticket is supported.
int32_t HITLS_GetExtendedMasterSecretMode(HITLS_Ctx *ctx, int32_t *mode)
Get extended master secret mode.
定义 conn_common.c:873
int32_t HITLS_SetTmpDh(HITLS_Ctx *ctx, HITLS_CRYPT_Key *dhPkey)
Set the DH parameter specified by the user.
int32_t HITLS_SetEncryptThenMac(HITLS_Ctx *ctx, bool encryptThenMacType)
Setting the Encrypt-Then-Mac mode.
int32_t HITLS_SetExtendedMasterSecretMode(HITLS_Ctx *ctx, int32_t mode)
Set extended master secret mode.
定义 conn_common.c:864
int32_t HITLS_VerifyClientPostHandshake(HITLS_Ctx *ctx)
This interface is valid only on the server. When the post-handshake command is configured,...
int32_t HITLS_SetCipherSuites(HITLS_Ctx *ctx, const uint16_t *cipherSuites, uint32_t cipherSuitesSize)
Set the supported cipher suites. The sequence of the cipher suites affects the priority of the select...
定义 conn_common.c:322
int32_t HITLS_GetRecordSizeLimit(HITLS_Ctx *ctx, uint16_t *recordSize)
Obtains the record size limit value of ctx.
int32_t HITLS_GetRenegotiationSupport(const HITLS_Ctx *ctx, bool *isSupportRenegotiation)
Obtain whether renegotiation is supported.
int32_t HITLS_SetMaxSendFragment(HITLS_Ctx *ctx, uint16_t maxSendFragment)
set the max send fragment to restrict the amount of plaintext bytes in any record
int32_t HITLS_ClientHelloGetLegacyVersion(HITLS_Ctx *ctx, uint16_t *version)
Obtain the legacy version from client hello.
int32_t HITLS_SetGroupList(HITLS_Ctx *ctx, const char *groups, uint32_t groupNamesLen)
Set the group supported during key exchange, the group supported by HiTLS can be queried in HITLS_Nam...
int32_t HITLS_SetVersionSupport(HITLS_Ctx *ctx, uint32_t version)
Set the supported version number.
int32_t HITLS_SetSessionTicketSupport(HITLS_Ctx *ctx, bool isSupport)
Sets whether to support session tickets.
void * HITLS_GetUserData(const HITLS_Ctx *ctx)
Obtain user data from the HiTLS context. This interface is called in the callback registered with the...
定义 conn_create.c:380
int32_t HITLS_Clear(HITLS_Ctx *ctx)
Reset the TLS handle to allow it to be used for another connection.
定义 conn_create.c:199
int32_t HITLS_GetClientVersion(const HITLS_Ctx *ctx, uint16_t *clientVersion)
Obtain the version number set by the client in ClientHello.
int32_t HITLS_SetFlightTransmitSwitch(HITLS_Ctx *ctx, bool isEnable)
Sets whether to send handshake messages by flight distance.
int32_t HITLS_GetModeSupport(const HITLS_Ctx *ctx, uint32_t *mode)
Obtains the functional characteristics mode in the config.
int32_t HITLS_SetQuietShutdown(HITLS_Ctx *ctx, int32_t mode)
Set the silent disconnection mode.
HITLS_CIPHER_List * HITLS_GetSupportedCiphers(const HITLS_Ctx *ctx)
Obtain the supported cipher suites list for HITLS_Ctx.
int32_t HITLS_SetDtlsTimerCb(HITLS_Ctx *ctx, HITLS_DtlsTimerCb cb)
Set the DTLS timeout interval callback.
int32_t HITLS_ClientHelloGetExtension(HITLS_Ctx *ctx, uint16_t type, uint8_t **out, uint32_t *outlen)
Obtain a specific extension from client hello.
int32_t HITLS_SetEmptyRecordsNum(HITLS_Ctx *ctx, uint32_t emptyNum)
set the max empty records number can be received
定义 conn_ctrl.c:480
int32_t HITLS_SetServerName(HITLS_Ctx *ctx, uint8_t *serverName, uint32_t serverNameStrlen)
Setting the value of server_name.
int32_t HITLS_KeyUpdate(HITLS_Ctx *ctx, uint32_t updateType)
Set the keyupdate type of the current context and send the keyupdate message.
int32_t HITLS_GetRwstate(const HITLS_Ctx *ctx, uint8_t *rwstate)
Obtain the current internal status.
int32_t HITLS_GetKeyUpdateType(HITLS_Ctx *ctx)
Return the keyupdate type of the current context.
int32_t HITLS_ClientHelloGetSessionID(HITLS_Ctx *ctx, uint8_t **out, uint8_t *outlen)
Obtain the session ID from client hello.
int32_t HITLS_Close(HITLS_Ctx *ctx)
Close the TLS connection.
定义 conn_establish.c:520
int32_t HITLS_SetShutdownState(HITLS_Ctx *ctx, uint32_t mode)
Set the shutdown status of the TLS link.
int32_t HITLS_GetHsRandom(const HITLS_Ctx *ctx, uint8_t *out, uint32_t *outlen, bool isClient)
Obtain the random number of the client and server during the handshake.
void * HITLS_GetRecordPaddingCbArg(HITLS_Ctx *ctx)
Obtains the parameter arg required by the RecordPadding callback function.
int32_t HITLS_SetRecordPaddingCbArg(HITLS_Ctx *ctx, void *arg)
Sets the parameters arg required by the RecordPadding callback function.
int32_t HITLS_SetNoQueryMtu(HITLS_Ctx *ctx, bool noQueryMtu)
Set the option that don't query mtu from the bio.
void HITLS_Free(HITLS_Ctx *ctx)
Release the TLS connection.
定义 conn_create.c:145
int32_t HITLS_SetModeSupport(HITLS_Ctx *ctx, uint32_t mode)
Set the function to support the specified feature.
int32_t HITLS_SetRecordSizeLimit(HITLS_Ctx *ctx, uint16_t recordSize)
The default record size limit is 0 to unsupport the record size limit extension (RFC 8449)....
int32_t HITLS_SetUio(HITLS_Ctx *ctx, BSL_UIO *uio)
Set the UIO object for the HiTLS context.
定义 conn_create.c:287
int32_t HITLS_SetClientOnceVerifySupport(HITLS_Ctx *ctx, bool support)
Set whether the client certificate can be requested only once.
int32_t HITLS_GetClientOnceVerifySupport(HITLS_Ctx *ctx, bool *isSupport)
Query whether the client certificate can be requested only once.
int32_t HITLS_GetOutPendingSize(const HITLS_Ctx *ctx, uint32_t *size)
Obtain the record out buffer remaining size
定义 conn_common.c:825
int32_t HITLS_GetMiddleBoxCompat(HITLS_Ctx *ctx, bool *isMiddleBox)
Obtain whether middle box compat mode is supported.
int32_t HITLS_Write(HITLS_Ctx *ctx, const uint8_t *data, uint32_t dataLen, uint32_t *writeLen)
Write data.
定义 conn_write.c:207
int32_t HITLS_SetRecInbufferSize(HITLS_Ctx *ctx, uint32_t recInbufferSize)
Set the rec inbuffer inital size
int32_t HITLS_SetClientRenegotiateSupport(HITLS_Ctx *ctx, bool isSupport)
Set whether to allow a renegotiate request from the client
int32_t HITLS_SetErrorCode(HITLS_Ctx *ctx, int32_t errorCode)
Record the error value of the HiTLS link.
定义 conn_create.c:410
int32_t HITLS_GetMaxWriteSize(const HITLS_Ctx *ctx, uint32_t *len)
Obtain the maximum writable (plaintext) length.
定义 conn_write.c:30
int32_t HITLS_GetSecureRenegotiationSupport(const HITLS_Ctx *ctx, bool *isSecureRenegotiation)
Obtains whether security renegotiation is supported.
int32_t HITLS_ClientHelloGetCiphers(HITLS_Ctx *ctx, uint16_t **out, uint16_t *outlen)
Obtain the cipher suites from client hello.
int32_t HITLS_SetNeedCheckPmsVersion(HITLS_Ctx *ctx, bool needCheck)
Sets whether to verify the version in the premaster secret.
BSL_UIO * HITLS_GetUio(const HITLS_Ctx *ctx)
Obtain the UIO object from the HiTLS context.
定义 conn_create.c:347
int32_t HITLS_GetNegotiateGroup(const HITLS_Ctx *ctx, uint16_t *group)
Obtain the negotiated group information.
int32_t HITLS_GetDtlsCookieExangeSupport(const HITLS_Ctx *ctx, bool *isSupport)
Querying whether the DTLS performs cookie exchange.
int32_t HITLS_GetErrorCode(const HITLS_Ctx *ctx)
Obtain the error value of the HiTLS link.
定义 conn_create.c:420
int32_t HITLS_GetRenegotiationState(const HITLS_Ctx *ctx, bool *isRenegotiationState)
Obtain the current is whether in the renegotiation state.
int32_t HITLS_SetResumptionOnRenegoSupport(HITLS_Ctx *ctx, bool support)
Set whether to support session restoration during renegotiation. By default, session restoration is n...
int32_t HITLS_GetExtendedMasterSecretSupport(HITLS_Ctx *ctx, bool *isSupport)
Query whether extended master keys are supported.
定义 conn_common.c:855
int32_t HITLS_DtlsGetTimeout(HITLS_Ctx *ctx, uint64_t *remainTimeOut)
Get the remaining timeout time for timeout retransmission.
int32_t HITLS_GetNoClientCertSupport(HITLS_Ctx *ctx, bool *isSupport)
Check whether no client certificate is supported, This command is valid only when client certificate ...
int32_t HITLS_IsBeforeHandShake(const HITLS_Ctx *ctx, bool *isBefore)
Check whether the handshake has not been performed.
int32_t HITLS_GetShutdownState(const HITLS_Ctx *ctx, uint32_t *mode)
Obtain the shutdown status of the TLS link.
int32_t HITLS_GetMaxProtoVersion(const HITLS_Ctx *ctx, uint16_t *maxVersion)
Obtain the latest protocol version.
int32_t HITLS_ClearModeSupport(HITLS_Ctx *ctx, uint32_t mode)
Function to clear the specified feature.
int32_t HITLS_GetCipherServerPreference(const HITLS_Ctx *ctx, bool *isSupport)
Obtains whether the current cipher suite supports preferential selection from the list of algorithms ...
int32_t HITLS_ReadHasPending(const HITLS_Ctx *ctx, bool *isPending)
Check the HiTLS object in the read cache. (including processed and unprocessed data,...
定义 conn_read.c:526
int32_t HITLS_SetEcPointFormats(HITLS_Ctx *ctx, const uint8_t *pointFormats, uint32_t pointFormatsSize)
Set the EC point format of the hitls.
定义 conn_create.c:647
int32_t HITLS_SetKeepPeerCertificate(HITLS_Ctx *ctx, bool isKeepPeerCert)
Set whether to save the peer certificate.
int32_t HITLS_IsHandShakeDone(const HITLS_Ctx *ctx, uint8_t *isDone)
Obtain the information about whether the handshake is complete.
int32_t HITLS_Peek(HITLS_Ctx *ctx, uint8_t *data, uint32_t bufSize, uint32_t *readLen)
read application data from a TLS/SSL connection
定义 conn_read.c:515
HITLS_Config * HITLS_GetGlobalConfig(const HITLS_Ctx *ctx)
Obtain the point of GlobalConfig
定义 conn_common.c:305
int32_t HITLS_GetLocalSignScheme(const HITLS_Ctx *ctx, HITLS_SignHashAlgo *localSignScheme)
Obtain the signature hash algorithm used by the local end.
int32_t HITLS_SetMtu(HITLS_Ctx *ctx, uint16_t mtu)
Set the MTU of a path.
int32_t HITLS_IsAead(const HITLS_Ctx *ctx, bool *isAead)
Obtain whether to use the AEAD algorithm.
int32_t HITLS_SetLinkMtu(HITLS_Ctx *ctx, uint16_t linkMtu)
Set the MTU of Data Link layer.
int32_t HITLS_GetResumptionOnRenegoSupport(HITLS_Ctx *ctx, bool *isSupport)
Get whether to support session restoration during renegotiation. By default, session restoration is n...
int32_t HITLS_GetClientVerifySupport(HITLS_Ctx *ctx, bool *isSupport)
Check whether the client certificate can be verified.
int32_t HITLS_SetVersion(HITLS_Ctx *ctx, uint32_t minVersion, uint32_t maxVersion)
Set the supported version number range.
int32_t HITLS_Read(HITLS_Ctx *ctx, uint8_t *data, uint32_t bufSize, uint32_t *readLen)
Read application data
定义 conn_read.c:493
uint32_t HITLS_GetReadPendingBytes(const HITLS_Ctx *ctx)
Obtain the number of bytes of application data to be read from the current record from the HiTLS obje...
定义 conn_read.c:537
int32_t HITLS_ExportKeyingMaterial(HITLS_Ctx *ctx, uint8_t *out, size_t outLen, const char *label, size_t labelLen, const uint8_t *context, size_t contextLen, int32_t useContext)
This API is designed for upper layer applications to export key materials based on RFC5705 (version <...
int32_t HITLS_GetClientCipherSuites(HITLS_Ctx *ctx, uint16_t *data, uint32_t dataLen, uint32_t *cipherSuitesSize)
Get the received cipher suites array from the client.
int32_t HITLS_SetUserData(HITLS_Ctx *ctx, void *userData)
Save the user data in the HiTLS context, which can be obtained from the callback registered with the ...
定义 conn_create.c:400
int32_t HITLS_IsDtls(const HITLS_Ctx *ctx, bool *isDtls)
Check whether DTLS is used.
int32_t HITLS_SetMaxProtoVersion(HITLS_Ctx *ctx, uint16_t version)
Set the maximum protocol version that is supported based on the specified version.
int32_t HITLS_SetRecordPaddingCb(HITLS_Ctx *ctx, HITLS_RecordPaddingCb callback)
Sets the RecordPadding callback.
const HITLS_Cipher * HITLS_GetCurrentCipher(const HITLS_Ctx *ctx)
Obtain the negotiated cipher suite pointer.
int32_t HITLS_GetEncryptThenMac(const HITLS_Ctx *ctx, bool *encryptThenMacType)
Obtains the Encrypt-Then-Mac type
int32_t HITLS_DoHandShake(HITLS_Ctx *ctx)
The client/server starts handshake.
定义 conn_establish.c:777
int32_t HITLS_GetClientRenegotiateSupport(HITLS_Ctx *ctx, bool *isSupport)
Get whether to allow a renegotiate request from the client
int32_t HITLS_SetEndPoint(HITLS_Ctx *ctx, bool isClient)
Set the initial status of the connection.
定义 conn_establish.c:296
int32_t HITLS_IsServer(const HITLS_Ctx *ctx, bool *isServer)
Indicates whether the HiTLS object functions as the server.
定义 conn_create.c:443
int32_t HITLS_GetPeerFinishVerifyData(const HITLS_Ctx *ctx, void *buf, uint32_t bufLen, uint32_t *dataLen)
Obtain the verification data and length of the peer end based on the received finished message.
int32_t HITLS_SetTmpDhCb(HITLS_Ctx *ctx, HITLS_DhTmpCb callback)
Set the TmpDh callback function.
int32_t HITLS_IsHandShaking(const HITLS_Ctx *ctx, bool *isHandShaking)
Check whether a handshake is being performed.
int32_t HITLS_SetVersionForbid(HITLS_Ctx *ctx, uint32_t noVersion)
Set the version number to be disabled.
int32_t HITLS_SetDtlsCookieExangeSupport(HITLS_Ctx *ctx, bool isSupport)
Sets whether to perform cookie exchange in the dtls.
int32_t HITLS_SetSigalgsList(HITLS_Ctx *ctx, const uint16_t *signAlgs, uint16_t signAlgsSize)
Set the signature algorithm supported by the hitls object.
定义 conn_create.c:627
const char * HITLS_GetStateString(uint32_t state)
Obtain the handshake status character string.
int32_t HITLS_Accept(HITLS_Ctx *ctx)
The server waits for the client to start handshake.
定义 conn_establish.c:383
int32_t HITLS_GetSharedGroup(const HITLS_Ctx *ctx, int32_t nmatch, uint16_t *groupId)
Obtain the supported peer group or the number of supported peer groups of the nth match....
int32_t HITLS_GetMaxCertList(const HITLS_Ctx *ctx, uint32_t *maxSize)
Obtains the maximum size of the certificate chain that can be sent by the peer end.
int32_t HITLS_GetPeerSignScheme(const HITLS_Ctx *ctx, HITLS_SignHashAlgo *peerSignScheme)
Obtain the signature hash algorithm used by the peer end.
HITLS_RecordPaddingCb HITLS_GetRecordPaddingCb(HITLS_Ctx *ctx)
Obtains the RecordPadding callback function.
int32_t HITLS_SetCipherServerPreference(HITLS_Ctx *ctx, bool isSupport)
The algorithm suite can be preferentially selected from the algorithm list supported by the server.
HITLS_Ctx * HITLS_New(HITLS_Config *config)
Create a TLS object and deep copy the HITLS_Config to the HITLS_Ctx.
定义 conn_create.c:61
int32_t HITLS_SetLegacyRenegotiateSupport(HITLS_Ctx *ctx, bool isSupport)
Set whether to abort handshake when server doesn't support SecRenegotiation
int32_t HITLS_ClientHelloGetRandom(HITLS_Ctx *ctx, uint8_t **out, uint8_t *outlen)
Obtain the random value from client hello.
int32_t HITLS_GetEmptyRecordsNum(const HITLS_Ctx *ctx, uint32_t *emptyNum)
Obtain the max empty records number can be received
定义 conn_ctrl.c:489
int32_t HITLS_Flush(HITLS_Ctx *ctx)
Flush the record out buffer
定义 conn_common.c:834
int32_t HITLS_SetMaxCertList(HITLS_Ctx *ctx, uint32_t maxSize)
Sets the maximum size of the certificate chain that can be sent from the peer end.
int32_t HITLS_GetQuietShutdown(const HITLS_Ctx *ctx, int32_t *mode)
Obtain the current silent disconnection mode.
int32_t HITLS_SetMiddleBoxCompat(HITLS_Ctx *ctx, bool isMiddleBox)
Sets whether to support middle box compat mode.
int32_t HITLS_SetCheckKeyUsage(HITLS_Ctx *ctx, bool isCheck)
Disables the verification of keyusage in the certificate. This function is enabled by default.
int32_t HITLS_GetPostHandshakeAuthSupport(HITLS_Ctx *ctx, bool *isSupport)
Query whether post-handshake AUTH is supported
int32_t HITLS_IsClient(const HITLS_Ctx *ctx, bool *isClient)
Check whether the current end is client.
定义 conn_common.c:480