The SHA256 implementation relied on WORDS_BIGENDIAN being defined for
big endian systems, but this was never done. This caused it to produce
wrong checksums on those systems.

Fix this by replacing the check with a generic check for big endian byte
order.

Fixes: 84552e64fa6d ("Adding sha256.[ch] Sorry forgot adding them. Thanks for 
Graham Gower <graham.go...@gmail.com>")
Signed-off-by: Jonas Gorski <jonas.gor...@gmail.com>
---
 libopkg/sha256.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libopkg/sha256.c b/libopkg/sha256.c
index e0c4e3e0d423..5848799c0260 100644
--- a/libopkg/sha256.c
+++ b/libopkg/sha256.c
@@ -30,7 +30,7 @@
 #include "unlocked-io.h"
 #endif
 
-#ifdef WORDS_BIGENDIAN
+#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
 #define SWAP(n) (n)
 #else
 #define SWAP(n) \
-- 
2.13.2


_______________________________________________
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev

Reply via email to