Further synchronizations with md32_common.h update, consistent naming
authorAndy Polyakov <appro@openssl.org>
Tue, 17 Oct 2006 16:13:18 +0000 (16:13 +0000)
committerAndy Polyakov <appro@openssl.org>
Tue, 17 Oct 2006 16:13:18 +0000 (16:13 +0000)
for low-level SHA block routines.

crypto/sha/asm/sha1-586.pl
crypto/sha/asm/sha1-ia64.pl
crypto/sha/asm/sha1-ppc.pl
crypto/sha/asm/sha1-x86_64.pl
crypto/sha/asm/sha512-ia64.pl
crypto/sha/asm/sha512-ppc.pl
crypto/sha/asm/sha512-x86_64.pl
crypto/sha/sha1s.cpp [deleted file]
crypto/sha/sha256.c
crypto/sha/sha512.c
crypto/sha/sha_locl.h

index 10c7d436416bd8a45f9a1f8aab1d143162b0fcbb..0b1e1731cb8b1d48cdf8a29989fc4bb2062a78f8 100644 (file)
@@ -149,7 +149,7 @@ sub BODY_40_59
        &add($f,$e);                    # f+=ROTATE(a,5)
        }
 
        &add($f,$e);                    # f+=ROTATE(a,5)
        }
 
-&function_begin("sha1_block_asm_data_order",16);
+&function_begin("sha1_block_data_order",16);
        &mov($tmp1,&wparam(0)); # SHA_CTX *c
        &mov($T,&wparam(1));    # const void *input
        &mov($A,&wparam(2));    # size_t num
        &mov($tmp1,&wparam(0)); # SHA_CTX *c
        &mov($T,&wparam(1));    # const void *input
        &mov($A,&wparam(2));    # size_t num
@@ -214,7 +214,7 @@ sub BODY_40_59
        &jb(&label("loop"));
 
        &stack_pop(16);
        &jb(&label("loop"));
 
        &stack_pop(16);
-&function_end("sha1_block_asm_data_order");
+&function_end("sha1_block_data_order");
 &asciz("SHA1 block transform for x86, CRYPTOGAMS by <appro\@openssl.org>");
 
 &asm_finish();
 &asciz("SHA1 block transform for x86, CRYPTOGAMS by <appro\@openssl.org>");
 
 &asm_finish();
index 9e2f73560f3a97b9c7eda6cf0929b22963efbfb3..242cadcc522f13fa64e9612cdb8a5d0fd82731f6 100644 (file)
@@ -239,11 +239,11 @@ tmp3=r11;
 ctx=r32;       // in0
 inp=r33;       // in1
 
 ctx=r32;       // in0
 inp=r33;       // in1
 
-// void sha1_block_asm_data_order(SHA_CTX *c,const void *p,size_t num);
-.global        sha1_block_asm_data_order#
-.proc  sha1_block_asm_data_order#
+// void sha1_block_data_order(SHA_CTX *c,const void *p,size_t num);
+.global        sha1_block_data_order#
+.proc  sha1_block_data_order#
 .align 32
 .align 32
