Change #include filenames from <foo.h> to <openssl.h>.
[openssl.git] / crypto / sha / sha_dgst.c
index 15245e3b2c4e8465bf64349933fead6ca1ef2bb6..ebfbb53aeee3f9f0ad2f26f46ddec35419c32a6f 100644 (file)
 #include <string.h>
 #define  SHA_0
 #undef SHA_1
-#include "sha.h"
+#include <openssl/sha.h>
 #include "sha_locl.h"
-#include "opensslv.h"
+#include <openssl/opensslv.h>
 
 char *SHA_version="SHA" OPENSSL_VERSION_PTEXT;
 
 /* Implemented from SHA-0 document - The Secure Hash Algorithm
  */
 
-#define INIT_DATA_h0 (unsigned long)0x67452301L
-#define INIT_DATA_h1 (unsigned long)0xefcdab89L
-#define INIT_DATA_h2 (unsigned long)0x98badcfeL
-#define INIT_DATA_h3 (unsigned long)0x10325476L
-#define INIT_DATA_h4 (unsigned long)0xc3d2e1f0L
+#define INIT_DATA_h0 0x67452301UL
+#define INIT_DATA_h1 0xefcdab89UL
+#define INIT_DATA_h2 0x98badcfeUL
+#define INIT_DATA_h3 0x10325476UL
+#define INIT_DATA_h4 0xc3d2e1f0UL
 
-#define K_00_19        0x5a827999L
-#define K_20_39 0x6ed9eba1L
-#define K_40_59 0x8f1bbcdcL
-#define K_60_79 0xca62c1d6L
+#define K_00_19        0x5a827999UL
+#define K_20_39 0x6ed9eba1UL
+#define K_40_59 0x8f1bbcdcUL
+#define K_60_79 0xca62c1d6UL
 
 #ifndef NOPROTO
-   void sha_block(SHA_CTX *c, register unsigned long *p, int num);
+   void sha_block(SHA_CTX *c, register SHA_LONG *p, int num);
 #else
    void sha_block();
 #endif
@@ -92,8 +92,7 @@ char *SHA_version="SHA" OPENSSL_VERSION_PTEXT;
 #define        M_p_c2nl_p      p_c2nl_p
 #define        M_nl2c          nl2c
 
-void SHA_Init(c)
-SHA_CTX *c;
+void SHA_Init(SHA_CTX *c)
        {
        c->h0=INIT_DATA_h0;
        c->h1=INIT_DATA_h1;
@@ -105,14 +104,11 @@ SHA_CTX *c;
        c->num=0;
        }
 
-void SHA_Update(c, data, len)
-SHA_CTX *c;
-register unsigned char *data;
-unsigned long len;
+void SHA_Update(SHA_CTX *c, register unsigned char *data, unsigned long len)
        {
-       register ULONG *p;
+       register SHA_LONG *p;
        int ew,ec,sw,sc;
-       ULONG l;
+       SHA_LONG l;
 
        if (len == 0) return;
 
@@ -179,13 +175,13 @@ unsigned long len;
         */
 #if 1
 #if defined(B_ENDIAN) || defined(SHA_ASM)
-       if ((((unsigned long)data)%sizeof(ULONG)) == 0)
+       if ((((unsigned long)data)%sizeof(SHA_LONG)) == 0)
                {
                sw=len/SHA_CBLOCK;
                if (sw)
                        {
                        sw*=SHA_CBLOCK;
-                       sha_block(c,(ULONG *)data,sw);
+                       sha_block(c,(SHA_LONG *)data,sw);
                        data+=sw;
                        len-=sw;
                        }
@@ -198,7 +194,7 @@ unsigned long len;
        while (len >= SHA_CBLOCK)
                {
 #if defined(B_ENDIAN) || defined(L_ENDIAN)
-               if (p != (unsigned long *)data)
+               if (p != (SHA_LONG *)data)
                        memcpy(p,data,SHA_CBLOCK);
                data+=SHA_CBLOCK;
 #  ifdef L_ENDIAN
@@ -238,13 +234,11 @@ unsigned long len;
        p[sw]=l;
        }
 
-void SHA_Transform(c,b)
-SHA_CTX *c;
-unsigned char *b;
+void SHA_Transform(SHA_CTX *c, unsigned char *b)
        {
-       ULONG p[16];
+       SHA_LONG p[16];
 #if !defined(B_ENDIAN)
-       ULONG *q;
+       SHA_LONG *q;
        int i;
 #endif
 
@@ -265,7 +259,7 @@ unsigned char *b;
        q=p;
        for (i=(SHA_LBLOCK/4); i; i--)
                {
-               ULONG l;
+               SHA_LONG l;
                c2nl(b,l); *(q++)=l;
                c2nl(b,l); *(q++)=l;
                c2nl(b,l); *(q++)=l;
@@ -275,13 +269,10 @@ unsigned char *b;
        sha_block(c,p,64);
        }
 
-void sha_block(c, W, num)
-SHA_CTX *c;
-register unsigned long *W;
-int num;
+void sha_block(SHA_CTX *c, register SHA_LONG *W, int num)
        {
-       register ULONG A,B,C,D,E,T;
-       ULONG X[16];
+       register SHA_LONG A,B,C,D,E,T;
+       SHA_LONG X[16];
 
        A=c->h0;
        B=c->h1;
@@ -394,13 +385,11 @@ int num;
                }
        }
 
-void SHA_Final(md, c)
-unsigned char *md;
-SHA_CTX *c;
+void SHA_Final(unsigned char *md, SHA_CTX *c)
        {
        register int i,j;
-       register ULONG l;
-       register ULONG *p;
+       register SHA_LONG l;
+       register SHA_LONG *p;
        static unsigned char end[4]={0x80,0x00,0x00,0x00};
        unsigned char *cp=end;