已合并
fix:Clean up sensitive information #943
balabala-123创建于 2025年12月24日
fix:Clean up sensitive information #943
已合并
共 10 个文件变更+36-17
| @@ -67,8 +67,29 @@ static const char *GetStateString(uint32_t state) | |||
| 67 | return stateMachineStr[state]; | 67 | return stateMachineStr[state]; |
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | +void ConnCleanSensitiveData(TLS_Ctx *ctx) | ||
| 71 | +{ | ||
| 72 | + if (ctx->hsCtx != NULL) { | ||
| 73 | + BSL_SAL_CleanseData(ctx->hsCtx->masterKey, sizeof(ctx->hsCtx->masterKey)); | ||
| 74 | + | ||
| 75 | + BSL_SAL_CleanseData(ctx->hsCtx->earlySecret, MAX_DIGEST_SIZE); | ||
| 76 | + BSL_SAL_CleanseData(ctx->hsCtx->handshakeSecret, MAX_DIGEST_SIZE); | ||
| 77 | + BSL_SAL_CleanseData(ctx->hsCtx->serverHsTrafficSecret, MAX_DIGEST_SIZE); | ||
| 78 | + BSL_SAL_CleanseData(ctx->hsCtx->clientHsTrafficSecret, MAX_DIGEST_SIZE); | ||
| 79 | + | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + BSL_SAL_CleanseData(ctx->clientAppTrafficSecret, MAX_DIGEST_SIZE); | ||
| 83 | + BSL_SAL_CleanseData(ctx->serverAppTrafficSecret, MAX_DIGEST_SIZE); | ||
| 84 | + BSL_SAL_CleanseData(ctx->resumptionMasterSecret, MAX_DIGEST_SIZE); | ||
| 85 | + | ||
| 86 | +} | ||
| 87 | + | ||
| 70 | void ChangeConnState(HITLS_Ctx *ctx, CM_State state) | 88 | void ChangeConnState(HITLS_Ctx *ctx, CM_State state) |
| 71 | { | 89 | { |
| 90 | + if (state == CM_STATE_ALERTED) { | ||
| 91 | + ConnCleanSensitiveData(ctx); | ||
| 92 | + } | ||
| 72 | if (GetConnState(ctx) == state) { | 93 | if (GetConnState(ctx) == state) { |
| 73 | return; | 94 | return; |
| 74 | } | 95 | } |
| @@ -63,6 +63,8 @@ int32_t AlertEventProcess(HITLS_Ctx *ctx); | |||
| 63 | 63 | ||
| 64 | void ChangeConnState(HITLS_Ctx *ctx, CM_State state); | 64 | void ChangeConnState(HITLS_Ctx *ctx, CM_State state); |
| 65 | 65 | ||
| 66 | +void ConnCleanSensitiveData(TLS_Ctx *ctx); | ||
| 67 | + | ||
| 66 | 68 | ||
| 67 | /** | 69 | /** |
| 68 | * @ingroup hitls | 70 | * @ingroup hitls |
| @@ -170,6 +170,7 @@ void HITLS_Free(HITLS_Ctx *ctx) | |||
| 170 | BSL_SAL_FREE(ctx->certificateReqCtx); | 170 | BSL_SAL_FREE(ctx->certificateReqCtx); |
| 171 | ctx->certificateReqCtxSize = 0; | 171 | ctx->certificateReqCtxSize = 0; |
| 172 | 172 | ||
| 173 | + ConnCleanSensitiveData(ctx); | ||
| 173 | BSL_SAL_FREE(ctx); | 174 | BSL_SAL_FREE(ctx); |
| 174 | return; | 175 | return; |
| 175 | } | 176 | } |
| @@ -117,7 +117,7 @@ void HITLS_SESS_Free(HITLS_Session *sess) | |||
| 117 | 117 | ||
| 118 | BSL_SAL_FREE(sess->hostName); | 118 | BSL_SAL_FREE(sess->hostName); |
| 119 | 119 | ||
| 120 | - memset_s(sess->masterKey, MAX_MASTER_KEY_SIZE, 0, MAX_MASTER_KEY_SIZE); | 120 | + BSL_SAL_CleanseData(sess->masterKey, MAX_MASTER_KEY_SIZE); |
| 121 | SAL_CERT_MgrCtxFree(sess->certMgrCtx); | 121 | SAL_CERT_MgrCtxFree(sess->certMgrCtx); |
| 122 | BSL_SAL_ThreadLockFree(sess->lock); | 122 | BSL_SAL_ThreadLockFree(sess->lock); |
| 123 | BSL_SAL_FREE(sess); | 123 | BSL_SAL_FREE(sess); |
| @@ -408,14 +408,13 @@ static int32_t GenerateSessFromTicket(HITLS_Lib_Ctx *libCtx, const char *attrNam | |||
| 408 | uint8_t *plaintext = BSL_SAL_Calloc(1u, ticketBufSize); | 408 | uint8_t *plaintext = BSL_SAL_Calloc(1u, ticketBufSize); |
| 409 | if (plaintext == NULL) { | 409 | if (plaintext == NULL) { |
| 410 | BSL_ERR_PUSH_ERROR(HITLS_MEMALLOC_FAIL); | 410 | BSL_ERR_PUSH_ERROR(HITLS_MEMALLOC_FAIL); |
| 411 | - BSL_LOG_BINLOG_FIXLEN(BINLOG_ID16037, BSL_LOG_LEVEL_ERR, BSL_LOG_BINLOG_TYPE_RUN, | 411 | + return RETURN_ERROR_NUMBER_PROCESS(HITLS_MEMALLOC_FAIL, BINLOG_ID16037, "plaintext malloc fail"); |
| 412 | - "plaintext malloc fail when decrypt session ticket.", 0, 0, 0, 0); | ||
| 413 | - return HITLS_MEMALLOC_FAIL; | ||
| 414 | } | 412 | } |
| 415 | int32_t ret; | 413 | int32_t ret; |
| 416 | ret = SAL_CRYPT_Decrypt(libCtx, attrName, | 414 | ret = SAL_CRYPT_Decrypt(libCtx, attrName, |
| 417 | cipher, ticket->encryptedState, ticket->encryptedStateSize, plaintext, &plaintextLen); | 415 | cipher, ticket->encryptedState, ticket->encryptedStateSize, plaintext, &plaintextLen); |
| 418 | if (ret != HITLS_SUCCESS) { | 416 | if (ret != HITLS_SUCCESS) { |
| 417 | + BSL_SAL_CleanseData(plaintext, plaintextLen); | ||
| 419 | BSL_SAL_FREE(plaintext); | 418 | BSL_SAL_FREE(plaintext); |
| 420 | BSL_LOG_BINLOG_FIXLEN(BINLOG_ID16038, BSL_LOG_LEVEL_INFO, BSL_LOG_BINLOG_TYPE_RUN, | 419 | BSL_LOG_BINLOG_FIXLEN(BINLOG_ID16038, BSL_LOG_LEVEL_INFO, BSL_LOG_BINLOG_TYPE_RUN, |
| 421 | "SAL_CRYPT_Decrypt fail when decrypt session ticket.", 0, 0, 0, 0); | 420 | "SAL_CRYPT_Decrypt fail when decrypt session ticket.", 0, 0, 0, 0); |
| @@ -431,6 +430,7 @@ static int32_t GenerateSessFromTicket(HITLS_Lib_Ctx *libCtx, const char *attrNam | |||
| 431 | uint8_t paddingLen = plaintext[plaintextLen - 1]; | 430 | uint8_t paddingLen = plaintext[plaintextLen - 1]; |
| 432 | for (uint32_t i = 1; i <= paddingLen; i++) { | 431 | for (uint32_t i = 1; i <= paddingLen; i++) { |
| 433 | if (plaintext[plaintextLen - 1 - i] != paddingLen) { | 432 | if (plaintext[plaintextLen - 1 - i] != paddingLen) { |
| 433 | + BSL_SAL_CleanseData(plaintext, plaintextLen); | ||
| 434 | BSL_SAL_FREE(plaintext); | 434 | BSL_SAL_FREE(plaintext); |
| 435 | return HITLS_SUCCESS; | 435 | return HITLS_SUCCESS; |
| 436 | } | 436 | } |
| @@ -442,11 +442,10 @@ static int32_t GenerateSessFromTicket(HITLS_Lib_Ctx *libCtx, const char *attrNam | |||
| 442 | /* Parse the ticket content to the SESS. */ | 442 | /* Parse the ticket content to the SESS. */ |
| 443 | HITLS_Session *session = HITLS_SESS_New(); | 443 | HITLS_Session *session = HITLS_SESS_New(); |
| 444 | if (session == NULL) { | 444 | if (session == NULL) { |
| 445 | + BSL_SAL_CleanseData(plaintext, plaintextLen); | ||
| 445 | BSL_SAL_FREE(plaintext); | 446 | BSL_SAL_FREE(plaintext); |
| 446 | BSL_ERR_PUSH_ERROR(HITLS_MEMALLOC_FAIL); | 447 | BSL_ERR_PUSH_ERROR(HITLS_MEMALLOC_FAIL); |
| 447 | - BSL_LOG_BINLOG_FIXLEN(BINLOG_ID16039, BSL_LOG_LEVEL_ERR, BSL_LOG_BINLOG_TYPE_RUN, | 448 | + return RETURN_ERROR_NUMBER_PROCESS(HITLS_MEMALLOC_FAIL, BINLOG_ID16039, "HITLS_SESS_New fail"); |
| 448 | - "HITLS_SESS_New fail when decrypt session ticket.", 0, 0, 0, 0); | ||
| 449 | - return HITLS_MEMALLOC_FAIL; | ||
| 450 | } | 449 | } |
| 451 | ret = SESS_Decode(session, plaintext, plaintextLen); | 450 | ret = SESS_Decode(session, plaintext, plaintextLen); |
| 452 | BSL_SAL_FREE(plaintext); | 451 | BSL_SAL_FREE(plaintext); |
| @@ -35,7 +35,6 @@ int32_t ServerRecvClientCertVerifyProcess(TLS_Ctx *ctx) | |||
| 35 | if (ret != HITLS_SUCCESS) { | 35 | if (ret != HITLS_SUCCESS) { |
| 36 | BSL_LOG_BINLOG_FIXLEN(BINLOG_ID15871, BSL_LOG_LEVEL_ERR, BSL_LOG_BINLOG_TYPE_RUN, | 36 | BSL_LOG_BINLOG_FIXLEN(BINLOG_ID15871, BSL_LOG_LEVEL_ERR, BSL_LOG_BINLOG_TYPE_RUN, |
| 37 | "server Calculate client finished data error.", 0, 0, 0, 0); | 37 | "server Calculate client finished data error.", 0, 0, 0, 0); |
| 38 | - (void)memset_s(ctx->hsCtx->masterKey, sizeof(ctx->hsCtx->masterKey), 0, sizeof(ctx->hsCtx->masterKey)); | ||
| 39 | ctx->method.sendAlert(ctx, ALERT_LEVEL_FATAL, ALERT_INTERNAL_ERROR); | 38 | ctx->method.sendAlert(ctx, ALERT_LEVEL_FATAL, ALERT_INTERNAL_ERROR); |
| 40 | return ret; | 39 | return ret; |
| 41 | } | 40 | } |
| @@ -208,7 +208,6 @@ int32_t ServerRecvClientKxProcess(TLS_Ctx *ctx, const HS_Msg *msg) | |||
| 208 | BSL_LOG_BINLOG_FIXLEN(BINLOG_ID15823, BSL_LOG_LEVEL_ERR, BSL_LOG_BINLOG_TYPE_RUN, | 208 | BSL_LOG_BINLOG_FIXLEN(BINLOG_ID15823, BSL_LOG_LEVEL_ERR, BSL_LOG_BINLOG_TYPE_RUN, |
| 209 | "server Calculate client finished data error.", 0, 0, 0, 0); | 209 | "server Calculate client finished data error.", 0, 0, 0, 0); |
| 210 | ctx->method.sendAlert(ctx, ALERT_LEVEL_FATAL, ALERT_INTERNAL_ERROR); | 210 | ctx->method.sendAlert(ctx, ALERT_LEVEL_FATAL, ALERT_INTERNAL_ERROR); |
| 211 | - (void)memset_s(ctx->hsCtx->masterKey, sizeof(ctx->hsCtx->masterKey), 0, sizeof(ctx->hsCtx->masterKey)); | ||
| 212 | return ret; | 211 | return ret; |
| 213 | } | 212 | } |
| 214 | 213 | ||
| @@ -701,7 +701,6 @@ int32_t ClientRecvServerHelloProcess(TLS_Ctx *ctx, const HS_Msg *msg) | |||
| 701 | /* Calculate the 'server verify data' for verifying the 'finished' message of the server. */ | 701 | /* Calculate the 'server verify data' for verifying the 'finished' message of the server. */ |
| 702 | ret = VERIFY_CalcVerifyData(ctx, false, ctx->hsCtx->masterKey, MASTER_SECRET_LEN); | 702 | ret = VERIFY_CalcVerifyData(ctx, false, ctx->hsCtx->masterKey, MASTER_SECRET_LEN); |
| 703 | if (ret != HITLS_SUCCESS) { | 703 | if (ret != HITLS_SUCCESS) { |
| 704 | - (void)memset_s(ctx->hsCtx->masterKey, sizeof(ctx->hsCtx->masterKey), 0, sizeof(ctx->hsCtx->masterKey)); | ||
| 705 | BSL_LOG_BINLOG_FIXLEN(BINLOG_ID15278, BSL_LOG_LEVEL_ERR, BSL_LOG_BINLOG_TYPE_RUN, | 704 | BSL_LOG_BINLOG_FIXLEN(BINLOG_ID15278, BSL_LOG_LEVEL_ERR, BSL_LOG_BINLOG_TYPE_RUN, |
| 706 | "client Calculate server finished data error.", 0, 0, 0, 0); | 705 | "client Calculate server finished data error.", 0, 0, 0, 0); |
| 707 | ctx->method.sendAlert(ctx, ALERT_LEVEL_FATAL, ALERT_INTERNAL_ERROR); | 706 | ctx->method.sendAlert(ctx, ALERT_LEVEL_FATAL, ALERT_INTERNAL_ERROR); |
| @@ -40,7 +40,6 @@ int32_t PrepareClientFinishedMsg(TLS_Ctx *ctx) | |||
| 40 | BSL_LOG_BINLOG_FIXLEN(BINLOG_ID15357, BSL_LOG_LEVEL_ERR, BSL_LOG_BINLOG_TYPE_RUN, | 40 | BSL_LOG_BINLOG_FIXLEN(BINLOG_ID15357, BSL_LOG_LEVEL_ERR, BSL_LOG_BINLOG_TYPE_RUN, |
| 41 | "client Calculate client finished data error.", 0, 0, 0, 0); | 41 | "client Calculate client finished data error.", 0, 0, 0, 0); |
| 42 | ctx->method.sendAlert(ctx, ALERT_LEVEL_FATAL, ALERT_INTERNAL_ERROR); | 42 | ctx->method.sendAlert(ctx, ALERT_LEVEL_FATAL, ALERT_INTERNAL_ERROR); |
| 43 | - (void)memset_s(ctx->hsCtx->masterKey, sizeof(ctx->hsCtx->masterKey), 0, sizeof(ctx->hsCtx->masterKey)); | ||
| 44 | return ret; | 43 | return ret; |
| 45 | } | 44 | } |
| 46 | 45 | ||
| @@ -90,7 +89,6 @@ int32_t Tls12ClientSendFinishedProcess(TLS_Ctx *ctx) | |||
| 90 | 89 | ||
| 91 | ret = VERIFY_CalcVerifyData(ctx, false, ctx->hsCtx->masterKey, MASTER_SECRET_LEN); | 90 | ret = VERIFY_CalcVerifyData(ctx, false, ctx->hsCtx->masterKey, MASTER_SECRET_LEN); |
| 92 | if (ret != HITLS_SUCCESS) { | 91 | if (ret != HITLS_SUCCESS) { |
| 93 | - (void)memset_s(ctx->hsCtx->masterKey, sizeof(ctx->hsCtx->masterKey), 0, sizeof(ctx->hsCtx->masterKey)); | ||
| 94 | BSL_LOG_BINLOG_FIXLEN(BINLOG_ID15361, BSL_LOG_LEVEL_ERR, BSL_LOG_BINLOG_TYPE_RUN, | 92 | BSL_LOG_BINLOG_FIXLEN(BINLOG_ID15361, BSL_LOG_LEVEL_ERR, BSL_LOG_BINLOG_TYPE_RUN, |
| 95 | "client Calculate server finished data error.", 0, 0, 0, 0); | 93 | "client Calculate server finished data error.", 0, 0, 0, 0); |
| 96 | ctx->method.sendAlert(ctx, ALERT_LEVEL_FATAL, ALERT_INTERNAL_ERROR); | 94 | ctx->method.sendAlert(ctx, ALERT_LEVEL_FATAL, ALERT_INTERNAL_ERROR); |
| @@ -124,7 +122,6 @@ static int32_t DtlsClientChangeStateAfterSendFinished(TLS_Ctx *ctx) | |||
| 124 | 122 | ||
| 125 | ret = VERIFY_CalcVerifyData(ctx, false, ctx->hsCtx->masterKey, MASTER_SECRET_LEN); | 123 | ret = VERIFY_CalcVerifyData(ctx, false, ctx->hsCtx->masterKey, MASTER_SECRET_LEN); |
| 126 | if (ret != HITLS_SUCCESS) { | 124 | if (ret != HITLS_SUCCESS) { |
| 127 | - (void)memset_s(ctx->hsCtx->masterKey, sizeof(ctx->hsCtx->masterKey), 0, sizeof(ctx->hsCtx->masterKey)); | ||
| 128 | BSL_LOG_BINLOG_FIXLEN(BINLOG_ID15367, BSL_LOG_LEVEL_ERR, BSL_LOG_BINLOG_TYPE_RUN, | 125 | BSL_LOG_BINLOG_FIXLEN(BINLOG_ID15367, BSL_LOG_LEVEL_ERR, BSL_LOG_BINLOG_TYPE_RUN, |
| 129 | "client Calculate server finished data error.", 0, 0, 0, 0); | 126 | "client Calculate server finished data error.", 0, 0, 0, 0); |
| 130 | ctx->method.sendAlert(ctx, ALERT_LEVEL_FATAL, ALERT_INTERNAL_ERROR); | 127 | ctx->method.sendAlert(ctx, ALERT_LEVEL_FATAL, ALERT_INTERNAL_ERROR); |
| @@ -300,7 +297,6 @@ static int32_t CalcVerifyData(TLS_Ctx *ctx) | |||
| 300 | { | 297 | { |
| 301 | int32_t ret = VERIFY_CalcVerifyData(ctx, false, ctx->hsCtx->masterKey, MASTER_SECRET_LEN); | 298 | int32_t ret = VERIFY_CalcVerifyData(ctx, false, ctx->hsCtx->masterKey, MASTER_SECRET_LEN); |
| 302 | if (ret != HITLS_SUCCESS) { | 299 | if (ret != HITLS_SUCCESS) { |
| 303 | - (void)memset_s(ctx->hsCtx->masterKey, sizeof(ctx->hsCtx->masterKey), 0, sizeof(ctx->hsCtx->masterKey)); | ||
| 304 | BSL_LOG_BINLOG_FIXLEN(BINLOG_ID15362, BSL_LOG_LEVEL_ERR, BSL_LOG_BINLOG_TYPE_RUN, | 300 | BSL_LOG_BINLOG_FIXLEN(BINLOG_ID15362, BSL_LOG_LEVEL_ERR, BSL_LOG_BINLOG_TYPE_RUN, |
| 305 | "server Calculate server finished data error.", 0, 0, 0, 0); | 301 | "server Calculate server finished data error.", 0, 0, 0, 0); |
| 306 | ctx->method.sendAlert(ctx, ALERT_LEVEL_FATAL, ALERT_INTERNAL_ERROR); | 302 | ctx->method.sendAlert(ctx, ALERT_LEVEL_FATAL, ALERT_INTERNAL_ERROR); |
| @@ -345,7 +341,6 @@ int32_t Tls12ServerSendFinishedProcess(TLS_Ctx *ctx) | |||
| 345 | BSL_LOG_BINLOG_FIXLEN(BINLOG_ID15366, BSL_LOG_LEVEL_ERR, BSL_LOG_BINLOG_TYPE_RUN, | 341 | BSL_LOG_BINLOG_FIXLEN(BINLOG_ID15366, BSL_LOG_LEVEL_ERR, BSL_LOG_BINLOG_TYPE_RUN, |
| 346 | "server Calculate client finished data error.", 0, 0, 0, 0); | 342 | "server Calculate client finished data error.", 0, 0, 0, 0); |
| 347 | ctx->method.sendAlert(ctx, ALERT_LEVEL_FATAL, ALERT_INTERNAL_ERROR); | 343 | ctx->method.sendAlert(ctx, ALERT_LEVEL_FATAL, ALERT_INTERNAL_ERROR); |
| 348 | - (void)memset_s(ctx->hsCtx->masterKey, sizeof(ctx->hsCtx->masterKey), 0, sizeof(ctx->hsCtx->masterKey)); | ||
| 349 | return ret; | 344 | return ret; |
| 350 | } | 345 | } |
| 351 | ctx->method.ctrlCCS(ctx, CCS_CMD_RECV_ACTIVE_CIPHER_SPEC); | 346 | ctx->method.ctrlCCS(ctx, CCS_CMD_RECV_ACTIVE_CIPHER_SPEC); |
| @@ -375,7 +370,6 @@ static int32_t DtlsServerChangeStateAfterSendFinished(TLS_Ctx *ctx) | |||
| 375 | BSL_LOG_BINLOG_FIXLEN(BINLOG_ID15371, BSL_LOG_LEVEL_ERR, BSL_LOG_BINLOG_TYPE_RUN, | 370 | BSL_LOG_BINLOG_FIXLEN(BINLOG_ID15371, BSL_LOG_LEVEL_ERR, BSL_LOG_BINLOG_TYPE_RUN, |
| 376 | "server Calculate client finished data error.", 0, 0, 0, 0); | 371 | "server Calculate client finished data error.", 0, 0, 0, 0); |
| 377 | ctx->method.sendAlert(ctx, ALERT_LEVEL_FATAL, ALERT_INTERNAL_ERROR); | 372 | ctx->method.sendAlert(ctx, ALERT_LEVEL_FATAL, ALERT_INTERNAL_ERROR); |
| 378 | - (void)memset_s(ctx->hsCtx->masterKey, sizeof(ctx->hsCtx->masterKey), 0, sizeof(ctx->hsCtx->masterKey)); | ||
| 379 | return ret; | 373 | return ret; |
| 380 | } | 374 | } |
| 381 | ctx->method.ctrlCCS(ctx, CCS_CMD_RECV_READY); | 375 | ctx->method.ctrlCCS(ctx, CCS_CMD_RECV_READY); |
| @@ -414,7 +408,6 @@ int32_t DtlsServerSendFinishedProcess(TLS_Ctx *ctx) | |||
| 414 | if (hsCtx->msgLen == 0) { | 408 | if (hsCtx->msgLen == 0) { |
| 415 | ret = VERIFY_CalcVerifyData(ctx, false, ctx->hsCtx->masterKey, MASTER_SECRET_LEN); | 409 | ret = VERIFY_CalcVerifyData(ctx, false, ctx->hsCtx->masterKey, MASTER_SECRET_LEN); |
| 416 | if (ret != HITLS_SUCCESS) { | 410 | if (ret != HITLS_SUCCESS) { |
| 417 | - (void)memset_s(ctx->hsCtx->masterKey, sizeof(ctx->hsCtx->masterKey), 0, sizeof(ctx->hsCtx->masterKey)); | ||
| 418 | BSL_LOG_BINLOG_FIXLEN(BINLOG_ID15372, BSL_LOG_LEVEL_ERR, BSL_LOG_BINLOG_TYPE_RUN, | 411 | BSL_LOG_BINLOG_FIXLEN(BINLOG_ID15372, BSL_LOG_LEVEL_ERR, BSL_LOG_BINLOG_TYPE_RUN, |
| 419 | "server Calculate server finished data error.", 0, 0, 0, 0); | 412 | "server Calculate server finished data error.", 0, 0, 0, 0); |
| 420 | ctx->method.sendAlert(ctx, ALERT_LEVEL_FATAL, ALERT_INTERNAL_ERROR); | 413 | ctx->method.sendAlert(ctx, ALERT_LEVEL_FATAL, ALERT_INTERNAL_ERROR); |
| @@ -211,6 +211,12 @@ void HS_DeInit(TLS_Ctx *ctx) | |||
| 211 | 211 | ||
| 212 | /* clear sensitive information */ | 212 | /* clear sensitive information */ |
| 213 | BSL_SAL_CleanseData(hsCtx->masterKey, MAX_DIGEST_SIZE); | 213 | BSL_SAL_CleanseData(hsCtx->masterKey, MAX_DIGEST_SIZE); |
| 214 | + | ||
| 215 | + BSL_SAL_CleanseData(ctx->hsCtx->earlySecret, MAX_DIGEST_SIZE); | ||
| 216 | + BSL_SAL_CleanseData(ctx->hsCtx->handshakeSecret, MAX_DIGEST_SIZE); | ||
| 217 | + BSL_SAL_CleanseData(ctx->hsCtx->serverHsTrafficSecret, MAX_DIGEST_SIZE); | ||
| 218 | + BSL_SAL_CleanseData(ctx->hsCtx->clientHsTrafficSecret, MAX_DIGEST_SIZE); | ||
| 219 | + | ||
| 214 | if (hsCtx->peerCert != NULL) { | 220 | if (hsCtx->peerCert != NULL) { |
| 215 | SAL_CERT_PairFree(ctx->config.tlsConfig.certMgrCtx, hsCtx->peerCert); | 221 | SAL_CERT_PairFree(ctx->config.tlsConfig.certMgrCtx, hsCtx->peerCert); |
| 216 | hsCtx->peerCert = NULL; | 222 | hsCtx->peerCert = NULL; |