maint: port to oddball tolower

* src/digest.c (hex_equal): Work even in oddball locales
where tolower does not work as expected on ASCII letters.
This commit is contained in:
Paul Eggert committed 2023-10-30 00:58:04 -07:00
1 parent 4edb14d20f
commit 5602342a16
1 file changed
+2 -3
+2 -3
View File
@@ -18,7 +18,6 @@
#include <config.h>
#include <ctype.h>
#include <getopt.h>
#include <sys/types.h>
@@ -1122,9 +1121,9 @@ hex_equal (unsigned char const *hex_digest, unsigned char const *bin_buffer)
size_t cnt;
for (cnt = 0; cnt < digest_bin_bytes; ++cnt)
{
if (tolower (hex_digest[2 * cnt])
if (c_tolower (hex_digest[2 * cnt])
!= bin2hex[bin_buffer[cnt] >> 4]
|| (tolower (hex_digest[2 * cnt + 1])
|| (c_tolower (hex_digest[2 * cnt + 1])
!= (bin2hex[bin_buffer[cnt] & 0xf])))
break;
}