]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Clear OpenSSL errors on SHA failures
authorMark Andrews <marka@isc.org>
Thu, 13 Jul 2023 04:41:00 +0000 (14:41 +1000)
committerMark Andrews <marka@isc.org>
Fri, 1 Sep 2023 02:01:20 +0000 (12:01 +1000)
lib/isc/iterated_hash.c

index e402e42221e12d62662d20ec9ad0f3a07c08678e..119c300050a1da6b03d06c87007713e1030d9a85 100644 (file)
@@ -14,6 +14,7 @@
 #include <stdbool.h>
 #include <stdio.h>
 
+#include <openssl/err.h>
 #include <openssl/opensslv.h>
 
 #include <isc/iterated_hash.h>
@@ -45,18 +46,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);
                }