27#define MASTER_SECRET_LABEL "CLIENT_RANDOM"
28#define CLIENT_EARLY_LABEL "CLIENT_EARLY_TRAFFIC_SECRET"
29#define CLIENT_HANDSHAKE_LABEL "CLIENT_HANDSHAKE_TRAFFIC_SECRET"
30#define SERVER_HANDSHAKE_LABEL "SERVER_HANDSHAKE_TRAFFIC_SECRET"
31#define CLIENT_APPLICATION_LABEL "CLIENT_TRAFFIC_SECRET_0"
32#define SERVER_APPLICATION_LABEL "SERVER_TRAFFIC_SECRET_0"
33#define EARLY_EXPORTER_SECRET_LABEL "EARLY_EXPORTER_SECRET"
34#define EXPORTER_SECRET_LABEL "EXPORTER_SECRET"
38#ifndef HITLS_MAX_OTHER_SECRET_SIZE
39#define HITLS_MAX_OTHER_SECRET_SIZE 1536
41#define MAX_PRE_MASTER_SECRET_SIZE (sizeof(uint16_t) + HITLS_MAX_OTHER_SECRET_SIZE + sizeof(uint16_t) + \
43#define MAX_SHA1_SIZE 20
44#define MAX_MD5_SIZE 16
123int32_t HS_GenerateMasterSecret(TLS_Ctx *ctx);
136int32_t HS_ProcessServerKxMsgIdentityHint(TLS_Ctx *ctx,
const ServerKeyExchangeMsg *serverKxMsg);
154int32_t HS_TLS13DeriveBinderKey(HITLS_Lib_Ctx *libCtx,
const char *attrName,
155 HITLS_HashAlgo hashAlgo,
bool isExternalPsk, uint8_t *earlySecret, uint32_t secretLen,
156 uint8_t *binderKey, uint32_t keyLen);
171int32_t HS_TLS13DeriveEarlySecret(HITLS_Lib_Ctx *libCtx,
const char *attrName,
172 HITLS_HashAlgo hashAlgo, uint8_t *psk, uint32_t pskLen, uint8_t *earlySecret, uint32_t *outLen);
191int32_t HS_TLS13DeriveNextStageSecret(HITLS_Lib_Ctx *libCtx,
const char *attrName,
192 HITLS_HashAlgo hashAlgo, uint8_t *inSecret, uint32_t inLen, uint8_t *givenSecret,
193 uint32_t givenLen, uint8_t *outSecret, uint32_t *outLen);
209int32_t HS_TLS13DeriveFinishedKey(HITLS_Lib_Ctx *libCtx,
const char *attrName,
210 HITLS_HashAlgo hashAlgo, uint8_t *baseKey, uint32_t baseKeyLen, uint8_t *finishedkey, uint32_t finishedkeyLen);
226int32_t HS_SwitchTrafficKey(TLS_Ctx *ctx, uint8_t *secret, uint32_t secretLen,
bool isOut);
237int32_t HS_SetInitPendingStateParam(
const TLS_Ctx *ctx,
bool isClient,
REC_SecParameters *keyPara);
252int32_t HS_TLS13CalcServerHelloProcessSecret(TLS_Ctx *ctx);
266int32_t HS_TLS13CalcServerFinishProcessSecret(TLS_Ctx *ctx);
281int32_t HS_TLS13UpdateTrafficSecret(TLS_Ctx *ctx,
bool isOut);
296int32_t HS_TLS13DeriveResumptionMasterSecret(TLS_Ctx *ctx);
313int32_t HS_TLS13DeriveResumePsk(
314 TLS_Ctx *ctx,
const uint8_t *ticketNonce, uint32_t ticketNonceSize, uint8_t *resumePsk, uint32_t resumePskLen);
316int32_t HS_TLS13DeriveHandshakeTrafficSecret(TLS_Ctx *ctx);
PskInfo is used for PSK negotiation and stores identity and psk during negotiation
定义 hs_ctx.h:112