it seems that this check does not work on solaris #if BYTE_ORDER != LITTLE_ENDIAN #define BYTE_SWAP #endif could you please check that BYTE_SWAP is defined in rijndael.c -m
> Date: Tue, 27 Feb 2001 12:35:16 +0100 > From: Markus Friedl <markus.friedl at informatik.uni-erlangen.de> > > it seems that this check does not work on solaris > > #if BYTE_ORDER != LITTLE_ENDIAN > #define BYTE_SWAP > #endif > > could you please check that BYTE_SWAP is defined > in rijndael.c > > -mBYTE_SWAP is NOT defined on my Solaris 2.6 sparc system. It might be useful to check if BYTE_ORDER and LITTLE_ENDIAN are defined before seeing if they are not the same... On Solaris, __BYTE_ORDER__ and __LITTLE_ENDIAN__ and __BIG_ENDIAN__ are defined in /usr/local/gcc-2.7.2.3/lib/gcc-lib/sparc-sun-solaris2.6/2.7.2.3/include/sys/byteorder.h Something like this patch seems to work for me. It might be better to do something in config.h and test it with configure... --- rijndael.c- Mon Feb 5 10:16:28 2001 +++ rijndael.c Tue Feb 27 03:55:49 2001 @@ -58,6 +58,21 @@ #define byte(x,n) ((u1byte)((x) >> (8 * n))) +#ifndef BYTE_ORDER +#ifdef __BYTE_ORDER__ +#define BYTE_ORDER __BYTE_ORDER__ +#else +#error BYTE_ORDER is not defined +#endif +#endif +#ifndef LITTLE_ENDIAN +#ifdef __LITTLE_ENDIAN__ +#define LITTLE_ENDIAN __LITTLE_ENDIAN__ +#else +#error LITTLE_ENDIAN is not defined +#endif +#endif + #if BYTE_ORDER != LITTLE_ENDIAN #define BYTE_SWAP #endif Note that the /usr/include/sys/byteorder.h file does not define either BYTE_ORDER or LITTLE_ENDIAN or __BYTE_ORDER__ or __LITTLE_ENDIAN__ but instead references _BIG_ENDIAN and other .h files reference _LITTLE_ENDIAN even though I do not see a #define for any of them. Enjoy! -- Mark
It isn't defined. I put this error line in: #ifdef BYTE_SWAP #define io_swap(x) bswap(x) #else #error BYTE_SWAP was not defined #define io_swap(x) (x) #endif [greg at puma openssh-2.5.1p1]$ make rijndael.o gcc -g -O2 -Wall -I/usr/local/include -I. -I./openbsd-compat -I. -DETCDIR=\"/usr/local/etc\" -D_PATH_SSH_PROGRAM=\"/usr/local/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/local/libexec/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/local/libexec/sftp-server\" -DHAVE_CONFIG_H -c rijndael.c rijndael.c:68: #error BYTE_SWAP was not defined make: *** [rijndael.o] Error 1>>>>> "Markus" == Markus Friedl <markus.friedl at informatik.uni-erlangen.de> writes:Markus> it seems that this check does not work on solaris Markus> #if BYTE_ORDER != LITTLE_ENDIAN #define BYTE_SWAP #endif Markus> could you please check that BYTE_SWAP is defined in Markus> rijndael.c
I was still sleepping while typing previous e-mail. Forgot to mention it was on Solaris 7. And yes, unconditionally defining BYTE_SWAP on solaris fixes the problem.>>>>> "Markus" == Markus Friedl <markus.friedl at informatik.uni-erlangen.de> writes:Markus> it seems that this check does not work on solaris Markus> #if BYTE_ORDER != LITTLE_ENDIAN #define BYTE_SWAP #endif Markus> could you please check that BYTE_SWAP is defined in Markus> rijndael.c
Gregory Steuck wrote:> I was still sleepping while typing previous e-mail. Forgot to mention it > was on Solaris 7. And yes, unconditionally defining BYTE_SWAP on solaris > fixes the problem. > > >>>>> "Markus" == Markus Friedl <markus.friedl at informatik.uni-erlangen.de> writes: > > Markus> it seems that this check does not work on solaris > > Markus> #if BYTE_ORDER != LITTLE_ENDIAN #define BYTE_SWAP #endif > > Markus> could you please check that BYTE_SWAP is defined in > Markus> rijndael.cI am not entirely sure how the value of BYTE_SWAP ought to be defined, but given that solaris is available for big-endian sparc/ultra and for little-endian x86 CPUs, we probably need to check the endian-ness of the CPU by running a small program and use the result to set the value for BYTE_ORDER, etc.. (Now I recall I had an issue with a very old libc on linux (circa 1996) in that it defined LITTLE_ENDIAN and BIG_ENDIAN macro in ctype.h of all the header files(!) and this uncalled-for name space pollution collided with a user program, namely crack 4-1. :-) Anyway, setting the value using a small program seems to me a non-protruding solution and is a very reliable one IMHO.)