Module: Mesa
Branch: master
Commit: 532674303a92c438cb1c48d224e9dee9dece91ec
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=532674303a92c438cb1c48d224e9dee9dece91ec

Author: Matt Turner <[email protected]>
Date:   Wed Nov 22 22:39:51 2017 -0800

util: Fix SHA1 implementation on big endian

The code defines a macro blk0(i) based on the preprocessor condition
BYTE_ORDER == LITTLE_ENDIAN. If true, blk0(i) is defined as a byte swap
operation. Unfortunately, if the preprocessor macros used in the test
are no defined, then the comparison becomes 0 == 0 and it evaluates as
true.

Fixes: d1efa09d342b ("util: import sha1 implementation from OpenBSD")
Reviewed-by: Emil Velikov <[email protected]>

---

 src/util/sha1/sha1.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/util/sha1/sha1.c b/src/util/sha1/sha1.c
index ef59ea1dfc..f36a77c202 100644
--- a/src/util/sha1/sha1.c
+++ b/src/util/sha1/sha1.c
@@ -16,6 +16,7 @@
 
 #include <stdint.h>
 #include <string.h>
+#include "u_endian.h"
 #include "sha1.h"
 
 #define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
@@ -24,7 +25,7 @@
  * blk0() and blk() perform the initial expand.
  * I got the idea of expanding during the round function from SSLeay
  */
-#if BYTE_ORDER == LITTLE_ENDIAN
+#ifdef PIPE_ARCH_LITTLE_ENDIAN
 # define blk0(i) (block->l[i] = (rol(block->l[i],24)&0xFF00FF00) \
     |(rol(block->l[i],8)&0x00FF00FF))
 #else

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to