summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTom Yu <tlyu@mit.edu>2004-05-25 21:48:02 +0000
committerTom Yu <tlyu@mit.edu>2004-05-25 21:48:02 +0000
commitb880eb00dabdfb8a20912e12b6296524f80e97df (patch)
treeead8fd8b1eb693d0c63190c940f915786e5aa53a /src
parentaf6a70a29f7969a4f208d58f47f7c7e86379c14a (diff)
downloadkrb5-b880eb00dabdfb8a20912e12b6296524f80e97df.tar.gz
krb5-b880eb00dabdfb8a20912e12b6296524f80e97df.tar.xz
krb5-b880eb00dabdfb8a20912e12b6296524f80e97df.zip
* aesopt.h (PLATFORM_BYTE_ORDER): Treat _WIN32 as always
little-endian. Default to little-endian if there's no other compile-time way to detect endianness, noting it as a guess. (SAFE_IO): Error out if SAFE_IO is not set and endianness was guessed. ticket: 2564 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16362 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src')
-rw-r--r--src/lib/crypto/aes/ChangeLog8
-rw-r--r--src/lib/crypto/aes/aesopt.h26
2 files changed, 23 insertions, 11 deletions
diff --git a/src/lib/crypto/aes/ChangeLog b/src/lib/crypto/aes/ChangeLog
index 033ae9bc3..77b4c3c19 100644
--- a/src/lib/crypto/aes/ChangeLog
+++ b/src/lib/crypto/aes/ChangeLog
@@ -1,3 +1,11 @@
+2004-05-25 Tom Yu <tlyu@mit.edu>
+
+ * aesopt.h (PLATFORM_BYTE_ORDER): Treat _WIN32 as always
+ little-endian. Default to little-endian if there's no other
+ compile-time way to detect endianness, noting it as a guess.
+ (SAFE_IO): Error out if SAFE_IO is not set and endianness was
+ guessed.
+
2004-05-13 Ken Raeburn <raeburn@mit.edu>
* Makefile.in (aes-test): Link test program against thread support
diff --git a/src/lib/crypto/aes/aesopt.h b/src/lib/crypto/aes/aesopt.h
index da5c83be2..0eebd46ae 100644
--- a/src/lib/crypto/aes/aesopt.h
+++ b/src/lib/crypto/aes/aesopt.h
@@ -180,7 +180,9 @@
# define PLATFORM_BYTE_ORDER AES_BIG_ENDIAN
#elif defined(_MIPSEL)
# define PLATFORM_BYTE_ORDER AES_LITTLE_ENDIAN
-#elif !defined(WIN32)
+#elif defined(_WIN32)
+# define PLATFORM_BYTE_ORDER AES_LITTLE_ENDIAN
+#elif !defined(_WIN32)
# include <stdlib.h>
# if defined(HAVE_ENDIAN_H)
# include <endian.h>
@@ -236,19 +238,12 @@
#define PLATFORM_BYTE_ORDER AES_LITTLE_ENDIAN
#elif 0 /* **** EDIT HERE IF NECESSARY **** */
#define PLATFORM_BYTE_ORDER AES_BIG_ENDIAN
-#else
-# error "barf"
-/*#elif (('1234' >> 24) == '1')
-# define PLATFORM_BYTE_ORDER AES_LITTLE_ENDIAN
-#elif (('4321' >> 24) == '1')
-# define PLATFORM_BYTE_ORDER AES_BIG_ENDIAN*/
+#elif 1
+#define PLATFORM_BYTE_ORDER AES_LITTLE_ENDIAN
+#define UNKNOWN_BYTE_ORDER /* we're guessing */
#endif
#endif
-#if !defined(PLATFORM_BYTE_ORDER)
-# error Please set undetermined byte order (lines 229 or 231 of aesopt.h).
-#endif
-
/* 3. ASSEMBLER SUPPORT
If the assembler code is used for encryption and decryption this file only
@@ -352,6 +347,15 @@
#define SAFE_IO
#endif
+/*
+ * If PLATFORM_BYTE_ORDER does not match the actual machine byte
+ * order, the fast word-access code will cause incorrect results.
+ * Therefore, SAFE_IO is required when the byte order is unknown.
+ */
+#if !defined(SAFE_IO) && defined(UNKNOWN_BYTE_ORDER)
+# error "SAFE_IO must be defined if machine byte order is unknown."
+#endif
+
/* 7. LOOP UNROLLING
The code for encryption and decrytpion cycles through a number of rounds