From mcintosh@mcintosh.research.telcordia.com Wed Jun 2 16:18:29 1999 Return-Path: Received: from mail.redhat.com (mail.redhat.com [199.183.24.239]) by developer.redhat.com (8.8.7/8.8.7) with ESMTP id QAA27467 for ; Wed, 2 Jun 1999 16:18:29 -0400 Received: from lacrosse.corp.redhat.com (root@lacrosse.corp.redhat.com [207.175.42.154]) by mail.redhat.com (8.8.7/8.8.7) with ESMTP id QAA15161 for ; Wed, 2 Jun 1999 16:18:28 -0400 Received: from mail.redhat.com (mail.redhat.com [199.183.24.239]) by lacrosse.corp.redhat.com (8.9.3/8.9.3) with ESMTP id QAA31733 for ; Wed, 2 Jun 1999 16:18:28 -0400 Received: from mcintosh.research.telcordia.com (mcintosh.research.telcordia.com [192.4.12.155]) by mail.redhat.com (8.8.7/8.8.7) with ESMTP id QAA15157 for ; Wed, 2 Jun 1999 16:18:27 -0400 Received: (from mcintosh@localhost) by mcintosh.research.telcordia.com (8.8.7/8.8.7) id QAA01342 for bugzilla@redhat.com; Wed, 2 Jun 1999 16:17:56 -0400 Date: Wed, 2 Jun 1999 16:17:56 -0400 From: Allen Mcintosh Message-Id: <199906022017.QAA01342@mcintosh.research.telcordia.com> To: bugzilla@redhat.com Subject: BUG ID #3218 This fixes a couple of problems in the DIP S/Key code, and tries to use the big/little endian code in /usr/include to keep the same problem from coming back on the next architecture. *** skey/md4.c 1999/05/27 17:34:00 1.1 --- skey/md4.c 1999/05/27 17:56:17 *************** *** 36,47 **** * MDupdate modifies has a side-effect on its input array (the order of bytes * in each word are reversed). If this is undesired a call to MDreverse(X) can * reverse the bytes of X back into order after each call to MDupdate. */ #define TRUE 1 #define FALSE 0 ! #if (defined(__MSDOS__) || defined(MPU8086) || defined(MPU8080) \ ! || defined(vax) || defined (MIPSEL) || defined(__alpha__)) #define LOWBYTEFIRST TRUE /* Low order bytes are first in memory */ #else /* Almost all other machines are big-endian */ #define LOWBYTEFIRST FALSE --- 36,52 ---- * MDupdate modifies has a side-effect on its input array (the order of bytes * in each word are reversed). If this is undesired a call to MDreverse(X) can * reverse the bytes of X back into order after each call to MDupdate. + * + * If something included endian.h, use that */ #define TRUE 1 #define FALSE 0 ! #if (defined(BYTE_ORDER) && BYTE_ORDER == LITTLE_ENDIAN) \ ! || (defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN) \ ! || (defined(__MSDOS__) || defined(MPU8086) || defined(MPU8080) \ ! || defined(vax) || defined (MIPSEL) || defined(__alpha__)) \ ! || defined(i386) || defined(__i386__) #define LOWBYTEFIRST TRUE /* Low order bytes are first in memory */ #else /* Almost all other machines are big-endian */ #define LOWBYTEFIRST FALSE *** skey/skeysubr.c 1999/05/27 17:35:32 1.1 --- skey/skeysubr.c 1999/05/27 18:01:30 *************** *** 68,76 **** #include "md4.h" #include "skey.h" ! #if (defined(__MSDOS__) || defined(MPU8086) || defined(MPU8080) \ ! || defined(vax) || defined (MIPSEL)) ! #define LITTLE_ENDIAN #endif /* Crunch a key: --- 68,82 ---- #include "md4.h" #include "skey.h" ! /* ! * If something included endian.h, use that ! */ ! ! #if (defined(BYTE_ORDER) && BYTE_ORDER == LITTLE_ENDIAN) \ ! || (defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN) \ ! || defined(__MSDOS__) || defined(MPU8086) || defined(MPU8080) \ ! || defined(vax) || defined (MIPSEL) || defined(i386) || defined(__i386__) ! #define Little_Endian #endif /* Crunch a key: *************** *** 86,92 **** char *buf; MDstruct md; unsigned int buflen; ! #ifndef LITTLE_ENDIAN int i; register __u32 tmp; #endif --- 92,98 ---- char *buf; MDstruct md; unsigned int buflen; ! #ifndef Little_Endian int i; register __u32 tmp; #endif *************** *** 108,114 **** md.buffer[0] ^= md.buffer[2]; md.buffer[1] ^= md.buffer[3]; ! #ifdef LITTLE_ENDIAN /* Only works on byte-addressed little-endian machines!! */ memcpy(result,(char *)md.buffer,8); #else --- 114,120 ---- md.buffer[0] ^= md.buffer[2]; md.buffer[1] ^= md.buffer[3]; ! #ifdef Little_Endian /* Only works on byte-addressed little-endian machines!! */ memcpy(result,(char *)md.buffer,8); #else *************** *** 135,141 **** char *x; { MDstruct md; ! #ifndef LITTLE_ENDIAN __u32 tmp; #endif --- 141,147 ---- char *x; { MDstruct md; ! #ifndef Little_Endian __u32 tmp; #endif *************** *** 146,152 **** md.buffer[0] ^= md.buffer[2]; md.buffer[1] ^= md.buffer[3]; ! #ifdef LITTLE_ENDIAN /* Only works on byte-addressed little-endian machines!! */ memcpy(x,(char *)md.buffer,8); --- 152,158 ---- md.buffer[0] ^= md.buffer[2]; md.buffer[1] ^= md.buffer[3]; ! #ifdef Little_Endian /* Only works on byte-addressed little-endian machines!! */ memcpy(x,(char *)md.buffer,8);