-sha1_block_asm_data_order:
+sha1_block_data_order:
        .prologue
 { .mmi;        alloc   tmp1=ar.pfs,3,15,0,0
        $ADDP   tmp0=4,ctx
        .prologue
 { .mmi;        alloc   tmp1=ar.pfs,3,15,0,0
        $ADDP   tmp0=4,ctx
@@ -306,7 +306,7 @@ $code.=<<___;
 { .mib;        st4     [ctx]=$h4,-16
        mov     pr=r2,0x1ffff
        br.ret.sptk.many        b0      };;
 { .mib;        st4     [ctx]=$h4,-16
        mov     pr=r2,0x1ffff
        br.ret.sptk.many        b0      };;
-.endp  sha1_block_asm_data_order#
+.endp  sha1_block_data_order#
 ___
 
 print $code;
 ___
 
 print $code;
index 5c5c7d87ecc41b3b5814ff7fa6ffb65ae998b2e6..fbd051652c17f0577c8d80dc583db61b65088353 100755 (executable)
@@ -158,9 +158,9 @@ ___
 $code=<<___;
 .text
 
 $code=<<___;
 .text
 
-.globl .sha1_block_asm_data_order
+.globl .sha1_block_data_order
 .align 4
 .align 4
-.sha1_block_asm_data_order:
+.sha1_block_data_order:
        mflr    r0
        $STU    $sp,`-($FRAME+64)`($sp)
        $PUSH   r0,`$FRAME-$SIZE_T*18`($sp)
        mflr    r0
        $STU    $sp,`-($FRAME+64)`($sp)
        $PUSH   r0,`$FRAME-$SIZE_T*18`($sp)
index 857db2d671e65cd530fddc878cb398b99b433b20..f3cb1347fb08ccd12b83734df4f8a00147c3f38e 100755 (executable)
@@ -158,6 +158,8 @@ $code.=<<___ if ($i<79);
        rol     \$30,$b
        add     $t0,$f
        rol     \$1,$xi
        rol     \$30,$b
        add     $t0,$f
        rol     \$1,$xi
+___
+$code.=<<___ if ($i<76);
        mov     $xi,`4*($j%16)`(%rsp)
 ___
 $code.=<<___ if ($i==79);
        mov     $xi,`4*($j%16)`(%rsp)
 ___
 $code.=<<___ if ($i==79);
@@ -200,7 +202,7 @@ ___
 
 $code=".text\n";
 
 
 $code=".text\n";
 
-&PROLOGUE("sha1_block_asm_data_order");
+&PROLOGUE("sha1_block_data_order");
 $code.=".align 4\n.Lloop:\n";
 for($i=0;$i<20;$i++)   { &BODY_00_19($i,@V); unshift(@V,pop(@V)); }
 for(;$i<40;$i++)       { &BODY_20_39($i,@V); unshift(@V,pop(@V)); }
 $code.=".align 4\n.Lloop:\n";
 for($i=0;$i<20;$i++)   { &BODY_00_19($i,@V); unshift(@V,pop(@V)); }
 for(;$i<40;$i++)       { &BODY_20_39($i,@V); unshift(@V,pop(@V)); }
@@ -227,7 +229,7 @@ $code.=<<___;
        sub     \$1,$num
        jnz     .Lloop
 ___
        sub     \$1,$num
        jnz     .Lloop
 ___
-&EPILOGUE("sha1_block_asm_data_order");
+&EPILOGUE("sha1_block_data_order");
 $code.=<<___;
 .asciz "SHA1 block transform for x86_64, CRYPTOGAMS by <appro\@openssl.org>"
 ___
 $code.=<<___;
 .asciz "SHA1 block transform for x86_64, CRYPTOGAMS by <appro\@openssl.org>"
 ___
index 628e33e42647f0de63626503557e57aff07890dc..bba7f6bb1579d9b7c8fe81b01cd291903e565fb4 100755 (executable)
@@ -71,7 +71,7 @@ if ($output =~ /512.*\.[s|asm]/) {
        $ADD="add";
        $SHRU="shr.u";
        $TABLE="K512";
        $ADD="add";
        $SHRU="shr.u";
        $TABLE="K512";
-       $func="sha512_block";
+       $func="sha512_block_data_order";
        @Sigma0=(28,34,39);
        @Sigma1=(14,18,41);
        @sigma0=(1,  8, 7);
        @Sigma0=(28,34,39);
        @Sigma1=(14,18,41);
        @sigma0=(1,  8, 7);
@@ -85,7 +85,7 @@ if ($output =~ /512.*\.[s|asm]/) {
        $ADD="padd4";
        $SHRU="pshr4.u";
        $TABLE="K256";
        $ADD="padd4";
        $SHRU="pshr4.u";
        $TABLE="K256";
-       $func="sha256_block";
+       $func="sha256_block_data_order";
        @Sigma0=( 2,13,22);
        @Sigma1=( 6,11,25);
        @sigma0=( 7,18, 3);
        @Sigma0=( 2,13,22);
        @Sigma1=( 6,11,25);
        @sigma0=( 7,18, 3);
index b866f93eef242ec8b11e1be25a6bbfd9746e0943..877d172215963bf251a8bf1d48047f96b114cda2 100755 (executable)
@@ -41,7 +41,7 @@ if ($output =~ /64/) {
        die "can't call ../perlasm/ppc-xlate.pl: $!";
 
 if ($output =~ /512/) {
        die "can't call ../perlasm/ppc-xlate.pl: $!";
 
 if ($output =~ /512/) {
-       $func="sha512_block";
+       $func="sha512_block_data_order";
        $SZ=8;
        @Sigma0=(28,34,39);
        @Sigma1=(14,18,41);
        $SZ=8;
        @Sigma0=(28,34,39);
        @Sigma1=(14,18,41);
@@ -53,7 +53,7 @@ if ($output =~ /512/) {
        $ROR="rotrdi";
        $SHR="srdi";
 } else {
        $ROR="rotrdi";
        $SHR="srdi";
 } else {
-       $func="sha256_block";
+       $func="sha256_block_data_order";
        $SZ=4;
        @Sigma0=( 2,13,22);
        @Sigma1=( 6,11,25);
        $SZ=4;
        @Sigma0=( 2,13,22);
        @Sigma1=( 6,11,25);
index 38157b610c94c65cc608e2e35152e91b80f588a0..4cf5c623d6f1684f9bfbe100d2718126a2ec632e 100755 (executable)
@@ -44,7 +44,7 @@ $output=shift;
 open STDOUT,"| $^X ../perlasm/x86_64-xlate.pl $output";
 
 if ($output =~ /512/) {
 open STDOUT,"| $^X ../perlasm/x86_64-xlate.pl $output";
 
 if ($output =~ /512/) {
-       $func="sha512_block";
+       $func="sha512_block_data_order";
        $TABLE="K512";
        $SZ=8;
        @ROT=($A,$B,$C,$D,$E,$F,$G,$H)=("%rax","%rbx","%rcx","%rdx",
        $TABLE="K512";
        $SZ=8;
        @ROT=($A,$B,$C,$D,$E,$F,$G,$H)=("%rax","%rbx","%rcx","%rdx",
@@ -56,7 +56,7 @@ if ($output =~ /512/) {
        @sigma1=(19,61, 6);
        $rounds=80;
 } else {
        @sigma1=(19,61, 6);
        $rounds=80;
 } else {
-       $func="sha256_block";
+       $func="sha256_block_data_order";
        $TABLE="K256";
        $SZ=4;
        @ROT=($A,$B,$C,$D,$E,$F,$G,$H)=("%eax","%ebx","%ecx","%edx",
        $TABLE="K256";
        $SZ=4;
        @ROT=($A,$B,$C,$D,$E,$F,$G,$H)=("%eax","%ebx","%ecx","%edx",
@@ -77,9 +77,8 @@ $Tbl="%rbp";
 $_ctx="16*$SZ+0*8(%rsp)";
 $_inp="16*$SZ+1*8(%rsp)";
 $_end="16*$SZ+2*8(%rsp)";
 $_ctx="16*$SZ+0*8(%rsp)";
 $_inp="16*$SZ+1*8(%rsp)";
 $_end="16*$SZ+2*8(%rsp)";
-$_ord="16*$SZ+3*8(%rsp)";
-$_rsp="16*$SZ+4*8(%rsp)";
-$framesz="16*$SZ+5*8";
+$_rsp="16*$SZ+3*8(%rsp)";
+$framesz="16*$SZ+4*8";
 
 
 sub ROUND_00_15()
 
 
 sub ROUND_00_15()
@@ -189,7 +188,6 @@ $func:
        mov     $ctx,$_ctx              # save ctx, 1st arg
        mov     $inp,$_inp              # save inp, 2nd arh
        mov     %rdx,$_end              # save end pointer, "3rd" arg
        mov     $ctx,$_ctx              # save ctx, 1st arg
        mov     $inp,$_inp              # save inp, 2nd arh
        mov     %rdx,$_end              # save end pointer, "3rd" arg
-       mov     %ecx,$_ord              # save host, 4th arg
        mov     %rbp,$_rsp              # save copy of %rsp
 
        .picmeup $Tbl
        mov     %rbp,$_rsp              # save copy of %rsp
 
        .picmeup $Tbl
@@ -209,25 +207,6 @@ $func:
 .Lloop:
        xor     $round,$round
 ___
 .Lloop:
        xor     $round,$round
 ___
-if ($SZ==4) {
-$code.=<<___;
-       cmpl    \$0,$_ord
-       je      .Ldata_order
-.align 16
-.Lhost_order:
-___
-
-       for($i=0;$i<16;$i++) {
-               $code.="        mov     $SZ*$i($inp),$T1\n";
-               &ROUND_00_15($i,@ROT);
-               unshift(@ROT,pop(@ROT));
-       }
-$code.=<<___;
-       jmp     .Lrounds_16_xx
-.align 16
-.Ldata_order:
-___
-} # 256
        for($i=0;$i<16;$i++) {
                $code.="        mov     $SZ*$i($inp),$T1\n";
                $code.="        bswap   $T1\n";
        for($i=0;$i<16;$i++) {
                $code.="        mov     $SZ*$i($inp),$T1\n";
                $code.="        bswap   $T1\n";
diff --git a/crypto/sha/sha1s.cpp b/crypto/sha/sha1s.cpp
deleted file mode 100644 (file)
index af23d1e..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-//
-// gettsc.inl
-//
-// gives access to the Pentium's (secret) cycle counter
-//
-// This software was written by Leonard Janke (janke@unixg.ubc.ca)
-// in 1996-7 and is entered, by him, into the public domain.
-
-#if defined(__WATCOMC__)
-void GetTSC(unsigned long&);
-#pragma aux GetTSC = 0x0f 0x31 "mov [edi], eax" parm [edi] modify [edx eax];
-#elif defined(__GNUC__)
-inline
-void GetTSC(unsigned long& tsc)
-{
-  asm volatile(".byte 15, 49\n\t"
-              : "=eax" (tsc)
-              :
-              : "%edx", "%eax");
-}
-#elif defined(_MSC_VER)
-inline
-void GetTSC(unsigned long& tsc)
-{
-  unsigned long a;
-  __asm _emit 0fh
-  __asm _emit 31h
-  __asm mov a, eax;
-  tsc=a;
-}
-#endif      
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <openssl/sha.h>
-
-#define sha1_block_x86 sha1_block_asm_data_order
-extern "C" {
-void sha1_block_x86(SHA_CTX *ctx, unsigned char *buffer,int num);
-}
-
-void main(int argc,char *argv[])
-       {
-       unsigned char buffer[64*256];
-       SHA_CTX ctx;
-       unsigned long s1,s2,e1,e2;
-       unsigned char k[16];
-       unsigned long data[2];
-       unsigned char iv[8];
-       int i,num=0,numm;
-       int j=0;
-
-       if (argc >= 2)
-               num=atoi(argv[1]);
-
-       if (num == 0) num=16;
-       if (num > 250) num=16;
-       numm=num+2;
-#if 0
-       num*=64;
-       numm*=64;
-#endif
-
-       for (j=0; j<6; j++)
-               {
-               for (i=0; i<10; i++) /**/
-                       {
-                       sha1_block_x86(&ctx,buffer,numm);
-                       GetTSC(s1);
-                       sha1_block_x86(&ctx,buffer,numm);
-                       GetTSC(e1);
-                       GetTSC(s2);
-                       sha1_block_x86(&ctx,buffer,num);
-                       GetTSC(e2);
-                       sha1_block_x86(&ctx,buffer,num);
-                       }
-
-               printf("sha1 (%d bytes) %d %d (%.2f)\n",num*64,
-                       e1-s1,e2-s2,(double)((e1-s1)-(e2-s2))/2);
-               }
-       }
-
index f83e5afe710d24545333a03f1681a5fe9b766f0f..9b69ff38d2d57aa35934007e7e7c01088fed4cab 100644 (file)
@@ -107,13 +107,14 @@ int SHA224_Final (unsigned char *md, SHA256_CTX *c)
 #define        HASH_TRANSFORM          SHA256_Transform
 #define        HASH_FINAL              SHA256_Final
 #define        HASH_BLOCK_DATA_ORDER   sha256_block_data_order
 #define        HASH_TRANSFORM          SHA256_Transform
 #define        HASH_FINAL              SHA256_Final
 #define        HASH_BLOCK_DATA_ORDER   sha256_block_data_order
+#ifndef SHA256_ASM
+static
+#endif
 void sha256_block_data_order (SHA256_CTX *ctx, const void *in, size_t num);
 
 #include "md32_common.h"
 
 void sha256_block_data_order (SHA256_CTX *ctx, const void *in, size_t num);
 
 #include "md32_common.h"
 
-#ifdef SHA256_ASM
-void sha256_block (SHA256_CTX *ctx, const void *in, size_t num, int host);
-#else
+#ifndef SHA256_ASM
 static const SHA_LONG K256[64] = {
        0x428a2f98UL,0x71374491UL,0xb5c0fbcfUL,0xe9b5dba5UL,
        0x3956c25bUL,0x59f111f1UL,0x923f82a4UL,0xab1c5ed5UL,
 static const SHA_LONG K256[64] = {
        0x428a2f98UL,0x71374491UL,0xb5c0fbcfUL,0xe9b5dba5UL,
        0x3956c25bUL,0x59f111f1UL,0x923f82a4UL,0xab1c5ed5UL,
@@ -147,7 +148,7 @@ static const SHA_LONG K256[64] = {
 
 #ifdef OPENSSL_SMALL_FOOTPRINT
 
 
 #ifdef OPENSSL_SMALL_FOOTPRINT
 
-static void sha256_block (SHA256_CTX *ctx, const void *in, size_t num, int host)
+static void sha256_block_data_order (SHA256_CTX *ctx, const void *in, size_t num)
        {
        unsigned MD32_REG_T a,b,c,d,e,f,g,h,s0,s1,T1,T2;
        SHA_LONG        X[16],l;
        {
        unsigned MD32_REG_T a,b,c,d,e,f,g,h,s0,s1,T1,T2;
        SHA_LONG        X[16],l;
@@ -199,7 +200,7 @@ static void sha256_block (SHA256_CTX *ctx, const void *in, size_t num, int host)
        T1 = X[(i)&0x0f] += s0 + s1 + X[(i+9)&0x0f];    \
        ROUND_00_15(i,a,b,c,d,e,f,g,h);         } while (0)
 
        T1 = X[(i)&0x0f] += s0 + s1 + X[(i+9)&0x0f];    \
        ROUND_00_15(i,a,b,c,d,e,f,g,h);         } while (0)
 
-static void sha256_block (SHA256_CTX *ctx, const void *in, size_t num, int host)
+static void sha256_block_data_order (SHA256_CTX *ctx, const void *in, size_t num)
        {
        unsigned MD32_REG_T a,b,c,d,e,f,g,h,s0,s1,T1;
        SHA_LONG        X[16];
        {
        unsigned MD32_REG_T a,b,c,d,e,f,g,h,s0,s1,T1;
        SHA_LONG        X[16];
@@ -278,7 +279,4 @@ static void sha256_block (SHA256_CTX *ctx, const void *in, size_t num, int host)
 #endif
 #endif /* SHA256_ASM */
 
 #endif
 #endif /* SHA256_ASM */
 
-void HASH_BLOCK_DATA_ORDER (SHA256_CTX *ctx, const void *in, size_t num)
-{   sha256_block (ctx,in,num,0);   }
-
 #endif /* OPENSSL_NO_SHA256 */
 #endif /* OPENSSL_NO_SHA256 */
index dba4c49c0b879b2aed63c2f6a73d563341495f7c..e7a7e5dea8b21c8a49039aa5ec243a54a4b83d50 100644 (file)
@@ -89,7 +89,7 @@ int SHA512_Init (SHA512_CTX *c)
 #ifndef SHA512_ASM
 static
 #endif
 #ifndef SHA512_ASM
 static
 #endif
-void sha512_block (SHA512_CTX *ctx, const void *in, size_t num);
+void sha512_block_data_order (SHA512_CTX *ctx, const void *in, size_t num);
 
 int SHA512_Final (unsigned char *md, SHA512_CTX *c)
        {
 
 int SHA512_Final (unsigned char *md, SHA512_CTX *c)
        {
@@ -100,7 +100,7 @@ int SHA512_Final (unsigned char *md, SHA512_CTX *c)
        n++;
        if (n > (sizeof(c->u)-16))
                memset (p+n,0,sizeof(c->u)-n), n=0,
        n++;
        if (n > (sizeof(c->u)-16))
                memset (p+n,0,sizeof(c->u)-n), n=0,
-               sha512_block (c,p,1);
+               sha512_block_data_order (c,p,1);
 
        memset (p+n,0,sizeof(c->u)-16-n);
 #ifdef B_ENDIAN
 
        memset (p+n,0,sizeof(c->u)-16-n);
 #ifdef B_ENDIAN
@@ -125,7 +125,7 @@ int SHA512_Final (unsigned char *md, SHA512_CTX *c)
        p[sizeof(c->u)-16] = (unsigned char)(c->Nh>>56);
 #endif
 
        p[sizeof(c->u)-16] = (unsigned char)(c->Nh>>56);
 #endif
 
-       sha512_block (c,p,1);
+       sha512_block_data_order (c,p,1);
 
        if (md==0) return 0;
 
 
        if (md==0) return 0;
 
@@ -197,7 +197,7 @@ int SHA512_Update (SHA512_CTX *c, const void *_data, size_t len)
                else    {
                        memcpy (p+c->num,data,n), c->num = 0;
                        len-=n, data+=n;
                else    {
                        memcpy (p+c->num,data,n), c->num = 0;
                        len-=n, data+=n;
-                       sha512_block (c,p,1);
+                       sha512_block_data_order (c,p,1);
                        }
                }
 
                        }
                }
 
@@ -207,12 +207,12 @@ int SHA512_Update (SHA512_CTX *c, const void *_data, size_t len)
                if ((size_t)data%sizeof(c->u.d[0]) != 0)
                        while (len >= sizeof(c->u))
                                memcpy (p,data,sizeof(c->u)),
                if ((size_t)data%sizeof(c->u.d[0]) != 0)
                        while (len >= sizeof(c->u))
                                memcpy (p,data,sizeof(c->u)),
-                               sha512_block (c,p,1),
+                               sha512_block_data_order (c,p,1),
                                len  -= sizeof(c->u),
                                data += sizeof(c->u);
                else
 #endif
                                len  -= sizeof(c->u),
                                data += sizeof(c->u);
                else
 #endif
-                       sha512_block (c,data,len/sizeof(c->u)),
+                       sha512_block_data_order (c,data,len/sizeof(c->u)),
                        data += len,
                        len  %= sizeof(c->u),
                        data -= len;
                        data += len,
                        len  %= sizeof(c->u),
                        data -= len;
@@ -227,7 +227,7 @@ int SHA384_Update (SHA512_CTX *c, const void *data, size_t len)
 {   return SHA512_Update (c,data,len);   }
 
 void SHA512_Transform (SHA512_CTX *c, const unsigned char *data)
 {   return SHA512_Update (c,data,len);   }
 
 void SHA512_Transform (SHA512_CTX *c, const unsigned char *data)
-{   sha512_block (c,data,1);  }
+{   sha512_block_data_order (c,data,1);  }
 
 unsigned char *SHA384(const unsigned char *d, size_t n, unsigned char *md)
        {
 
 unsigned char *SHA384(const unsigned char *d, size_t n, unsigned char *md)
        {
@@ -392,7 +392,7 @@ static const SHA_LONG64 K512[80] = {
 
 #ifdef OPENSSL_SMALL_FOOTPRINT
 
 
 #ifdef OPENSSL_SMALL_FOOTPRINT
 
-static void sha512_block (SHA512_CTX *ctx, const void *in, size_t num)
+static void sha512_block_data_order (SHA512_CTX *ctx, const void *in, size_t num)
        {
        const SHA_LONG64 *W=in;
        SHA_LONG64      a,b,c,d,e,f,g,h,s0,s1,T1,T2;
        {
        const SHA_LONG64 *W=in;
        SHA_LONG64      a,b,c,d,e,f,g,h,s0,s1,T1,T2;
@@ -453,7 +453,7 @@ static void sha512_block (SHA512_CTX *ctx, const void *in, size_t num)
        T1 = X[(i)&0x0f] += s0 + s1 + X[(i+9)&0x0f];    \
        ROUND_00_15(i,a,b,c,d,e,f,g,h);         } while (0)
 
        T1 = X[(i)&0x0f] += s0 + s1 + X[(i+9)&0x0f];    \
        ROUND_00_15(i,a,b,c,d,e,f,g,h);         } while (0)
 
-static void sha512_block (SHA512_CTX *ctx, const void *in, size_t num)
+static void sha512_block_data_order (SHA512_CTX *ctx, const void *in, size_t num)
        {
        const SHA_LONG64 *W=in;
        SHA_LONG64      a,b,c,d,e,f,g,h,s0,s1,T1;
        {
        const SHA_LONG64 *W=in;
        SHA_LONG64      a,b,c,d,e,f,g,h,s0,s1,T1;
index d482ba12a03e69dbed399f9c0cfdb7498dc27952..247d4df6f53c9a1508e604665eba8af1d6add5d6 100644 (file)
@@ -85,7 +85,7 @@
 # define HASH_BLOCK_DATA_ORDER         sha_block_data_order
 # define Xupdate(a,ix,ia,ib,ic,id)     (ix=(a)=(ia^ib^ic^id))
 
 # define HASH_BLOCK_DATA_ORDER         sha_block_data_order
 # define Xupdate(a,ix,ia,ib,ic,id)     (ix=(a)=(ia^ib^ic^id))
 
-  void sha_block_data_order (SHA_CTX *c, const void *p,size_t num);
+static void sha_block_data_order (SHA_CTX *c, const void *p,size_t num);
 
 #elif defined(SHA_1)
 
 
 #elif defined(SHA_1)
 
                                        )
 # endif
 
                                        )
 # endif
 
-# ifdef SHA1_ASM
-#  if defined(__i386) || defined(__i386__) || defined(_M_IX86) || defined(__INTEL__) \
-   || defined(__x86_64) || defined(__x86_64__) || defined(_M_AMD64) || defined(_M_X64)
-#   define sha1_block_data_order               sha1_block_asm_data_order
-#   define DONT_IMPLEMENT_BLOCK_DATA_ORDER
-#  elif defined(__ia64) || defined(__ia64__) || defined(_M_IA64)
-#   define sha1_block_data_order               sha1_block_asm_data_order
-#   define DONT_IMPLEMENT_BLOCK_DATA_ORDER
-#  elif defined(_ARCH_PPC) || defined(_ARCH_PPC64) || \
-       defined(__ppc) || defined(__ppc__) || defined(__powerpc) || \
-       defined(__ppc64) || defined(__ppc64__) || defined(__powerpc64)
-#   define sha1_block_data_order               sha1_block_asm_data_order
-#   define DONT_IMPLEMENT_BLOCK_DATA_ORDER
-#  endif
-# endif
-  void sha1_block_data_order (SHA_CTX *c, const void *p,size_t num);
+#ifndef SHA1_ASM
+static
+#endif
+void sha1_block_data_order (SHA_CTX *c, const void *p,size_t num);
 
 #else
 # error "Either SHA_0 or SHA_1 must be defined."
 
 #else
 # error "Either SHA_0 or SHA_1 must be defined."
@@ -216,8 +204,8 @@ int HASH_INIT (SHA_CTX *c)
 # define X(i)  XX[i]
 #endif
 
 # define X(i)  XX[i]
 #endif
 
-#ifndef DONT_IMPLEMENT_BLOCK_DATA_ORDER
-void HASH_BLOCK_DATA_ORDER (SHA_CTX *c, const void *p, size_t num)
+#if !defined(SHA_1) || !defined(SHA1_ASM)
+static void HASH_BLOCK_DATA_ORDER (SHA_CTX *c, const void *p, size_t num)
        {
        const unsigned char *data=p;
        register unsigned MD32_REG_T A,B,C,D,E,T,l;
        {
        const unsigned char *data=p;
        register unsigned MD32_REG_T A,B,C,D,E,T,l;
@@ -416,8 +404,8 @@ void HASH_BLOCK_DATA_ORDER (SHA_CTX *c, const void *p, size_t num)
        E=D, D=C, C=ROTATE(B,30), B=A;  \
        A=ROTATE(A,5)+T+xa;         } while(0)
 
        E=D, D=C, C=ROTATE(B,30), B=A;  \
        A=ROTATE(A,5)+T+xa;         } while(0)
 
-#ifndef DONT_IMPLEMENT_BLOCK_DATA_ORDER
-void HASH_BLOCK_DATA_ORDER (SHA_CTX *c, const void *p, size_t num)
+#if !defined(SHA_1) || !defined(SHA1_ASM)
+static void HASH_BLOCK_DATA_ORDER (SHA_CTX *c, const void *p, size_t num)
        {
        const unsigned char *data=p;
        register unsigned MD32_REG_T A,B,C,D,E,T,l;
        {
        const unsigned char *data=p;
        register unsigned MD32_REG_T A,B,C,D,E,T,l;