aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@calcurse.org>2022-03-11 11:23:47 -0500
committerLukas Fleischer <lfleischer@calcurse.org>2022-03-11 11:23:47 -0500
commit20b23cc32edd4ad8aed1699b3b5d372efeac5c67 (patch)
tree4078122f69f3e062bf32bf648ef02ced0a51adee
parentbea73492114c95149733405205483ce56d11125a (diff)
downloadcalcurse-20b23cc32edd4ad8aed1699b3b5d372efeac5c67.tar.gz
calcurse-20b23cc32edd4ad8aed1699b3b5d372efeac5c67.zip
Fix SHA1 calculation on big-endian systems
Add the AC_C_BIGENDIAN macro to determine endianness and set WORDS_BIGENDIAN accordingly. Fixes GitHub issue #397. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
-rw-r--r--configure.ac1
-rw-r--r--src/sha1.c1
2 files changed, 2 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 7405450..e7594c5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -19,6 +19,7 @@ AC_CANONICAL_HOST
# Checks for programs
#-------------------------------------------------------------------------------
AC_PROG_CC
+AC_C_BIGENDIAN
#-------------------------------------------------------------------------------
# Checks for header files
#-------------------------------------------------------------------------------
diff --git a/src/sha1.c b/src/sha1.c
index 3826c76..6a5f0e3 100644
--- a/src/sha1.c
+++ b/src/sha1.c
@@ -43,6 +43,7 @@
#include <stdlib.h>
#include <string.h>
+#include "config.h"
#include "sha1.h"
#define rol(val, n) (((val) << (n)) | ((val) >> (32 - (n))))