pkgsrc/net/bind8/patches/patch-ab
rillig bb62f49418 Fixed wrong use of WRKSRC. Cleaned up the Makefile. Added an override
for INSTALL_LIB. As the libraries are installed with the correct
ownership now (LIBOWN and LIBGRP), bumped the PKGREVISION.
2005-11-04 19:36:01 +00:00

174 lines
6.1 KiB
Text

$NetBSD: patch-ab,v 1.6 2005/11/04 19:36:01 rillig Exp $
--- src/lib/cylink/sha.c.orig Tue May 29 05:47:21 2001
+++ src/lib/cylink/sha.c
@@ -150,6 +150,129 @@ int SHA( uchar *message,
* PRIVATE FUNCTIONS DEFINITIONS
****************************************************************************/
+#ifdef __sparc_v9__
+#define nR1(v,w,x,y,z,i) subRound(*v, *w, *x, *y, *z, f1, k1SHA, i)
+#define nR2(v,w,x,y,z,i) subRound(*v, *w, *x, *y, *z, f2, k2SHA, i)
+#define nR3(v,w,x,y,z,i) subRound(*v, *w, *x, *y, *z, f3, k3SHA, i)
+#define nR4(v,w,x,y,z,i) subRound(*v, *w, *x, *y, *z, f4, k4SHA, i)
+
+void doexpand1(u_int32_t *W)
+{
+ 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); 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); expand(48);
+}
+
+void doexpand2(u_int32_t *W)
+{
+ 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); 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_R1(u_int32_t *A, u_int32_t *B, u_int32_t *C, u_int32_t *D, u_int32_t *E, u_int32_t *W)
+{
+ nR1( A, B, C, D, E, W[ 0] );
+ nR1( E, A, B, C, D, W[ 1] );
+ nR1( D, E, A, B, C, W[ 2] );
+ nR1( C, D, E, A, B, W[ 3] );
+ nR1( B, C, D, E, A, W[ 4] );
+ nR1( A, B, C, D, E, W[ 5] );
+ nR1( E, A, B, C, D, W[ 6] );
+ nR1( D, E, A, B, C, W[ 7] );
+ nR1( C, D, E, A, B, W[ 8] );
+ nR1( B, C, D, E, A, W[ 9] );
+ nR1( A, B, C, D, E, W[10] );
+ nR1( E, A, B, C, D, W[11] );
+ nR1( D, E, A, B, C, W[12] );
+ nR1( C, D, E, A, B, W[13] );
+ nR1( B, C, D, E, A, W[14] );
+ nR1( A, B, C, D, E, W[15] );
+ nR1( E, A, B, C, D, W[16] );
+ nR1( D, E, A, B, C, W[17] );
+ nR1( C, D, E, A, B, W[18] );
+ nR1( B, C, D, E, A, W[19] );
+}
+
+void do_R2(u_int32_t *A, u_int32_t *B, u_int32_t *C, u_int32_t *D, u_int32_t *E, u_int32_t *W)
+{
+ nR2( A, B, C, D, E, W[20]);
+ nR2( E, A, B, C, D, W[21]);
+ nR2( D, E, A, B, C, W[22]);
+ nR2( C, D, E, A, B, W[23]);
+ nR2( B, C, D, E, A, W[24]);
+ nR2( A, B, C, D, E, W[25]);
+ nR2( E, A, B, C, D, W[26]);
+ nR2( D, E, A, B, C, W[27]);
+ nR2( C, D, E, A, B, W[28]);
+ nR2( B, C, D, E, A, W[29]);
+ nR2( A, B, C, D, E, W[30]);
+ nR2( E, A, B, C, D, W[31]);
+ nR2( D, E, A, B, C, W[32]);
+ nR2( C, D, E, A, B, W[33]);
+ nR2( B, C, D, E, A, W[34]);
+ nR2( A, B, C, D, E, W[35]);
+ nR2( E, A, B, C, D, W[36]);
+ nR2( D, E, A, B, C, W[37]);
+ nR2( C, D, E, A, B, W[38]);
+ nR2( B, C, D, E, A, W[39]);
+}
+
+void do_R3(u_int32_t *A, u_int32_t *B, u_int32_t *C, u_int32_t *D, u_int32_t *E, u_int32_t *W)
+{
+ nR3( A, B, C, D, E, W[40]);
+ nR3( E, A, B, C, D, W[41]);
+ nR3( D, E, A, B, C, W[42]);
+ nR3( C, D, E, A, B, W[43]);
+ nR3( B, C, D, E, A, W[44]);
+ nR3( A, B, C, D, E, W[45]);
+ nR3( E, A, B, C, D, W[46]);
+ nR3( D, E, A, B, C, W[47]);
+ nR3( C, D, E, A, B, W[48]);
+ nR3( B, C, D, E, A, W[49]);
+ nR3( A, B, C, D, E, W[50]);
+ nR3( E, A, B, C, D, W[51]);
+ nR3( D, E, A, B, C, W[52]);
+ nR3( C, D, E, A, B, W[53]);
+ nR3( B, C, D, E, A, W[54]);
+ nR3( A, B, C, D, E, W[55]);
+ nR3( E, A, B, C, D, W[56]);
+ nR3( D, E, A, B, C, W[57]);
+ nR3( C, D, E, A, B, W[58]);
+ nR3( B, C, D, E, A, W[59]);
+}
+
+void do_R4(u_int32_t *A, u_int32_t *B, u_int32_t *C, u_int32_t *D, u_int32_t *E, u_int32_t *W)
+{
+ nR4( A, B, C, D, E, W[60]);
+ nR4( E, A, B, C, D, W[61]);
+ nR4( D, E, A, B, C, W[62]);
+ nR4( C, D, E, A, B, W[63]);
+ nR4( B, C, D, E, A, W[64]);
+ nR4( A, B, C, D, E, W[65]);
+ nR4( E, A, B, C, D, W[66]);
+ nR4( D, E, A, B, C, W[67]);
+ nR4( C, D, E, A, B, W[68]);
+ nR4( B, C, D, E, A, W[69]);
+ nR4( A, B, C, D, E, W[70]);
+ nR4( E, A, B, C, D, W[71]);
+ nR4( D, E, A, B, C, W[72]);
+ nR4( C, D, E, A, B, W[73]);
+ nR4( B, C, D, E, A, W[74]);
+ nR4( A, B, C, D, E, W[75]);
+ nR4( E, A, B, C, D, W[76]);
+ nR4( D, E, A, B, C, W[77]);
+ nR4( C, D, E, A, B, W[78]);
+ nR4( B, C, D, E, A, W[79]);
+}
+#endif
+
/****************************************************************************
* NAME: void shaTransform( u_int32_t *state,
@@ -182,6 +305,10 @@ int SHA( uchar *message,
ByteSwap32( (uchar *)W, 64); /*TKL00201*/
#endif /*TKL00201*/
/* Expand the 16 words into 80 words */
+#ifdef __sparc_v9__
+ doexpand1(W);
+ doexpand2(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);expand(31);expand(32);expand(33);
@@ -193,6 +320,7 @@ int SHA( uchar *message,
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);
+#endif
/*Set up first buffer*/
A = state[0];
B = state[1];
@@ -201,6 +329,12 @@ int SHA( uchar *message,
E = state[4];
/* Heavy mangling, in 4 sub-rounds of 20 iterations each. */
+#ifdef __sparc_v9__
+ do_R1(&A, &B, &C, &D, &E, W);
+ do_R2(&A, &B, &C, &D, &E, W);
+ do_R3(&A, &B, &C, &D, &E, W);
+ do_R4(&A, &B, &C, &D, &E, W);
+#else
subRound( A, B, C, D, E, f1, k1SHA, W[ 0] );
subRound( E, A, B, C, D, f1, k1SHA, W[ 1] );
subRound( D, E, A, B, C, f1, k1SHA, W[ 2] );
@@ -284,6 +418,7 @@ int SHA( uchar *message,
subRound( D, E, A, B, C, f4, k4SHA, W[77]);
subRound( C, D, E, A, B, f4, k4SHA, W[78]);
subRound( B, C, D, E, A, f4, k4SHA, W[79]);
+#endif
state[0] += A;
state[1] += B;