summaryrefslogtreecommitdiff
path: root/security/tripwire/patches/patch-ac
blob: 681fb05b43b1ad03268688b8a9de00de9c2a4941 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
$NetBSD: patch-ac,v 1.2 1999/04/09 10:46:57 agc Exp $

NetBSD defines both LITTLE_ENDIAN and BIG_ENDIAN, and sets the
definition of BYTE_ORDER accordingly.  So check the value of
BYTE_ORDER in this file.

--- sigs/sha/sha.c	1994/07/25 15:46:45	1.5
+++ sigs/sha/sha.c	1998/11/17 15:59:20
@@ -46,10 +46,17 @@
 
 #include "sha.h"
 
-#if BYTEORDER == 0x1234
-#define LITTLE_ENDIAN
+#ifdef __NetBSD__
+#include <machine/endian.h>
+#elif (defined(__sun__) && defined(__svr4__))
+#define BIG_ENDIAN	4321
+#define LITTLE_ENDIAN	1234
+#if defined(__sparc__)
+#define BYTE_ORDER	BIG_ENDIAN
+#elif defined(__i386__)
+#define BYTE_ORDER	LITTLE_ENDIAN
+#endif
 #endif
-
 
 /* The SHS f()-functions */
 
@@ -214,7 +221,7 @@
     shsInfo->digest[ 4 ] += E;
     }
 
-#ifdef LITTLE_ENDIAN
+#if BYTE_ORDER == LITTLE_ENDIAN
 
 /* When run on a little-endian CPU we need to perform byte reversal on an
    array of longwords.  It is possible to make the code endianness-
@@ -258,7 +265,7 @@
     while( count >= SHS_BLOCKSIZE )
 	{
 	memcpy( (char *) shsInfo->data, (char *) buffer, SHS_BLOCKSIZE );
-#ifdef LITTLE_ENDIAN
+#if BYTE_ORDER == LITTLE_ENDIAN
 	byteReverse( shsInfo->data, SHS_BLOCKSIZE );
 #endif /* LITTLE_ENDIAN */
 	shsTransform( shsInfo );
@@ -289,7 +296,7 @@
 	{
 	/* Two lots of padding:  Pad the first block to 64 bytes */
 	memset( ( char * ) shsInfo->data + count, 0, 64 - count );
-#ifdef LITTLE_ENDIAN
+#if BYTE_ORDER == LITTLE_ENDIAN
 	byteReverse( shsInfo->data, SHS_BLOCKSIZE );
 #endif /* LITTLE_ENDIAN */
 	shsTransform( shsInfo );
@@ -300,7 +307,7 @@
     else
 	/* Pad block to 56 bytes */
 	memset( ( char * ) shsInfo->data + count, 0, 56 - count );
-#ifdef LITTLE_ENDIAN
+#if BYTE_ORDER == LITTLE_ENDIAN
     byteReverse( shsInfo->data, SHS_BLOCKSIZE );
 #endif /* LITTLE_ENDIAN */
 
@@ -309,7 +316,7 @@
     shsInfo->data[ 15 ] = lowBitcount;
 
     shsTransform( shsInfo );
-#ifdef LITTLE_ENDIAN
+#if BYTE_ORDER == LITTLE_ENDIAN
     byteReverse( shsInfo->data, SHS_DIGESTSIZE );
 #endif /* LITTLE_ENDIAN */
     }