rijndael byteswapping

Rob Braun bbraun at synack.net
Mon Jul 2 15:12:02 EST 2001


The byteorder detection macro for the rijndael algorithm doesn't work 
for systems that are building for multiple architectures, such as Darwin.

This was the change that was needed to rijndael.c to get the macros
building properly in such a situation.  It seems to be a little more
reliable than the existing system.

Rob

--- openssh_cvs/rijndael.c	Tue Feb 27 13:14:22 2001
+++ /Users/rbraun/OpenSSH/openssh/rijndael.c	Mon Jun 25 18:00:24 2001
@@ -58,7 +58,8 @@
 
 #define byte(x,n)   ((u1byte)((x) >> (8 * n)))
 
-#ifdef WORDS_BIGENDIAN
+/* We can't trust WORDS_BIGENDIAN when building for multiple architectures at the same time */
+#if (defined(BYTE_ORDER) && defined(BIG_ENDIAN) && (BYTE_ORDER == BIG_ENDIAN)) || defined(WORDS_BIGENDIAN)
 #define BYTE_SWAP
 #endif
 



More information about the openssh-unix-dev mailing list