已合并
fix:Change the function parameter type to bool* #609
balabala-123创建于 2025年9月19日
fix:Change the function parameter type to bool* #609
已合并
共 34 个文件变更+251-264
| @@ -374,7 +374,7 @@ int32_t HITLS_SetMaxProtoVersion(HITLS_Ctx *ctx, uint16_t version); | |||
| 374 | * @retval HITLS_SUCCESS, obtained successfully. | 374 | * @retval HITLS_SUCCESS, obtained successfully. |
| 375 | * HITLS_NULL_INPUT, The input parameter pointer is null. | 375 | * HITLS_NULL_INPUT, The input parameter pointer is null. |
| 376 | */ | 376 | */ |
| 377 | -int32_t HITLS_IsAead(const HITLS_Ctx *ctx, uint8_t *isAead); | 377 | +int32_t HITLS_IsAead(const HITLS_Ctx *ctx, bool *isAead); |
| 378 | 378 | ||
| 379 | /** | 379 | /** |
| 380 | * @ingroup hitls | 380 | * @ingroup hitls |
| @@ -385,7 +385,7 @@ int32_t HITLS_IsAead(const HITLS_Ctx *ctx, uint8_t *isAead); | |||
| 385 | * @retval HITLS_SUCCESS, is obtained successfully. | 385 | * @retval HITLS_SUCCESS, is obtained successfully. |
| 386 | * HITLS_NULL_INPUT, The input parameter pointer is null. | 386 | * HITLS_NULL_INPUT, The input parameter pointer is null. |
| 387 | */ | 387 | */ |
| 388 | -int32_t HITLS_IsDtls(const HITLS_Ctx *ctx, uint8_t *isDtls); | 388 | +int32_t HITLS_IsDtls(const HITLS_Ctx *ctx, bool *isDtls); |
| 389 | 389 | ||
| 390 | /** | 390 | /** |
| 391 | * @ingroup hitls | 391 | * @ingroup hitls |
| @@ -427,7 +427,7 @@ int32_t HITLS_IsHandShakeDone(const HITLS_Ctx *ctx, uint8_t *isDone); | |||
| 427 | * @retval HITLS_SUCCESS, if successful. | 427 | * @retval HITLS_SUCCESS, if successful. |
| 428 | * @retval For other error codes, see hitls_error.h. | 428 | * @retval For other error codes, see hitls_error.h. |
| 429 | */ | 429 | */ |
| 430 | -int32_t HITLS_IsServer(const HITLS_Ctx *ctx, uint8_t *isServer); | 430 | +int32_t HITLS_IsServer(const HITLS_Ctx *ctx, bool *isServer); |
| 431 | 431 | ||
| 432 | /** | 432 | /** |
| 433 | * @ingroup hitls | 433 | * @ingroup hitls |
| @@ -440,7 +440,7 @@ int32_t HITLS_IsServer(const HITLS_Ctx *ctx, uint8_t *isServer); | |||
| 440 | * @retval HITLS_SUCCESS, if successful. | 440 | * @retval HITLS_SUCCESS, if successful. |
| 441 | * @retval For other error codes, see hitls_error.h. | 441 | * @retval For other error codes, see hitls_error.h. |
| 442 | */ | 442 | */ |
| 443 | -int32_t HITLS_ReadHasPending(const HITLS_Ctx *ctx, uint8_t *isPending); | 443 | +int32_t HITLS_ReadHasPending(const HITLS_Ctx *ctx, bool *isPending); |
| 444 | 444 | ||
| 445 | /** | 445 | /** |
| 446 | * @ingroup hitls | 446 | * @ingroup hitls |
| @@ -675,7 +675,7 @@ const char *HITLS_GetStateString(uint32_t state); | |||
| 675 | * @retval HITLS_SUCCESS, Obtaining the status succeeded. | 675 | * @retval HITLS_SUCCESS, Obtaining the status succeeded. |
| 676 | * For other error codes, see hitls_error.h. | 676 | * For other error codes, see hitls_error.h. |
| 677 | */ | 677 | */ |
| 678 | -int32_t HITLS_IsHandShaking(const HITLS_Ctx *ctx, uint8_t *isHandShaking); | 678 | +int32_t HITLS_IsHandShaking(const HITLS_Ctx *ctx, bool *isHandShaking); |
| 679 | 679 | ||
| 680 | /** | 680 | /** |
| 681 | * @ingroup hitls | 681 | * @ingroup hitls |
| @@ -686,7 +686,7 @@ int32_t HITLS_IsHandShaking(const HITLS_Ctx *ctx, uint8_t *isHandShaking); | |||
| 686 | * @retval HITLS_SUCCESS, obtain successful. | 686 | * @retval HITLS_SUCCESS, obtain successful. |
| 687 | * For details about other error codes, see hitls_error.h. | 687 | * For details about other error codes, see hitls_error.h. |
| 688 | */ | 688 | */ |
| 689 | -int32_t HITLS_GetRenegotiationSupport(const HITLS_Ctx *ctx, uint8_t *isSupportRenegotiation); | 689 | +int32_t HITLS_GetRenegotiationSupport(const HITLS_Ctx *ctx, bool *isSupportRenegotiation); |
| 690 | 690 | ||
| 691 | /** | 691 | /** |
| 692 | * @ingroup hitls | 692 | * @ingroup hitls |
| @@ -697,7 +697,7 @@ int32_t HITLS_GetRenegotiationSupport(const HITLS_Ctx *ctx, uint8_t *isSupportRe | |||
| 697 | * @retval HITLS_SUCCESS, obtaining the status succeeded. | 697 | * @retval HITLS_SUCCESS, obtaining the status succeeded. |
| 698 | * For other error codes, see hitls_error.h. | 698 | * For other error codes, see hitls_error.h. |
| 699 | */ | 699 | */ |
| 700 | -int32_t HITLS_IsBeforeHandShake(const HITLS_Ctx *ctx, uint8_t *isBefore); | 700 | +int32_t HITLS_IsBeforeHandShake(const HITLS_Ctx *ctx, bool *isBefore); |
| 701 | 701 | ||
| 702 | /** | 702 | /** |
| 703 | * @ingroup hitls | 703 | * @ingroup hitls |
| @@ -1012,7 +1012,7 @@ int32_t HITLS_GetFinishVerifyData(const HITLS_Ctx *ctx, void *buf, uint32_t bufL | |||
| 1012 | * @retval HITLS_SUCCESS, obtained successfully. | 1012 | * @retval HITLS_SUCCESS, obtained successfully. |
| 1013 | * For details about other error codes, see hitls_error.h. | 1013 | * For details about other error codes, see hitls_error.h. |
| 1014 | */ | 1014 | */ |
| 1015 | -int32_t HITLS_GetSecureRenegotiationSupport(const HITLS_Ctx *ctx, uint8_t *isSecureRenegotiation); | 1015 | +int32_t HITLS_GetSecureRenegotiationSupport(const HITLS_Ctx *ctx, bool *isSecureRenegotiation); |
| 1016 | 1016 | ||
| 1017 | /** | 1017 | /** |
| 1018 | * @ingroup hitls | 1018 | * @ingroup hitls |
| @@ -1073,7 +1073,7 @@ int32_t HITLS_Renegotiate(HITLS_Ctx *ctx); | |||
| 1073 | * @retval HITLS_SUCCESS, if successful. | 1073 | * @retval HITLS_SUCCESS, if successful. |
| 1074 | * @retval For details about other error codes, see hitls_error.h. | 1074 | * @retval For details about other error codes, see hitls_error.h. |
| 1075 | */ | 1075 | */ |
| 1076 | -int32_t HITLS_GetRenegotiationState(const HITLS_Ctx *ctx, uint8_t *isRenegotiationState); | 1076 | +int32_t HITLS_GetRenegotiationState(const HITLS_Ctx *ctx, bool *isRenegotiationState); |
| 1077 | 1077 | ||
| 1078 | 1078 | ||
| 1079 | /** | 1079 | /** |
| @@ -1096,7 +1096,7 @@ int32_t HITLS_GetRwstate(const HITLS_Ctx *ctx, uint8_t *rwstate); | |||
| 1096 | * @retval HITLS_SUCCESS, if successful. | 1096 | * @retval HITLS_SUCCESS, if successful. |
| 1097 | * @retval HITLS_NULL_INPUT, ctx is null. | 1097 | * @retval HITLS_NULL_INPUT, ctx is null. |
| 1098 | */ | 1098 | */ |
| 1099 | -int32_t HITLS_GetClientVerifySupport(HITLS_Ctx *ctx, uint8_t *isSupport); | 1099 | +int32_t HITLS_GetClientVerifySupport(HITLS_Ctx *ctx, bool *isSupport); |
| 1100 | 1100 | ||
| 1101 | /** | 1101 | /** |
| 1102 | * @ingroup hitls | 1102 | * @ingroup hitls |
| @@ -1108,7 +1108,7 @@ int32_t HITLS_GetClientVerifySupport(HITLS_Ctx *ctx, uint8_t *isSupport); | |||
| 1108 | * @retval HITLS_SUCCESS, if successful. | 1108 | * @retval HITLS_SUCCESS, if successful. |
| 1109 | * @retval HITLS_NULL_INPUT, ctx is null. | 1109 | * @retval HITLS_NULL_INPUT, ctx is null. |
| 1110 | */ | 1110 | */ |
| 1111 | -int32_t HITLS_GetNoClientCertSupport(HITLS_Ctx *ctx, uint8_t *isSupport); | 1111 | +int32_t HITLS_GetNoClientCertSupport(HITLS_Ctx *ctx, bool *isSupport); |
| 1112 | 1112 | ||
| 1113 | /** | 1113 | /** |
| 1114 | * @ingroup hitls | 1114 | * @ingroup hitls |
| @@ -1119,7 +1119,7 @@ int32_t HITLS_GetNoClientCertSupport(HITLS_Ctx *ctx, uint8_t *isSupport); | |||
| 1119 | * @retval HITLS_SUCCESS, if successful. | 1119 | * @retval HITLS_SUCCESS, if successful. |
| 1120 | * @retval HITLS_NULL_INPUT, ctx is null. | 1120 | * @retval HITLS_NULL_INPUT, ctx is null. |
| 1121 | */ | 1121 | */ |
| 1122 | -int32_t HITLS_GetPostHandshakeAuthSupport(HITLS_Ctx *ctx, uint8_t *isSupport); | 1122 | +int32_t HITLS_GetPostHandshakeAuthSupport(HITLS_Ctx *ctx, bool *isSupport); |
| 1123 | 1123 | ||
| 1124 | /** | 1124 | /** |
| 1125 | * @ingroup hitls | 1125 | * @ingroup hitls |
| @@ -1130,7 +1130,7 @@ int32_t HITLS_GetPostHandshakeAuthSupport(HITLS_Ctx *ctx, uint8_t *isSupport); | |||
| 1130 | * @retval HITLS_SUCCESS, if successful. | 1130 | * @retval HITLS_SUCCESS, if successful. |
| 1131 | * @retval HITLS_NULL_INPUT, ctx is null. | 1131 | * @retval HITLS_NULL_INPUT, ctx is null. |
| 1132 | */ | 1132 | */ |
| 1133 | -int32_t HITLS_GetVerifyNoneSupport(HITLS_Ctx *ctx, uint8_t *isSupport); | 1133 | +int32_t HITLS_GetVerifyNoneSupport(HITLS_Ctx *ctx, bool *isSupport); |
| 1134 | 1134 | ||
| 1135 | /** | 1135 | /** |
| 1136 | * @ingroup hitls | 1136 | * @ingroup hitls |
| @@ -1141,7 +1141,7 @@ int32_t HITLS_GetVerifyNoneSupport(HITLS_Ctx *ctx, uint8_t *isSupport); | |||
| 1141 | * @retval HITLS_SUCCESS, if successful. | 1141 | * @retval HITLS_SUCCESS, if successful. |
| 1142 | * @retval HITLS_NULL_INPUT, ctx is null. | 1142 | * @retval HITLS_NULL_INPUT, ctx is null. |
| 1143 | */ | 1143 | */ |
| 1144 | -int32_t HITLS_GetClientOnceVerifySupport(HITLS_Ctx *ctx, uint8_t *isSupport); | 1144 | +int32_t HITLS_GetClientOnceVerifySupport(HITLS_Ctx *ctx, bool *isSupport); |
| 1145 | 1145 | ||
| 1146 | 1146 | ||
| 1147 | /** | 1147 | /** |
| @@ -1197,7 +1197,7 @@ int32_t HITLS_GetModeSupport(const HITLS_Ctx *ctx, uint32_t *mode); | |||
| 1197 | * @retval HITLS_NULL_INPUT, the input parameter pointer is NULL. | 1197 | * @retval HITLS_NULL_INPUT, the input parameter pointer is NULL. |
| 1198 | * @retval HITLS_SUCCESS, if successful. | 1198 | * @retval HITLS_SUCCESS, if successful. |
| 1199 | */ | 1199 | */ |
| 1200 | -int32_t HITLS_SetEncryptThenMac(HITLS_Ctx *ctx, uint32_t encryptThenMacType); | 1200 | +int32_t HITLS_SetEncryptThenMac(HITLS_Ctx *ctx, bool encryptThenMacType); |
| 1201 | 1201 | ||
| 1202 | /** | 1202 | /** |
| 1203 | * @ingroup hitls | 1203 | * @ingroup hitls |
| @@ -1208,7 +1208,7 @@ int32_t HITLS_SetEncryptThenMac(HITLS_Ctx *ctx, uint32_t encryptThenMacType); | |||
| 1208 | * @retval HITLS_NULL_INPUT, the input parameter pointer is NULL. | 1208 | * @retval HITLS_NULL_INPUT, the input parameter pointer is NULL. |
| 1209 | * @retval HITLS_SUCCESS, if successful. | 1209 | * @retval HITLS_SUCCESS, if successful. |
| 1210 | */ | 1210 | */ |
| 1211 | -int32_t HITLS_GetEncryptThenMac(const HITLS_Ctx *ctx, uint32_t *encryptThenMacType); | 1211 | +int32_t HITLS_GetEncryptThenMac(const HITLS_Ctx *ctx, bool *encryptThenMacType); |
| 1212 | 1212 | ||
| 1213 | /** | 1213 | /** |
| 1214 | * @ingroup hitls | 1214 | * @ingroup hitls |
| @@ -1296,7 +1296,7 @@ int32_t HITLS_SetSessionTicketSupport(HITLS_Ctx *ctx, bool isSupport); | |||
| 1296 | * @retval HITLS_SUCCESS, if successful. | 1296 | * @retval HITLS_SUCCESS, if successful. |
| 1297 | * @retval HITLS_NULL_INPUT, the input parameter pointer is NULL. | 1297 | * @retval HITLS_NULL_INPUT, the input parameter pointer is NULL. |
| 1298 | */ | 1298 | */ |
| 1299 | -int32_t HITLS_GetSessionTicketSupport(const HITLS_Ctx *ctx, uint8_t *isSupport); | 1299 | +int32_t HITLS_GetSessionTicketSupport(const HITLS_Ctx *ctx, bool *isSupport); |
| 1300 | 1300 | ||
| 1301 | /** | 1301 | /** |
| 1302 | * @ingroup hitls | 1302 | * @ingroup hitls |
| @@ -1330,7 +1330,7 @@ int32_t HITLS_GetDtlsCookieExangeSupport(const HITLS_Ctx *ctx, bool *isSupport); | |||
| 1330 | * @retval HITLS_NULL_INPUT, the input parameter pointer is NULL. | 1330 | * @retval HITLS_NULL_INPUT, the input parameter pointer is NULL. |
| 1331 | * @retval HITLS_SUCCESS, if successful. | 1331 | * @retval HITLS_SUCCESS, if successful. |
| 1332 | */ | 1332 | */ |
| 1333 | -int32_t HITLS_SetFlightTransmitSwitch(HITLS_Ctx *ctx, uint8_t isEnable); | 1333 | +int32_t HITLS_SetFlightTransmitSwitch(HITLS_Ctx *ctx, bool isEnable); |
| 1334 | 1334 | ||
| 1335 | /** | 1335 | /** |
| 1336 | * @ingroup hitls | 1336 | * @ingroup hitls |
| @@ -1341,7 +1341,7 @@ int32_t HITLS_SetFlightTransmitSwitch(HITLS_Ctx *ctx, uint8_t isEnable); | |||
| 1341 | * @retval HITLS_NULL_INPUT, the input parameter pointer is NULL. | 1341 | * @retval HITLS_NULL_INPUT, the input parameter pointer is NULL. |
| 1342 | * @retval HITLS_SUCCESS, if successful. | 1342 | * @retval HITLS_SUCCESS, if successful. |
| 1343 | */ | 1343 | */ |
| 1344 | -int32_t HITLS_GetFlightTransmitSwitch(const HITLS_Ctx *ctx, uint8_t *isEnable); | 1344 | +int32_t HITLS_GetFlightTransmitSwitch(const HITLS_Ctx *ctx, bool *isEnable); |
| 1345 | 1345 | ||
| 1346 | /** | 1346 | /** |
| 1347 | * @ingroup hitls | 1347 | * @ingroup hitls |
| @@ -660,7 +660,7 @@ int32_t HITLS_CFG_SetTmpDh(HITLS_Config *config, HITLS_CRYPT_Key *dhPkey); | |||
| 660 | * @retval HITLS_SUCCESS, if successful. | 660 | * @retval HITLS_SUCCESS, if successful. |
| 661 | * @retval HITLS_NULL_INPUT, config is null. | 661 | * @retval HITLS_NULL_INPUT, config is null. |
| 662 | */ | 662 | */ |
| 663 | -int32_t HITLS_CFG_GetRenegotiationSupport(const HITLS_Config *config, uint8_t *isSupport); | 663 | +int32_t HITLS_CFG_GetRenegotiationSupport(const HITLS_Config *config, bool *isSupport); |
| 664 | 664 | ||
| 665 | 665 | ||
| 666 | /** | 666 | /** |
| @@ -672,7 +672,7 @@ int32_t HITLS_CFG_GetRenegotiationSupport(const HITLS_Config *config, uint8_t *i | |||
| 672 | * @retval HITLS_SUCCESS, if successful. | 672 | * @retval HITLS_SUCCESS, if successful. |
| 673 | * @retval HITLS_NULL_INPUT, config is null. | 673 | * @retval HITLS_NULL_INPUT, config is null. |
| 674 | */ | 674 | */ |
| 675 | -int32_t HITLS_CFG_GetClientVerifySupport(HITLS_Config *config, uint8_t *isSupport); | 675 | +int32_t HITLS_CFG_GetClientVerifySupport(HITLS_Config *config, bool *isSupport); |
| 676 | 676 | ||
| 677 | /** | 677 | /** |
| 678 | * @ingroup hitls_config | 678 | * @ingroup hitls_config |
| @@ -684,7 +684,7 @@ int32_t HITLS_CFG_GetClientVerifySupport(HITLS_Config *config, uint8_t *isSuppor | |||
| 684 | * @retval HITLS_SUCCESS, if successful. | 684 | * @retval HITLS_SUCCESS, if successful. |
| 685 | * @retval HITLS_NULL_INPUT, config is null. | 685 | * @retval HITLS_NULL_INPUT, config is null. |
| 686 | */ | 686 | */ |
| 687 | -int32_t HITLS_CFG_GetNoClientCertSupport(HITLS_Config *config, uint8_t *isSupport); | 687 | +int32_t HITLS_CFG_GetNoClientCertSupport(HITLS_Config *config, bool *isSupport); |
| 688 | 688 | ||
| 689 | /** | 689 | /** |
| 690 | * @ingroup hitls_config | 690 | * @ingroup hitls_config |
| @@ -695,7 +695,7 @@ int32_t HITLS_CFG_GetNoClientCertSupport(HITLS_Config *config, uint8_t *isSuppor | |||
| 695 | * @retval HITLS_SUCCESS, if successful. | 695 | * @retval HITLS_SUCCESS, if successful. |
| 696 | * @retval HITLS_NULL_INPUT, config is null. | 696 | * @retval HITLS_NULL_INPUT, config is null. |
| 697 | */ | 697 | */ |
| 698 | -int32_t HITLS_CFG_GetExtenedMasterSecretSupport(HITLS_Config *config, uint8_t *isSupport); | 698 | +int32_t HITLS_CFG_GetExtenedMasterSecretSupport(HITLS_Config *config, bool *isSupport); |
| 699 | 699 | ||
| 700 | /** | 700 | /** |
| 701 | * @ingroup hitls_config | 701 | * @ingroup hitls_config |
| @@ -707,7 +707,7 @@ int32_t HITLS_CFG_GetExtenedMasterSecretSupport(HITLS_Config *config, uint8_t *i | |||
| 707 | * @retval HITLS_SUCCESS, if successful. | 707 | * @retval HITLS_SUCCESS, if successful. |
| 708 | * @retval HITLS_NULL_INPUT, config is null. | 708 | * @retval HITLS_NULL_INPUT, config is null. |
| 709 | */ | 709 | */ |
| 710 | -int32_t HITLS_CFG_GetDhAutoSupport(HITLS_Config *config, uint8_t *isSupport); | 710 | +int32_t HITLS_CFG_GetDhAutoSupport(HITLS_Config *config, bool *isSupport); |
| 711 | 711 | ||
| 712 | /** | 712 | /** |
| 713 | * @ingroup hitls_config | 713 | * @ingroup hitls_config |
| @@ -736,7 +736,7 @@ int32_t HITLS_CFG_SetPostHandshakeAuthSupport(HITLS_Config *config, bool support | |||
| 736 | * @retval HITLS_SUCCESS, if successful. | 736 | * @retval HITLS_SUCCESS, if successful. |
| 737 | * @retval HITLS_NULL_INPUT, config is null. | 737 | * @retval HITLS_NULL_INPUT, config is null. |
| 738 | */ | 738 | */ |
| 739 | -int32_t HITLS_CFG_GetPostHandshakeAuthSupport(HITLS_Config *config, uint8_t *isSupport); | 739 | +int32_t HITLS_CFG_GetPostHandshakeAuthSupport(HITLS_Config *config, bool *isSupport); |
| 740 | 740 | ||
| 741 | /** | 741 | /** |
| 742 | * @ingroup hitls_config | 742 | * @ingroup hitls_config |
| @@ -757,7 +757,7 @@ int32_t HITLS_CFG_SetVerifyNoneSupport(HITLS_Config *config, bool support); | |||
| 757 | * @retval HITLS_SUCCESS, if successful. | 757 | * @retval HITLS_SUCCESS, if successful. |
| 758 | * @retval HITLS_NULL_INPUT, config is null. | 758 | * @retval HITLS_NULL_INPUT, config is null. |
| 759 | */ | 759 | */ |
| 760 | -int32_t HITLS_CFG_GetVerifyNoneSupport(HITLS_Config *config, uint8_t *isSupport); | 760 | +int32_t HITLS_CFG_GetVerifyNoneSupport(HITLS_Config *config, bool *isSupport); |
| 761 | 761 | ||
| 762 | /** | 762 | /** |
| 763 | * @ingroup hitls_config | 763 | * @ingroup hitls_config |
| @@ -779,7 +779,7 @@ int32_t HITLS_CFG_SetClientOnceVerifySupport(HITLS_Config *config, bool support) | |||
| 779 | * @retval HITLS_SUCCESS, if successful. | 779 | * @retval HITLS_SUCCESS, if successful. |
| 780 | * @retval HITLS_NULL_INPUT, config is null. | 780 | * @retval HITLS_NULL_INPUT, config is null. |
| 781 | */ | 781 | */ |
| 782 | -int32_t HITLS_CFG_GetClientOnceVerifySupport(HITLS_Config *config, uint8_t *isSupport); | 782 | +int32_t HITLS_CFG_GetClientOnceVerifySupport(HITLS_Config *config, bool *isSupport); |
| 783 | 783 | ||
| 784 | /** | 784 | /** |
| 785 | * @ingroup hitls_config | 785 | * @ingroup hitls_config |
| @@ -1074,7 +1074,7 @@ int32_t HITLS_CFG_GetDescription(const HITLS_Cipher *cipher, uint8_t *buf, int32 | |||
| 1074 | * @retval HITLS_SUCCESS, obtained successfully. | 1074 | * @retval HITLS_SUCCESS, obtained successfully. |
| 1075 | * HITLS_NULL_INPUT, the input parameter pointer is null. | 1075 | * HITLS_NULL_INPUT, the input parameter pointer is null. |
| 1076 | */ | 1076 | */ |
| 1077 | -int32_t HITLS_CIPHER_IsAead(const HITLS_Cipher *cipher, uint8_t *isAead); | 1077 | +int32_t HITLS_CIPHER_IsAead(const HITLS_Cipher *cipher, bool *isAead); |
| 1078 | 1078 | ||
| 1079 | /** | 1079 | /** |
| 1080 | * @ingroup hitls_config | 1080 | * @ingroup hitls_config |
| @@ -1195,7 +1195,7 @@ int32_t HITLS_CFG_SetDtlsPostHsTimeoutVal(HITLS_Config *config, uint32_t timeout | |||
| 1195 | * @retval HITLS_NULL_INPUT, the input parameter pointer is null. | 1195 | * @retval HITLS_NULL_INPUT, the input parameter pointer is null. |
| 1196 | * @retval HITLS_SUCCESS, if successful. | 1196 | * @retval HITLS_SUCCESS, if successful. |
| 1197 | */ | 1197 | */ |
| 1198 | -int32_t HITLS_CFG_SetEncryptThenMac(HITLS_Config *config, uint32_t encryptThenMacType); | 1198 | +int32_t HITLS_CFG_SetEncryptThenMac(HITLS_Config *config, bool encryptThenMacType); |
| 1199 | 1199 | ||
| 1200 | /** | 1200 | /** |
| 1201 | * @ingroup hitls_config | 1201 | * @ingroup hitls_config |
| @@ -1206,7 +1206,7 @@ int32_t HITLS_CFG_SetEncryptThenMac(HITLS_Config *config, uint32_t encryptThenMa | |||
| 1206 | * @retval HITLS_NULL_INPUT, the input parameter pointer is null. | 1206 | * @retval HITLS_NULL_INPUT, the input parameter pointer is null. |
| 1207 | * @retval HITLS_SUCCESS, if successful. | 1207 | * @retval HITLS_SUCCESS, if successful. |
| 1208 | */ | 1208 | */ |
| 1209 | -int32_t HITLS_CFG_GetEncryptThenMac(const HITLS_Config *config, uint32_t *encryptThenMacType); | 1209 | +int32_t HITLS_CFG_GetEncryptThenMac(const HITLS_Config *config, bool *encryptThenMacType); |
| 1210 | 1210 | ||
| 1211 | /** | 1211 | /** |
| 1212 | * @ingroup hitls_config | 1212 | * @ingroup hitls_config |
| @@ -1264,7 +1264,7 @@ int32_t HITLS_CFG_SetConfigUserDataFreeCb(HITLS_Config *config, HITLS_ConfigUser | |||
| 1264 | * @retval HITLS_SUCCESS, obtained successfully. | 1264 | * @retval HITLS_SUCCESS, obtained successfully. |
| 1265 | * HITLS_NULL_INPUT, the input parameter pointer is null. | 1265 | * HITLS_NULL_INPUT, the input parameter pointer is null. |
| 1266 | */ | 1266 | */ |
| 1267 | -int32_t HITLS_CFG_IsDtls(const HITLS_Config *config, uint8_t *isDtls); | 1267 | +int32_t HITLS_CFG_IsDtls(const HITLS_Config *config, bool *isDtls); |
| 1268 | 1268 | ||
| 1269 | /** | 1269 | /** |
| 1270 | * @ingroup hitls_config | 1270 | * @ingroup hitls_config |
| @@ -1299,7 +1299,7 @@ int32_t HITLS_CFG_GetCipherServerPreference(const HITLS_Config *config, bool *is | |||
| 1299 | * @retval HITLS_NULL_INPUT, the input parameter pointer is null. | 1299 | * @retval HITLS_NULL_INPUT, the input parameter pointer is null. |
| 1300 | * @retval HITLS_SUCCESS, if successful. | 1300 | * @retval HITLS_SUCCESS, if successful. |
| 1301 | */ | 1301 | */ |
| 1302 | -int32_t HITLS_CFG_SetFlightTransmitSwitch(HITLS_Config *config, uint8_t isEnable); | 1302 | +int32_t HITLS_CFG_SetFlightTransmitSwitch(HITLS_Config *config, bool isEnable); |
| 1303 | 1303 | ||
| 1304 | /** | 1304 | /** |
| 1305 | * @ingroup hitls_config | 1305 | * @ingroup hitls_config |
| @@ -1310,7 +1310,7 @@ int32_t HITLS_CFG_SetFlightTransmitSwitch(HITLS_Config *config, uint8_t isEnable | |||
| 1310 | * @retval HITLS_NULL_INPUT, the input parameter pointer is null. | 1310 | * @retval HITLS_NULL_INPUT, the input parameter pointer is null. |
| 1311 | * @retval HITLS_SUCCESS, if successful. | 1311 | * @retval HITLS_SUCCESS, if successful. |
| 1312 | */ | 1312 | */ |
| 1313 | -int32_t HITLS_CFG_GetFlightTransmitSwitch(const HITLS_Config *config, uint8_t *isEnable); | 1313 | +int32_t HITLS_CFG_GetFlightTransmitSwitch(const HITLS_Config *config, bool *isEnable); |
| 1314 | 1314 | ||
| 1315 | /** | 1315 | /** |
| 1316 | * @ingroup hitls_config | 1316 | * @ingroup hitls_config |
| @@ -65,7 +65,7 @@ int32_t HITLS_CFG_SetSessionTicketSupport(HITLS_Config *config, bool support); | |||
| 65 | * @retval HITLS_SUCCESS, if successful. | 65 | * @retval HITLS_SUCCESS, if successful. |
| 66 | * @retval HITLS_NULL_INPUT, config is null. | 66 | * @retval HITLS_NULL_INPUT, config is null. |
| 67 | */ | 67 | */ |
| 68 | -int32_t HITLS_CFG_GetSessionTicketSupport(const HITLS_Config *config, uint8_t *isSupport); | 68 | +int32_t HITLS_CFG_GetSessionTicketSupport(const HITLS_Config *config, bool *isSupport); |
| 69 | 69 | ||
| 70 | /** | 70 | /** |
| 71 | * @ingroup hitls_session | 71 | * @ingroup hitls_session |
| @@ -316,7 +316,7 @@ int32_t HITLS_CFG_GetSessionTimeout(const HITLS_Config *config, uint64_t *timeou | |||
| 316 | * @retval HITLS_SUCCESS, if successful. | 316 | * @retval HITLS_SUCCESS, if successful. |
| 317 | * For details about other error codes, see hitls_error.h. | 317 | * For details about other error codes, see hitls_error.h. |
| 318 | */ | 318 | */ |
| 319 | -int32_t HITLS_IsSessionReused(HITLS_Ctx *ctx, uint8_t *isReused); | 319 | +int32_t HITLS_IsSessionReused(HITLS_Ctx *ctx, bool *isReused); |
| 320 | 320 | ||
| 321 | /** | 321 | /** |
| 322 | * @ingroup hitls_session | 322 | * @ingroup hitls_session |
| @@ -584,7 +584,7 @@ int32_t HITLS_SESS_SetHaveExtMasterSecret(HITLS_Session *sess, uint8_t haveExtMa | |||
| 584 | * @retval HITLS_SUCCESS, if successful. | 584 | * @retval HITLS_SUCCESS, if successful. |
| 585 | * @retval For other error codes, see hitls_error.h. | 585 | * @retval For other error codes, see hitls_error.h. |
| 586 | */ | 586 | */ |
| 587 | -int32_t HITLS_SESS_GetHaveExtMasterSecret(HITLS_Session *sess, uint8_t *haveExtMasterSecret); | 587 | +int32_t HITLS_SESS_GetHaveExtMasterSecret(HITLS_Session *sess, bool *haveExtMasterSecret); |
| 588 | 588 | ||
| 589 | /** | 589 | /** |
| 590 | * @ingroup hitls_session | 590 | * @ingroup hitls_session |
| @@ -539,7 +539,7 @@ int HitlsSetCtx(HITLS_Config *outCfg, HLT_Ctx_Config *inCtxCfg) | |||
| 539 | 539 | ||
| 540 | // Whether encrypt-then-mac is supported | 540 | // Whether encrypt-then-mac is supported |
| 541 | LOG_DEBUG("HiTLS Set Support EncryptThenMac is %d", inCtxCfg->isEncryptThenMac); | 541 | LOG_DEBUG("HiTLS Set Support EncryptThenMac is %d", inCtxCfg->isEncryptThenMac); |
| 542 | - ret = HITLS_CFG_SetEncryptThenMac(outCfg, (uint32_t)inCtxCfg->isEncryptThenMac); | 542 | + ret = HITLS_CFG_SetEncryptThenMac(outCfg, inCtxCfg->isEncryptThenMac); |
| 543 | ASSERT_RETURN(ret == SUCCESS, "HITLS_CFG_SetEncryptThenMac ERROR"); | 543 | ASSERT_RETURN(ret == SUCCESS, "HITLS_CFG_SetEncryptThenMac ERROR"); |
| 544 | 544 | ||
| 545 | // ECC Point Format Configuration for Asymmetric Algorithms | 545 | // ECC Point Format Configuration for Asymmetric Algorithms |
| @@ -910,7 +910,7 @@ int HitlsSetSession(void *ssl, void *session) | |||
| 910 | 910 | ||
| 911 | int HitlsSessionReused(void *ssl) | 911 | int HitlsSessionReused(void *ssl) |
| 912 | { | 912 | { |
| 913 | - uint8_t isReused = 0; | 913 | + bool isReused = false; |
| 914 | (void)ssl; | 914 | (void)ssl; |
| 915 | 915 | ||
| 916 | int32_t ret; | 916 | int32_t ret; |
| @@ -22,7 +22,7 @@ | |||
| 22 | * @title Enable the session restoration function at both ends. If the session ID is obtained after the link is | 22 | * @title Enable the session restoration function at both ends. If the session ID is obtained after the link is |
| 23 | successfully established, a fatal alert is sent. The session ID fails to be used to restore the session. | 23 | successfully established, a fatal alert is sent. The session ID fails to be used to restore the session. |
| 24 | * @precon nan | 24 | * @precon nan |
| 25 | -* @brief 1. Use the default configuration items to configure the client and server. | 25 | +* @brief 1. Use the default configuration items to configure the client and server. |
| 26 | * Enable the session restoration function at both ends. Expected result 1. | 26 | * Enable the session restoration function at both ends. Expected result 1. |
| 27 | * 2. Obtaine the session ID and a fatal alert is sent. The session ID fails to be used to restore the session. | 27 | * 2. Obtaine the session ID and a fatal alert is sent. The session ID fails to be used to restore the session. |
| 28 | * Expected result 2. | 28 | * Expected result 2. |
| @@ -55,9 +55,9 @@ void UT_TLS_TLCP_CONSISTENCY_RESUME_TC003() | |||
| 55 | HITLS_SetSession(client->ssl, clientSession); | 55 | HITLS_SetSession(client->ssl, clientSession); |
| 56 | server = FRAME_CreateTLCPLink(config, BSL_UIO_TCP, false); | 56 | server = FRAME_CreateTLCPLink(config, BSL_UIO_TCP, false); |
| 57 | ASSERT_EQ(FRAME_CreateConnection(client, server, false, HS_STATE_BUTT), HITLS_SUCCESS); | 57 | ASSERT_EQ(FRAME_CreateConnection(client, server, false, HS_STATE_BUTT), HITLS_SUCCESS); |
| 58 | - uint8_t isReused = 0; | 58 | + bool isReused = false; |
| 59 | ASSERT_EQ(HITLS_IsSessionReused(client->ssl, &isReused), HITLS_SUCCESS); | 59 | ASSERT_EQ(HITLS_IsSessionReused(client->ssl, &isReused), HITLS_SUCCESS); |
| 60 | - ASSERT_EQ(isReused, 0); | 60 | + ASSERT_EQ(isReused, false); |
| 61 | EXIT: | 61 | EXIT: |
| 62 | HITLS_CFG_FreeConfig(config); | 62 | HITLS_CFG_FreeConfig(config); |
| 63 | FRAME_FreeLink(client); | 63 | FRAME_FreeLink(client); |
| @@ -69,12 +69,12 @@ EXIT: | |||
| 69 | 69 | ||
| 70 | /* @ | 70 | /* @ |
| 71 | * @test UT_TLS_TLCP_CONSISTENCY_RESUME_TC004 | 71 | * @test UT_TLS_TLCP_CONSISTENCY_RESUME_TC004 |
| 72 | -* @title Set the client and server support session recovery. After the first connection is established, the session ID | 72 | +* @title Set the client and server support session recovery. After the first connection is established, the session ID |
| 73 | - is obtained. Create two connection. The client and server are the same as those in the last session. Use the | 73 | + is obtained. Create two connection. The client and server are the same as those in the last session. Use the |
| 74 | same session ID to restore the session. If the session on one link fails, check whether the data communication | 74 | same session ID to restore the session. If the session on one link fails, check whether the data communication |
| 75 | on the other link is blocked. It is expected that the link is not blocked. | 75 | on the other link is blocked. It is expected that the link is not blocked. |
| 76 | * @precon nan | 76 | * @precon nan |
| 77 | -* @brief 1. Use the default configuration items to configure the client and server. | 77 | +* @brief 1. Use the default configuration items to configure the client and server. |
| 78 | * Enable the session restoration function at both ends. Expected result 1. | 78 | * Enable the session restoration function at both ends. Expected result 1. |
| 79 | * 2. Use the default configuration items to configure two new client and server. | 79 | * 2. Use the default configuration items to configure two new client and server. |
| 80 | * The client and server are the same as those in the last session. Expected result 1. | 80 | * The client and server are the same as those in the last session. Expected result 1. |
| @@ -117,9 +117,9 @@ void UT_TLS_TLCP_CONSISTENCY_RESUME_TC004() | |||
| 117 | FRAME_FreeLink(server); | 117 | FRAME_FreeLink(server); |
| 118 | 118 | ||
| 119 | ASSERT_EQ(FRAME_CreateConnection(clientResume, serverResume, false, HS_STATE_BUTT), HITLS_SUCCESS); | 119 | ASSERT_EQ(FRAME_CreateConnection(clientResume, serverResume, false, HS_STATE_BUTT), HITLS_SUCCESS); |
| 120 | - uint8_t isReused = 0; | 120 | + bool isReused = false; |
| 121 | ASSERT_EQ(HITLS_IsSessionReused(clientResume->ssl, &isReused), HITLS_SUCCESS); | 121 | ASSERT_EQ(HITLS_IsSessionReused(clientResume->ssl, &isReused), HITLS_SUCCESS); |
| 122 | - ASSERT_EQ(isReused, 1); | 122 | + ASSERT_EQ(isReused, true); |
| 123 | EXIT: | 123 | EXIT: |
| 124 | HITLS_CFG_FreeConfig(config); | 124 | HITLS_CFG_FreeConfig(config); |
| 125 | FRAME_FreeLink(clientResume); | 125 | FRAME_FreeLink(clientResume); |
| @@ -137,7 +137,7 @@ EXIT: | |||
| 137 | * on the other link is blocked. If the data communication on the other link is not blocked, the data | 137 | * on the other link is blocked. If the data communication on the other link is not blocked, the data |
| 138 | * communication on the other link is not blocked. | 138 | * communication on the other link is not blocked. |
| 139 | * @precon nan | 139 | * @precon nan |
| 140 | -* @brief 1. Use the default configuration items to configure the client and server. | 140 | +* @brief 1. Use the default configuration items to configure the client and server. |
| 141 | * Enable the session restoration function at both ends. Expected result 1. | 141 | * Enable the session restoration function at both ends. Expected result 1. |
| 142 | * 2. Use the default configuration items to configure two new client and server. | 142 | * 2. Use the default configuration items to configure two new client and server. |
| 143 | * The client and server are the same as those in the last session. Expected result 1. | 143 | * The client and server are the same as those in the last session. Expected result 1. |
| @@ -179,11 +179,11 @@ void UT_TLS_TLCP_CONSISTENCY_RESUME_TC005() | |||
| 179 | ASSERT_EQ(FRAME_CreateConnection(clientResume, serverResume, false, HS_STATE_BUTT), HITLS_SUCCESS); | 179 | ASSERT_EQ(FRAME_CreateConnection(clientResume, serverResume, false, HS_STATE_BUTT), HITLS_SUCCESS); |
| 180 | ASSERT_EQ(FRAME_CreateConnection(client, server, false, HS_STATE_BUTT), HITLS_SUCCESS); | 180 | ASSERT_EQ(FRAME_CreateConnection(client, server, false, HS_STATE_BUTT), HITLS_SUCCESS); |
| 181 | 181 | ||
| 182 | - uint8_t isReused = 0; | 182 | + bool isReused = false; |
| 183 | ASSERT_EQ(HITLS_IsSessionReused(clientResume->ssl, &isReused), HITLS_SUCCESS); | 183 | ASSERT_EQ(HITLS_IsSessionReused(clientResume->ssl, &isReused), HITLS_SUCCESS); |
| 184 | - ASSERT_EQ(isReused, 0); | 184 | + ASSERT_EQ(isReused, false); |
| 185 | ASSERT_EQ(HITLS_IsSessionReused(client->ssl, &isReused), HITLS_SUCCESS); | 185 | ASSERT_EQ(HITLS_IsSessionReused(client->ssl, &isReused), HITLS_SUCCESS); |
| 186 | - ASSERT_EQ(isReused, 1); | 186 | + ASSERT_EQ(isReused, true); |
| 187 | 187 | ||
| 188 | EXIT: | 188 | EXIT: |
| 189 | HITLS_CFG_FreeConfig(config); | 189 | HITLS_CFG_FreeConfig(config); |
| @@ -227,9 +227,9 @@ void UT_TLS_TLCP_CONSISTENCY_RESUME_TC006() | |||
| 227 | HITLS_SetSession(client->ssl, clientSession); | 227 | HITLS_SetSession(client->ssl, clientSession); |
| 228 | sleep(timeout); | 228 | sleep(timeout); |
| 229 | ASSERT_EQ(FRAME_CreateConnection(client, server, false, HS_STATE_BUTT), HITLS_SUCCESS); | 229 | ASSERT_EQ(FRAME_CreateConnection(client, server, false, HS_STATE_BUTT), HITLS_SUCCESS); |
| 230 | - uint8_t isReused = 0; | 230 | + bool isReused = false; |
| 231 | ASSERT_EQ(HITLS_IsSessionReused(client->ssl, &isReused), HITLS_SUCCESS); | 231 | ASSERT_EQ(HITLS_IsSessionReused(client->ssl, &isReused), HITLS_SUCCESS); |
| 232 | - ASSERT_EQ(isReused, 0); | 232 | + ASSERT_EQ(isReused, false); |
| 233 | EXIT: | 233 | EXIT: |
| 234 | HITLS_CFG_FreeConfig(config); | 234 | HITLS_CFG_FreeConfig(config); |
| 235 | FRAME_FreeLink(client); | 235 | FRAME_FreeLink(client); |
| @@ -269,9 +269,9 @@ void UT_TLS_TLCP_CONSISTENCY_RESUME_TC007() | |||
| 269 | server = FRAME_CreateTLCPLink(config, BSL_UIO_TCP, false); | 269 | server = FRAME_CreateTLCPLink(config, BSL_UIO_TCP, false); |
| 270 | HITLS_SetSession(client->ssl, clientSession); | 270 | HITLS_SetSession(client->ssl, clientSession); |
| 271 | ASSERT_EQ(FRAME_CreateConnection(client, server, false, HS_STATE_BUTT), HITLS_SUCCESS); | 271 | ASSERT_EQ(FRAME_CreateConnection(client, server, false, HS_STATE_BUTT), HITLS_SUCCESS); |
| 272 | - uint8_t isReused = 0; | 272 | + bool isReused = false; |
| 273 | ASSERT_EQ(HITLS_IsSessionReused(client->ssl, &isReused), HITLS_SUCCESS); | 273 | ASSERT_EQ(HITLS_IsSessionReused(client->ssl, &isReused), HITLS_SUCCESS); |
| 274 | - ASSERT_EQ(isReused, 0); | 274 | + ASSERT_EQ(isReused, false); |
| 275 | EXIT: | 275 | EXIT: |
| 276 | HITLS_CFG_FreeConfig(config); | 276 | HITLS_CFG_FreeConfig(config); |
| 277 | FRAME_FreeLink(client); | 277 | FRAME_FreeLink(client); |
| @@ -379,9 +379,9 @@ void SDV_TLS_TLCP_CONSISTENCY_RESUME_FUNC_TC003(int version, int connType) | |||
| 379 | if (session != NULL) { | 379 | if (session != NULL) { |
| 380 | ASSERT_TRUE(HITLS_SetSession(clientSsl, session) == HITLS_SUCCESS); | 380 | ASSERT_TRUE(HITLS_SetSession(clientSsl, session) == HITLS_SUCCESS); |
| 381 | ASSERT_EQ(HLT_TlsConnect(clientSsl), HITLS_SUCCESS); | 381 | ASSERT_EQ(HLT_TlsConnect(clientSsl), HITLS_SUCCESS); |
| 382 | - uint8_t isReused = 0; | 382 | + bool isReused = false; |
| 383 | ASSERT_TRUE(HITLS_IsSessionReused(clientSsl, &isReused) == HITLS_SUCCESS); | 383 | ASSERT_TRUE(HITLS_IsSessionReused(clientSsl, &isReused) == HITLS_SUCCESS); |
| 384 | - ASSERT_TRUE(isReused == 1); | 384 | + ASSERT_TRUE(isReused == true); |
| 385 | } else { | 385 | } else { |
| 386 | ASSERT_TRUE(HLT_TlsConnect(clientSsl) == 0); | 386 | ASSERT_TRUE(HLT_TlsConnect(clientSsl) == 0); |
| 387 | ASSERT_TRUE(HLT_RpcTlsWrite(remoteProcess, serverSslId, (uint8_t *)writeBuf, strlen(writeBuf)) == 0); | 387 | ASSERT_TRUE(HLT_RpcTlsWrite(remoteProcess, serverSslId, (uint8_t *)writeBuf, strlen(writeBuf)) == 0); |
| @@ -541,9 +541,9 @@ void SDV_TLS_TLCP_CONSISTENCY_RESUME_FUNC_TC004(int version, int connType) | |||
| 541 | ASSERT_TRUE(session != NULL); | 541 | ASSERT_TRUE(session != NULL); |
| 542 | ASSERT_TRUE(HITLS_SESS_IsResumable(session) == true); | 542 | ASSERT_TRUE(HITLS_SESS_IsResumable(session) == true); |
| 543 | if (count == 2) { | 543 | if (count == 2) { |
| 544 | - uint8_t isReused = 0; | 544 | + bool isReused = false; |
| 545 | ASSERT_TRUE(HITLS_IsSessionReused(clientSsl, &isReused) == HITLS_SUCCESS); | 545 | ASSERT_TRUE(HITLS_IsSessionReused(clientSsl, &isReused) == HITLS_SUCCESS); |
| 546 | - ASSERT_TRUE(isReused == 1); | 546 | + ASSERT_TRUE(isReused == true); |
| 547 | } | 547 | } |
| 548 | count++; | 548 | count++; |
| 549 | } while (count <= 2); | 549 | } while (count <= 2); |
| @@ -1144,13 +1144,13 @@ void SDV_TLS_TLCP_CONSISTENCY_RESUME_FUNC_TC009(int mode) | |||
| 1144 | 1144 | ||
| 1145 | if (cnt == 2) { | 1145 | if (cnt == 2) { |
| 1146 | if (mode == HITLS_SESS_CACHE_NO || mode == HITLS_SESS_CACHE_CLIENT){ | 1146 | if (mode == HITLS_SESS_CACHE_NO || mode == HITLS_SESS_CACHE_CLIENT){ |
| 1147 | - uint8_t isReused = -1; | 1147 | + bool isReused = false; |
| 1148 | HITLS_IsSessionReused(clientSsl, &isReused); | 1148 | HITLS_IsSessionReused(clientSsl, &isReused); |
| 1149 | - ASSERT_TRUE(isReused == 0); | 1149 | + ASSERT_TRUE(isReused == false); |
| 1150 | } else { | 1150 | } else { |
| 1151 | - uint8_t isReused = -1; | 1151 | + bool isReused = false; |
| 1152 | HITLS_IsSessionReused(clientSsl, &isReused); | 1152 | HITLS_IsSessionReused(clientSsl, &isReused); |
| 1153 | - ASSERT_TRUE(isReused == 1); | 1153 | + ASSERT_TRUE(isReused == true); |
| 1154 | } | 1154 | } |
| 1155 | } else { | 1155 | } else { |
| 1156 | session = HITLS_GetDupSession(clientSsl); | 1156 | session = HITLS_GetDupSession(clientSsl); |
| @@ -858,7 +858,7 @@ void UT_TLS_TLS12_RFC5746_CONSISTENCY_EXTENDED_RENEGOTIATION_FUNC_TC007(void) | |||
| 858 | FRAME_LinkObj *client = NULL; | 858 | FRAME_LinkObj *client = NULL; |
| 859 | FRAME_LinkObj *server = NULL; | 859 | FRAME_LinkObj *server = NULL; |
| 860 | 860 | ||
| 861 | - uint8_t isRenegotiation = true; | 861 | + bool isRenegotiation = true; |
| 862 | config = HITLS_CFG_NewTLS12Config(); | 862 | config = HITLS_CFG_NewTLS12Config(); |
| 863 | ASSERT_TRUE(config != NULL); | 863 | ASSERT_TRUE(config != NULL); |
| 864 | 864 | ||
| @@ -909,7 +909,7 @@ void UT_TLS_TLS12_RFC5746_CONSISTENCY_EXTENDED_RENEGOTIATION_FUNC_TC008(void) | |||
| 909 | FRAME_LinkObj *client = NULL; | 909 | FRAME_LinkObj *client = NULL; |
| 910 | FRAME_LinkObj *server = NULL; | 910 | FRAME_LinkObj *server = NULL; |
| 911 | 911 | ||
| 912 | - uint8_t isRenegotiation = true; | 912 | + bool isRenegotiation = true; |
| 913 | config = HITLS_CFG_NewTLS12Config(); | 913 | config = HITLS_CFG_NewTLS12Config(); |
| 914 | ASSERT_TRUE(config != NULL); | 914 | ASSERT_TRUE(config != NULL); |
| 915 | 915 | ||
| @@ -983,7 +983,7 @@ void UT_TLS_TLS12_RFC5746_CONSISTENCY_EXTENDED_RENEGOTIATION_FUNC_TC006(void) | |||
| 983 | FRAME_LinkObj *client = NULL; | 983 | FRAME_LinkObj *client = NULL; |
| 984 | FRAME_LinkObj *server = NULL; | 984 | FRAME_LinkObj *server = NULL; |
| 985 | 985 | ||
| 986 | - uint8_t isRenegotiation = true; | 986 | + bool isRenegotiation = true; |
| 987 | config = HITLS_CFG_NewTLS12Config(); | 987 | config = HITLS_CFG_NewTLS12Config(); |
| 988 | ASSERT_TRUE(config != NULL); | 988 | ASSERT_TRUE(config != NULL); |
| 989 | 989 | ||
| @@ -1064,7 +1064,7 @@ void UT_TLS_TLS12_RFC5746_CONSISTENCY_EXTENDED_RENEGOTIATION_FUNC_TC0014(void) | |||
| 1064 | FRAME_LinkObj *client = NULL; | 1064 | FRAME_LinkObj *client = NULL; |
| 1065 | FRAME_LinkObj *server = NULL; | 1065 | FRAME_LinkObj *server = NULL; |
| 1066 | 1066 | ||
| 1067 | - uint8_t isRenegotiation = true; | 1067 | + bool isRenegotiation = true; |
| 1068 | config = HITLS_CFG_NewTLS12Config(); | 1068 | config = HITLS_CFG_NewTLS12Config(); |
| 1069 | ASSERT_TRUE(config != NULL); | 1069 | ASSERT_TRUE(config != NULL); |
| 1070 | 1070 | ||
| @@ -1152,7 +1152,7 @@ void UT_TLS_TLS12_RFC5746_CONSISTENCY_EXTENDED_RENEGOTIATION_FUNC_TC0015(void) | |||
| 1152 | FRAME_LinkObj *client = NULL; | 1152 | FRAME_LinkObj *client = NULL; |
| 1153 | FRAME_LinkObj *server = NULL; | 1153 | FRAME_LinkObj *server = NULL; |
| 1154 | 1154 | ||
| 1155 | - uint8_t isRenegotiation = true; | 1155 | + bool isRenegotiation = true; |
| 1156 | config = HITLS_CFG_NewTLS12Config(); | 1156 | config = HITLS_CFG_NewTLS12Config(); |
| 1157 | ASSERT_TRUE(config != NULL); | 1157 | ASSERT_TRUE(config != NULL); |
| 1158 | 1158 | ||
| @@ -1232,7 +1232,7 @@ void UT_TLS_TLS12_RFC5746_CONSISTENCY_EXTENDED_RENEGOTIATION_FUNC_TC0012(void) | |||
| 1232 | FRAME_LinkObj *client = NULL; | 1232 | FRAME_LinkObj *client = NULL; |
| 1233 | FRAME_LinkObj *server = NULL; | 1233 | FRAME_LinkObj *server = NULL; |
| 1234 | 1234 | ||
| 1235 | - uint8_t isRenegotiation = true; | 1235 | + bool isRenegotiation = true; |
| 1236 | config = HITLS_CFG_NewTLS12Config(); | 1236 | config = HITLS_CFG_NewTLS12Config(); |
| 1237 | ASSERT_TRUE(config != NULL); | 1237 | ASSERT_TRUE(config != NULL); |
| 1238 | 1238 | ||
| @@ -481,7 +481,7 @@ EXIT: | |||
| 481 | * @test SDV_TLS_TLS12_RFC7627_CONSISTENCY_EXTENDED_MASTER_SECRET_FUNC_TC009 | 481 | * @test SDV_TLS_TLS12_RFC7627_CONSISTENCY_EXTENDED_MASTER_SECRET_FUNC_TC009 |
| 482 | * @title Resume sessions that both support no EMS on the client and server | 482 | * @title Resume sessions that both support no EMS on the client and server |
| 483 | * @precon nan | 483 | * @precon nan |
| 484 | -* @brief 1. The client and server that does not support the extension connection establishment. | 484 | +* @brief 1. The client and server that does not support the extension connection establishment. |
| 485 | * Disconnect the connection and save the session. | 485 | * Disconnect the connection and save the session. |
| 486 | * 2. Apply for another server that does not support the extension and establish a connection. Expected result | 486 | * 2. Apply for another server that does not support the extension and establish a connection. Expected result |
| 487 | * 2 is obtained. | 487 | * 2 is obtained. |
| @@ -493,31 +493,31 @@ void SDV_TLS_TLS12_RFC7627_CONSISTENCY_EXTENDED_MASTER_SECRET_FUNC_TC009(int ver | |||
| 493 | { | 493 | { |
| 494 | Process *localProcess = NULL; | 494 | Process *localProcess = NULL; |
| 495 | Process *remoteProcess = NULL; | 495 | Process *remoteProcess = NULL; |
| 496 | - HLT_Ctx_Config *clientCtxConfig = NULL; | 496 | + HLT_Ctx_Config *clientCtxConfig = NULL; |
| 497 | HLT_Ctx_Config *serverCtxConfig = NULL; | 497 | HLT_Ctx_Config *serverCtxConfig = NULL; |
| 498 | HLT_FD sockFd = {0}; | 498 | HLT_FD sockFd = {0}; |
| 499 | int32_t serverConfigId = 0; | 499 | int32_t serverConfigId = 0; |
| 500 | - | 500 | + |
| 501 | HITLS_Session *session = NULL; | 501 | HITLS_Session *session = NULL; |
| 502 | const char *writeBuf = "Hello world"; | 502 | const char *writeBuf = "Hello world"; |
| 503 | uint8_t readBuf[READ_BUF_SIZE] = {0}; | 503 | uint8_t readBuf[READ_BUF_SIZE] = {0}; |
| 504 | uint32_t readLen; | 504 | uint32_t readLen; |
| 505 | int32_t cnt = 1; | 505 | int32_t cnt = 1; |
| 506 | - | 506 | + |
| 507 | localProcess = HLT_InitLocalProcess(HITLS); | 507 | localProcess = HLT_InitLocalProcess(HITLS); |
| 508 | ASSERT_TRUE(localProcess != NULL); | 508 | ASSERT_TRUE(localProcess != NULL); |
| 509 | remoteProcess = HLT_CreateRemoteProcess(HITLS); | 509 | remoteProcess = HLT_CreateRemoteProcess(HITLS); |
| 510 | ASSERT_TRUE(remoteProcess != NULL); | 510 | ASSERT_TRUE(remoteProcess != NULL); |
| 511 | - | 511 | + |
| 512 | void *clientConfig = HLT_TlsNewCtx(version); | 512 | void *clientConfig = HLT_TlsNewCtx(version); |
| 513 | ASSERT_TRUE(clientConfig != NULL); | 513 | ASSERT_TRUE(clientConfig != NULL); |
| 514 | - | 514 | + |
| 515 | clientCtxConfig = HLT_NewCtxConfig(NULL, "CLIENT"); | 515 | clientCtxConfig = HLT_NewCtxConfig(NULL, "CLIENT"); |
| 516 | HLT_SetExtenedMasterSecretSupport(clientCtxConfig, false); | 516 | HLT_SetExtenedMasterSecretSupport(clientCtxConfig, false); |
| 517 | - | 517 | + |
| 518 | serverCtxConfig = HLT_NewCtxConfig(NULL, "SERVER"); | 518 | serverCtxConfig = HLT_NewCtxConfig(NULL, "SERVER"); |
| 519 | HLT_SetExtenedMasterSecretSupport(serverCtxConfig, false); | 519 | HLT_SetExtenedMasterSecretSupport(serverCtxConfig, false); |
| 520 | - | 520 | + |
| 521 | 521 | ||
| 522 | serverConfigId = HLT_RpcProviderTlsNewCtx(remoteProcess, version, false, NULL, NULL, NULL, 0, NULL); | 522 | serverConfigId = HLT_RpcProviderTlsNewCtx(remoteProcess, version, false, NULL, NULL, NULL, 0, NULL); |
| 523 | 523 | ||
| @@ -544,7 +544,7 @@ void SDV_TLS_TLS12_RFC7627_CONSISTENCY_EXTENDED_MASTER_SECRET_FUNC_TC009(int ver | |||
| 544 | remoteProcess->connType = connType; | 544 | remoteProcess->connType = connType; |
| 545 | localProcess->connType = connType; | 545 | localProcess->connType = connType; |
| 546 | int32_t serverSslId = HLT_RpcTlsNewSsl(remoteProcess, serverConfigId); | 546 | int32_t serverSslId = HLT_RpcTlsNewSsl(remoteProcess, serverConfigId); |
| 547 | - | 547 | + |
| 548 | HLT_Ssl_Config *serverSslConfig; | 548 | HLT_Ssl_Config *serverSslConfig; |
| 549 | serverSslConfig = HLT_NewSslConfig(NULL); | 549 | serverSslConfig = HLT_NewSslConfig(NULL); |
| 550 | ASSERT_TRUE(serverSslConfig != NULL); | 550 | ASSERT_TRUE(serverSslConfig != NULL); |
| @@ -554,20 +554,20 @@ void SDV_TLS_TLS12_RFC7627_CONSISTENCY_EXTENDED_MASTER_SECRET_FUNC_TC009(int ver | |||
| 554 | HLT_RpcTlsAccept(remoteProcess, serverSslId); | 554 | HLT_RpcTlsAccept(remoteProcess, serverSslId); |
| 555 | void *clientSsl = HLT_TlsNewSsl(clientConfig); | 555 | void *clientSsl = HLT_TlsNewSsl(clientConfig); |
| 556 | ASSERT_TRUE(clientSsl != NULL); | 556 | ASSERT_TRUE(clientSsl != NULL); |
| 557 | - | 557 | + |
| 558 | HLT_Ssl_Config *clientSslConfig; | 558 | HLT_Ssl_Config *clientSslConfig; |
| 559 | clientSslConfig = HLT_NewSslConfig(NULL); | 559 | clientSslConfig = HLT_NewSslConfig(NULL); |
| 560 | ASSERT_TRUE(clientSslConfig != NULL); | 560 | ASSERT_TRUE(clientSslConfig != NULL); |
| 561 | clientSslConfig->sockFd = localProcess->connFd; | 561 | clientSslConfig->sockFd = localProcess->connFd; |
| 562 | clientSslConfig->connType = connType; | 562 | clientSslConfig->connType = connType; |
| 563 | - | 563 | + |
| 564 | HLT_TlsSetSsl(clientSsl, clientSslConfig); | 564 | HLT_TlsSetSsl(clientSsl, clientSslConfig); |
| 565 | if (session != NULL) { | 565 | if (session != NULL) { |
| 566 | ASSERT_TRUE(HITLS_SetSession(clientSsl, session) == HITLS_SUCCESS); | 566 | ASSERT_TRUE(HITLS_SetSession(clientSsl, session) == HITLS_SUCCESS); |
| 567 | ASSERT_TRUE(HLT_TlsConnect(clientSsl) == 0); | 567 | ASSERT_TRUE(HLT_TlsConnect(clientSsl) == 0); |
| 568 | - uint8_t isReused = 0; | 568 | + bool isReused = false; |
| 569 | ASSERT_TRUE(HITLS_IsSessionReused(clientSsl, &isReused) == HITLS_SUCCESS); | 569 | ASSERT_TRUE(HITLS_IsSessionReused(clientSsl, &isReused) == HITLS_SUCCESS); |
| 570 | - ASSERT_TRUE(isReused != 0); | 570 | + ASSERT_TRUE(isReused == true); |
| 571 | } else { | 571 | } else { |
| 572 | ASSERT_TRUE(HLT_TlsConnect(clientSsl) == 0); | 572 | ASSERT_TRUE(HLT_TlsConnect(clientSsl) == 0); |
| 573 | ASSERT_TRUE(HLT_RpcTlsWrite(remoteProcess, serverSslId, (uint8_t *)writeBuf, strlen(writeBuf)) == 0); | 573 | ASSERT_TRUE(HLT_RpcTlsWrite(remoteProcess, serverSslId, (uint8_t *)writeBuf, strlen(writeBuf)) == 0); |
| @@ -581,12 +581,12 @@ void SDV_TLS_TLS12_RFC7627_CONSISTENCY_EXTENDED_MASTER_SECRET_FUNC_TC009(int ver | |||
| 581 | HLT_RpcTlsRead(remoteProcess, serverSslId, readBuf, READ_BUF_SIZE, &readLen); | 581 | HLT_RpcTlsRead(remoteProcess, serverSslId, readBuf, READ_BUF_SIZE, &readLen); |
| 582 | HLT_RpcCloseFd(remoteProcess, sockFd.peerFd, remoteProcess->connType); | 582 | HLT_RpcCloseFd(remoteProcess, sockFd.peerFd, remoteProcess->connType); |
| 583 | HLT_CloseFd(sockFd.srcFd, localProcess->connType); | 583 | HLT_CloseFd(sockFd.srcFd, localProcess->connType); |
| 584 | - | 584 | + |
| 585 | session = HITLS_GetDupSession(clientSsl); | 585 | session = HITLS_GetDupSession(clientSsl); |
| 586 | ASSERT_TRUE(session != NULL); | 586 | ASSERT_TRUE(session != NULL); |
| 587 | ASSERT_TRUE(HITLS_SESS_IsResumable(session) == true); | 587 | ASSERT_TRUE(HITLS_SESS_IsResumable(session) == true); |
| 588 | } | 588 | } |
| 589 | - | 589 | + |
| 590 | cnt++; | 590 | cnt++; |
| 591 | } while (cnt < 3); | 591 | } while (cnt < 3); |
| 592 | EXIT: | 592 | EXIT: |
| @@ -1394,9 +1394,9 @@ void UT_TLS_TLS13_RFC8446_CONSISTENCY_OBFUSCATED_TICKET_AGE_FUNC_TC002() | |||
| 1394 | 1394 | ||
| 1395 | // Establish a connection. | 1395 | // Establish a connection. |
| 1396 | ASSERT_EQ(FRAME_CreateConnection(testInfo.client, testInfo.server, false, HS_STATE_BUTT), HITLS_SUCCESS); | 1396 | ASSERT_EQ(FRAME_CreateConnection(testInfo.client, testInfo.server, false, HS_STATE_BUTT), HITLS_SUCCESS); |
| 1397 | - uint8_t isReused = 0; | 1397 | + bool isReused = false; |
| 1398 | ASSERT_EQ(HITLS_IsSessionReused(testInfo.client->ssl, &isReused), HITLS_SUCCESS); | 1398 | ASSERT_EQ(HITLS_IsSessionReused(testInfo.client->ssl, &isReused), HITLS_SUCCESS); |
| 1399 | - ASSERT_EQ(isReused, 1); | 1399 | + ASSERT_EQ(isReused, true); |
| 1400 | EXIT: | 1400 | EXIT: |
| 1401 | ClearWrapper(); | 1401 | ClearWrapper(); |
| 1402 | STUB_Reset(&stubInfo); | 1402 | STUB_Reset(&stubInfo); |
| @@ -3151,9 +3151,9 @@ static int32_t SendCcs(HITLS_Ctx *ctx, uint8_t *data, uint8_t len) | |||
| 3151 | return ret; | 3151 | return ret; |
| 3152 | } | 3152 | } |
| 3153 | /* If isFlightTransmitEnable is enabled, the stored handshake information needs to be sent. */ | 3153 | /* If isFlightTransmitEnable is enabled, the stored handshake information needs to be sent. */ |
| 3154 | - uint8_t isFlightTransmitEnable; | 3154 | + bool isFlightTransmitEnable = false; |
| 3155 | (void)HITLS_GetFlightTransmitSwitch(ctx, &isFlightTransmitEnable); | 3155 | (void)HITLS_GetFlightTransmitSwitch(ctx, &isFlightTransmitEnable); |
| 3156 | - if (isFlightTransmitEnable == 1) { | 3156 | + if (isFlightTransmitEnable == true) { |
| 3157 | ret = BSL_UIO_Ctrl(ctx->uio, BSL_UIO_FLUSH, 0, NULL); | 3157 | ret = BSL_UIO_Ctrl(ctx->uio, BSL_UIO_FLUSH, 0, NULL); |
| 3158 | if (ret == BSL_UIO_IO_BUSY) { | 3158 | if (ret == BSL_UIO_IO_BUSY) { |
| 3159 | return HITLS_REC_NORMAL_IO_BUSY; | 3159 | return HITLS_REC_NORMAL_IO_BUSY; |
| @@ -3177,9 +3177,9 @@ static int32_t SendAlert(HITLS_Ctx *ctx, ALERT_Level level, ALERT_Description de | |||
| 3177 | return ret; | 3177 | return ret; |
| 3178 | } | 3178 | } |
| 3179 | /* If isFlightTransmitEnable is enabled, the stored handshake information needs to be sent. */ | 3179 | /* If isFlightTransmitEnable is enabled, the stored handshake information needs to be sent. */ |
| 3180 | - uint8_t isFlightTransmitEnable; | 3180 | + bool isFlightTransmitEnable = false; |
| 3181 | (void)HITLS_GetFlightTransmitSwitch(ctx, &isFlightTransmitEnable); | 3181 | (void)HITLS_GetFlightTransmitSwitch(ctx, &isFlightTransmitEnable); |
| 3182 | - if (isFlightTransmitEnable == 1) { | 3182 | + if (isFlightTransmitEnable == true) { |
| 3183 | ret = BSL_UIO_Ctrl(ctx->uio, BSL_UIO_FLUSH, 0, NULL); | 3183 | ret = BSL_UIO_Ctrl(ctx->uio, BSL_UIO_FLUSH, 0, NULL); |
| 3184 | if (ret == BSL_UIO_IO_BUSY) { | 3184 | if (ret == BSL_UIO_IO_BUSY) { |
| 3185 | return HITLS_REC_NORMAL_IO_BUSY; | 3185 | return HITLS_REC_NORMAL_IO_BUSY; |
| @@ -1688,9 +1688,9 @@ void UT_TLS_TLS13_RFC8446_CONSISTENCY_PSK_FUNC_TC001() | |||
| 1688 | 1688 | ||
| 1689 | HITLS_SetSession(testInfo.client->ssl, testInfo.clientSession); | 1689 | HITLS_SetSession(testInfo.client->ssl, testInfo.clientSession); |
| 1690 | ASSERT_EQ(FRAME_CreateConnection(testInfo.client, testInfo.server, true, HS_STATE_BUTT), HITLS_SUCCESS); | 1690 | ASSERT_EQ(FRAME_CreateConnection(testInfo.client, testInfo.server, true, HS_STATE_BUTT), HITLS_SUCCESS); |
| 1691 | - uint8_t isReused = 0; | 1691 | + bool isReused = false; |
| 1692 | ASSERT_EQ(HITLS_IsSessionReused(testInfo.client->ssl, &isReused), HITLS_SUCCESS); | 1692 | ASSERT_EQ(HITLS_IsSessionReused(testInfo.client->ssl, &isReused), HITLS_SUCCESS); |
| 1693 | - ASSERT_EQ(isReused, 0); | 1693 | + ASSERT_EQ(isReused, false); |
| 1694 | EXIT: | 1694 | EXIT: |
| 1695 | ClearWrapper(); | 1695 | ClearWrapper(); |
| 1696 | HITLS_CFG_FreeConfig(testInfo.config); | 1696 | HITLS_CFG_FreeConfig(testInfo.config); |
| @@ -118,9 +118,9 @@ static void Test_PskConnect(uint32_t serverMode, PskStatus pskStatus) | |||
| 118 | HITLS_CFG_SetKeyExchMode(testInfo.config, serverMode); | 118 | HITLS_CFG_SetKeyExchMode(testInfo.config, serverMode); |
| 119 | testInfo.server = FRAME_CreateLink(testInfo.config, testInfo.uioType); | 119 | testInfo.server = FRAME_CreateLink(testInfo.config, testInfo.uioType); |
| 120 | ASSERT_EQ(FRAME_CreateConnection(testInfo.client, testInfo.server, false, HS_STATE_BUTT), HITLS_SUCCESS); | 120 | ASSERT_EQ(FRAME_CreateConnection(testInfo.client, testInfo.server, false, HS_STATE_BUTT), HITLS_SUCCESS); |
| 121 | - uint8_t isReused = 0; | 121 | + bool isReused = false; |
| 122 | ASSERT_EQ(HITLS_IsSessionReused(testInfo.client->ssl, &isReused), HITLS_SUCCESS); | 122 | ASSERT_EQ(HITLS_IsSessionReused(testInfo.client->ssl, &isReused), HITLS_SUCCESS); |
| 123 | - ASSERT_EQ(isReused, pskStatus == SESSION_RESUME_PSK ? 1 : 0); | 123 | + ASSERT_EQ(isReused, pskStatus == SESSION_RESUME_PSK); |
| 124 | EXIT: | 124 | EXIT: |
| 125 | ClearWrapper(); | 125 | ClearWrapper(); |
| 126 | HITLS_CFG_FreeConfig(testInfo.config); | 126 | HITLS_CFG_FreeConfig(testInfo.config); |
| @@ -228,9 +228,9 @@ void UT_TLS_TLS13_RFC8446_CONSISTENCY_PSK_MODES_FUNC_TC005() | |||
| 228 | HITLS_SetSession(testInfo.client->ssl, testInfo.clientSession); | 228 | HITLS_SetSession(testInfo.client->ssl, testInfo.clientSession); |
| 229 | testInfo.server = FRAME_CreateLink(testInfo.config, testInfo.uioType); | 229 | testInfo.server = FRAME_CreateLink(testInfo.config, testInfo.uioType); |
| 230 | ASSERT_EQ(FRAME_CreateConnection(testInfo.client, testInfo.server, false, HS_STATE_BUTT), HITLS_SUCCESS); | 230 | ASSERT_EQ(FRAME_CreateConnection(testInfo.client, testInfo.server, false, HS_STATE_BUTT), HITLS_SUCCESS); |
| 231 | - uint8_t isReused = 0; | 231 | + bool isReused = false; |
| 232 | ASSERT_EQ(HITLS_IsSessionReused(testInfo.client->ssl, &isReused), HITLS_SUCCESS); | 232 | ASSERT_EQ(HITLS_IsSessionReused(testInfo.client->ssl, &isReused), HITLS_SUCCESS); |
| 233 | - ASSERT_EQ(isReused, 0); | 233 | + ASSERT_EQ(isReused, false); |
| 234 | EXIT: | 234 | EXIT: |
| 235 | ClearWrapper(); | 235 | ClearWrapper(); |
| 236 | HITLS_CFG_FreeConfig(testInfo.config); | 236 | HITLS_CFG_FreeConfig(testInfo.config); |
| @@ -842,9 +842,9 @@ void UT_TLS_TLS13_RFC8446_CONSISTENCY_SVERSION_FUNC_TC006() | |||
| 842 | 842 | ||
| 843 | ASSERT_EQ(FRAME_CreateConnection(client, server, false, HS_STATE_BUTT), HITLS_SUCCESS); | 843 | ASSERT_EQ(FRAME_CreateConnection(client, server, false, HS_STATE_BUTT), HITLS_SUCCESS); |
| 844 | 844 | ||
| 845 | - uint8_t isReused = 0; | 845 | + bool isReused = false; |
| 846 | ASSERT_EQ(HITLS_IsSessionReused(client->ssl, &isReused), HITLS_SUCCESS); | 846 | ASSERT_EQ(HITLS_IsSessionReused(client->ssl, &isReused), HITLS_SUCCESS); |
| 847 | - ASSERT_EQ(isReused, 1); | 847 | + ASSERT_EQ(isReused, true); |
| 848 | 848 | ||
| 849 | EXIT: | 849 | EXIT: |
| 850 | HITLS_CFG_FreeConfig(config_c); | 850 | HITLS_CFG_FreeConfig(config_c); |
| @@ -1001,9 +1001,9 @@ void UT_TLS_TLS13_RFC8446_CONSISTENCY_PSKTICKETLIFETIME_FUNC_TC001() | |||
| 1001 | 1001 | ||
| 1002 | ASSERT_EQ(FRAME_CreateConnection(client, server, false, HS_STATE_BUTT), HITLS_SUCCESS); | 1002 | ASSERT_EQ(FRAME_CreateConnection(client, server, false, HS_STATE_BUTT), HITLS_SUCCESS); |
| 1003 | 1003 | ||
| 1004 | - uint8_t isReused = 0; | 1004 | + bool isReused = false; |
| 1005 | ASSERT_EQ(HITLS_IsSessionReused(client->ssl, &isReused), HITLS_SUCCESS); | 1005 | ASSERT_EQ(HITLS_IsSessionReused(client->ssl, &isReused), HITLS_SUCCESS); |
| 1006 | - ASSERT_EQ(isReused, 0); | 1006 | + ASSERT_EQ(isReused, false); |
| 1007 | 1007 | ||
| 1008 | EXIT: | 1008 | EXIT: |
| 1009 | HITLS_CFG_FreeConfig(config); | 1009 | HITLS_CFG_FreeConfig(config); |
Mtestcode/sdv/testcase/tls/consistency/tls13/test_suite_sdv_frame_tls13_consistency_rfc8446_record.c+12-12
| @@ -49,9 +49,9 @@ static int32_t SendCcs(HITLS_Ctx *ctx, uint8_t *data, uint8_t len) | |||
| 49 | return ret; | 49 | return ret; |
| 50 | } | 50 | } |
| 51 | /* If isFlightTransmitEnable is enabled, the stored handshake information needs to be sent. */ | 51 | /* If isFlightTransmitEnable is enabled, the stored handshake information needs to be sent. */ |
| 52 | - uint8_t isFlightTransmitEnable; | 52 | + bool isFlightTransmitEnable = false; |
| 53 | (void)HITLS_GetFlightTransmitSwitch(ctx, &isFlightTransmitEnable); | 53 | (void)HITLS_GetFlightTransmitSwitch(ctx, &isFlightTransmitEnable); |
| 54 | - if (isFlightTransmitEnable == 1) { | 54 | + if (isFlightTransmitEnable == true) { |
| 55 | ret = BSL_UIO_Ctrl(ctx->uio, BSL_UIO_FLUSH, 0, NULL); | 55 | ret = BSL_UIO_Ctrl(ctx->uio, BSL_UIO_FLUSH, 0, NULL); |
| 56 | if (ret == BSL_UIO_IO_BUSY) { | 56 | if (ret == BSL_UIO_IO_BUSY) { |
| 57 | return HITLS_REC_NORMAL_IO_BUSY; | 57 | return HITLS_REC_NORMAL_IO_BUSY; |
| @@ -75,9 +75,9 @@ static int32_t SendAlert(HITLS_Ctx *ctx, ALERT_Level level, ALERT_Description de | |||
| 75 | return ret; | 75 | return ret; |
| 76 | } | 76 | } |
| 77 | /* If isFlightTransmitEnable is enabled, the stored handshake information needs to be sent. */ | 77 | /* If isFlightTransmitEnable is enabled, the stored handshake information needs to be sent. */ |
| 78 | - uint8_t isFlightTransmitEnable; | 78 | + bool isFlightTransmitEnable = false; |
| 79 | (void)HITLS_GetFlightTransmitSwitch(ctx, &isFlightTransmitEnable); | 79 | (void)HITLS_GetFlightTransmitSwitch(ctx, &isFlightTransmitEnable); |
| 80 | - if (isFlightTransmitEnable == 1) { | 80 | + if (isFlightTransmitEnable == true) { |
| 81 | ret = BSL_UIO_Ctrl(ctx->uio, BSL_UIO_FLUSH, 0, NULL); | 81 | ret = BSL_UIO_Ctrl(ctx->uio, BSL_UIO_FLUSH, 0, NULL); |
| 82 | if (ret == BSL_UIO_IO_BUSY) { | 82 | if (ret == BSL_UIO_IO_BUSY) { |
| 83 | return HITLS_REC_NORMAL_IO_BUSY; | 83 | return HITLS_REC_NORMAL_IO_BUSY; |
| @@ -98,9 +98,9 @@ static int32_t SendErrorAlert(HITLS_Ctx *ctx, ALERT_Level level, ALERT_Descripti | |||
| 98 | return ret; | 98 | return ret; |
| 99 | } | 99 | } |
| 100 | /* If isFlightTransmitEnable is enabled, the stored handshake information needs to be sent. */ | 100 | /* If isFlightTransmitEnable is enabled, the stored handshake information needs to be sent. */ |
| 101 | - uint8_t isFlightTransmitEnable; | 101 | + bool isFlightTransmitEnable = false; |
| 102 | (void)HITLS_GetFlightTransmitSwitch(ctx, &isFlightTransmitEnable); | 102 | (void)HITLS_GetFlightTransmitSwitch(ctx, &isFlightTransmitEnable); |
| 103 | - if (isFlightTransmitEnable == 1) { | 103 | + if (isFlightTransmitEnable == true) { |
| 104 | ret = BSL_UIO_Ctrl(ctx->uio, BSL_UIO_FLUSH, 0, NULL); | 104 | ret = BSL_UIO_Ctrl(ctx->uio, BSL_UIO_FLUSH, 0, NULL); |
| 105 | if (ret == BSL_UIO_IO_BUSY) { | 105 | if (ret == BSL_UIO_IO_BUSY) { |
| 106 | return HITLS_REC_NORMAL_IO_BUSY; | 106 | return HITLS_REC_NORMAL_IO_BUSY; |
| @@ -378,9 +378,9 @@ void UT_TLS_TLS13_RFC8446_CONSISTENCY_IGNORE_CCS_FUNC_TC004(void) | |||
| 378 | 378 | ||
| 379 | ASSERT_TRUE(FRAME_CreateConnection(client, server, true, TRY_RECV_FINISH) == HITLS_SUCCESS); | 379 | ASSERT_TRUE(FRAME_CreateConnection(client, server, true, TRY_RECV_FINISH) == HITLS_SUCCESS); |
| 380 | ASSERT_EQ(server->ssl->hsCtx->state, TRY_RECV_FINISH); | 380 | ASSERT_EQ(server->ssl->hsCtx->state, TRY_RECV_FINISH); |
| 381 | - uint8_t isReused = 0; | 381 | + bool isReused = false; |
| 382 | ASSERT_EQ(HITLS_IsSessionReused(client->ssl, &isReused), HITLS_SUCCESS); | 382 | ASSERT_EQ(HITLS_IsSessionReused(client->ssl, &isReused), HITLS_SUCCESS); |
| 383 | - ASSERT_EQ(isReused, 1); | 383 | + ASSERT_EQ(isReused, true); |
| 384 | FrameUioUserData *ioServerData = BSL_UIO_GetUserData(server->io); | 384 | FrameUioUserData *ioServerData = BSL_UIO_GetUserData(server->io); |
| 385 | FrameMsg recMsg; | 385 | FrameMsg recMsg; |
| 386 | ASSERT_TRUE(memcpy_s(recMsg.msg, MAX_RECORD_LENTH, ioServerData->recMsg.msg, ioServerData->recMsg.len) == EOK); | 386 | ASSERT_TRUE(memcpy_s(recMsg.msg, MAX_RECORD_LENTH, ioServerData->recMsg.msg, ioServerData->recMsg.len) == EOK); |
| @@ -2112,9 +2112,9 @@ void UT_TLS_TLS13_RFC8446_CONSISTENCY_LEGACY_RECORD_VERSION_FUNC_TC004(void) | |||
| 2112 | ioClientData->recMsg.msg[bufOffset] = 0xff; | 2112 | ioClientData->recMsg.msg[bufOffset] = 0xff; |
| 2113 | ASSERT_EQ(FRAME_CreateConnection(client, server, true, HS_STATE_BUTT), HITLS_SUCCESS); | 2113 | ASSERT_EQ(FRAME_CreateConnection(client, server, true, HS_STATE_BUTT), HITLS_SUCCESS); |
| 2114 | 2114 | ||
| 2115 | - uint8_t isReused = 0; | 2115 | + bool isReused = false; |
| 2116 | ASSERT_EQ(HITLS_IsSessionReused(client->ssl, &isReused), HITLS_SUCCESS); | 2116 | ASSERT_EQ(HITLS_IsSessionReused(client->ssl, &isReused), HITLS_SUCCESS); |
| 2117 | - ASSERT_EQ(isReused, 1); | 2117 | + ASSERT_EQ(isReused, true); |
| 2118 | EXIT: | 2118 | EXIT: |
| 2119 | HITLS_CFG_FreeConfig(tlsConfig); | 2119 | HITLS_CFG_FreeConfig(tlsConfig); |
| 2120 | FRAME_FreeLink(client); | 2120 | FRAME_FreeLink(client); |
| @@ -2185,9 +2185,9 @@ void UT_TLS_TLS13_RFC8446_CONSISTENCY_LEGACY_RECORD_VERSION_FUNC_TC005(void) | |||
| 2185 | ioClientData->recMsg.msg[bufOffset] = 0xff; | 2185 | ioClientData->recMsg.msg[bufOffset] = 0xff; |
| 2186 | ASSERT_EQ(FRAME_CreateConnection(client, server, true, HS_STATE_BUTT), HITLS_SUCCESS); | 2186 | ASSERT_EQ(FRAME_CreateConnection(client, server, true, HS_STATE_BUTT), HITLS_SUCCESS); |
| 2187 | 2187 | ||
| 2188 | - uint8_t isReused = 0; | 2188 | + bool isReused = false; |
| 2189 | ASSERT_EQ(HITLS_IsSessionReused(client->ssl, &isReused), HITLS_SUCCESS); | 2189 | ASSERT_EQ(HITLS_IsSessionReused(client->ssl, &isReused), HITLS_SUCCESS); |
| 2190 | - ASSERT_EQ(isReused, 1); | 2190 | + ASSERT_EQ(isReused, true); |
| 2191 | EXIT: | 2191 | EXIT: |
| 2192 | HITLS_CFG_FreeConfig(tlsConfig); | 2192 | HITLS_CFG_FreeConfig(tlsConfig); |
| 2193 | FRAME_FreeLink(client); | 2193 | FRAME_FreeLink(client); |
| @@ -1111,9 +1111,9 @@ void SDV_TLS_TLS13_RFC8446_CONSISTENCY_PSKTICKET_FUNC_TC001(int version, int con | |||
| 1111 | HITLS_SESS_Free(session); | 1111 | HITLS_SESS_Free(session); |
| 1112 | session = NULL; | 1112 | session = NULL; |
| 1113 | 1113 | ||
| 1114 | - uint8_t isReused = 0; | 1114 | + bool isReused = false; |
| 1115 | ASSERT_TRUE(HITLS_IsSessionReused(clientSsl, &isReused) == HITLS_SUCCESS); | 1115 | ASSERT_TRUE(HITLS_IsSessionReused(clientSsl, &isReused) == HITLS_SUCCESS); |
| 1116 | - ASSERT_TRUE(isReused == 0); | 1116 | + ASSERT_TRUE(isReused == false); |
| 1117 | } | 1117 | } |
| 1118 | 1118 | ||
| 1119 | session = HITLS_GetDupSession(clientSsl); | 1119 | session = HITLS_GetDupSession(clientSsl); |
| @@ -73,9 +73,9 @@ void UT_TLS12_RESUME_FUNC_TC001() | |||
| 73 | ASSERT_EQ(HITLS_SetSession(client->ssl, clientSession), HITLS_SUCCESS); | 73 | ASSERT_EQ(HITLS_SetSession(client->ssl, clientSession), HITLS_SUCCESS); |
| 74 | 74 | ||
| 75 | ASSERT_EQ(FRAME_CreateConnection(client, server, false, HS_STATE_BUTT), HITLS_SUCCESS); | 75 | ASSERT_EQ(FRAME_CreateConnection(client, server, false, HS_STATE_BUTT), HITLS_SUCCESS); |
| 76 | - uint8_t isReused = 0; | 76 | + bool isReused = false; |
| 77 | ASSERT_EQ(HITLS_IsSessionReused(client->ssl, &isReused), HITLS_SUCCESS); | 77 | ASSERT_EQ(HITLS_IsSessionReused(client->ssl, &isReused), HITLS_SUCCESS); |
| 78 | - ASSERT_EQ(isReused, 1); | 78 | + ASSERT_EQ(isReused, true); |
| 79 | 79 | ||
| 80 | EXIT: | 80 | EXIT: |
| 81 | HITLS_CFG_FreeConfig(config); | 81 | HITLS_CFG_FreeConfig(config); |
| @@ -27,7 +27,7 @@ | |||
| 27 | * @test SDV_TLS12_RESUME_FUNC_TC001 | 27 | * @test SDV_TLS12_RESUME_FUNC_TC001 |
| 28 | * @title Test the PSK-based session resume of tls12. | 28 | * @title Test the PSK-based session resume of tls12. |
| 29 | * | 29 | * |
| 30 | -* @brief 1. at first handshake, config the client does not support tickets, | 30 | +* @brief 1. at first handshake, config the client does not support tickets, |
| 31 | but the server supports tickets. Expect result 1 | 31 | but the server supports tickets. Expect result 1 |
| 32 | 2. after first handshake, config the client support tickets, Expect result 2 | 32 | 2. after first handshake, config the client support tickets, Expect result 2 |
| 33 | * @expect 1. connect success | 33 | * @expect 1. connect success |
| @@ -110,9 +110,9 @@ void SDV_TLS12_RESUME_FUNC_TC001() | |||
| 110 | } else { | 110 | } else { |
| 111 | int ret = HLT_TlsConnect(clientSsl); | 111 | int ret = HLT_TlsConnect(clientSsl); |
| 112 | ASSERT_EQ(ret, HITLS_SUCCESS); | 112 | ASSERT_EQ(ret, HITLS_SUCCESS); |
| 113 | - uint8_t isReused = 0; | 113 | + bool isReused = false; |
| 114 | ASSERT_TRUE(HITLS_IsSessionReused(clientSsl, &isReused) == HITLS_SUCCESS); | 114 | ASSERT_TRUE(HITLS_IsSessionReused(clientSsl, &isReused) == HITLS_SUCCESS); |
| 115 | - ASSERT_EQ(isReused, 1); | 115 | + ASSERT_EQ(isReused, true); |
| 116 | } | 116 | } |
| 117 | ASSERT_TRUE(HLT_TlsClose(clientSsl) == 0); | 117 | ASSERT_TRUE(HLT_TlsClose(clientSsl) == 0); |
| 118 | HLT_RpcTlsClose(remoteProcess, serverSslId); | 118 | HLT_RpcTlsClose(remoteProcess, serverSslId); |
| @@ -251,9 +251,9 @@ void SDV_HITLS_TICKET_KEY_CALLBACK_RESUME_FUNC_TC001(int version, int connType, | |||
| 251 | HITLS_SESS_Free(session); | 251 | HITLS_SESS_Free(session); |
| 252 | session = NULL; | 252 | session = NULL; |
| 253 | 253 | ||
| 254 | - uint8_t isReused = 0; | 254 | + bool isReused = false; |
| 255 | ASSERT_TRUE(HITLS_IsSessionReused(clientSsl, &isReused) == HITLS_SUCCESS); | 255 | ASSERT_TRUE(HITLS_IsSessionReused(clientSsl, &isReused) == HITLS_SUCCESS); |
| 256 | - ASSERT_TRUE(isReused == 1); | 256 | + ASSERT_TRUE(isReused == true); |
| 257 | } | 257 | } |
| 258 | 258 | ||
| 259 | // After the first handshake is complete, obtain and store the session. | 259 | // After the first handshake is complete, obtain and store the session. |
| @@ -304,7 +304,7 @@ void UT_TLS_CM_SET_GET_ENCRYPTHENMAC_FUNC_TC001(int version) | |||
| 304 | FRAME_LinkObj *server = NULL; | 304 | FRAME_LinkObj *server = NULL; |
| 305 | config = GetHitlsConfigViaVersion(version); | 305 | config = GetHitlsConfigViaVersion(version); |
| 306 | ASSERT_TRUE(config != NULL); | 306 | ASSERT_TRUE(config != NULL); |
| 307 | - ASSERT_EQ(HITLS_CFG_SetEncryptThenMac(config, 1), HITLS_SUCCESS); | 307 | + ASSERT_EQ(HITLS_CFG_SetEncryptThenMac(config, true), HITLS_SUCCESS); |
| 308 | 308 | ||
| 309 | uint16_t signAlgs[] = {CERT_SIG_SCHEME_RSA_PKCS1_SHA256, CERT_SIG_SCHEME_ECDSA_SECP256R1_SHA256}; | 309 | uint16_t signAlgs[] = {CERT_SIG_SCHEME_RSA_PKCS1_SHA256, CERT_SIG_SCHEME_ECDSA_SECP256R1_SHA256}; |
| 310 | HITLS_CFG_SetSignature(config, signAlgs, sizeof(signAlgs) / sizeof(uint16_t)); | 310 | HITLS_CFG_SetSignature(config, signAlgs, sizeof(signAlgs) / sizeof(uint16_t)); |
| @@ -318,7 +318,7 @@ void UT_TLS_CM_SET_GET_ENCRYPTHENMAC_FUNC_TC001(int version) | |||
| 318 | server = FRAME_CreateLink(config, BSL_UIO_TCP); | 318 | server = FRAME_CreateLink(config, BSL_UIO_TCP); |
| 319 | ASSERT_TRUE(server != NULL); | 319 | ASSERT_TRUE(server != NULL); |
| 320 | 320 | ||
| 321 | - uint32_t encryptThenMacType = 0; | 321 | + bool encryptThenMacType = 0; |
| 322 | ASSERT_EQ(HITLS_GetEncryptThenMac(server->ssl, &encryptThenMacType), HITLS_SUCCESS); | 322 | ASSERT_EQ(HITLS_GetEncryptThenMac(server->ssl, &encryptThenMacType), HITLS_SUCCESS); |
| 323 | ASSERT_EQ(encryptThenMacType, 1); | 323 | ASSERT_EQ(encryptThenMacType, 1); |
| 324 | 324 | ||
| @@ -406,8 +406,8 @@ void UT_TLS_CM_SET_GET_SESSION_TICKET_SUPPORT_API_TC001(int tlsVersion) | |||
| 406 | FRAME_Init(); | 406 | FRAME_Init(); |
| 407 | HITLS_Config *config = NULL; | 407 | HITLS_Config *config = NULL; |
| 408 | HITLS_Ctx *ctx = NULL; | 408 | HITLS_Ctx *ctx = NULL; |
| 409 | - uint8_t isSupport = -1; | 409 | + bool isSupport = false; |
| 410 | - uint8_t getIsSupport = -1; | 410 | + bool getIsSupport = false; |
| 411 | ASSERT_TRUE(HITLS_SetSessionTicketSupport(ctx, isSupport) == HITLS_NULL_INPUT); | 411 | ASSERT_TRUE(HITLS_SetSessionTicketSupport(ctx, isSupport) == HITLS_NULL_INPUT); |
| 412 | ASSERT_TRUE(HITLS_GetSessionTicketSupport(ctx, &getIsSupport) == HITLS_NULL_INPUT); | 412 | ASSERT_TRUE(HITLS_GetSessionTicketSupport(ctx, &getIsSupport) == HITLS_NULL_INPUT); |
| 413 | 413 | ||
| @@ -417,12 +417,12 @@ void UT_TLS_CM_SET_GET_SESSION_TICKET_SUPPORT_API_TC001(int tlsVersion) | |||
| 417 | ASSERT_TRUE(ctx != NULL); | 417 | ASSERT_TRUE(ctx != NULL); |
| 418 | 418 | ||
| 419 | ASSERT_TRUE(HITLS_GetSessionTicketSupport(ctx, NULL) == HITLS_NULL_INPUT); | 419 | ASSERT_TRUE(HITLS_GetSessionTicketSupport(ctx, NULL) == HITLS_NULL_INPUT); |
| 420 | - isSupport = 1; | 420 | + isSupport = true; |
| 421 | ASSERT_TRUE(HITLS_SetSessionTicketSupport(ctx, isSupport) == HITLS_SUCCESS); | 421 | ASSERT_TRUE(HITLS_SetSessionTicketSupport(ctx, isSupport) == HITLS_SUCCESS); |
| 422 | - isSupport = -1; | 422 | + isSupport = true; |
| 423 | ASSERT_TRUE(HITLS_SetSessionTicketSupport(ctx, isSupport) == HITLS_SUCCESS); | 423 | ASSERT_TRUE(HITLS_SetSessionTicketSupport(ctx, isSupport) == HITLS_SUCCESS); |
| 424 | - ASSERT_TRUE(ctx->config.tlsConfig.isSupportSessionTicket = true); | 424 | + ASSERT_TRUE(ctx->config.tlsConfig.isSupportSessionTicket == true); |
| 425 | - isSupport = 0; | 425 | + isSupport = false; |
| 426 | ASSERT_TRUE(HITLS_SetSessionTicketSupport(ctx, isSupport) == HITLS_SUCCESS); | 426 | ASSERT_TRUE(HITLS_SetSessionTicketSupport(ctx, isSupport) == HITLS_SUCCESS); |
| 427 | 427 | ||
| 428 | ASSERT_TRUE(HITLS_GetSessionTicketSupport(ctx, &getIsSupport) == HITLS_SUCCESS); | 428 | ASSERT_TRUE(HITLS_GetSessionTicketSupport(ctx, &getIsSupport) == HITLS_SUCCESS); |
| @@ -964,7 +964,7 @@ EXIT: | |||
| 964 | * @expect 1. The connection is not established. | 964 | * @expect 1. The connection is not established. |
| 965 | 2. The client status is CM_STATE_HANDSHAKING. | 965 | 2. The client status is CM_STATE_HANDSHAKING. |
| 966 | 3. The client status is CM_STATE_ALERTING. | 966 | 3. The client status is CM_STATE_ALERTING. |
| 967 | - 4. The client status is CM_STATE_ALERTED. | 967 | + 4. The client status is CM_STATE_ALERTED. |
| 968 | 5. The client status is CM_STATE_CLOSED. | 968 | 5. The client status is CM_STATE_CLOSED. |
| 969 | * @prior Level 1 | 969 | * @prior Level 1 |
| 970 | * @auto TRUE | 970 | * @auto TRUE |
| @@ -998,7 +998,7 @@ void UT_TLS_HITLS_CLOSE_TC001(int uioType) | |||
| 998 | ASSERT_TRUE(clientTlsCtx->state == CM_STATE_HANDSHAKING); | 998 | ASSERT_TRUE(clientTlsCtx->state == CM_STATE_HANDSHAKING); |
| 999 | 999 | ||
| 1000 | FrameUioUserData *ioUserData = BSL_UIO_GetUserData(client->io); | 1000 | FrameUioUserData *ioUserData = BSL_UIO_GetUserData(client->io); |
| 1001 | - ioUserData->sndMsg.len = 1; | 1001 | + ioUserData->sndMsg.len = 1; |
| 1002 | ASSERT_TRUE(HITLS_Close(clientTlsCtx) == HITLS_REC_NORMAL_IO_BUSY); | 1002 | ASSERT_TRUE(HITLS_Close(clientTlsCtx) == HITLS_REC_NORMAL_IO_BUSY); |
| 1003 | ASSERT_EQ(clientTlsCtx->state, CM_STATE_ALERTED); | 1003 | ASSERT_EQ(clientTlsCtx->state, CM_STATE_ALERTED); |
| 1004 | 1004 | ||
| @@ -325,7 +325,7 @@ void UT_TLS_CFG_SET_GET_EXTENEDMASTERSECRETSUPPORT_API_TC001(int tlsVersion) | |||
| 325 | FRAME_Init(); | 325 | FRAME_Init(); |
| 326 | HITLS_Config *config = NULL; | 326 | HITLS_Config *config = NULL; |
| 327 | bool support = -1; | 327 | bool support = -1; |
| 328 | - uint8_t isSupport = -1; | 328 | + bool isSupport = -1; |
| 329 | ASSERT_TRUE(HITLS_CFG_SetExtenedMasterSecretSupport(config, support) == HITLS_NULL_INPUT); | 329 | ASSERT_TRUE(HITLS_CFG_SetExtenedMasterSecretSupport(config, support) == HITLS_NULL_INPUT); |
| 330 | ASSERT_TRUE(HITLS_CFG_GetExtenedMasterSecretSupport(config, &isSupport) == HITLS_NULL_INPUT); | 330 | ASSERT_TRUE(HITLS_CFG_GetExtenedMasterSecretSupport(config, &isSupport) == HITLS_NULL_INPUT); |
| 331 | 331 | ||
| @@ -386,7 +386,7 @@ void UT_TLS_CFG_SET_GET_POSTHANDSHAKEAUTHSUPPORT_API_TC001(int tlsVersion) | |||
| 386 | FRAME_Init(); | 386 | FRAME_Init(); |
| 387 | HITLS_Config *config = NULL; | 387 | HITLS_Config *config = NULL; |
| 388 | bool support = -1; | 388 | bool support = -1; |
| 389 | - uint8_t isSupport = -1; | 389 | + bool isSupport = -1; |
| 390 | ASSERT_TRUE(HITLS_CFG_SetPostHandshakeAuthSupport(config, support) == HITLS_NULL_INPUT); | 390 | ASSERT_TRUE(HITLS_CFG_SetPostHandshakeAuthSupport(config, support) == HITLS_NULL_INPUT); |
| 391 | ASSERT_TRUE(HITLS_CFG_GetPostHandshakeAuthSupport(config, &isSupport) == HITLS_NULL_INPUT); | 391 | ASSERT_TRUE(HITLS_CFG_GetPostHandshakeAuthSupport(config, &isSupport) == HITLS_NULL_INPUT); |
| 392 | 392 | ||
| @@ -610,7 +610,7 @@ void UT_TLS_CFG_SET_GET_ENCRYPTTHENMAC_API_TC001(int tlsVersion) | |||
| 610 | { | 610 | { |
| 611 | FRAME_Init(); | 611 | FRAME_Init(); |
| 612 | HITLS_Config *config = NULL; | 612 | HITLS_Config *config = NULL; |
| 613 | - uint32_t encryptThenMacType = 0; | 613 | + bool encryptThenMacType = false; |
| 614 | 614 | ||
| 615 | ASSERT_TRUE(HITLS_CFG_SetEncryptThenMac(config, encryptThenMacType) == HITLS_NULL_INPUT); | 615 | ASSERT_TRUE(HITLS_CFG_SetEncryptThenMac(config, encryptThenMacType) == HITLS_NULL_INPUT); |
| 616 | ASSERT_TRUE(HITLS_CFG_GetEncryptThenMac(config, &encryptThenMacType) == HITLS_NULL_INPUT); | 616 | ASSERT_TRUE(HITLS_CFG_GetEncryptThenMac(config, &encryptThenMacType) == HITLS_NULL_INPUT); |
| @@ -627,13 +627,13 @@ void UT_TLS_CFG_SET_GET_ENCRYPTTHENMAC_API_TC001(int tlsVersion) | |||
| 627 | } | 627 | } |
| 628 | 628 | ||
| 629 | ASSERT_TRUE(HITLS_CFG_GetEncryptThenMac(config, NULL) == HITLS_NULL_INPUT); | 629 | ASSERT_TRUE(HITLS_CFG_GetEncryptThenMac(config, NULL) == HITLS_NULL_INPUT); |
| 630 | - encryptThenMacType = 1; | 630 | + encryptThenMacType = true; |
| 631 | ASSERT_TRUE(HITLS_CFG_SetEncryptThenMac(config, encryptThenMacType) == HITLS_SUCCESS); | 631 | ASSERT_TRUE(HITLS_CFG_SetEncryptThenMac(config, encryptThenMacType) == HITLS_SUCCESS); |
| 632 | - encryptThenMacType = 2; | 632 | + encryptThenMacType = true; |
| 633 | ASSERT_TRUE(HITLS_CFG_SetEncryptThenMac(config, encryptThenMacType) == HITLS_SUCCESS); | 633 | ASSERT_TRUE(HITLS_CFG_SetEncryptThenMac(config, encryptThenMacType) == HITLS_SUCCESS); |
| 634 | - ASSERT_TRUE(config->isEncryptThenMac = true); | 634 | + ASSERT_TRUE(config->isEncryptThenMac == true); |
| 635 | 635 | ||
| 636 | - uint32_t getencryptThenMacType = -1; | 636 | + bool getencryptThenMacType = false; |
| 637 | ASSERT_TRUE(HITLS_CFG_GetEncryptThenMac(config, &getencryptThenMacType) == HITLS_SUCCESS); | 637 | ASSERT_TRUE(HITLS_CFG_GetEncryptThenMac(config, &getencryptThenMacType) == HITLS_SUCCESS); |
| 638 | ASSERT_TRUE(getencryptThenMacType == config->isEncryptThenMac); | 638 | ASSERT_TRUE(getencryptThenMacType == config->isEncryptThenMac); |
| 639 | EXIT: | 639 | EXIT: |
| @@ -660,7 +660,7 @@ void UT_TLS_CFG_IS_DTLS_API_TC001(int tlsVersion) | |||
| 660 | { | 660 | { |
| 661 | FRAME_Init(); | 661 | FRAME_Init(); |
| 662 | HITLS_Config *config = NULL; | 662 | HITLS_Config *config = NULL; |
| 663 | - uint8_t isDtls = false; | 663 | + bool isDtls = false; |
| 664 | 664 | ||
| 665 | ASSERT_TRUE(HITLS_CFG_IsDtls(config, &isDtls) == HITLS_NULL_INPUT); | 665 | ASSERT_TRUE(HITLS_CFG_IsDtls(config, &isDtls) == HITLS_NULL_INPUT); |
| 666 | switch (tlsVersion) { | 666 | switch (tlsVersion) { |
| @@ -1596,7 +1596,7 @@ void UT_TLS_CFG_SET_GET_DHAUTOSUPPORT_TC001(int tlsVersion) | |||
| 1596 | FRAME_Init(); | 1596 | FRAME_Init(); |
| 1597 | HITLS_Config *config = NULL; | 1597 | HITLS_Config *config = NULL; |
| 1598 | bool support = -1; | 1598 | bool support = -1; |
| 1599 | - uint8_t isSupport = -1; | 1599 | + bool isSupport = -1; |
| 1600 | ASSERT_TRUE(HITLS_CFG_SetDhAutoSupport(config, support) == HITLS_NULL_INPUT); | 1600 | ASSERT_TRUE(HITLS_CFG_SetDhAutoSupport(config, support) == HITLS_NULL_INPUT); |
| 1601 | ASSERT_TRUE(HITLS_CFG_GetDhAutoSupport(config, &isSupport) == HITLS_NULL_INPUT); | 1601 | ASSERT_TRUE(HITLS_CFG_GetDhAutoSupport(config, &isSupport) == HITLS_NULL_INPUT); |
| 1602 | 1602 | ||
| @@ -107,7 +107,7 @@ void SDV_TLS_CM_KEYUPDATE_FUNC_TC001(int version) | |||
| 107 | ASSERT_TRUE(config != NULL); | 107 | ASSERT_TRUE(config != NULL); |
| 108 | 108 | ||
| 109 | config->isSupportRenegotiation = true; | 109 | config->isSupportRenegotiation = true; |
| 110 | - ASSERT_EQ(HITLS_CFG_SetEncryptThenMac(config, 1), HITLS_SUCCESS); | 110 | + ASSERT_EQ(HITLS_CFG_SetEncryptThenMac(config, true), HITLS_SUCCESS); |
| 111 | 111 | ||
| 112 | uint16_t signAlgs[] = {CERT_SIG_SCHEME_RSA_PKCS1_SHA256, CERT_SIG_SCHEME_ECDSA_SECP256R1_SHA256}; | 112 | uint16_t signAlgs[] = {CERT_SIG_SCHEME_RSA_PKCS1_SHA256, CERT_SIG_SCHEME_ECDSA_SECP256R1_SHA256}; |
| 113 | HITLS_CFG_SetSignature(config, signAlgs, sizeof(signAlgs) / sizeof(uint16_t)); | 113 | HITLS_CFG_SetSignature(config, signAlgs, sizeof(signAlgs) / sizeof(uint16_t)); |
| @@ -473,7 +473,7 @@ void UT_TLS_CM_GET_NEGOTIATED_VERSION_FUNC_TC001(int version) | |||
| 473 | ASSERT_TRUE(config != NULL); | 473 | ASSERT_TRUE(config != NULL); |
| 474 | 474 | ||
| 475 | config->isSupportRenegotiation = true; | 475 | config->isSupportRenegotiation = true; |
| 476 | - ASSERT_EQ(HITLS_CFG_SetEncryptThenMac(config, 1), HITLS_SUCCESS); | 476 | + ASSERT_EQ(HITLS_CFG_SetEncryptThenMac(config, true), HITLS_SUCCESS); |
| 477 | 477 | ||
| 478 | uint16_t signAlgs[] = {CERT_SIG_SCHEME_RSA_PKCS1_SHA256, CERT_SIG_SCHEME_ECDSA_SECP256R1_SHA256}; | 478 | uint16_t signAlgs[] = {CERT_SIG_SCHEME_RSA_PKCS1_SHA256, CERT_SIG_SCHEME_ECDSA_SECP256R1_SHA256}; |
| 479 | HITLS_CFG_SetSignature(config, signAlgs, sizeof(signAlgs) / sizeof(uint16_t)); | 479 | HITLS_CFG_SetSignature(config, signAlgs, sizeof(signAlgs) / sizeof(uint16_t)); |
| @@ -623,7 +623,7 @@ void UT_TLS_CM_IS_AEAD_FUNC_TC001(int version, int ciphersuite) | |||
| 623 | { | 623 | { |
| 624 | FRAME_Init(); | 624 | FRAME_Init(); |
| 625 | int ret; | 625 | int ret; |
| 626 | - uint8_t isAEAD = 0; | 626 | + bool isAEAD = false; |
| 627 | HITLS_Config *config_c = GetHitlsConfigViaVersion(version); | 627 | HITLS_Config *config_c = GetHitlsConfigViaVersion(version); |
| 628 | HITLS_Config *config_s = GetHitlsConfigViaVersion(version); | 628 | HITLS_Config *config_s = GetHitlsConfigViaVersion(version); |
| 629 | FRAME_LinkObj *client = NULL; | 629 | FRAME_LinkObj *client = NULL; |
| @@ -767,7 +767,7 @@ void UT_TLS_CM_IS_SERVER_FUNC_TC001(int version) | |||
| 767 | { | 767 | { |
| 768 | FRAME_Init(); | 768 | FRAME_Init(); |
| 769 | int ret; | 769 | int ret; |
| 770 | - uint8_t isServer; | 770 | + bool isServer; |
| 771 | HITLS_Config *config = GetHitlsConfigViaVersion(version); | 771 | HITLS_Config *config = GetHitlsConfigViaVersion(version); |
| 772 | FRAME_LinkObj *client = NULL; | 772 | FRAME_LinkObj *client = NULL; |
| 773 | FRAME_LinkObj *server = NULL; | 773 | FRAME_LinkObj *server = NULL; |
| @@ -811,7 +811,7 @@ void UT_TLS_CM_READHASPENDING_FUNC_TC001(int version) | |||
| 811 | HITLS_Config *config = GetHitlsConfigViaVersion(version); | 811 | HITLS_Config *config = GetHitlsConfigViaVersion(version); |
| 812 | FRAME_LinkObj *client = NULL; | 812 | FRAME_LinkObj *client = NULL; |
| 813 | FRAME_LinkObj *server = NULL; | 813 | FRAME_LinkObj *server = NULL; |
| 814 | - uint8_t isPending = 0; | 814 | + bool isPending = false; |
| 815 | ASSERT_TRUE(config != NULL); | 815 | ASSERT_TRUE(config != NULL); |
| 816 | 816 | ||
| 817 | client = FRAME_CreateLink(config, BSL_UIO_TCP); | 817 | client = FRAME_CreateLink(config, BSL_UIO_TCP); |
| @@ -1084,7 +1084,7 @@ void UT_TLS_CM_GET_LOCAL_SIGN_SCHEME_FUNC_TC001(int version) | |||
| 1084 | config = GetHitlsConfigViaVersion(version); | 1084 | config = GetHitlsConfigViaVersion(version); |
| 1085 | ASSERT_TRUE(config != NULL); | 1085 | ASSERT_TRUE(config != NULL); |
| 1086 | config->isSupportRenegotiation = true; | 1086 | config->isSupportRenegotiation = true; |
| 1087 | - ASSERT_EQ(HITLS_CFG_SetEncryptThenMac(config, 1), HITLS_SUCCESS); | 1087 | + ASSERT_EQ(HITLS_CFG_SetEncryptThenMac(config, true), HITLS_SUCCESS); |
| 1088 | 1088 | ||
| 1089 | uint16_t signAlgs[] = {CERT_SIG_SCHEME_RSA_PKCS1_SHA256, CERT_SIG_SCHEME_ECDSA_SECP256R1_SHA256}; | 1089 | uint16_t signAlgs[] = {CERT_SIG_SCHEME_RSA_PKCS1_SHA256, CERT_SIG_SCHEME_ECDSA_SECP256R1_SHA256}; |
| 1090 | HITLS_CFG_SetSignature(config, signAlgs, sizeof(signAlgs) / sizeof(uint16_t)); | 1090 | HITLS_CFG_SetSignature(config, signAlgs, sizeof(signAlgs) / sizeof(uint16_t)); |
| @@ -1402,7 +1402,7 @@ void UT_TLS_CM_GET_HANDSHAKE_STATE_FUNC_TC001(int version) | |||
| 1402 | config = GetHitlsConfigViaVersion(version); | 1402 | config = GetHitlsConfigViaVersion(version); |
| 1403 | ASSERT_TRUE(config != NULL); | 1403 | ASSERT_TRUE(config != NULL); |
| 1404 | config->isSupportRenegotiation = true; | 1404 | config->isSupportRenegotiation = true; |
| 1405 | - ASSERT_EQ(HITLS_CFG_SetEncryptThenMac(config, 1), HITLS_SUCCESS); | 1405 | + ASSERT_EQ(HITLS_CFG_SetEncryptThenMac(config, true), HITLS_SUCCESS); |
| 1406 | 1406 | ||
| 1407 | uint16_t signAlgs[] = {CERT_SIG_SCHEME_RSA_PKCS1_SHA256, CERT_SIG_SCHEME_ECDSA_SECP256R1_SHA256}; | 1407 | uint16_t signAlgs[] = {CERT_SIG_SCHEME_RSA_PKCS1_SHA256, CERT_SIG_SCHEME_ECDSA_SECP256R1_SHA256}; |
| 1408 | HITLS_CFG_SetSignature(config, signAlgs, sizeof(signAlgs) / sizeof(uint16_t)); | 1408 | HITLS_CFG_SetSignature(config, signAlgs, sizeof(signAlgs) / sizeof(uint16_t)); |
| @@ -1510,7 +1510,7 @@ EXIT: | |||
| 1510 | void UT_TLS_CM_IS_HANDSHAKING_FUNC_TC001(int version) | 1510 | void UT_TLS_CM_IS_HANDSHAKING_FUNC_TC001(int version) |
| 1511 | { | 1511 | { |
| 1512 | FRAME_Init(); | 1512 | FRAME_Init(); |
| 1513 | - uint8_t isHandShaking = 0; | 1513 | + bool isHandShaking = false; |
| 1514 | HITLS_Config *tlsConfig = GetHitlsConfigViaVersion(version); | 1514 | HITLS_Config *tlsConfig = GetHitlsConfigViaVersion(version); |
| 1515 | ASSERT_TRUE(tlsConfig != NULL); | 1515 | ASSERT_TRUE(tlsConfig != NULL); |
| 1516 | tlsConfig->isSupportRenegotiation = true; | 1516 | tlsConfig->isSupportRenegotiation = true; |
| @@ -1524,19 +1524,19 @@ void UT_TLS_CM_IS_HANDSHAKING_FUNC_TC001(int version) | |||
| 1524 | ASSERT_TRUE(clientTlsCtx->state == CM_STATE_IDLE); | 1524 | ASSERT_TRUE(clientTlsCtx->state == CM_STATE_IDLE); |
| 1525 | ASSERT_TRUE(serverTlsCtx->state == CM_STATE_IDLE); | 1525 | ASSERT_TRUE(serverTlsCtx->state == CM_STATE_IDLE); |
| 1526 | ASSERT_TRUE(HITLS_IsHandShaking(clientTlsCtx, &isHandShaking) == HITLS_SUCCESS); | 1526 | ASSERT_TRUE(HITLS_IsHandShaking(clientTlsCtx, &isHandShaking) == HITLS_SUCCESS); |
| 1527 | - ASSERT_TRUE(isHandShaking == 0); | 1527 | + ASSERT_TRUE(isHandShaking == false); |
| 1528 | 1528 | ||
| 1529 | ASSERT_TRUE(FRAME_CreateConnection(client, server, true, TRY_RECV_SERVER_HELLO) == HITLS_SUCCESS); | 1529 | ASSERT_TRUE(FRAME_CreateConnection(client, server, true, TRY_RECV_SERVER_HELLO) == HITLS_SUCCESS); |
| 1530 | ASSERT_TRUE(clientTlsCtx->state == CM_STATE_HANDSHAKING); | 1530 | ASSERT_TRUE(clientTlsCtx->state == CM_STATE_HANDSHAKING); |
| 1531 | ASSERT_TRUE(serverTlsCtx->state == CM_STATE_HANDSHAKING); | 1531 | ASSERT_TRUE(serverTlsCtx->state == CM_STATE_HANDSHAKING); |
| 1532 | ASSERT_TRUE(HITLS_IsHandShaking(clientTlsCtx, &isHandShaking) == HITLS_SUCCESS); | 1532 | ASSERT_TRUE(HITLS_IsHandShaking(clientTlsCtx, &isHandShaking) == HITLS_SUCCESS); |
| 1533 | - ASSERT_TRUE(isHandShaking == 1); | 1533 | + ASSERT_TRUE(isHandShaking == true); |
| 1534 | 1534 | ||
| 1535 | ASSERT_TRUE(FRAME_CreateConnection(client, server, true, HS_STATE_BUTT) == HITLS_SUCCESS); | 1535 | ASSERT_TRUE(FRAME_CreateConnection(client, server, true, HS_STATE_BUTT) == HITLS_SUCCESS); |
| 1536 | ASSERT_TRUE(clientTlsCtx->state == CM_STATE_TRANSPORTING); | 1536 | ASSERT_TRUE(clientTlsCtx->state == CM_STATE_TRANSPORTING); |
| 1537 | ASSERT_TRUE(serverTlsCtx->state == CM_STATE_TRANSPORTING); | 1537 | ASSERT_TRUE(serverTlsCtx->state == CM_STATE_TRANSPORTING); |
| 1538 | ASSERT_TRUE(HITLS_IsHandShaking(clientTlsCtx, &isHandShaking) == HITLS_SUCCESS); | 1538 | ASSERT_TRUE(HITLS_IsHandShaking(clientTlsCtx, &isHandShaking) == HITLS_SUCCESS); |
| 1539 | - ASSERT_TRUE(isHandShaking == 0); | 1539 | + ASSERT_TRUE(isHandShaking == false); |
| 1540 | 1540 | ||
| 1541 | if (version == HITLS_VERSION_TLS12) { | 1541 | if (version == HITLS_VERSION_TLS12) { |
| 1542 | ASSERT_EQ(HITLS_Renegotiate(clientTlsCtx), HITLS_SUCCESS); | 1542 | ASSERT_EQ(HITLS_Renegotiate(clientTlsCtx), HITLS_SUCCESS); |
| @@ -1544,13 +1544,13 @@ void UT_TLS_CM_IS_HANDSHAKING_FUNC_TC001(int version) | |||
| 1544 | ASSERT_TRUE(serverTlsCtx->state == CM_STATE_RENEGOTIATION); | 1544 | ASSERT_TRUE(serverTlsCtx->state == CM_STATE_RENEGOTIATION); |
| 1545 | ASSERT_TRUE(clientTlsCtx->state == CM_STATE_RENEGOTIATION); | 1545 | ASSERT_TRUE(clientTlsCtx->state == CM_STATE_RENEGOTIATION); |
| 1546 | ASSERT_TRUE(HITLS_IsHandShaking(clientTlsCtx, &isHandShaking) == HITLS_SUCCESS); | 1546 | ASSERT_TRUE(HITLS_IsHandShaking(clientTlsCtx, &isHandShaking) == HITLS_SUCCESS); |
| 1547 | - ASSERT_TRUE(isHandShaking == 1); | 1547 | + ASSERT_TRUE(isHandShaking == true); |
| 1548 | 1548 | ||
| 1549 | ASSERT_TRUE(FRAME_CreateRenegotiationState(client, server, true, HS_STATE_BUTT) == HITLS_SUCCESS); | 1549 | ASSERT_TRUE(FRAME_CreateRenegotiationState(client, server, true, HS_STATE_BUTT) == HITLS_SUCCESS); |
| 1550 | ASSERT_TRUE(clientTlsCtx->state == CM_STATE_TRANSPORTING); | 1550 | ASSERT_TRUE(clientTlsCtx->state == CM_STATE_TRANSPORTING); |
| 1551 | ASSERT_TRUE(serverTlsCtx->state == CM_STATE_TRANSPORTING); | 1551 | ASSERT_TRUE(serverTlsCtx->state == CM_STATE_TRANSPORTING); |
| 1552 | ASSERT_TRUE(HITLS_IsHandShaking(clientTlsCtx, &isHandShaking) == HITLS_SUCCESS); | 1552 | ASSERT_TRUE(HITLS_IsHandShaking(clientTlsCtx, &isHandShaking) == HITLS_SUCCESS); |
| 1553 | - ASSERT_TRUE(isHandShaking == 0); | 1553 | + ASSERT_TRUE(isHandShaking == false); |
| 1554 | } | 1554 | } |
| 1555 | EXIT: | 1555 | EXIT: |
| 1556 | HITLS_CFG_FreeConfig(tlsConfig); | 1556 | HITLS_CFG_FreeConfig(tlsConfig); |
| @@ -1581,7 +1581,7 @@ void UT_TLS_CM_HITLS_IsBeforeHandShake_FUNC_TC001(int version) | |||
| 1581 | { | 1581 | { |
| 1582 | FRAME_Init(); | 1582 | FRAME_Init(); |
| 1583 | int ret = 0; | 1583 | int ret = 0; |
| 1584 | - uint8_t isBefore = 0; | 1584 | + bool isBefore = false; |
| 1585 | HITLS_Config *config_c = GetHitlsConfigViaVersion(version); | 1585 | HITLS_Config *config_c = GetHitlsConfigViaVersion(version); |
| 1586 | HITLS_Config *config_s = GetHitlsConfigViaVersion(version); | 1586 | HITLS_Config *config_s = GetHitlsConfigViaVersion(version); |
| 1587 | ASSERT_TRUE(config_c != NULL); | 1587 | ASSERT_TRUE(config_c != NULL); |
| @@ -1595,19 +1595,19 @@ void UT_TLS_CM_HITLS_IsBeforeHandShake_FUNC_TC001(int version) | |||
| 1595 | ret = HITLS_IsBeforeHandShake(client->ssl, &isBefore); | 1595 | ret = HITLS_IsBeforeHandShake(client->ssl, &isBefore); |
| 1596 | ASSERT_TRUE(ret == HITLS_SUCCESS); | 1596 | ASSERT_TRUE(ret == HITLS_SUCCESS); |
| 1597 | ASSERT_TRUE(client->ssl->state == CM_STATE_IDLE); | 1597 | ASSERT_TRUE(client->ssl->state == CM_STATE_IDLE); |
| 1598 | - ASSERT_TRUE(isBefore == 1); | 1598 | + ASSERT_TRUE(isBefore == true); |
| 1599 | 1599 | ||
| 1600 | ASSERT_EQ(FRAME_CreateConnection(client, server, true, TRY_RECV_SERVER_HELLO), HITLS_SUCCESS); | 1600 | ASSERT_EQ(FRAME_CreateConnection(client, server, true, TRY_RECV_SERVER_HELLO), HITLS_SUCCESS); |
| 1601 | 1601 | ||
| 1602 | ret = HITLS_IsBeforeHandShake(client->ssl, &isBefore); | 1602 | ret = HITLS_IsBeforeHandShake(client->ssl, &isBefore); |
| 1603 | ASSERT_TRUE(ret == HITLS_SUCCESS); | 1603 | ASSERT_TRUE(ret == HITLS_SUCCESS); |
| 1604 | ASSERT_TRUE(client->ssl->state == CM_STATE_HANDSHAKING); | 1604 | ASSERT_TRUE(client->ssl->state == CM_STATE_HANDSHAKING); |
| 1605 | - ASSERT_TRUE(isBefore == 0); | 1605 | + ASSERT_TRUE(isBefore == false); |
| 1606 | 1606 | ||
| 1607 | ASSERT_EQ(FRAME_CreateConnection(client, server, true, HS_STATE_BUTT), HITLS_SUCCESS); | 1607 | ASSERT_EQ(FRAME_CreateConnection(client, server, true, HS_STATE_BUTT), HITLS_SUCCESS); |
| 1608 | ASSERT_TRUE(ret == HITLS_SUCCESS); | 1608 | ASSERT_TRUE(ret == HITLS_SUCCESS); |
| 1609 | ASSERT_TRUE(client->ssl->state == CM_STATE_TRANSPORTING); | 1609 | ASSERT_TRUE(client->ssl->state == CM_STATE_TRANSPORTING); |
| 1610 | - ASSERT_TRUE(isBefore == 0); | 1610 | + ASSERT_TRUE(isBefore == false); |
| 1611 | 1611 | ||
| 1612 | EXIT: | 1612 | EXIT: |
| 1613 | HITLS_CFG_FreeConfig(config_c); | 1613 | HITLS_CFG_FreeConfig(config_c); |
| @@ -2298,7 +2298,7 @@ void UT_TLS_CM_HITLS_GetFinishVerifyData_FUNC_TC001(int version) | |||
| 2298 | FRAME_LinkObj *server = NULL; | 2298 | FRAME_LinkObj *server = NULL; |
| 2299 | config = GetHitlsConfigViaVersion(version); | 2299 | config = GetHitlsConfigViaVersion(version); |
| 2300 | ASSERT_TRUE(config != NULL); | 2300 | ASSERT_TRUE(config != NULL); |
| 2301 | - ASSERT_EQ(HITLS_CFG_SetEncryptThenMac(config, 1), HITLS_SUCCESS); | 2301 | + ASSERT_EQ(HITLS_CFG_SetEncryptThenMac(config, true), HITLS_SUCCESS); |
| 2302 | 2302 | ||
| 2303 | uint16_t signAlgs[] = {CERT_SIG_SCHEME_RSA_PKCS1_SHA256, CERT_SIG_SCHEME_ECDSA_SECP256R1_SHA256}; | 2303 | uint16_t signAlgs[] = {CERT_SIG_SCHEME_RSA_PKCS1_SHA256, CERT_SIG_SCHEME_ECDSA_SECP256R1_SHA256}; |
| 2304 | HITLS_CFG_SetSignature(config, signAlgs, sizeof(signAlgs) / sizeof(uint16_t)); | 2304 | HITLS_CFG_SetSignature(config, signAlgs, sizeof(signAlgs) / sizeof(uint16_t)); |
| @@ -2346,7 +2346,7 @@ void UT_TLS_CM_HITLS_GetFinishVerifyData_FUNC_TC002(int version) | |||
| 2346 | FRAME_LinkObj *server = NULL; | 2346 | FRAME_LinkObj *server = NULL; |
| 2347 | config = GetHitlsConfigViaVersion(version); | 2347 | config = GetHitlsConfigViaVersion(version); |
| 2348 | ASSERT_TRUE(config != NULL); | 2348 | ASSERT_TRUE(config != NULL); |
| 2349 | - ASSERT_EQ(HITLS_CFG_SetEncryptThenMac(config, 1), HITLS_SUCCESS); | 2349 | + ASSERT_EQ(HITLS_CFG_SetEncryptThenMac(config, true), HITLS_SUCCESS); |
| 2350 | 2350 | ||
| 2351 | uint16_t signAlgs[] = {CERT_SIG_SCHEME_RSA_PKCS1_SHA256, CERT_SIG_SCHEME_ECDSA_SECP256R1_SHA256}; | 2351 | uint16_t signAlgs[] = {CERT_SIG_SCHEME_RSA_PKCS1_SHA256, CERT_SIG_SCHEME_ECDSA_SECP256R1_SHA256}; |
| 2352 | HITLS_CFG_SetSignature(config, signAlgs, sizeof(signAlgs) / sizeof(uint16_t)); | 2352 | HITLS_CFG_SetSignature(config, signAlgs, sizeof(signAlgs) / sizeof(uint16_t)); |
| @@ -2403,7 +2403,7 @@ void UT_TLS_CM_HITLS_GetFinishVerifyData_FUNC_TC003(int version) | |||
| 2403 | ASSERT_TRUE(config != NULL); | 2403 | ASSERT_TRUE(config != NULL); |
| 2404 | 2404 | ||
| 2405 | config->isSupportRenegotiation = true; | 2405 | config->isSupportRenegotiation = true; |
| 2406 | - ASSERT_EQ(HITLS_CFG_SetEncryptThenMac(config, 1), HITLS_SUCCESS); | 2406 | + ASSERT_EQ(HITLS_CFG_SetEncryptThenMac(config, true), HITLS_SUCCESS); |
| 2407 | 2407 | ||
| 2408 | uint16_t signAlgs[] = {CERT_SIG_SCHEME_RSA_PKCS1_SHA256, CERT_SIG_SCHEME_ECDSA_SECP256R1_SHA256}; | 2408 | uint16_t signAlgs[] = {CERT_SIG_SCHEME_RSA_PKCS1_SHA256, CERT_SIG_SCHEME_ECDSA_SECP256R1_SHA256}; |
| 2409 | HITLS_CFG_SetSignature(config, signAlgs, sizeof(signAlgs) / sizeof(uint16_t)); | 2409 | HITLS_CFG_SetSignature(config, signAlgs, sizeof(signAlgs) / sizeof(uint16_t)); |
| @@ -2492,7 +2492,7 @@ void UT_TLS_CM_HITLS_GetRenegotiationState_FUNC_TC001(void) | |||
| 2492 | FRAME_LinkObj *client = NULL; | 2492 | FRAME_LinkObj *client = NULL; |
| 2493 | FRAME_LinkObj *server = NULL; | 2493 | FRAME_LinkObj *server = NULL; |
| 2494 | 2494 | ||
| 2495 | - uint8_t isRenegotiation = true; | 2495 | + bool isRenegotiation = true; |
| 2496 | config = HITLS_CFG_NewTLS12Config(); | 2496 | config = HITLS_CFG_NewTLS12Config(); |
| 2497 | ASSERT_TRUE(config != NULL); | 2497 | ASSERT_TRUE(config != NULL); |
| 2498 | 2498 | ||
| @@ -2633,7 +2633,7 @@ void UT_HITLS_CM_SET_GET_CLIENTVERIFYSUPPORT_API_TC001(int tlsVersion) | |||
| 2633 | HITLS_Config *config = NULL; | 2633 | HITLS_Config *config = NULL; |
| 2634 | HITLS_Ctx *ctx = NULL; | 2634 | HITLS_Ctx *ctx = NULL; |
| 2635 | bool support = -1; | 2635 | bool support = -1; |
| 2636 | - uint8_t isSupport = -1; | 2636 | + bool isSupport = -1; |
| 2637 | ASSERT_TRUE(HITLS_SetClientVerifySupport(ctx, support) == HITLS_NULL_INPUT); | 2637 | ASSERT_TRUE(HITLS_SetClientVerifySupport(ctx, support) == HITLS_NULL_INPUT); |
| 2638 | ASSERT_TRUE(HITLS_GetClientVerifySupport(ctx, &isSupport) == HITLS_NULL_INPUT); | 2638 | ASSERT_TRUE(HITLS_GetClientVerifySupport(ctx, &isSupport) == HITLS_NULL_INPUT); |
| 2639 | 2639 | ||
| @@ -2690,7 +2690,7 @@ void UT_HITLS_CM_SET_GET_NOCLIENTCERTSUPPORT_API_TC001(int tlsVersion) | |||
| 2690 | HITLS_Config *config = NULL; | 2690 | HITLS_Config *config = NULL; |
| 2691 | HITLS_Ctx *ctx = NULL; | 2691 | HITLS_Ctx *ctx = NULL; |
| 2692 | bool support = -1; | 2692 | bool support = -1; |
| 2693 | - uint8_t isSupport = -1; | 2693 | + bool isSupport = -1; |
| 2694 | ASSERT_TRUE(HITLS_SetNoClientCertSupport(ctx, support) == HITLS_NULL_INPUT); | 2694 | ASSERT_TRUE(HITLS_SetNoClientCertSupport(ctx, support) == HITLS_NULL_INPUT); |
| 2695 | ASSERT_TRUE(HITLS_GetNoClientCertSupport(ctx, &isSupport) == HITLS_NULL_INPUT); | 2695 | ASSERT_TRUE(HITLS_GetNoClientCertSupport(ctx, &isSupport) == HITLS_NULL_INPUT); |
| 2696 | 2696 | ||
| @@ -2747,7 +2747,7 @@ void UT_HITLS_CM_SET_GET_VERIFYNONESUPPORT_API_TC001(int tlsVersion) | |||
| 2747 | HITLS_Config *config = NULL; | 2747 | HITLS_Config *config = NULL; |
| 2748 | HITLS_Ctx *ctx = NULL; | 2748 | HITLS_Ctx *ctx = NULL; |
| 2749 | bool support = -1; | 2749 | bool support = -1; |
| 2750 | - uint8_t isSupport = -1; | 2750 | + bool isSupport = -1; |
| 2751 | ASSERT_TRUE(HITLS_SetVerifyNoneSupport(ctx, support) == HITLS_NULL_INPUT); | 2751 | ASSERT_TRUE(HITLS_SetVerifyNoneSupport(ctx, support) == HITLS_NULL_INPUT); |
| 2752 | ASSERT_TRUE(HITLS_GetVerifyNoneSupport(ctx, &isSupport) == HITLS_NULL_INPUT); | 2752 | ASSERT_TRUE(HITLS_GetVerifyNoneSupport(ctx, &isSupport) == HITLS_NULL_INPUT); |
| 2753 | 2753 | ||
| @@ -2804,7 +2804,7 @@ void UT_HITLS_CM_SET_GET_CLIENTONCEVERIFYSUPPORT_API_TC001(int tlsVersion) | |||
| 2804 | HITLS_Config *config = NULL; | 2804 | HITLS_Config *config = NULL; |
| 2805 | HITLS_Ctx *ctx = NULL; | 2805 | HITLS_Ctx *ctx = NULL; |
| 2806 | bool support = -1; | 2806 | bool support = -1; |
| 2807 | - uint8_t isSupport = -1; | 2807 | + bool isSupport = -1; |
| 2808 | ASSERT_TRUE(HITLS_SetClientOnceVerifySupport(ctx, support) == HITLS_NULL_INPUT); | 2808 | ASSERT_TRUE(HITLS_SetClientOnceVerifySupport(ctx, support) == HITLS_NULL_INPUT); |
| 2809 | ASSERT_TRUE(HITLS_GetClientOnceVerifySupport(ctx, &isSupport) == HITLS_NULL_INPUT); | 2809 | ASSERT_TRUE(HITLS_GetClientOnceVerifySupport(ctx, &isSupport) == HITLS_NULL_INPUT); |
| 2810 | 2810 | ||
| @@ -3154,7 +3154,7 @@ void UT_HITLS_CM_SET_GET_RENEGOTIATIONSUPPORT_FUNC_TC001(int tlsVersion) | |||
| 3154 | HITLS_Config *config = NULL; | 3154 | HITLS_Config *config = NULL; |
| 3155 | HITLS_Ctx *ctx = NULL; | 3155 | HITLS_Ctx *ctx = NULL; |
| 3156 | bool support = -1; | 3156 | bool support = -1; |
| 3157 | - uint8_t isSupport = -1; | 3157 | + bool isSupport = -1; |
| 3158 | ASSERT_TRUE(HITLS_SetRenegotiationSupport(ctx, support) == HITLS_NULL_INPUT); | 3158 | ASSERT_TRUE(HITLS_SetRenegotiationSupport(ctx, support) == HITLS_NULL_INPUT); |
| 3159 | ASSERT_TRUE(HITLS_GetRenegotiationSupport(ctx, &isSupport) == HITLS_NULL_INPUT); | 3159 | ASSERT_TRUE(HITLS_GetRenegotiationSupport(ctx, &isSupport) == HITLS_NULL_INPUT); |
| 3160 | 3160 | ||
| @@ -3209,8 +3209,8 @@ void UT_HITLS_CM_SET_GET_FLIGHTTRANSMITSWITCH_FUNC_TC001(int tlsVersion) | |||
| 3209 | FRAME_Init(); | 3209 | FRAME_Init(); |
| 3210 | HITLS_Config *config = NULL; | 3210 | HITLS_Config *config = NULL; |
| 3211 | HITLS_Ctx *ctx = NULL; | 3211 | HITLS_Ctx *ctx = NULL; |
| 3212 | - uint8_t isEnable = -1; | 3212 | + bool isEnable = false; |
| 3213 | - uint8_t getIsEnable = -1; | 3213 | + bool getIsEnable = false; |
| 3214 | ASSERT_TRUE(HITLS_SetFlightTransmitSwitch(ctx, isEnable) == HITLS_NULL_INPUT); | 3214 | ASSERT_TRUE(HITLS_SetFlightTransmitSwitch(ctx, isEnable) == HITLS_NULL_INPUT); |
| 3215 | ASSERT_TRUE(HITLS_GetFlightTransmitSwitch(ctx, &getIsEnable) == HITLS_NULL_INPUT); | 3215 | ASSERT_TRUE(HITLS_GetFlightTransmitSwitch(ctx, &getIsEnable) == HITLS_NULL_INPUT); |
| 3216 | 3216 | ||
| @@ -4220,7 +4220,7 @@ void UT_TLS_CM_IS_DTLS_API_TC001(int tlsVersion) | |||
| 4220 | HitlsInit(); | 4220 | HitlsInit(); |
| 4221 | HITLS_Config *config = NULL; | 4221 | HITLS_Config *config = NULL; |
| 4222 | HITLS_Ctx *ctx = NULL; | 4222 | HITLS_Ctx *ctx = NULL; |
| 4223 | - uint8_t isDtls = 0; | 4223 | + bool isDtls = false; |
| 4224 | ASSERT_TRUE(HITLS_IsDtls(ctx, &isDtls) == HITLS_NULL_INPUT); | 4224 | ASSERT_TRUE(HITLS_IsDtls(ctx, &isDtls) == HITLS_NULL_INPUT); |
| 4225 | 4225 | ||
| 4226 | config = GetHitlsConfigViaVersion(tlsVersion); | 4226 | config = GetHitlsConfigViaVersion(tlsVersion); |
| @@ -4447,7 +4447,7 @@ void UT_HITLS_CM_SET_GET_ENCRYPTTHENMAC_TC001(int tlsVersion) | |||
| 4447 | FRAME_Init(); | 4447 | FRAME_Init(); |
| 4448 | HITLS_Config *config = NULL; | 4448 | HITLS_Config *config = NULL; |
| 4449 | HITLS_Ctx *ctx = NULL; | 4449 | HITLS_Ctx *ctx = NULL; |
| 4450 | - uint32_t encryptThenMacType = 0; | 4450 | + bool encryptThenMacType = false; |
| 4451 | 4451 | ||
| 4452 | ASSERT_TRUE(HITLS_SetEncryptThenMac(ctx, encryptThenMacType) == HITLS_NULL_INPUT); | 4452 | ASSERT_TRUE(HITLS_SetEncryptThenMac(ctx, encryptThenMacType) == HITLS_NULL_INPUT); |
| 4453 | ASSERT_TRUE(HITLS_GetEncryptThenMac(ctx, &encryptThenMacType) == HITLS_NULL_INPUT); | 4453 | ASSERT_TRUE(HITLS_GetEncryptThenMac(ctx, &encryptThenMacType) == HITLS_NULL_INPUT); |
| @@ -4457,13 +4457,13 @@ void UT_HITLS_CM_SET_GET_ENCRYPTTHENMAC_TC001(int tlsVersion) | |||
| 4457 | ASSERT_TRUE(ctx != NULL); | 4457 | ASSERT_TRUE(ctx != NULL); |
| 4458 | 4458 | ||
| 4459 | ASSERT_TRUE(HITLS_GetEncryptThenMac(ctx, NULL) == HITLS_NULL_INPUT); | 4459 | ASSERT_TRUE(HITLS_GetEncryptThenMac(ctx, NULL) == HITLS_NULL_INPUT); |
| 4460 | - encryptThenMacType = 1; | 4460 | + encryptThenMacType = true; |
| 4461 | ASSERT_TRUE(HITLS_SetEncryptThenMac(ctx, encryptThenMacType) == HITLS_SUCCESS); | 4461 | ASSERT_TRUE(HITLS_SetEncryptThenMac(ctx, encryptThenMacType) == HITLS_SUCCESS); |
| 4462 | - encryptThenMacType = -1; | 4462 | + encryptThenMacType = true; |
| 4463 | ASSERT_TRUE(HITLS_SetEncryptThenMac(ctx, encryptThenMacType) == HITLS_SUCCESS); | 4463 | ASSERT_TRUE(HITLS_SetEncryptThenMac(ctx, encryptThenMacType) == HITLS_SUCCESS); |
| 4464 | - ASSERT_TRUE(config->isEncryptThenMac = true); | 4464 | + ASSERT_TRUE(config->isEncryptThenMac == true); |
| 4465 | 4465 | ||
| 4466 | - uint32_t getencryptThenMacType = -1; | 4466 | + bool getencryptThenMacType = false; |
| 4467 | ASSERT_TRUE(HITLS_GetEncryptThenMac(ctx, &getencryptThenMacType) == HITLS_SUCCESS); | 4467 | ASSERT_TRUE(HITLS_GetEncryptThenMac(ctx, &getencryptThenMacType) == HITLS_SUCCESS); |
| 4468 | ASSERT_TRUE(getencryptThenMacType == true); | 4468 | ASSERT_TRUE(getencryptThenMacType == true); |
| 4469 | EXIT: | 4469 | EXIT: |
| @@ -244,7 +244,7 @@ void UT_TLS_CFG_SET_GET_NOCLIENTCERTSUPPORT_API_TC001(int tlsVersion) | |||
| 244 | FRAME_Init(); | 244 | FRAME_Init(); |
| 245 | HITLS_Config *config = NULL; | 245 | HITLS_Config *config = NULL; |
| 246 | bool support = -1; | 246 | bool support = -1; |
| 247 | - uint8_t isSupport = -1; | 247 | + bool isSupport = -1; |
| 248 | ASSERT_TRUE(HITLS_CFG_SetNoClientCertSupport(config, support) == HITLS_NULL_INPUT); | 248 | ASSERT_TRUE(HITLS_CFG_SetNoClientCertSupport(config, support) == HITLS_NULL_INPUT); |
| 249 | ASSERT_TRUE(HITLS_CFG_GetNoClientCertSupport(config, &isSupport) == HITLS_NULL_INPUT); | 249 | ASSERT_TRUE(HITLS_CFG_GetNoClientCertSupport(config, &isSupport) == HITLS_NULL_INPUT); |
| 250 | 250 | ||
| @@ -306,7 +306,7 @@ void UT_TLS_CFG_SET_GET_CLIENTVERIFYSUPPORT_API_TC001(int tlsVersion) | |||
| 306 | FRAME_Init(); | 306 | FRAME_Init(); |
| 307 | HITLS_Config *config = NULL; | 307 | HITLS_Config *config = NULL; |
| 308 | bool support = -1; | 308 | bool support = -1; |
| 309 | - uint8_t isSupport = -1; | 309 | + bool isSupport = false; |
| 310 | ASSERT_TRUE(HITLS_CFG_SetClientVerifySupport(config, support) == HITLS_NULL_INPUT); | 310 | ASSERT_TRUE(HITLS_CFG_SetClientVerifySupport(config, support) == HITLS_NULL_INPUT); |
| 311 | ASSERT_TRUE(HITLS_CFG_GetClientVerifySupport(config, &isSupport) == HITLS_NULL_INPUT); | 311 | ASSERT_TRUE(HITLS_CFG_GetClientVerifySupport(config, &isSupport) == HITLS_NULL_INPUT); |
| 312 | 312 | ||
| @@ -766,7 +766,7 @@ EXIT: | |||
| 766 | void UT_TLS_CFG_CIPHER_ISAEAD_API_TC001(void) | 766 | void UT_TLS_CFG_CIPHER_ISAEAD_API_TC001(void) |
| 767 | { | 767 | { |
| 768 | const HITLS_Cipher *cipher = NULL; | 768 | const HITLS_Cipher *cipher = NULL; |
| 769 | - uint8_t isAead = false; | 769 | + bool isAead = false; |
| 770 | ASSERT_TRUE(HITLS_CIPHER_IsAead(cipher, &isAead) == HITLS_NULL_INPUT); | 770 | ASSERT_TRUE(HITLS_CIPHER_IsAead(cipher, &isAead) == HITLS_NULL_INPUT); |
| 771 | 771 | ||
| 772 | const uint16_t cipherID = HITLS_RSA_WITH_AES_128_GCM_SHA256; | 772 | const uint16_t cipherID = HITLS_RSA_WITH_AES_128_GCM_SHA256; |
| @@ -1024,7 +1024,7 @@ void UT_TLS_CFG_SET_GET_RENEGOTIATIONSUPPORT_FUNC_TC001() | |||
| 1024 | FRAME_LinkObj *clientRes; | 1024 | FRAME_LinkObj *clientRes; |
| 1025 | FRAME_LinkObj *serverRes; | 1025 | FRAME_LinkObj *serverRes; |
| 1026 | HITLS_Config *config = NULL; | 1026 | HITLS_Config *config = NULL; |
| 1027 | - uint8_t supportrenegotiation; | 1027 | + bool supportrenegotiation = false; |
| 1028 | config = HITLS_CFG_NewTLS12Config(); | 1028 | config = HITLS_CFG_NewTLS12Config(); |
| 1029 | ASSERT_TRUE(config != NULL); | 1029 | ASSERT_TRUE(config != NULL); |
| 1030 | 1030 | ||
| @@ -1442,7 +1442,7 @@ void UT_TLS_CFG_GET_SECURE_RENEGOTIATIONSUPPORET_API_TC001(void) | |||
| 1442 | HitlsInit(); | 1442 | HitlsInit(); |
| 1443 | HITLS_Config *config = NULL; | 1443 | HITLS_Config *config = NULL; |
| 1444 | HITLS_Ctx *ctx = NULL; | 1444 | HITLS_Ctx *ctx = NULL; |
| 1445 | - uint8_t isSecureRenegotiation = 0; | 1445 | + bool isSecureRenegotiation = false; |
| 1446 | ASSERT_TRUE(HITLS_GetSecureRenegotiationSupport(NULL, &isSecureRenegotiation) == HITLS_NULL_INPUT); | 1446 | ASSERT_TRUE(HITLS_GetSecureRenegotiationSupport(NULL, &isSecureRenegotiation) == HITLS_NULL_INPUT); |
| 1447 | 1447 | ||
| 1448 | config = HITLS_CFG_NewTLS12Config(); | 1448 | config = HITLS_CFG_NewTLS12Config(); |
| @@ -214,7 +214,7 @@ void SDV_TLS_CFG_SET_GET_VERIFYNONESUPPORT_FUNC_TC001(int version, int connType) | |||
| 214 | HLT_Tls_Res *clientRes = NULL; | 214 | HLT_Tls_Res *clientRes = NULL; |
| 215 | HLT_Process *localProcess = NULL; | 215 | HLT_Process *localProcess = NULL; |
| 216 | HLT_Process *remoteProcess = NULL; | 216 | HLT_Process *remoteProcess = NULL; |
| 217 | - uint8_t c_flag = 0; | 217 | + bool c_flag = 0; |
| 218 | 218 | ||
| 219 | localProcess = HLT_InitLocalProcess(HITLS); | 219 | localProcess = HLT_InitLocalProcess(HITLS); |
| 220 | ASSERT_TRUE(localProcess != NULL); | 220 | ASSERT_TRUE(localProcess != NULL); |
| @@ -292,7 +292,7 @@ void SDV_TLS_CFG_SET_GET_CLIENTVERIFYUPPORT_FUNC_TC001(int clientverify) | |||
| 292 | ASSERT_TRUE(config_c != NULL); | 292 | ASSERT_TRUE(config_c != NULL); |
| 293 | ASSERT_TRUE(config_s != NULL); | 293 | ASSERT_TRUE(config_s != NULL); |
| 294 | 294 | ||
| 295 | - uint8_t c_flag; | 295 | + bool c_flag; |
| 296 | 296 | ||
| 297 | if (clientverify) { | 297 | if (clientverify) { |
| 298 | HITLS_CFG_SetClientVerifySupport(config_s, true); | 298 | HITLS_CFG_SetClientVerifySupport(config_s, true); |
| @@ -546,7 +546,7 @@ void SDV_TLS_CFG_GET_FLIGHTTRANSMITSWITH_FUNC_TC001(int version) | |||
| 546 | 546 | ||
| 547 | HITLS_Config *Config = NULL; | 547 | HITLS_Config *Config = NULL; |
| 548 | HITLS_Ctx *ctx = NULL; | 548 | HITLS_Ctx *ctx = NULL; |
| 549 | - uint8_t support; | 549 | + bool support; |
| 550 | Config = GetHitlsConfigViaVersion(version); | 550 | Config = GetHitlsConfigViaVersion(version); |
| 551 | ASSERT_TRUE(Config != NULL); | 551 | ASSERT_TRUE(Config != NULL); |
| 552 | ctx = HITLS_New(Config); | 552 | ctx = HITLS_New(Config); |
| @@ -129,9 +129,9 @@ int32_t ALERT_Flush(TLS_Ctx *ctx) | |||
| 129 | } | 129 | } |
| 130 | 130 | ||
| 131 | /* if isFlightTransmitEnable is enabled, the stored handshake information needs to be sent */ | 131 | /* if isFlightTransmitEnable is enabled, the stored handshake information needs to be sent */ |
| 132 | - uint8_t isFlightTransmitEnable = 0; | 132 | + bool isFlightTransmitEnable = false; |
| 133 | (void)HITLS_GetFlightTransmitSwitch(ctx, &isFlightTransmitEnable); | 133 | (void)HITLS_GetFlightTransmitSwitch(ctx, &isFlightTransmitEnable); |
| 134 | - if (isFlightTransmitEnable == 1) { | 134 | + if (isFlightTransmitEnable) { |
| 135 | ret = BSL_UIO_Ctrl(ctx->uio, BSL_UIO_FLUSH, 0, NULL); | 135 | ret = BSL_UIO_Ctrl(ctx->uio, BSL_UIO_FLUSH, 0, NULL); |
| 136 | if (ret == BSL_UIO_IO_BUSY) { | 136 | if (ret == BSL_UIO_IO_BUSY) { |
| 137 | BSL_ERR_PUSH_ERROR(HITLS_REC_NORMAL_IO_BUSY); | 137 | BSL_ERR_PUSH_ERROR(HITLS_REC_NORMAL_IO_BUSY); |
| @@ -382,17 +382,13 @@ int32_t HITLS_GetSelectedAlpnProto(HITLS_Ctx *ctx, uint8_t **proto, uint32_t *pr | |||
| 382 | } | 382 | } |
| 383 | 383 | ||
| 384 | 384 | ||
| 385 | -int32_t HITLS_IsServer(const HITLS_Ctx *ctx, uint8_t *isServer) | 385 | +int32_t HITLS_IsServer(const HITLS_Ctx *ctx, bool *isServer) |
| 386 | { | 386 | { |
| 387 | if (ctx == NULL || isServer == NULL) { | 387 | if (ctx == NULL || isServer == NULL) { |
| 388 | return HITLS_NULL_INPUT; | 388 | return HITLS_NULL_INPUT; |
| 389 | } | 389 | } |
| 390 | 390 | ||
| 391 | - *isServer = 0; | 391 | + *isServer = !ctx->isClient; |
| 392 | - if (ctx->isClient == false) { | ||
| 393 | - *isServer = 1; | ||
| 394 | - } | ||
| 395 | - | ||
| 396 | return HITLS_SUCCESS; | 392 | return HITLS_SUCCESS; |
| 397 | } | 393 | } |
| 398 | 394 | ||
| @@ -496,7 +492,7 @@ int32_t HITLS_SetSigalgsList(HITLS_Ctx *ctx, const uint16_t *signAlgs, uint16_t | |||
| 496 | } | 492 | } |
| 497 | 493 | ||
| 498 | 494 | ||
| 499 | -int32_t HITLS_GetRenegotiationSupport(const HITLS_Ctx *ctx, uint8_t *isSupportRenegotiation) | 495 | +int32_t HITLS_GetRenegotiationSupport(const HITLS_Ctx *ctx, bool *isSupportRenegotiation) |
| 500 | { | 496 | { |
| 501 | if (ctx == NULL) { | 497 | if (ctx == NULL) { |
| 502 | return HITLS_NULL_INPUT; | 498 | return HITLS_NULL_INPUT; |
| @@ -624,13 +620,13 @@ HITLS_TrustedCAList *HITLS_GetClientCAList(const HITLS_Ctx *ctx) | |||
| 624 | } | 620 | } |
| 625 | 621 | ||
| 626 | 622 | ||
| 627 | -int32_t HITLS_GetSecureRenegotiationSupport(const HITLS_Ctx *ctx, uint8_t *isSecureRenegotiation) | 623 | +int32_t HITLS_GetSecureRenegotiationSupport(const HITLS_Ctx *ctx, bool *isSecureRenegotiation) |
| 628 | { | 624 | { |
| 629 | if (ctx == NULL || isSecureRenegotiation == NULL) { | 625 | if (ctx == NULL || isSecureRenegotiation == NULL) { |
| 630 | return HITLS_NULL_INPUT; | 626 | return HITLS_NULL_INPUT; |
| 631 | } | 627 | } |
| 632 | 628 | ||
| 633 | - *isSecureRenegotiation = (uint8_t)ctx->negotiatedInfo.isSecureRenegotiation; | 629 | + *isSecureRenegotiation = ctx->negotiatedInfo.isSecureRenegotiation; |
| 634 | return HITLS_SUCCESS; | 630 | return HITLS_SUCCESS; |
| 635 | } | 631 | } |
| 636 | 632 | ||
| @@ -78,7 +78,7 @@ int32_t HITLS_SetMaxProtoVersion(HITLS_Ctx *ctx, uint16_t version) | |||
| 78 | 78 | ||
| 79 | 79 | ||
| 80 | 80 | ||
| 81 | -int32_t HITLS_IsAead(const HITLS_Ctx *ctx, uint8_t *isAead) | 81 | +int32_t HITLS_IsAead(const HITLS_Ctx *ctx, bool *isAead) |
| 82 | { | 82 | { |
| 83 | if (ctx == NULL) { | 83 | if (ctx == NULL) { |
| 84 | return HITLS_NULL_INPUT; | 84 | return HITLS_NULL_INPUT; |
| @@ -89,7 +89,7 @@ int32_t HITLS_IsAead(const HITLS_Ctx *ctx, uint8_t *isAead) | |||
| 89 | } | 89 | } |
| 90 | 90 | ||
| 91 | 91 | ||
| 92 | -int32_t HITLS_IsDtls(const HITLS_Ctx *ctx, uint8_t *isDtls) | 92 | +int32_t HITLS_IsDtls(const HITLS_Ctx *ctx, bool *isDtls) |
| 93 | { | 93 | { |
| 94 | if (ctx == NULL) { | 94 | if (ctx == NULL) { |
| 95 | return HITLS_NULL_INPUT; | 95 | return HITLS_NULL_INPUT; |
| @@ -99,13 +99,13 @@ int32_t HITLS_IsDtls(const HITLS_Ctx *ctx, uint8_t *isDtls) | |||
| 99 | 99 | ||
| 100 | 100 | ||
| 101 | 101 | ||
| 102 | -int32_t HITLS_IsSessionReused(HITLS_Ctx *ctx, uint8_t *isReused) | 102 | +int32_t HITLS_IsSessionReused(HITLS_Ctx *ctx, bool *isReused) |
| 103 | { | 103 | { |
| 104 | if (ctx == NULL || isReused == NULL) { | 104 | if (ctx == NULL || isReused == NULL) { |
| 105 | return HITLS_NULL_INPUT; | 105 | return HITLS_NULL_INPUT; |
| 106 | } | 106 | } |
| 107 | 107 | ||
| 108 | - *isReused = (uint8_t)ctx->negotiatedInfo.isResume; | 108 | + *isReused = ctx->negotiatedInfo.isResume; |
| 109 | return HITLS_SUCCESS; | 109 | return HITLS_SUCCESS; |
| 110 | } | 110 | } |
| 111 | 111 | ||
| @@ -222,13 +222,13 @@ int32_t HITLS_GetQuietShutdown(const HITLS_Ctx *ctx, int32_t *mode) | |||
| 222 | return HITLS_SUCCESS; | 222 | return HITLS_SUCCESS; |
| 223 | } | 223 | } |
| 224 | 224 | ||
| 225 | -int32_t HITLS_GetRenegotiationState(const HITLS_Ctx *ctx, uint8_t *isRenegotiationState) | 225 | +int32_t HITLS_GetRenegotiationState(const HITLS_Ctx *ctx, bool *isRenegotiationState) |
| 226 | { | 226 | { |
| 227 | if (ctx == NULL || isRenegotiationState == NULL) { | 227 | if (ctx == NULL || isRenegotiationState == NULL) { |
| 228 | return HITLS_NULL_INPUT; | 228 | return HITLS_NULL_INPUT; |
| 229 | } | 229 | } |
| 230 | 230 | ||
| 231 | - *isRenegotiationState = (uint8_t)ctx->negotiatedInfo.isRenegotiation; | 231 | + *isRenegotiationState = ctx->negotiatedInfo.isRenegotiation; |
| 232 | 232 | ||
| 233 | return HITLS_SUCCESS; | 233 | return HITLS_SUCCESS; |
| 234 | } | 234 | } |
| @@ -265,7 +265,7 @@ int32_t HITLS_GetShutdownState(const HITLS_Ctx *ctx, uint32_t *mode) | |||
| 265 | } | 265 | } |
| 266 | 266 | ||
| 267 | 267 | ||
| 268 | -int32_t HITLS_GetClientVerifySupport(HITLS_Ctx *ctx, uint8_t *isSupport) | 268 | +int32_t HITLS_GetClientVerifySupport(HITLS_Ctx *ctx, bool *isSupport) |
| 269 | { | 269 | { |
| 270 | if (ctx == NULL) { | 270 | if (ctx == NULL) { |
| 271 | return HITLS_NULL_INPUT; | 271 | return HITLS_NULL_INPUT; |
| @@ -274,7 +274,7 @@ int32_t HITLS_GetClientVerifySupport(HITLS_Ctx *ctx, uint8_t *isSupport) | |||
| 274 | return HITLS_CFG_GetClientVerifySupport(&(ctx->config.tlsConfig), isSupport); | 274 | return HITLS_CFG_GetClientVerifySupport(&(ctx->config.tlsConfig), isSupport); |
| 275 | } | 275 | } |
| 276 | 276 | ||
| 277 | -int32_t HITLS_GetNoClientCertSupport(HITLS_Ctx *ctx, uint8_t *isSupport) | 277 | +int32_t HITLS_GetNoClientCertSupport(HITLS_Ctx *ctx, bool *isSupport) |
| 278 | { | 278 | { |
| 279 | if (ctx == NULL) { | 279 | if (ctx == NULL) { |
| 280 | return HITLS_NULL_INPUT; | 280 | return HITLS_NULL_INPUT; |
| @@ -285,7 +285,7 @@ int32_t HITLS_GetNoClientCertSupport(HITLS_Ctx *ctx, uint8_t *isSupport) | |||
| 285 | 285 | ||
| 286 | 286 | ||
| 287 | 287 | ||
| 288 | -int32_t HITLS_GetPostHandshakeAuthSupport(HITLS_Ctx *ctx, uint8_t *isSupport) | 288 | +int32_t HITLS_GetPostHandshakeAuthSupport(HITLS_Ctx *ctx, bool *isSupport) |
| 289 | { | 289 | { |
| 290 | if (ctx == NULL) { | 290 | if (ctx == NULL) { |
| 291 | return HITLS_NULL_INPUT; | 291 | return HITLS_NULL_INPUT; |
| @@ -295,7 +295,7 @@ int32_t HITLS_GetPostHandshakeAuthSupport(HITLS_Ctx *ctx, uint8_t *isSupport) | |||
| 295 | } | 295 | } |
| 296 | 296 | ||
| 297 | 297 | ||
| 298 | -int32_t HITLS_GetVerifyNoneSupport(HITLS_Ctx *ctx, uint8_t *isSupport) | 298 | +int32_t HITLS_GetVerifyNoneSupport(HITLS_Ctx *ctx, bool *isSupport) |
| 299 | { | 299 | { |
| 300 | if (ctx == NULL) { | 300 | if (ctx == NULL) { |
| 301 | return HITLS_NULL_INPUT; | 301 | return HITLS_NULL_INPUT; |
| @@ -306,7 +306,7 @@ int32_t HITLS_GetVerifyNoneSupport(HITLS_Ctx *ctx, uint8_t *isSupport) | |||
| 306 | 306 | ||
| 307 | 307 | ||
| 308 | 308 | ||
| 309 | -int32_t HITLS_GetClientOnceVerifySupport(HITLS_Ctx *ctx, uint8_t *isSupport) | 309 | +int32_t HITLS_GetClientOnceVerifySupport(HITLS_Ctx *ctx, bool *isSupport) |
| 310 | { | 310 | { |
| 311 | if (ctx == NULL) { | 311 | if (ctx == NULL) { |
| 312 | return HITLS_NULL_INPUT; | 312 | return HITLS_NULL_INPUT; |
| @@ -348,7 +348,7 @@ int32_t HITLS_GetModeSupport(const HITLS_Ctx *ctx, uint32_t *mode) | |||
| 348 | 348 | ||
| 349 | 349 | ||
| 350 | 350 | ||
| 351 | -int32_t HITLS_SetEncryptThenMac(HITLS_Ctx *ctx, uint32_t encryptThenMacType) | 351 | +int32_t HITLS_SetEncryptThenMac(HITLS_Ctx *ctx, bool encryptThenMacType) |
| 352 | { | 352 | { |
| 353 | if (ctx == NULL) { | 353 | if (ctx == NULL) { |
| 354 | return HITLS_NULL_INPUT; | 354 | return HITLS_NULL_INPUT; |
| @@ -357,7 +357,7 @@ int32_t HITLS_SetEncryptThenMac(HITLS_Ctx *ctx, uint32_t encryptThenMacType) | |||
| 357 | return HITLS_CFG_SetEncryptThenMac(&(ctx->config.tlsConfig), encryptThenMacType); | 357 | return HITLS_CFG_SetEncryptThenMac(&(ctx->config.tlsConfig), encryptThenMacType); |
| 358 | } | 358 | } |
| 359 | 359 | ||
| 360 | -int32_t HITLS_GetEncryptThenMac(const HITLS_Ctx *ctx, uint32_t *encryptThenMacType) | 360 | +int32_t HITLS_GetEncryptThenMac(const HITLS_Ctx *ctx, bool *encryptThenMacType) |
| 361 | { | 361 | { |
| 362 | if (ctx == NULL || encryptThenMacType == NULL) { | 362 | if (ctx == NULL || encryptThenMacType == NULL) { |
| 363 | return HITLS_NULL_INPUT; | 363 | return HITLS_NULL_INPUT; |
| @@ -365,7 +365,7 @@ int32_t HITLS_GetEncryptThenMac(const HITLS_Ctx *ctx, uint32_t *encryptThenMacTy | |||
| 365 | 365 | ||
| 366 | // Returns the negotiated value if it has been negotiated | 366 | // Returns the negotiated value if it has been negotiated |
| 367 | if (ctx->negotiatedInfo.version > 0) { | 367 | if (ctx->negotiatedInfo.version > 0) { |
| 368 | - *encryptThenMacType = (uint32_t)ctx->negotiatedInfo.isEncryptThenMac; | 368 | + *encryptThenMacType = ctx->negotiatedInfo.isEncryptThenMac; |
| 369 | return HITLS_SUCCESS; | 369 | return HITLS_SUCCESS; |
| 370 | } else { | 370 | } else { |
| 371 | return HITLS_CFG_GetEncryptThenMac(&(ctx->config.tlsConfig), encryptThenMacType); | 371 | return HITLS_CFG_GetEncryptThenMac(&(ctx->config.tlsConfig), encryptThenMacType); |
| @@ -439,7 +439,7 @@ int32_t HITLS_SetSessionTicketSupport(HITLS_Ctx *ctx, bool isSupport) | |||
| 439 | return HITLS_CFG_SetSessionTicketSupport(&(ctx->config.tlsConfig), isSupport); | 439 | return HITLS_CFG_SetSessionTicketSupport(&(ctx->config.tlsConfig), isSupport); |
| 440 | } | 440 | } |
| 441 | 441 | ||
| 442 | -int32_t HITLS_GetSessionTicketSupport(const HITLS_Ctx *ctx, uint8_t *isSupport) | 442 | +int32_t HITLS_GetSessionTicketSupport(const HITLS_Ctx *ctx, bool *isSupport) |
| 443 | { | 443 | { |
| 444 | if (ctx == NULL) { | 444 | if (ctx == NULL) { |
| 445 | return HITLS_NULL_INPUT; | 445 | return HITLS_NULL_INPUT; |
| @@ -486,7 +486,7 @@ uint32_t HITLS_GetTicketNums(HITLS_Ctx *ctx) | |||
| 486 | } | 486 | } |
| 487 | 487 | ||
| 488 | 488 | ||
| 489 | -int32_t HITLS_SetFlightTransmitSwitch(HITLS_Ctx *ctx, uint8_t isEnable) | 489 | +int32_t HITLS_SetFlightTransmitSwitch(HITLS_Ctx *ctx, bool isEnable) |
| 490 | { | 490 | { |
| 491 | if (ctx == NULL) { | 491 | if (ctx == NULL) { |
| 492 | return HITLS_NULL_INPUT; | 492 | return HITLS_NULL_INPUT; |
| @@ -495,7 +495,7 @@ int32_t HITLS_SetFlightTransmitSwitch(HITLS_Ctx *ctx, uint8_t isEnable) | |||
| 495 | return HITLS_CFG_SetFlightTransmitSwitch(&(ctx->config.tlsConfig), isEnable); | 495 | return HITLS_CFG_SetFlightTransmitSwitch(&(ctx->config.tlsConfig), isEnable); |
| 496 | } | 496 | } |
| 497 | 497 | ||
| 498 | -int32_t HITLS_GetFlightTransmitSwitch(const HITLS_Ctx *ctx, uint8_t *isEnable) | 498 | +int32_t HITLS_GetFlightTransmitSwitch(const HITLS_Ctx *ctx, bool *isEnable) |
| 499 | { | 499 | { |
| 500 | if (ctx == NULL) { | 500 | if (ctx == NULL) { |
| 501 | return HITLS_NULL_INPUT; | 501 | return HITLS_NULL_INPUT; |
| @@ -532,28 +532,28 @@ int32_t HITLS_GetHandShakeState(const HITLS_Ctx *ctx, uint32_t *state) | |||
| 532 | return HITLS_SUCCESS; | 532 | return HITLS_SUCCESS; |
| 533 | } | 533 | } |
| 534 | 534 | ||
| 535 | -int32_t HITLS_IsHandShaking(const HITLS_Ctx *ctx, uint8_t *isHandShaking) | 535 | +int32_t HITLS_IsHandShaking(const HITLS_Ctx *ctx, bool *isHandShaking) |
| 536 | { | 536 | { |
| 537 | if (ctx == NULL || isHandShaking == NULL) { | 537 | if (ctx == NULL || isHandShaking == NULL) { |
| 538 | return HITLS_NULL_INPUT; | 538 | return HITLS_NULL_INPUT; |
| 539 | } | 539 | } |
| 540 | 540 | ||
| 541 | - *isHandShaking = 0; | 541 | + *isHandShaking = false; |
| 542 | uint32_t state = GetConnState(ctx); | 542 | uint32_t state = GetConnState(ctx); |
| 543 | if ((state == CM_STATE_HANDSHAKING) || (state == CM_STATE_RENEGOTIATION)) { | 543 | if ((state == CM_STATE_HANDSHAKING) || (state == CM_STATE_RENEGOTIATION)) { |
| 544 | - *isHandShaking = 1; | 544 | + *isHandShaking = true; |
| 545 | } | 545 | } |
| 546 | return HITLS_SUCCESS; | 546 | return HITLS_SUCCESS; |
| 547 | } | 547 | } |
| 548 | 548 | ||
| 549 | -int32_t HITLS_IsBeforeHandShake(const HITLS_Ctx *ctx, uint8_t *isBefore) | 549 | +int32_t HITLS_IsBeforeHandShake(const HITLS_Ctx *ctx, bool *isBefore) |
| 550 | { | 550 | { |
| 551 | if (ctx == NULL || isBefore == NULL) { | 551 | if (ctx == NULL || isBefore == NULL) { |
| 552 | return HITLS_NULL_INPUT; | 552 | return HITLS_NULL_INPUT; |
| 553 | } | 553 | } |
| 554 | - *isBefore = 0; | 554 | + *isBefore = false; |
| 555 | if (GetConnState(ctx) == CM_STATE_IDLE) { | 555 | if (GetConnState(ctx) == CM_STATE_IDLE) { |
| 556 | - *isBefore = 1; | 556 | + *isBefore = true; |
| 557 | } | 557 | } |
| 558 | return HITLS_SUCCESS; | 558 | return HITLS_SUCCESS; |
| 559 | } | 559 | } |
| @@ -654,7 +654,7 @@ static int32_t CheckRenegotiateValid(HITLS_Ctx *ctx) | |||
| 654 | return HITLS_NULL_INPUT; | 654 | return HITLS_NULL_INPUT; |
| 655 | } | 655 | } |
| 656 | 656 | ||
| 657 | - uint8_t isSupport = false; | 657 | + bool isSupport = false; |
| 658 | 658 | ||
| 659 | (void)HITLS_GetRenegotiationSupport(ctx, &isSupport); | 659 | (void)HITLS_GetRenegotiationSupport(ctx, &isSupport); |
| 660 | /* Renegotiation is disabled */ | 660 | /* Renegotiation is disabled */ |
| @@ -503,13 +503,13 @@ int32_t HITLS_Peek(HITLS_Ctx *ctx, uint8_t *data, uint32_t bufSize, uint32_t *re | |||
| 503 | return ret; | 503 | return ret; |
| 504 | } | 504 | } |
| 505 | 505 | ||
| 506 | -int32_t HITLS_ReadHasPending(const HITLS_Ctx *ctx, uint8_t *isPending) | 506 | +int32_t HITLS_ReadHasPending(const HITLS_Ctx *ctx, bool *isPending) |
| 507 | { | 507 | { |
| 508 | if (ctx == NULL || isPending == NULL) { | 508 | if (ctx == NULL || isPending == NULL) { |
| 509 | return HITLS_NULL_INPUT; | 509 | return HITLS_NULL_INPUT; |
| 510 | } | 510 | } |
| 511 | 511 | ||
| 512 | - *isPending = APP_GetReadPendingBytes(ctx) > 0 || REC_ReadHasPending(ctx) ? 1 : 0; | 512 | + *isPending = (APP_GetReadPendingBytes(ctx) > 0 || REC_ReadHasPending(ctx)); |
| 513 | 513 | ||
| 514 | return HITLS_SUCCESS; | 514 | return HITLS_SUCCESS; |
| 515 | } | 515 | } |
| @@ -2118,7 +2118,7 @@ int32_t HITLS_CFG_GetDescription(const HITLS_Cipher *cipher, uint8_t *buf, int32 | |||
| 2118 | * @return HITLS_SUCCESS Obtained successfully. | 2118 | * @return HITLS_SUCCESS Obtained successfully. |
| 2119 | * HITLS_NULL_INPUT The input parameter pointer is NULL. | 2119 | * HITLS_NULL_INPUT The input parameter pointer is NULL. |
| 2120 | */ | 2120 | */ |
| 2121 | -int32_t HITLS_CIPHER_IsAead(const HITLS_Cipher *cipher, uint8_t *isAead) | 2121 | +int32_t HITLS_CIPHER_IsAead(const HITLS_Cipher *cipher, bool *isAead) |
| 2122 | { | 2122 | { |
| 2123 | if (cipher == NULL || isAead == NULL) { | 2123 | if (cipher == NULL || isAead == NULL) { |
| 2124 | BSL_ERR_PUSH_ERROR(HITLS_NULL_INPUT); | 2124 | BSL_ERR_PUSH_ERROR(HITLS_NULL_INPUT); |
| @@ -1151,13 +1151,13 @@ int32_t HITLS_CFG_SetTmpDh(HITLS_Config *config, HITLS_CRYPT_Key *dhPkey) | |||
| 1151 | return HITLS_SUCCESS; | 1151 | return HITLS_SUCCESS; |
| 1152 | } | 1152 | } |
| 1153 | 1153 | ||
| 1154 | -int32_t HITLS_CFG_GetDhAutoSupport(HITLS_Config *config, uint8_t *isSupport) | 1154 | +int32_t HITLS_CFG_GetDhAutoSupport(HITLS_Config *config, bool *isSupport) |
| 1155 | { | 1155 | { |
| 1156 | if (config == NULL || isSupport == NULL) { | 1156 | if (config == NULL || isSupport == NULL) { |
| 1157 | return HITLS_NULL_INPUT; | 1157 | return HITLS_NULL_INPUT; |
| 1158 | } | 1158 | } |
| 1159 | 1159 | ||
| 1160 | - *isSupport = (uint8_t)config->isSupportDhAuto; | 1160 | + *isSupport = config->isSupportDhAuto; |
| 1161 | return HITLS_SUCCESS; | 1161 | return HITLS_SUCCESS; |
| 1162 | } | 1162 | } |
| 1163 | 1163 | ||
| @@ -1561,35 +1561,35 @@ int32_t HITLS_CFG_SetSessionTicketSupport(HITLS_Config *config, bool support) | |||
| 1561 | 1561 | ||
| 1562 | 1562 | ||
| 1563 | 1563 | ||
| 1564 | -int32_t HITLS_CFG_GetRenegotiationSupport(const HITLS_Config *config, uint8_t *isSupport) | 1564 | +int32_t HITLS_CFG_GetRenegotiationSupport(const HITLS_Config *config, bool *isSupport) |
| 1565 | { | 1565 | { |
| 1566 | if (config == NULL || isSupport == NULL) { | 1566 | if (config == NULL || isSupport == NULL) { |
| 1567 | return HITLS_NULL_INPUT; | 1567 | return HITLS_NULL_INPUT; |
| 1568 | } | 1568 | } |
| 1569 | 1569 | ||
| 1570 | - *isSupport = (uint8_t)config->isSupportRenegotiation; | 1570 | + *isSupport = config->isSupportRenegotiation; |
| 1571 | return HITLS_SUCCESS; | 1571 | return HITLS_SUCCESS; |
| 1572 | } | 1572 | } |
| 1573 | 1573 | ||
| 1574 | 1574 | ||
| 1575 | -int32_t HITLS_CFG_GetExtenedMasterSecretSupport(HITLS_Config *config, uint8_t *isSupport) | 1575 | +int32_t HITLS_CFG_GetExtenedMasterSecretSupport(HITLS_Config *config, bool *isSupport) |
| 1576 | { | 1576 | { |
| 1577 | if (config == NULL || isSupport == NULL) { | 1577 | if (config == NULL || isSupport == NULL) { |
| 1578 | return HITLS_NULL_INPUT; | 1578 | return HITLS_NULL_INPUT; |
| 1579 | } | 1579 | } |
| 1580 | 1580 | ||
| 1581 | - *isSupport = (uint8_t)config->isSupportExtendMasterSecret; | 1581 | + *isSupport = config->isSupportExtendMasterSecret; |
| 1582 | return HITLS_SUCCESS; | 1582 | return HITLS_SUCCESS; |
| 1583 | } | 1583 | } |
| 1584 | 1584 | ||
| 1585 | 1585 | ||
| 1586 | -int32_t HITLS_CFG_GetSessionTicketSupport(const HITLS_Config *config, uint8_t *isSupport) | 1586 | +int32_t HITLS_CFG_GetSessionTicketSupport(const HITLS_Config *config, bool *isSupport) |
| 1587 | { | 1587 | { |
| 1588 | if (config == NULL || isSupport == NULL) { | 1588 | if (config == NULL || isSupport == NULL) { |
| 1589 | return HITLS_NULL_INPUT; | 1589 | return HITLS_NULL_INPUT; |
| 1590 | } | 1590 | } |
| 1591 | 1591 | ||
| 1592 | - *isSupport = (uint8_t)config->isSupportSessionTicket; | 1592 | + *isSupport = config->isSupportSessionTicket; |
| 1593 | return HITLS_SUCCESS; | 1593 | return HITLS_SUCCESS; |
| 1594 | } | 1594 | } |
| 1595 | 1595 | ||
| @@ -1633,13 +1633,13 @@ int32_t HITLS_CFG_SetClientOnceVerifySupport(HITLS_Config *config, bool support) | |||
| 1633 | return HITLS_SUCCESS; | 1633 | return HITLS_SUCCESS; |
| 1634 | } | 1634 | } |
| 1635 | 1635 | ||
| 1636 | -int32_t HITLS_CFG_GetClientOnceVerifySupport(HITLS_Config *config, uint8_t *isSupport) | 1636 | +int32_t HITLS_CFG_GetClientOnceVerifySupport(HITLS_Config *config, bool *isSupport) |
| 1637 | { | 1637 | { |
| 1638 | if (config == NULL || isSupport == NULL) { | 1638 | if (config == NULL || isSupport == NULL) { |
| 1639 | return HITLS_NULL_INPUT; | 1639 | return HITLS_NULL_INPUT; |
| 1640 | } | 1640 | } |
| 1641 | 1641 | ||
| 1642 | - *isSupport = (uint8_t)config->isSupportClientOnceVerify; | 1642 | + *isSupport = config->isSupportClientOnceVerify; |
| 1643 | return HITLS_SUCCESS; | 1643 | return HITLS_SUCCESS; |
| 1644 | } | 1644 | } |
| 1645 | 1645 | ||
| @@ -1917,33 +1917,29 @@ int32_t HITLS_CFG_SetDtlsPostHsTimeoutVal(HITLS_Config *config, uint32_t timeout | |||
| 1917 | 1917 | ||
| 1918 | 1918 | ||
| 1919 | 1919 | ||
| 1920 | -int32_t HITLS_CFG_SetEncryptThenMac(HITLS_Config *config, uint32_t encryptThenMacType) | 1920 | +int32_t HITLS_CFG_SetEncryptThenMac(HITLS_Config *config, bool encryptThenMacType) |
| 1921 | { | 1921 | { |
| 1922 | if (config == NULL) { | 1922 | if (config == NULL) { |
| 1923 | return HITLS_NULL_INPUT; | 1923 | return HITLS_NULL_INPUT; |
| 1924 | } | 1924 | } |
| 1925 | 1925 | ||
| 1926 | - if (encryptThenMacType == 0) { | 1926 | + config->isEncryptThenMac = encryptThenMacType; |
| 1927 | - config->isEncryptThenMac = false; | ||
| 1928 | - } else { | ||
| 1929 | - config->isEncryptThenMac = true; | ||
| 1930 | - } | ||
| 1931 | return HITLS_SUCCESS; | 1927 | return HITLS_SUCCESS; |
| 1932 | } | 1928 | } |
| 1933 | 1929 | ||
| 1934 | -int32_t HITLS_CFG_GetEncryptThenMac(const HITLS_Config *config, uint32_t *encryptThenMacType) | 1930 | +int32_t HITLS_CFG_GetEncryptThenMac(const HITLS_Config *config, bool *encryptThenMacType) |
| 1935 | { | 1931 | { |
| 1936 | if (config == NULL || encryptThenMacType == NULL) { | 1932 | if (config == NULL || encryptThenMacType == NULL) { |
| 1937 | return HITLS_NULL_INPUT; | 1933 | return HITLS_NULL_INPUT; |
| 1938 | } | 1934 | } |
| 1939 | 1935 | ||
| 1940 | - *encryptThenMacType = (uint32_t)config->isEncryptThenMac; | 1936 | + *encryptThenMacType = config->isEncryptThenMac; |
| 1941 | return HITLS_SUCCESS; | 1937 | return HITLS_SUCCESS; |
| 1942 | } | 1938 | } |
| 1943 | 1939 | ||
| 1944 | 1940 | ||
| 1945 | 1941 | ||
| 1946 | -int32_t HITLS_CFG_IsDtls(const HITLS_Config *config, uint8_t *isDtls) | 1942 | +int32_t HITLS_CFG_IsDtls(const HITLS_Config *config, bool *isDtls) |
| 1947 | { | 1943 | { |
| 1948 | if (config == NULL || isDtls == NULL) { | 1944 | if (config == NULL || isDtls == NULL) { |
| 1949 | return HITLS_NULL_INPUT; | 1945 | return HITLS_NULL_INPUT; |
| @@ -1993,21 +1989,17 @@ uint32_t HITLS_CFG_GetTicketNums(HITLS_Config *config) | |||
| 1993 | } | 1989 | } |
| 1994 | 1990 | ||
| 1995 | 1991 | ||
| 1996 | -int32_t HITLS_CFG_SetFlightTransmitSwitch(HITLS_Config *config, uint8_t isEnable) | 1992 | +int32_t HITLS_CFG_SetFlightTransmitSwitch(HITLS_Config *config, bool isEnable) |
| 1997 | { | 1993 | { |
| 1998 | if (config == NULL) { | 1994 | if (config == NULL) { |
| 1999 | return HITLS_NULL_INPUT; | 1995 | return HITLS_NULL_INPUT; |
| 2000 | } | 1996 | } |
| 2001 | 1997 | ||
| 2002 | - if (isEnable == 0) { | 1998 | + config->isFlightTransmitEnable = isEnable; |
| 2003 | - config->isFlightTransmitEnable = false; | ||
| 2004 | - } else { | ||
| 2005 | - config->isFlightTransmitEnable = true; | ||
| 2006 | - } | ||
| 2007 | return HITLS_SUCCESS; | 1999 | return HITLS_SUCCESS; |
| 2008 | } | 2000 | } |
| 2009 | 2001 | ||
| 2010 | -int32_t HITLS_CFG_GetFlightTransmitSwitch(const HITLS_Config *config, uint8_t *isEnable) | 2002 | +int32_t HITLS_CFG_GetFlightTransmitSwitch(const HITLS_Config *config, bool *isEnable) |
| 2011 | { | 2003 | { |
| 2012 | if (config == NULL || isEnable == NULL) { | 2004 | if (config == NULL || isEnable == NULL) { |
| 2013 | return HITLS_NULL_INPUT; | 2005 | return HITLS_NULL_INPUT; |
| @@ -700,33 +700,33 @@ int32_t HITLS_CFG_SetVerifyNoneSupport(HITLS_Config *config, bool support) | |||
| 700 | return HITLS_SUCCESS; | 700 | return HITLS_SUCCESS; |
| 701 | } | 701 | } |
| 702 | 702 | ||
| 703 | -int32_t HITLS_CFG_GetVerifyNoneSupport(HITLS_Config *config, uint8_t *isSupport) | 703 | +int32_t HITLS_CFG_GetVerifyNoneSupport(HITLS_Config *config, bool *isSupport) |
| 704 | { | 704 | { |
| 705 | if (config == NULL || isSupport == NULL) { | 705 | if (config == NULL || isSupport == NULL) { |
| 706 | return HITLS_NULL_INPUT; | 706 | return HITLS_NULL_INPUT; |
| 707 | } | 707 | } |
| 708 | 708 | ||
| 709 | - *isSupport = (uint8_t)config->isSupportVerifyNone; | 709 | + *isSupport = config->isSupportVerifyNone; |
| 710 | return HITLS_SUCCESS; | 710 | return HITLS_SUCCESS; |
| 711 | } | 711 | } |
| 712 | 712 | ||
| 713 | -int32_t HITLS_CFG_GetClientVerifySupport(HITLS_Config *config, uint8_t *isSupport) | 713 | +int32_t HITLS_CFG_GetClientVerifySupport(HITLS_Config *config, bool *isSupport) |
| 714 | { | 714 | { |
| 715 | if (config == NULL || isSupport == NULL) { | 715 | if (config == NULL || isSupport == NULL) { |
| 716 | return HITLS_NULL_INPUT; | 716 | return HITLS_NULL_INPUT; |
| 717 | } | 717 | } |
| 718 | 718 | ||
| 719 | - *isSupport = (uint8_t)config->isSupportClientVerify; | 719 | + *isSupport = config->isSupportClientVerify; |
| 720 | return HITLS_SUCCESS; | 720 | return HITLS_SUCCESS; |
| 721 | } | 721 | } |
| 722 | 722 | ||
| 723 | -int32_t HITLS_CFG_GetNoClientCertSupport(HITLS_Config *config, uint8_t *isSupport) | 723 | +int32_t HITLS_CFG_GetNoClientCertSupport(HITLS_Config *config, bool *isSupport) |
| 724 | { | 724 | { |
| 725 | if (config == NULL || isSupport == NULL) { | 725 | if (config == NULL || isSupport == NULL) { |
| 726 | return HITLS_NULL_INPUT; | 726 | return HITLS_NULL_INPUT; |
| 727 | } | 727 | } |
| 728 | 728 | ||
| 729 | - *isSupport = (uint8_t)config->isSupportNoClientCert; | 729 | + *isSupport = config->isSupportNoClientCert; |
| 730 | return HITLS_SUCCESS; | 730 | return HITLS_SUCCESS; |
| 731 | } | 731 | } |
| 732 | 732 | ||
| @@ -110,13 +110,13 @@ int32_t HITLS_CFG_SetPostHandshakeAuthSupport(HITLS_Config *config, bool support | |||
| 110 | config->isSupportPostHandshakeAuth = support; | 110 | config->isSupportPostHandshakeAuth = support; |
| 111 | return HITLS_SUCCESS; | 111 | return HITLS_SUCCESS; |
| 112 | } | 112 | } |
| 113 | -int32_t HITLS_CFG_GetPostHandshakeAuthSupport(HITLS_Config *config, uint8_t *isSupport) | 113 | +int32_t HITLS_CFG_GetPostHandshakeAuthSupport(HITLS_Config *config, bool *isSupport) |
| 114 | { | 114 | { |
| 115 | if (config == NULL || isSupport == NULL) { | 115 | if (config == NULL || isSupport == NULL) { |
| 116 | return HITLS_NULL_INPUT; | 116 | return HITLS_NULL_INPUT; |
| 117 | } | 117 | } |
| 118 | 118 | ||
| 119 | - *isSupport = (uint8_t)config->isSupportPostHandshakeAuth; | 119 | + *isSupport = config->isSupportPostHandshakeAuth; |
| 120 | return HITLS_SUCCESS; | 120 | return HITLS_SUCCESS; |
| 121 | } | 121 | } |
| 122 | 122 | ||
| @@ -324,7 +324,7 @@ int32_t HITLS_SESS_SetHaveExtMasterSecret(HITLS_Session *sess, uint8_t haveExtMa | |||
| 324 | return HITLS_SUCCESS; | 324 | return HITLS_SUCCESS; |
| 325 | } | 325 | } |
| 326 | 326 | ||
| 327 | -int32_t HITLS_SESS_GetHaveExtMasterSecret(HITLS_Session *sess, uint8_t *haveExtMasterSecret) | 327 | +int32_t HITLS_SESS_GetHaveExtMasterSecret(HITLS_Session *sess, bool *haveExtMasterSecret) |
| 328 | { | 328 | { |
| 329 | if (sess == NULL || haveExtMasterSecret == NULL) { | 329 | if (sess == NULL || haveExtMasterSecret == NULL) { |
| 330 | BSL_LOG_BINLOG_FIXLEN(BINLOG_ID16735, BSL_LOG_LEVEL_ERR, BSL_LOG_BINLOG_TYPE_RUN, "input null", 0, 0, 0, 0); | 330 | BSL_LOG_BINLOG_FIXLEN(BINLOG_ID16735, BSL_LOG_LEVEL_ERR, BSL_LOG_BINLOG_TYPE_RUN, "input null", 0, 0, 0, 0); |
| @@ -333,7 +333,7 @@ int32_t HITLS_SESS_GetHaveExtMasterSecret(HITLS_Session *sess, uint8_t *haveExtM | |||
| 333 | } | 333 | } |
| 334 | 334 | ||
| 335 | BSL_SAL_ThreadReadLock(sess->lock); | 335 | BSL_SAL_ThreadReadLock(sess->lock); |
| 336 | - *haveExtMasterSecret = (uint8_t)sess->haveExtMasterSecret; | 336 | + *haveExtMasterSecret = sess->haveExtMasterSecret; |
| 337 | BSL_SAL_ThreadUnlock(sess->lock); | 337 | BSL_SAL_ThreadUnlock(sess->lock); |
| 338 | return HITLS_SUCCESS; | 338 | return HITLS_SUCCESS; |
| 339 | } | 339 | } |
| @@ -835,9 +835,9 @@ static int32_t ResumeCheckExtendedMasterScret(TLS_Ctx *ctx, const ClientHelloMsg | |||
| 835 | return HITLS_SUCCESS; | 835 | return HITLS_SUCCESS; |
| 836 | } | 836 | } |
| 837 | (void)clientHello; | 837 | (void)clientHello; |
| 838 | - uint8_t haveExtMasterSecret = false; | 838 | + bool haveExtMasterSecret = false; |
| 839 | HITLS_SESS_GetHaveExtMasterSecret(*sess, &haveExtMasterSecret); | 839 | HITLS_SESS_GetHaveExtMasterSecret(*sess, &haveExtMasterSecret); |
| 840 | - if (haveExtMasterSecret != 0) { | 840 | + if (haveExtMasterSecret) { |
| 841 | if (!clientHello->extension.flag.haveExtendedMasterSecret) { | 841 | if (!clientHello->extension.flag.haveExtendedMasterSecret) { |
| 842 | BSL_LOG_BINLOG_FIXLEN(BINLOG_ID17051, BSL_LOG_LEVEL_ERR, BSL_LOG_BINLOG_TYPE_RUN, | 842 | BSL_LOG_BINLOG_FIXLEN(BINLOG_ID17051, BSL_LOG_LEVEL_ERR, BSL_LOG_BINLOG_TYPE_RUN, |
| 843 | "ExtendedMasterSecret err", 0, 0, 0, 0); | 843 | "ExtendedMasterSecret err", 0, 0, 0, 0); |
| @@ -147,10 +147,9 @@ static int32_t ClientCheckExtendedMasterSecret(TLS_Ctx *ctx, const ServerHelloMs | |||
| 147 | does not contain the extension, the client MUST abort the | 147 | does not contain the extension, the client MUST abort the |
| 148 | handshake. */ | 148 | handshake. */ |
| 149 | if (ctx->negotiatedInfo.isResume && ctx->session != NULL) { | 149 | if (ctx->negotiatedInfo.isResume && ctx->session != NULL) { |
| 150 | - uint8_t haveExtMasterSecret; | 150 | + bool haveExtMasterSecret; |
| 151 | HITLS_SESS_GetHaveExtMasterSecret(ctx->session, &haveExtMasterSecret); | 151 | HITLS_SESS_GetHaveExtMasterSecret(ctx->session, &haveExtMasterSecret); |
| 152 | - bool preEms = haveExtMasterSecret != 0; | 152 | + if (serverHello->haveExtendedMasterSecret != haveExtMasterSecret) { |
| 153 | - if (serverHello->haveExtendedMasterSecret != preEms) { | ||
| 154 | BSL_LOG_BINLOG_FIXLEN(BINLOG_ID17083, BSL_LOG_LEVEL_ERR, BSL_LOG_BINLOG_TYPE_RUN, | 153 | BSL_LOG_BINLOG_FIXLEN(BINLOG_ID17083, BSL_LOG_LEVEL_ERR, BSL_LOG_BINLOG_TYPE_RUN, |
| 155 | "ExtendedMasterSecret err", 0, 0, 0, 0); | 154 | "ExtendedMasterSecret err", 0, 0, 0, 0); |
| 156 | ctx->method.sendAlert(ctx, ALERT_LEVEL_FATAL, ALERT_HANDSHAKE_FAILURE); | 155 | ctx->method.sendAlert(ctx, ALERT_LEVEL_FATAL, ALERT_HANDSHAKE_FAILURE); |
| @@ -527,7 +526,7 @@ static int32_t ClientCheckResumeServerHello(TLS_Ctx *ctx, const ServerHelloMsg * | |||
| 527 | { | 526 | { |
| 528 | uint16_t version = 0; | 527 | uint16_t version = 0; |
| 529 | uint16_t cipherSuite = 0; | 528 | uint16_t cipherSuite = 0; |
| 530 | - uint8_t haveExtMasterSecret = 0; | 529 | + bool haveExtMasterSecret = false; |
| 531 | 530 | ||
| 532 | HITLS_SESS_GetProtocolVersion(ctx->session, &version); | 531 | HITLS_SESS_GetProtocolVersion(ctx->session, &version); |
| 533 | HITLS_SESS_GetCipherSuite(ctx->session, &cipherSuite); | 532 | HITLS_SESS_GetCipherSuite(ctx->session, &cipherSuite); |
| @@ -552,7 +551,7 @@ static int32_t ClientCheckResumeServerHello(TLS_Ctx *ctx, const ServerHelloMsg * | |||
| 552 | } | 551 | } |
| 553 | 552 | ||
| 554 | /* Check the extended master secret information */ | 553 | /* Check the extended master secret information */ |
| 555 | - if (serverHello->haveExtendedMasterSecret != (bool)haveExtMasterSecret) { | 554 | + if (serverHello->haveExtendedMasterSecret != haveExtMasterSecret) { |
| 556 | BSL_LOG_BINLOG_FIXLEN(BINLOG_ID15275, BSL_LOG_LEVEL_ERR, BSL_LOG_BINLOG_TYPE_RUN, | 555 | BSL_LOG_BINLOG_FIXLEN(BINLOG_ID15275, BSL_LOG_LEVEL_ERR, BSL_LOG_BINLOG_TYPE_RUN, |
| 557 | "session resume error:can not downgrade from extended master secret.", 0, 0, 0, 0); | 556 | "session resume error:can not downgrade from extended master secret.", 0, 0, 0, 0); |
| 558 | ctx->method.sendAlert(ctx, ALERT_LEVEL_FATAL, ALERT_HANDSHAKE_FAILURE); | 557 | ctx->method.sendAlert(ctx, ALERT_LEVEL_FATAL, ALERT_HANDSHAKE_FAILURE); |
| @@ -59,9 +59,9 @@ static int32_t ClientPrepareSession(TLS_Ctx *ctx) | |||
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | if (ctx->session != NULL) { | 61 | if (ctx->session != NULL) { |
| 62 | - uint8_t haveExtMasterSecret = 0; | 62 | + bool haveExtMasterSecret = false; |
| 63 | HITLS_SESS_GetHaveExtMasterSecret(ctx->session, &haveExtMasterSecret); | 63 | HITLS_SESS_GetHaveExtMasterSecret(ctx->session, &haveExtMasterSecret); |
| 64 | - if (haveExtMasterSecret == 0 && ctx->config.tlsConfig.isSupportExtendMasterSecret) { | 64 | + if (!haveExtMasterSecret && ctx->config.tlsConfig.isSupportExtendMasterSecret) { |
| 65 | HITLS_SESS_Free(ctx->session); | 65 | HITLS_SESS_Free(ctx->session); |
| 66 | ctx->session = NULL; | 66 | ctx->session = NULL; |
| 67 | return HITLS_SUCCESS; | 67 | return HITLS_SUCCESS; |