Clear OpenSSL errors on SHA failures

(cherry picked from commit 247422c69f)
This commit is contained in:
Mark Andrews 2023-07-13 14:41:00 +10:00
parent 34a0bb146c
commit 900efd613f

View file

@ -44,18 +44,22 @@ isc_iterated_hash(unsigned char *out, const unsigned int hashalg,
do {
if (SHA1_Init(&ctx) != 1) {
ERR_clear_error();
return (0);
}
if (SHA1_Update(&ctx, buf, len) != 1) {
ERR_clear_error();
return (0);
}
if (SHA1_Update(&ctx, salt, saltlength) != 1) {
ERR_clear_error();
return (0);
}
if (SHA1_Final(out, &ctx) != 1) {
ERR_clear_error();
return (0);
}