From 30cb0aa238e27bce59df7b4581ca8af33f8f9c59 Mon Sep 17 00:00:00 2001 From: seb Date: Tue, 20 Aug 2002 17:19:34 +0000 Subject: Fix sparc64 build by patching sigs/sha/sha.c like the revision 1.6 of basesrc/lib/libc/hash/sha1.c. --- security/tripwire/distinfo | 4 +- security/tripwire/patches/patch-ac | 140 ++++++++++++++++++++++++++++++++++--- 2 files changed, 133 insertions(+), 11 deletions(-) (limited to 'security') diff --git a/security/tripwire/distinfo b/security/tripwire/distinfo index fdcab40375e..359a0c24e5a 100644 --- a/security/tripwire/distinfo +++ b/security/tripwire/distinfo @@ -1,8 +1,8 @@ -$NetBSD: distinfo,v 1.2 2001/04/19 15:40:41 agc Exp $ +$NetBSD: distinfo,v 1.3 2002/08/20 17:19:34 seb Exp $ SHA1 (tripwire-1.2.tar.Z) = 5acf8e1b12547f98171ff5fdb9bf239b21275d70 Size (tripwire-1.2.tar.Z) = 462187 bytes SHA1 (patch-aa) = 37e41b99fbd437cc62b1446545f963d03e91e819 SHA1 (patch-ab) = a71a44eeecb84e3453dfb3e4e03258ce47ccd999 -SHA1 (patch-ac) = a86765a0299e5f1467a0e512ffebd45110b3a7ca +SHA1 (patch-ac) = 35b3fe52f497e6cbbf7edfeaee398f0d24aff219 SHA1 (patch-ad) = 92fe68b5cb929dfc16b767e28d72852428246a32 diff --git a/security/tripwire/patches/patch-ac b/security/tripwire/patches/patch-ac index 681fb05b43b..624af036e4a 100644 --- a/security/tripwire/patches/patch-ac +++ b/security/tripwire/patches/patch-ac @@ -1,11 +1,11 @@ -$NetBSD: patch-ac,v 1.2 1999/04/09 10:46:57 agc Exp $ +$NetBSD: patch-ac,v 1.3 2002/08/20 17:19:35 seb 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. +BYTE_ORDER in this file. And fix build on sparc64. ---- sigs/sha/sha.c 1994/07/25 15:46:45 1.5 -+++ sigs/sha/sha.c 1998/11/17 15:59:20 +--- sigs/sha/sha.c.orig Mon Jul 25 15:46:45 1994 ++++ sigs/sha/sha.c Tue Aug 20 16:34:59 2002 @@ -46,10 +46,17 @@ #include "sha.h" @@ -27,7 +27,129 @@ BYTE_ORDER in this file. /* The SHS f()-functions */ -@@ -214,7 +221,7 @@ +@@ -148,6 +155,85 @@ + shsInfo->countLo = shsInfo->countHi = 0L; + } + ++#ifdef __sparc_v9__ ++void expand1(LONG *W) ++{ ++ LONG temp; ++ expand( 16 ); expand( 17 ); expand( 18 ); expand( 19 ); expand( 20 ); ++ expand( 21 ); expand( 22 ); expand( 23 ); expand( 24 ); expand( 25 ); ++ expand( 26 ); expand( 27 ); expand( 28 ); expand( 29 ); expand( 30 ); ++ expand( 31 ); ++} ++ ++void expand2(LONG *W) ++{ ++ LONG temp; ++ expand( 32 ); expand( 33 ); expand( 34 ); expand( 35 ); ++ expand( 36 ); expand( 37 ); expand( 38 ); expand( 39 ); expand( 40 ); ++ expand( 41 ); expand( 42 ); expand( 43 ); expand( 44 ); expand( 45 ); ++ expand( 46 ); expand( 47 ); ++} ++ ++void expand3(LONG *W) ++{ ++ LONG temp; ++ expand( 48 ); expand( 49 ); expand( 50 ); ++ expand( 51 ); expand( 52 ); expand( 53 ); expand( 54 ); expand( 55 ); ++ expand( 56 ); expand( 57 ); expand( 58 ); expand( 59 ); expand( 60 ); ++ expand( 61 ); expand( 62 ); expand( 63 ); ++} ++ ++void expand4(LONG *W) ++{ ++ LONG temp; ++ expand( 64 ); expand( 65 ); ++ expand( 66 ); expand( 67 ); expand( 68 ); expand( 69 ); expand( 70 ); ++ expand( 71 ); expand( 72 ); expand( 73 ); expand( 74 ); expand( 75 ); ++ expand( 76 ); expand( 77 ); expand( 78 ); expand( 79 ); ++} ++ ++void do_Round1(LONG *W) ++{ ++ LONG temp; ++ subRound1( 0 ); subRound1( 1 ); subRound1( 2 ); subRound1( 3 ); ++ subRound1( 4 ); subRound1( 5 ); subRound1( 6 ); subRound1( 7 ); ++ subRound1( 8 ); subRound1( 9 ); subRound1( 10 ); subRound1( 11 ); ++ subRound1( 12 ); subRound1( 13 ); subRound1( 14 ); subRound1( 15 ); ++ subRound1( 16 ); subRound1( 17 ); subRound1( 18 ); subRound1( 19 ); ++} ++ ++void do_Round2(LONG *W) ++{ ++ LONG temp; ++ subRound2( 20 ); subRound2( 21 ); subRound2( 22 ); subRound2( 23 ); ++ subRound2( 24 ); subRound2( 25 ); subRound2( 26 ); subRound2( 27 ); ++ subRound2( 28 ); subRound2( 29 ); subRound2( 30 ); subRound2( 31 ); ++ subRound2( 32 ); subRound2( 33 ); subRound2( 34 ); subRound2( 35 ); ++ subRound2( 36 ); subRound2( 37 ); subRound2( 38 ); subRound2( 39 ); ++} ++ ++void do_Round3(LONG *W) ++{ ++ LONG temp; ++ subRound3( 40 ); subRound3( 41 ); subRound3( 42 ); subRound3( 43 ); ++ subRound3( 44 ); subRound3( 45 ); subRound3( 46 ); subRound3( 47 ); ++ subRound3( 48 ); subRound3( 49 ); subRound3( 50 ); subRound3( 51 ); ++ subRound3( 52 ); subRound3( 53 ); subRound3( 54 ); subRound3( 55 ); ++ subRound3( 56 ); subRound3( 57 ); subRound3( 58 ); subRound3( 59 ); ++} ++ ++void do_Round4(LONG *W) ++{ ++ LONG temp; ++ subRound4( 60 ); subRound4( 61 ); subRound4( 62 ); subRound4( 63 ); ++ subRound4( 64 ); subRound4( 65 ); subRound4( 66 ); subRound4( 67 ); ++ subRound4( 68 ); subRound4( 69 ); subRound4( 70 ); subRound4( 71 ); ++ subRound4( 72 ); subRound4( 73 ); subRound4( 74 ); subRound4( 75 ); ++ subRound4( 76 ); subRound4( 77 ); subRound4( 78 ); subRound4( 79 ); ++} ++ ++#endif ++ + /* Perform the SHS transformation. Note that this code, like MD5, seems to + break some optimizing compilers - it may be necessary to split it into + sections, eg based on the four subrounds */ +@@ -163,6 +249,9 @@ + W[ i ] = shsInfo->data[ i ]; + + /* Step B. Expand the 16 words into 64 temporary data words */ ++#ifdef __sparc_v9__ ++ expand1(W); expand2(W); expand3(W); expand4(W); ++#else + expand( 16 ); expand( 17 ); expand( 18 ); expand( 19 ); expand( 20 ); + expand( 21 ); expand( 22 ); expand( 23 ); expand( 24 ); expand( 25 ); + expand( 26 ); expand( 27 ); expand( 28 ); expand( 29 ); expand( 30 ); +@@ -176,6 +265,7 @@ + expand( 66 ); expand( 67 ); expand( 68 ); expand( 69 ); expand( 70 ); + expand( 71 ); expand( 72 ); expand( 73 ); expand( 74 ); expand( 75 ); + expand( 76 ); expand( 77 ); expand( 78 ); expand( 79 ); ++#endif + + /* Step C. Set up first buffer */ + A = shsInfo->digest[ 0 ]; +@@ -185,6 +275,9 @@ + E = shsInfo->digest[ 4 ]; + + /* Step D. Serious mangling, divided into four sub-rounds */ ++#ifdef __sparc_v9__ ++ do_Round1(W); do_Round2(W); do_Round3(W); do_Round4(W); ++#else + subRound1( 0 ); subRound1( 1 ); subRound1( 2 ); subRound1( 3 ); + subRound1( 4 ); subRound1( 5 ); subRound1( 6 ); subRound1( 7 ); + subRound1( 8 ); subRound1( 9 ); subRound1( 10 ); subRound1( 11 ); +@@ -205,6 +298,7 @@ + subRound4( 68 ); subRound4( 69 ); subRound4( 70 ); subRound4( 71 ); + subRound4( 72 ); subRound4( 73 ); subRound4( 74 ); subRound4( 75 ); + subRound4( 76 ); subRound4( 77 ); subRound4( 78 ); subRound4( 79 ); ++#endif + + /* Step E. Build message digest */ + shsInfo->digest[ 0 ] += A; +@@ -214,7 +308,7 @@ shsInfo->digest[ 4 ] += E; } @@ -36,7 +158,7 @@ BYTE_ORDER in this file. /* 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 @@ +@@ -258,7 +352,7 @@ while( count >= SHS_BLOCKSIZE ) { memcpy( (char *) shsInfo->data, (char *) buffer, SHS_BLOCKSIZE ); @@ -45,7 +167,7 @@ BYTE_ORDER in this file. byteReverse( shsInfo->data, SHS_BLOCKSIZE ); #endif /* LITTLE_ENDIAN */ shsTransform( shsInfo ); -@@ -289,7 +296,7 @@ +@@ -289,7 +383,7 @@ { /* Two lots of padding: Pad the first block to 64 bytes */ memset( ( char * ) shsInfo->data + count, 0, 64 - count ); @@ -54,7 +176,7 @@ BYTE_ORDER in this file. byteReverse( shsInfo->data, SHS_BLOCKSIZE ); #endif /* LITTLE_ENDIAN */ shsTransform( shsInfo ); -@@ -300,7 +307,7 @@ +@@ -300,7 +394,7 @@ else /* Pad block to 56 bytes */ memset( ( char * ) shsInfo->data + count, 0, 56 - count ); @@ -63,7 +185,7 @@ BYTE_ORDER in this file. byteReverse( shsInfo->data, SHS_BLOCKSIZE ); #endif /* LITTLE_ENDIAN */ -@@ -309,7 +316,7 @@ +@@ -309,7 +403,7 @@ shsInfo->data[ 15 ] = lowBitcount; shsTransform( shsInfo ); -- cgit v1.2.3