33
33
34
34
#include <time.h>
35
35
36
+ #include "common/sha2.h"
36
37
#include "px.h"
37
- #include "sha2.h"
38
38
39
39
void init_sha224 (PX_MD * h );
40
40
void init_sha256 (PX_MD * h );
@@ -46,43 +46,43 @@ void init_sha512(PX_MD *h);
46
46
static unsigned
47
47
int_sha224_len (PX_MD * h )
48
48
{
49
- return SHA224_DIGEST_LENGTH ;
49
+ return PG_SHA224_DIGEST_LENGTH ;
50
50
}
51
51
52
52
static unsigned
53
53
int_sha224_block_len (PX_MD * h )
54
54
{
55
- return SHA224_BLOCK_LENGTH ;
55
+ return PG_SHA224_BLOCK_LENGTH ;
56
56
}
57
57
58
58
static void
59
59
int_sha224_update (PX_MD * h , const uint8 * data , unsigned dlen )
60
60
{
61
- SHA224_CTX * ctx = (SHA224_CTX * ) h -> p .ptr ;
61
+ pg_sha224_ctx * ctx = (pg_sha224_ctx * ) h -> p .ptr ;
62
62
63
- SHA224_Update (ctx , data , dlen );
63
+ pg_sha224_update (ctx , data , dlen );
64
64
}
65
65
66
66
static void
67
67
int_sha224_reset (PX_MD * h )
68
68
{
69
- SHA224_CTX * ctx = (SHA224_CTX * ) h -> p .ptr ;
69
+ pg_sha224_ctx * ctx = (pg_sha224_ctx * ) h -> p .ptr ;
70
70
71
- SHA224_Init (ctx );
71
+ pg_sha224_init (ctx );
72
72
}
73
73
74
74
static void
75
75
int_sha224_finish (PX_MD * h , uint8 * dst )
76
76
{
77
- SHA224_CTX * ctx = (SHA224_CTX * ) h -> p .ptr ;
77
+ pg_sha224_ctx * ctx = (pg_sha224_ctx * ) h -> p .ptr ;
78
78
79
- SHA224_Final ( dst , ctx );
79
+ pg_sha224_final ( ctx , dst );
80
80
}
81
81
82
82
static void
83
83
int_sha224_free (PX_MD * h )
84
84
{
85
- SHA224_CTX * ctx = (SHA224_CTX * ) h -> p .ptr ;
85
+ pg_sha224_ctx * ctx = (pg_sha224_ctx * ) h -> p .ptr ;
86
86
87
87
px_memset (ctx , 0 , sizeof (* ctx ));
88
88
px_free (ctx );
@@ -94,43 +94,43 @@ int_sha224_free(PX_MD *h)
94
94
static unsigned
95
95
int_sha256_len (PX_MD * h )
96
96
{
97
- return SHA256_DIGEST_LENGTH ;
97
+ return PG_SHA256_DIGEST_LENGTH ;
98
98
}
99
99
100
100
static unsigned
101
101
int_sha256_block_len (PX_MD * h )
102
102
{
103
- return SHA256_BLOCK_LENGTH ;
103
+ return PG_SHA256_BLOCK_LENGTH ;
104
104
}
105
105
106
106
static void
107
107
int_sha256_update (PX_MD * h , const uint8 * data , unsigned dlen )
108
108
{
109
- SHA256_CTX * ctx = (SHA256_CTX * ) h -> p .ptr ;
109
+ pg_sha256_ctx * ctx = (pg_sha256_ctx * ) h -> p .ptr ;
110
110
111
- SHA256_Update (ctx , data , dlen );
111
+ pg_sha256_update (ctx , data , dlen );
112
112
}
113
113
114
114
static void
115
115
int_sha256_reset (PX_MD * h )
116
116
{
117
- SHA256_CTX * ctx = (SHA256_CTX * ) h -> p .ptr ;
117
+ pg_sha256_ctx * ctx = (pg_sha256_ctx * ) h -> p .ptr ;
118
118
119
- SHA256_Init (ctx );
119
+ pg_sha256_init (ctx );
120
120
}
121
121
122
122
static void
123
123
int_sha256_finish (PX_MD * h , uint8 * dst )
124
124
{
125
- SHA256_CTX * ctx = (SHA256_CTX * ) h -> p .ptr ;
125
+ pg_sha256_ctx * ctx = (pg_sha256_ctx * ) h -> p .ptr ;
126
126
127
- SHA256_Final ( dst , ctx );
127
+ pg_sha256_final ( ctx , dst );
128
128
}
129
129
130
130
static void
131
131
int_sha256_free (PX_MD * h )
132
132
{
133
- SHA256_CTX * ctx = (SHA256_CTX * ) h -> p .ptr ;
133
+ pg_sha256_ctx * ctx = (pg_sha256_ctx * ) h -> p .ptr ;
134
134
135
135
px_memset (ctx , 0 , sizeof (* ctx ));
136
136
px_free (ctx );
@@ -142,43 +142,43 @@ int_sha256_free(PX_MD *h)
142
142
static unsigned
143
143
int_sha384_len (PX_MD * h )
144
144
{
145
- return SHA384_DIGEST_LENGTH ;
145
+ return PG_SHA384_DIGEST_LENGTH ;
146
146
}
147
147
148
148
static unsigned
149
149
int_sha384_block_len (PX_MD * h )
150
150
{
151
- return SHA384_BLOCK_LENGTH ;
151
+ return PG_SHA384_BLOCK_LENGTH ;
152
152
}
153
153
154
154
static void
155
155
int_sha384_update (PX_MD * h , const uint8 * data , unsigned dlen )
156
156
{
157
- SHA384_CTX * ctx = (SHA384_CTX * ) h -> p .ptr ;
157
+ pg_sha384_ctx * ctx = (pg_sha384_ctx * ) h -> p .ptr ;
158
158
159
- SHA384_Update (ctx , data , dlen );
159
+ pg_sha384_update (ctx , data , dlen );
160
160
}
161
161
162
162
static void
163
163
int_sha384_reset (PX_MD * h )
164
164
{
165
- SHA384_CTX * ctx = (SHA384_CTX * ) h -> p .ptr ;
165
+ pg_sha384_ctx * ctx = (pg_sha384_ctx * ) h -> p .ptr ;
166
166
167
- SHA384_Init (ctx );
167
+ pg_sha384_init (ctx );
168
168
}
169
169
170
170
static void
171
171
int_sha384_finish (PX_MD * h , uint8 * dst )
172
172
{
173
- SHA384_CTX * ctx = (SHA384_CTX * ) h -> p .ptr ;
173
+ pg_sha384_ctx * ctx = (pg_sha384_ctx * ) h -> p .ptr ;
174
174
175
- SHA384_Final ( dst , ctx );
175
+ pg_sha384_final ( ctx , dst );
176
176
}
177
177
178
178
static void
179
179
int_sha384_free (PX_MD * h )
180
180
{
181
- SHA384_CTX * ctx = (SHA384_CTX * ) h -> p .ptr ;
181
+ pg_sha384_ctx * ctx = (pg_sha384_ctx * ) h -> p .ptr ;
182
182
183
183
px_memset (ctx , 0 , sizeof (* ctx ));
184
184
px_free (ctx );
@@ -190,43 +190,43 @@ int_sha384_free(PX_MD *h)
190
190
static unsigned
191
191
int_sha512_len (PX_MD * h )
192
192
{
193
- return SHA512_DIGEST_LENGTH ;
193
+ return PG_SHA512_DIGEST_LENGTH ;
194
194
}
195
195
196
196
static unsigned
197
197
int_sha512_block_len (PX_MD * h )
198
198
{
199
- return SHA512_BLOCK_LENGTH ;
199
+ return PG_SHA512_BLOCK_LENGTH ;
200
200
}
201
201
202
202
static void
203
203
int_sha512_update (PX_MD * h , const uint8 * data , unsigned dlen )
204
204
{
205
- SHA512_CTX * ctx = (SHA512_CTX * ) h -> p .ptr ;
205
+ pg_sha512_ctx * ctx = (pg_sha512_ctx * ) h -> p .ptr ;
206
206
207
- SHA512_Update (ctx , data , dlen );
207
+ pg_sha512_update (ctx , data , dlen );
208
208
}
209
209
210
210
static void
211
211
int_sha512_reset (PX_MD * h )
212
212
{
213
- SHA512_CTX * ctx = (SHA512_CTX * ) h -> p .ptr ;
213
+ pg_sha512_ctx * ctx = (pg_sha512_ctx * ) h -> p .ptr ;
214
214
215
- SHA512_Init (ctx );
215
+ pg_sha512_init (ctx );
216
216
}
217
217
218
218
static void
219
219
int_sha512_finish (PX_MD * h , uint8 * dst )
220
220
{
221
- SHA512_CTX * ctx = (SHA512_CTX * ) h -> p .ptr ;
221
+ pg_sha512_ctx * ctx = (pg_sha512_ctx * ) h -> p .ptr ;
222
222
223
- SHA512_Final ( dst , ctx );
223
+ pg_sha512_final ( ctx , dst );
224
224
}
225
225
226
226
static void
227
227
int_sha512_free (PX_MD * h )
228
228
{
229
- SHA512_CTX * ctx = (SHA512_CTX * ) h -> p .ptr ;
229
+ pg_sha512_ctx * ctx = (pg_sha512_ctx * ) h -> p .ptr ;
230
230
231
231
px_memset (ctx , 0 , sizeof (* ctx ));
232
232
px_free (ctx );
@@ -238,7 +238,7 @@ int_sha512_free(PX_MD *h)
238
238
void
239
239
init_sha224 (PX_MD * md )
240
240
{
241
- SHA224_CTX * ctx ;
241
+ pg_sha224_ctx * ctx ;
242
242
243
243
ctx = px_alloc (sizeof (* ctx ));
244
244
memset (ctx , 0 , sizeof (* ctx ));
@@ -258,7 +258,7 @@ init_sha224(PX_MD *md)
258
258
void
259
259
init_sha256 (PX_MD * md )
260
260
{
261
- SHA256_CTX * ctx ;
261
+ pg_sha256_ctx * ctx ;
262
262
263
263
ctx = px_alloc (sizeof (* ctx ));
264
264
memset (ctx , 0 , sizeof (* ctx ));
@@ -278,7 +278,7 @@ init_sha256(PX_MD *md)
278
278
void
279
279
init_sha384 (PX_MD * md )
280
280
{
281
- SHA384_CTX * ctx ;
281
+ pg_sha384_ctx * ctx ;
282
282
283
283
ctx = px_alloc (sizeof (* ctx ));
284
284
memset (ctx , 0 , sizeof (* ctx ));
@@ -298,7 +298,7 @@ init_sha384(PX_MD *md)
298
298
void
299
299
init_sha512 (PX_MD * md )
300
300
{
301
- SHA512_CTX * ctx ;
301
+ pg_sha512_ctx * ctx ;
302
302
303
303
ctx = px_alloc (sizeof (* ctx ));
304
304
memset (ctx , 0 , sizeof (* ctx ));
0 commit comments