1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
Use C99 standard's uint32_t
--- md5auth/md5.h
+++ md5auth/md5.h
@@ -23,10 +23,12 @@
documentation and/or software.
*/
+#include <stdint.h>
+
/* MD5 context. */
typedef struct {
- u_int32_t state[4]; /* state (ABCD) */
- u_int32_t count[2]; /* number of bits, modulo 2^64 (lsb first) */
+ uint32_t state[4]; /* state (ABCD) */
+ uint32_t count[2]; /* number of bits, modulo 2^64 (lsb first) */
unsigned char buffer[64]; /* input buffer */
} MD5_CTX;
--- md5auth/md5c.c
+++ md5auth/md5c.c
@@ -46,11 +46,11 @@
#define S43 15
#define S44 21
-static void MD5Transform PROTO_LIST ((u_int32_t [4], unsigned char [64]));
+static void MD5Transform PROTO_LIST ((uint32_t [4], unsigned char [64]));
static void Encode PROTO_LIST
- ((unsigned char *, u_int32_t *, unsigned int));
+ ((unsigned char *, uint32_t *, unsigned int));
static void Decode PROTO_LIST
- ((u_int32_t *, unsigned char *, unsigned int));
+ ((uint32_t *, unsigned char *, unsigned int));
static void MD5_memcpy PROTO_LIST ((POINTER, POINTER, unsigned int));
static void MD5_memset PROTO_LIST ((POINTER, int, unsigned int));
@@ -75,22 +75,22 @@
Rotation is separate from addition to prevent recomputation.
*/
#define FF(a, b, c, d, x, s, ac) { \
- (a) += F ((b), (c), (d)) + (x) + (u_int32_t)(ac); \
+ (a) += F ((b), (c), (d)) + (x) + (uint32_t)(ac); \
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}
#define GG(a, b, c, d, x, s, ac) { \
- (a) += G ((b), (c), (d)) + (x) + (u_int32_t)(ac); \
+ (a) += G ((b), (c), (d)) + (x) + (uint32_t)(ac); \
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}
#define HH(a, b, c, d, x, s, ac) { \
- (a) += H ((b), (c), (d)) + (x) + (u_int32_t)(ac); \
+ (a) += H ((b), (c), (d)) + (x) + (uint32_t)(ac); \
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}
#define II(a, b, c, d, x, s, ac) { \
- (a) += I ((b), (c), (d)) + (x) + (u_int32_t)(ac); \
+ (a) += I ((b), (c), (d)) + (x) + (uint32_t)(ac); \
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}
@@ -124,10 +124,10 @@
index = (unsigned int)((context->count[0] >> 3) & 0x3F);
/* Update number of bits */
- if ((context->count[0] += ((u_int32_t)inputLen << 3))
- < ((u_int32_t)inputLen << 3))
+ if ((context->count[0] += ((uint32_t)inputLen << 3))
+ < ((uint32_t)inputLen << 3))
context->count[1]++;
- context->count[1] += ((u_int32_t)inputLen >> 29);
+ context->count[1] += ((uint32_t)inputLen >> 29);
partLen = 64 - index;
@@ -184,10 +184,10 @@
/* MD5 basic transformation. Transforms state based on block.
*/
static void MD5Transform (state, block)
-u_int32_t state[4];
+uint32_t state[4];
unsigned char block[64];
{
- u_int32_t a = state[0], b = state[1], c = state[2], d = state[3], x[16];
+ uint32_t a = state[0], b = state[1], c = state[2], d = state[3], x[16];
Decode (x, block, 64);
@@ -273,12 +273,12 @@
MD5_memset ((POINTER)x, 0, sizeof (x));
}
-/* Encodes input (u_int32_t) into output (unsigned char). Assumes len is
+/* Encodes input (uint32_t) into output (unsigned char). Assumes len is
a multiple of 4.
*/
static void Encode (output, input, len)
unsigned char *output;
-u_int32_t *input;
+uint32_t *input;
unsigned int len;
{
unsigned int i, j;
@@ -291,19 +291,19 @@
}
}
-/* Decodes input (unsigned char) into output (u_int32_t). Assumes len is
+/* Decodes input (unsigned char) into output (uint32_t). Assumes len is
a multiple of 4.
*/
static void Decode (output, input, len)
-u_int32_t *output;
+uint32_t *output;
unsigned char *input;
unsigned int len;
{
unsigned int i, j;
for (i = 0, j = 0; j < len; i++, j += 4)
- output[i] = ((u_int32_t)input[j]) | (((u_int32_t)input[j+1]) << 8) |
- (((u_int32_t)input[j+2]) << 16) | (((u_int32_t)input[j+3]) << 24);
+ output[i] = ((uint32_t)input[j]) | (((uint32_t)input[j+1]) << 8) |
+ (((uint32_t)input[j+2]) << 16) | (((uint32_t)input[j+3]) << 24);
}
/* Note: Replace "for loop" with standard memcpy if possible.
|