- 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/hmac.c
r457 r464 25 25 #endif 26 26 27 #include <wolfssl/wolfcrypt/ settings.h>27 #include <wolfssl/wolfcrypt/wc_port.h> 28 28 #include <wolfssl/wolfcrypt/error-crypt.h> 29 29 … … 1015 1015 1016 1016 if (ret == 0) 1017 ret 1017 ret = wc_HmacInit(hmac, heap, devId); 1018 1018 if (ret == 0) { 1019 1019 XMEMCPY(hmac->id, id, len); 1020 1020 hmac->idLen = len; 1021 } 1022 1023 return ret; 1024 } 1025 1026 int wc_HmacInit_Label(Hmac* hmac, const char* label, void* heap, int devId) 1027 { 1028 int ret = 0; 1029 int labelLen = 0; 1030 1031 if (hmac == NULL || label == NULL) 1032 ret = BAD_FUNC_ARG; 1033 if (ret == 0) { 1034 labelLen = (int)XSTRLEN(label); 1035 if (labelLen == 0 || labelLen > HMAC_MAX_LABEL_LEN) 1036 ret = BUFFER_E; 1037 } 1038 1039 if (ret == 0) 1040 ret = wc_HmacInit(hmac, heap, devId); 1041 if (ret == 0) { 1042 XMEMCPY(hmac->label, label, labelLen); 1043 hmac->labelLen = labelLen; 1021 1044 } 1022 1045 … … 1217 1240 byte n = 0x1; 1218 1241 1242 /* RFC 5869 states that the length of output keying material in 1243 octets must be L <= 255*HashLen or N = ceil(L/HashLen) */ 1244 1245 if (out == NULL || ((outSz/hashSz) + ((outSz % hashSz) != 0)) > 255) 1246 return BAD_FUNC_ARG; 1247 1219 1248 ret = wc_HmacInit(&myHmac, NULL, INVALID_DEVID); 1220 1249 if (ret != 0) 1221 1250 return ret; 1251 1222 1252 1223 1253 while (outIdx < outSz) {
Note:
See TracChangeset
for help on using the changeset viewer.