mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-31 19:24:42 +02:00
ssl.c: clean up MD5->SHA refactor of wolfSSL_LH_strhash() (peer review).
This commit is contained in:
19
src/ssl.c
19
src/ssl.c
@@ -56192,20 +56192,17 @@ unsigned long wolfSSL_LH_strhash(const char *str)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = 0;
|
ret = wc_ShaUpdate(&sha, (const byte *)str, (word32)strLen);
|
||||||
do {
|
if (ret != 0) {
|
||||||
if (wc_ShaUpdate(&sha, (const byte *)str, (word32)strLen) != 0) {
|
WOLFSSL_MSG("SHA1 Update failed");
|
||||||
WOLFSSL_MSG("SHA1 Update failed");
|
} else {
|
||||||
break;
|
ret = wc_ShaFinal(&sha, digest);
|
||||||
}
|
if (ret != 0) {
|
||||||
if (wc_ShaFinal(&sha, digest) != 0) {
|
|
||||||
WOLFSSL_MSG("SHA1 Final failed");
|
WOLFSSL_MSG("SHA1 Final failed");
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
ret = 1;
|
}
|
||||||
} while (0);
|
|
||||||
wc_ShaFree(&sha);
|
wc_ShaFree(&sha);
|
||||||
if (ret == 0)
|
if (ret != 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Take first 4 bytes in small endian as unsigned long */
|
/* Take first 4 bytes in small endian as unsigned long */
|
||||||
|
Reference in New Issue
Block a user