]> git.ozlabs.org Git - ppp.git/commitdiff
Don't use unsigned long in the SHA1 code; we want 32-bit variables
authorPaul Mackerras <paulus@samba.org>
Sun, 24 Oct 2004 23:31:20 +0000 (23:31 +0000)
committerPaul Mackerras <paulus@samba.org>
Sun, 24 Oct 2004 23:31:20 +0000 (23:31 +0000)
and unsigned long is 64 bits on 64-bit platforms.  Use unsigned int
or u_int32_t instead.  Pointed out by Oleg Makarenko.

linux/mppe/sha1.c
linux/mppe/sha1.h
pppd/sha1.c
pppd/sha1.h

index 7e8b03cf30a053b3ce53a529df78701de1e28a13..a895c87363c3466baaed32ad0a1b08060201edc4 100644 (file)
@@ -29,7 +29,7 @@
 
 #include "sha1.h"
 
-static void SHA1_Transform(unsigned long[5], const unsigned char[64]);
+static void SHA1_Transform(unsigned int[5], const unsigned char[64]);
 
 #define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
 
@@ -57,12 +57,12 @@ static void SHA1_Transform(unsigned long[5], const unsigned char[64]);
 /* Hash a single 512-bit block. This is the core of the algorithm. */
 
 static void
-SHA1_Transform(unsigned long state[5], const unsigned char buffer[64])
+SHA1_Transform(unsigned int state[5], const unsigned char buffer[64])
 {
-    unsigned long a, b, c, d, e;
+    unsigned int a, b, c, d, e;
     typedef union {
        unsigned char c[64];
-       unsigned long l[16];
+       unsigned int l[16];
     } CHAR64LONG16;
     CHAR64LONG16 *block;
 
@@ -156,7 +156,7 @@ SHA1_Update(SHA1_CTX *context, const unsigned char *data, unsigned int len)
 void
 SHA1_Final(unsigned char digest[20], SHA1_CTX *context)
 {
-    unsigned long i, j;
+    unsigned int i, j;
     unsigned char finalcount[8];
 
     for (i = 0; i < 8; i++) {
index b23356bb21c8e4fe6f82a24e06ae78ba2c806896..451868cd6261b7da41df1f74fc64550e9c56f65b 100644 (file)
@@ -4,8 +4,8 @@
 #define _SHA1_H
 
 typedef struct {
-    unsigned long state[5];
-    unsigned long count[2];
+    unsigned int state[5];
+    unsigned int count[2];
     unsigned char buffer[64];
 } SHA1_CTX;
 
index b8701b4306e03621de80102d362818f2fce3b887..da142f1a7611b67a31e0ba39da5c36c70de8c1d5 100644 (file)
@@ -21,7 +21,7 @@
 #include "sha1.h"
 
 static void
-SHA1_Transform(unsigned long[5], const unsigned char[64]);
+SHA1_Transform(u_int32_t[5], const unsigned char[64]);
 
 #define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
 
@@ -42,12 +42,12 @@ SHA1_Transform(unsigned long[5], const unsigned char[64]);
 /* Hash a single 512-bit block. This is the core of the algorithm. */
 
 static void
-SHA1_Transform(unsigned long state[5], const unsigned char buffer[64])
+SHA1_Transform(u_int32_t state[5], const unsigned char buffer[64])
 {
-    unsigned long a, b, c, d, e;
+    u_int32_t a, b, c, d, e;
     typedef union {
        unsigned char c[64];
-       unsigned long l[16];
+       u_int32_t l[16];
     } CHAR64LONG16;
     CHAR64LONG16 *block;
 
@@ -141,7 +141,7 @@ SHA1_Update(SHA1_CTX *context, const unsigned char *data, unsigned int len)
 void
 SHA1_Final(unsigned char digest[20], SHA1_CTX *context)
 {
-    unsigned long i, j;
+    u_int32_t i, j;
     unsigned char finalcount[8];
 
     for (i = 0; i < 8; i++) {
index f1d26618b6be6b19433cd3679ddcfe3541af91cc..83f64df25843ac6f8bbd1bfe686a00c09ff8716a 100644 (file)
@@ -17,8 +17,8 @@
 #endif
 
 typedef struct {
-    unsigned long state[5];
-    unsigned long count[2];
+    u_int32_t state[5];
+    u_int32_t count[2];
     unsigned char buffer[64];
 } SHA1_CTX;