and unsigned long is 64 bits on 64-bit platforms. Use unsigned int
or u_int32_t instead. Pointed out by Oleg Makarenko.
-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))))
#define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
/* Hash a single 512-bit block. This is the core of the algorithm. */
static void
/* 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];
typedef union {
unsigned char c[64];
} CHAR64LONG16;
CHAR64LONG16 *block;
} CHAR64LONG16;
CHAR64LONG16 *block;
void
SHA1_Final(unsigned char digest[20], SHA1_CTX *context)
{
void
SHA1_Final(unsigned char digest[20], SHA1_CTX *context)
{
unsigned char finalcount[8];
for (i = 0; i < 8; i++) {
unsigned char finalcount[8];
for (i = 0; i < 8; i++) {
#define _SHA1_H
typedef struct {
#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;
unsigned char buffer[64];
} SHA1_CTX;
#include "sha1.h"
static void
#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))))
#define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
/* Hash a single 512-bit block. This is the core of the algorithm. */
static void
/* 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];
typedef union {
unsigned char c[64];
} CHAR64LONG16;
CHAR64LONG16 *block;
} CHAR64LONG16;
CHAR64LONG16 *block;
void
SHA1_Final(unsigned char digest[20], SHA1_CTX *context)
{
void
SHA1_Final(unsigned char digest[20], SHA1_CTX *context)
{
unsigned char finalcount[8];
for (i = 0; i < 8; i++) {
unsigned char finalcount[8];
for (i = 0; i < 8; i++) {
- unsigned long state[5];
- unsigned long count[2];
+ u_int32_t state[5];
+ u_int32_t count[2];
unsigned char buffer[64];
} SHA1_CTX;
unsigned char buffer[64];
} SHA1_CTX;