- Timestamp:
- Jun 22, 2021, 9:00:19 PM (3 years ago)
- Location:
- azure_iot_hub_f767zi/trunk/wolfssl-4.7.0
- Files:
-
- 1 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
azure_iot_hub_f767zi/trunk/wolfssl-4.7.0/wolfcrypt/src/hash.c
r457 r464 34 34 #include <wolfssl/wolfcrypt/hash.h> 35 35 #include <wolfssl/wolfcrypt/hmac.h> 36 #include <wolfssl/wolfcrypt/cryptocb.h> 36 37 37 38 #ifdef NO_INLINE … … 625 626 int ret = HASH_TYPE_E; /* Default to hash type error */ 626 627 627 if (hash == NULL || data == NULL)628 if (hash == NULL || (data == NULL && dataSz > 0)) 628 629 return BAD_FUNC_ARG; 629 630 … … 1027 1028 wc_Sha sha[1]; 1028 1029 #endif 1030 int devId = INVALID_DEVID; 1029 1031 1030 1032 #ifdef WOLFSSL_SMALL_STACK … … 1034 1036 #endif 1035 1037 1036 if ((ret = wc_InitSha(sha)) != 0) { 1038 #ifdef WOLF_CRYPTO_CB 1039 /* only use devId if its not an empty hash */ 1040 if (data != NULL && len > 0) 1041 devId = wc_CryptoCb_GetDevIdAtIndex(0); 1042 #endif 1043 1044 if ((ret = wc_InitSha_ex(sha, NULL, devId)) != 0) { 1037 1045 WOLFSSL_MSG("InitSha failed"); 1038 1046 } … … 1102 1110 wc_Sha256 sha256[1]; 1103 1111 #endif 1112 int devId = INVALID_DEVID; 1104 1113 1105 1114 #ifdef WOLFSSL_SMALL_STACK … … 1110 1119 #endif 1111 1120 1112 if ((ret = wc_InitSha256(sha256)) != 0) { 1121 #ifdef WOLF_CRYPTO_CB 1122 /* only use devId if its not an empty hash */ 1123 if (data != NULL && len > 0) 1124 devId = wc_CryptoCb_GetDevIdAtIndex(0); 1125 #endif 1126 1127 if ((ret = wc_InitSha256_ex(sha256, NULL, devId)) != 0) { 1113 1128 WOLFSSL_MSG("InitSha256 failed"); 1114 1129 }
Note:
See TracChangeset
for help on using the changeset viewer.