diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r--[-rwxr-xr-x] | src/examples/msgs_i18n.c | 0 | ||||
-rw-r--r-- | src/lib/md5.c | 16 | ||||
-rw-r--r-- | src/lib/md5.h | 12 | ||||
-rw-r--r-- | src/microhttpd/digestauth.c | 10 | ||||
-rw-r--r-- | src/microhttpd/md5.c | 12 | ||||
-rw-r--r-- | src/microhttpd/md5.h | 10 | ||||
-rw-r--r-- | src/microhttpd/sha256.c | 4 | ||||
-rw-r--r-- | src/microhttpd/sha256.h | 4 | ||||
-rw-r--r-- | src/microhttpd/test_md5.c | 28 | ||||
-rw-r--r-- | src/microhttpd/test_sha256.c | 20 |
11 files changed, 62 insertions, 58 deletions
@@ -1,3 +1,7 @@ | |||
1 | Mon 03 Jun 2019 11:45:52 PM CEST | ||
2 | Apply MHD_-prefix to hash functions, even if they are not in the | ||
3 | officially exported API. -CG/DB | ||
4 | |||
1 | Sun May 26 23:05:42 MSK 2019 | 5 | Sun May 26 23:05:42 MSK 2019 |
2 | Better detection of sockaddr member in configure, fixed build on *BSD, | 6 | Better detection of sockaddr member in configure, fixed build on *BSD, |
3 | Fixed compiler warnings, | 7 | Fixed compiler warnings, |
diff --git a/src/examples/msgs_i18n.c b/src/examples/msgs_i18n.c index 2d8eb566..2d8eb566 100755..100644 --- a/src/examples/msgs_i18n.c +++ b/src/examples/msgs_i18n.c | |||
diff --git a/src/lib/md5.c b/src/lib/md5.c index d92a42ee..a7eb35fe 100644 --- a/src/lib/md5.c +++ b/src/lib/md5.c | |||
@@ -10,8 +10,8 @@ | |||
10 | * with every copy. | 10 | * with every copy. |
11 | * | 11 | * |
12 | * To compute the message digest of a chunk of bytes, declare an | 12 | * To compute the message digest of a chunk of bytes, declare an |
13 | * MD5Context structure, pass it to MD5Init, call MD5Update as | 13 | * MD5Context structure, pass it to MHD_MD5Init, call MHD_MD5Update as |
14 | * needed on buffers full of bytes, and then call MD5Final, which | 14 | * needed on buffers full of bytes, and then call MHD_MD5Final, which |
15 | * will fill a supplied 16-byte array with the digest. | 15 | * will fill a supplied 16-byte array with the digest. |
16 | */ | 16 | */ |
17 | 17 | ||
@@ -47,7 +47,7 @@ static uint8_t PADDING[MD5_BLOCK_SIZE] = { | |||
47 | * initialization constants. | 47 | * initialization constants. |
48 | */ | 48 | */ |
49 | void | 49 | void |
50 | MD5Init(struct MD5Context *ctx) | 50 | MHD_MD5Init(struct MD5Context *ctx) |
51 | { | 51 | { |
52 | if (!ctx) | 52 | if (!ctx) |
53 | return; | 53 | return; |
@@ -64,7 +64,7 @@ MD5Init(struct MD5Context *ctx) | |||
64 | * of bytes. | 64 | * of bytes. |
65 | */ | 65 | */ |
66 | void | 66 | void |
67 | MD5Update(struct MD5Context *ctx, const unsigned char *input, size_t len) | 67 | MHD_MD5Update(struct MD5Context *ctx, const unsigned char *input, size_t len) |
68 | { | 68 | { |
69 | size_t have, need; | 69 | size_t have, need; |
70 | 70 | ||
@@ -124,15 +124,15 @@ MD5Pad(struct MD5Context *ctx) | |||
124 | ((ctx->count >> 3) & (MD5_BLOCK_SIZE - 1)); | 124 | ((ctx->count >> 3) & (MD5_BLOCK_SIZE - 1)); |
125 | if (padlen < 1 + 8) | 125 | if (padlen < 1 + 8) |
126 | padlen += MD5_BLOCK_SIZE; | 126 | padlen += MD5_BLOCK_SIZE; |
127 | MD5Update(ctx, PADDING, padlen - 8); /* padlen - 8 <= 64 */ | 127 | MHD_MD5Update(ctx, PADDING, padlen - 8); /* padlen - 8 <= 64 */ |
128 | MD5Update(ctx, count, 8); | 128 | MHD_MD5Update(ctx, count, 8); |
129 | } | 129 | } |
130 | 130 | ||
131 | /* | 131 | /* |
132 | * Final wrapup--call MD5Pad, fill in digest and zero out ctx. | 132 | * Final wrapup--call MD5Pad, fill in digest and zero out ctx. |
133 | */ | 133 | */ |
134 | void | 134 | void |
135 | MD5Final(unsigned char digest[MD5_DIGEST_SIZE], struct MD5Context *ctx) | 135 | MHD_MD5Final(unsigned char digest[MD5_DIGEST_SIZE], struct MD5Context *ctx) |
136 | { | 136 | { |
137 | int i; | 137 | int i; |
138 | 138 | ||
@@ -161,7 +161,7 @@ MD5Final(unsigned char digest[MD5_DIGEST_SIZE], struct MD5Context *ctx) | |||
161 | 161 | ||
162 | /* | 162 | /* |
163 | * The core of the MD5 algorithm, this alters an existing MD5 hash to | 163 | * The core of the MD5 algorithm, this alters an existing MD5 hash to |
164 | * reflect the addition of 16 longwords of new data. MD5Update blocks | 164 | * reflect the addition of 16 longwords of new data. MHD_MD5Update blocks |
165 | * the data and converts bytes into longwords for this routine. | 165 | * the data and converts bytes into longwords for this routine. |
166 | */ | 166 | */ |
167 | void | 167 | void |
diff --git a/src/lib/md5.h b/src/lib/md5.h index ad1151e9..7a6f84e6 100644 --- a/src/lib/md5.h +++ b/src/lib/md5.h | |||
@@ -10,8 +10,8 @@ | |||
10 | * with every copy. | 10 | * with every copy. |
11 | * | 11 | * |
12 | * To compute the message digest of a chunk of bytes, declare an | 12 | * To compute the message digest of a chunk of bytes, declare an |
13 | * MD5Context structure, pass it to MD5Init, call MD5Update as | 13 | * MD5Context structure, pass it to MHD_MD5Init, call MHD_MD5Update as |
14 | * needed on buffers full of bytes, and then call MD5Final, which | 14 | * needed on buffers full of bytes, and then call MHD_MD5Final, which |
15 | * will fill a supplied 16-byte array with the digest. | 15 | * will fill a supplied 16-byte array with the digest. |
16 | */ | 16 | */ |
17 | 17 | ||
@@ -35,13 +35,13 @@ struct MD5Context | |||
35 | * Start MD5 accumulation. Set bit count to 0 and buffer to mysterious | 35 | * Start MD5 accumulation. Set bit count to 0 and buffer to mysterious |
36 | * initialization constants. | 36 | * initialization constants. |
37 | */ | 37 | */ |
38 | void MD5Init(struct MD5Context *ctx); | 38 | void MHD_MD5Init(struct MD5Context *ctx); |
39 | 39 | ||
40 | /* | 40 | /* |
41 | * Update context to reflect the concatenation of another buffer full | 41 | * Update context to reflect the concatenation of another buffer full |
42 | * of bytes. | 42 | * of bytes. |
43 | */ | 43 | */ |
44 | void MD5Update(struct MD5Context *ctx, const unsigned char *input, size_t len); | 44 | void MHD_MD5Update(struct MD5Context *ctx, const unsigned char *input, size_t len); |
45 | 45 | ||
46 | /* | 46 | /* |
47 | * Pad pad to 64-byte boundary with the bit pattern | 47 | * Pad pad to 64-byte boundary with the bit pattern |
@@ -52,11 +52,11 @@ void MD5Pad(struct MD5Context *ctx); | |||
52 | /* | 52 | /* |
53 | * Final wrapup--call MD5Pad, fill in digest and zero out ctx. | 53 | * Final wrapup--call MD5Pad, fill in digest and zero out ctx. |
54 | */ | 54 | */ |
55 | void MD5Final(unsigned char digest[MD5_DIGEST_SIZE], struct MD5Context *ctx); | 55 | void MHD_MD5Final(unsigned char digest[MD5_DIGEST_SIZE], struct MD5Context *ctx); |
56 | 56 | ||
57 | /* | 57 | /* |
58 | * The core of the MD5 algorithm, this alters an existing MD5 hash to | 58 | * The core of the MD5 algorithm, this alters an existing MD5 hash to |
59 | * reflect the addition of 16 longwords of new data. MD5Update blocks | 59 | * reflect the addition of 16 longwords of new data. MHD_MD5Update blocks |
60 | * the data and converts bytes into longwords for this routine. | 60 | * the data and converts bytes into longwords for this routine. |
61 | */ | 61 | */ |
62 | void MD5Transform(uint32_t state[4], const uint8_t block[MD5_BLOCK_SIZE]); | 62 | void MD5Transform(uint32_t state[4], const uint8_t block[MD5_BLOCK_SIZE]); |
diff --git a/src/microhttpd/digestauth.c b/src/microhttpd/digestauth.c index c2783dd7..ce7edb79 100644 --- a/src/microhttpd/digestauth.c +++ b/src/microhttpd/digestauth.c | |||
@@ -1195,9 +1195,9 @@ MHD_digest_auth_check (struct MHD_Connection *connection, | |||
1195 | da.ctx = &ctx.md5; \ | 1195 | da.ctx = &ctx.md5; \ |
1196 | da.alg = "md5"; \ | 1196 | da.alg = "md5"; \ |
1197 | da.sessionkey = skey.md5; \ | 1197 | da.sessionkey = skey.md5; \ |
1198 | da.init = &MD5Init; \ | 1198 | da.init = &MHD_MD5Init; \ |
1199 | da.update = &MD5Update; \ | 1199 | da.update = &MHD_MD5Update; \ |
1200 | da.digest = &MD5Final; \ | 1200 | da.digest = &MHD_MD5Final; \ |
1201 | break; \ | 1201 | break; \ |
1202 | case MHD_DIGEST_ALG_AUTO: \ | 1202 | case MHD_DIGEST_ALG_AUTO: \ |
1203 | /* auto == SHA256, fall-though thus intentional! */ \ | 1203 | /* auto == SHA256, fall-though thus intentional! */ \ |
@@ -1206,8 +1206,8 @@ MHD_digest_auth_check (struct MHD_Connection *connection, | |||
1206 | da.ctx = &ctx.sha256; \ | 1206 | da.ctx = &ctx.sha256; \ |
1207 | da.alg = "sha-256"; \ | 1207 | da.alg = "sha-256"; \ |
1208 | da.sessionkey = skey.sha256; \ | 1208 | da.sessionkey = skey.sha256; \ |
1209 | da.init = &sha256_init; \ | 1209 | da.init = &MHD_SHA256_init; \ |
1210 | da.update = &sha256_update; \ | 1210 | da.update = &MHD_SHA256_update; \ |
1211 | da.digest = &sha256_finish; \ | 1211 | da.digest = &sha256_finish; \ |
1212 | break; \ | 1212 | break; \ |
1213 | } \ | 1213 | } \ |
diff --git a/src/microhttpd/md5.c b/src/microhttpd/md5.c index 08ed6ee5..25f25372 100644 --- a/src/microhttpd/md5.c +++ b/src/microhttpd/md5.c | |||
@@ -10,8 +10,8 @@ | |||
10 | * with every copy. | 10 | * with every copy. |
11 | * | 11 | * |
12 | * To compute the message digest of a chunk of bytes, declare an | 12 | * To compute the message digest of a chunk of bytes, declare an |
13 | * MD5Context structure, pass it to MD5Init, call MD5Update as | 13 | * MD5Context structure, pass it to MHD_MD5Init, call MHD_MD5Update as |
14 | * needed on buffers full of bytes, and then call MD5Final, which | 14 | * needed on buffers full of bytes, and then call MHD_MD5Final, which |
15 | * will fill a supplied 16-byte array with the digest. | 15 | * will fill a supplied 16-byte array with the digest. |
16 | */ | 16 | */ |
17 | 17 | ||
@@ -34,7 +34,7 @@ | |||
34 | * @param ctx must be a `struct MD5Context *` | 34 | * @param ctx must be a `struct MD5Context *` |
35 | */ | 35 | */ |
36 | void | 36 | void |
37 | MD5Init (void *ctx_) | 37 | MHD_MD5Init (void *ctx_) |
38 | { | 38 | { |
39 | struct MD5Context *ctx = ctx_; | 39 | struct MD5Context *ctx = ctx_; |
40 | 40 | ||
@@ -57,7 +57,7 @@ MD5Transform (uint32_t state[4], | |||
57 | * @param ctx must be a `struct MD5Context *` | 57 | * @param ctx must be a `struct MD5Context *` |
58 | */ | 58 | */ |
59 | void | 59 | void |
60 | MD5Final (void *ctx_, | 60 | MHD_MD5Final (void *ctx_, |
61 | uint8_t digest[MD5_DIGEST_SIZE]) | 61 | uint8_t digest[MD5_DIGEST_SIZE]) |
62 | { | 62 | { |
63 | struct MD5Context *ctx = ctx_; | 63 | struct MD5Context *ctx = ctx_; |
@@ -119,7 +119,7 @@ MD5Final (void *ctx_, | |||
119 | 119 | ||
120 | /** | 120 | /** |
121 | * The core of the MD5 algorithm, this alters an existing MD5 hash to | 121 | * The core of the MD5 algorithm, this alters an existing MD5 hash to |
122 | * reflect the addition of 16 longwords of new data. MD5Update blocks | 122 | * reflect the addition of 16 longwords of new data. MHD_MD5Update blocks |
123 | * the data and converts bytes into longwords for this routine. | 123 | * the data and converts bytes into longwords for this routine. |
124 | */ | 124 | */ |
125 | static void | 125 | static void |
@@ -225,7 +225,7 @@ MD5Transform (uint32_t state[4], | |||
225 | * of bytes. | 225 | * of bytes. |
226 | */ | 226 | */ |
227 | void | 227 | void |
228 | MD5Update (void *ctx_, | 228 | MHD_MD5Update (void *ctx_, |
229 | const uint8_t *input, | 229 | const uint8_t *input, |
230 | size_t len) | 230 | size_t len) |
231 | { | 231 | { |
diff --git a/src/microhttpd/md5.h b/src/microhttpd/md5.h index 0c1acab1..3c1d1c1c 100644 --- a/src/microhttpd/md5.h +++ b/src/microhttpd/md5.h | |||
@@ -10,8 +10,8 @@ | |||
10 | * with every copy. | 10 | * with every copy. |
11 | * | 11 | * |
12 | * To compute the message digest of a chunk of bytes, declare an | 12 | * To compute the message digest of a chunk of bytes, declare an |
13 | * MD5Context structure, pass it to MD5Init, call MD5Update as | 13 | * MD5Context structure, pass it to MHD_MD5Init, call MHD_MD5Update as |
14 | * needed on buffers full of bytes, and then call MD5Final, which | 14 | * needed on buffers full of bytes, and then call MHD_MD5Final, which |
15 | * will fill a supplied 16-byte array with the digest. | 15 | * will fill a supplied 16-byte array with the digest. |
16 | */ | 16 | */ |
17 | 17 | ||
@@ -41,7 +41,7 @@ struct MD5Context | |||
41 | * @param ctx_ must be a `struct MD5Context *` | 41 | * @param ctx_ must be a `struct MD5Context *` |
42 | */ | 42 | */ |
43 | void | 43 | void |
44 | MD5Init (void *ctx_); | 44 | MHD_MD5Init (void *ctx_); |
45 | 45 | ||
46 | 46 | ||
47 | /** | 47 | /** |
@@ -51,7 +51,7 @@ MD5Init (void *ctx_); | |||
51 | * @param ctx_ must be a `struct MD5Context *` | 51 | * @param ctx_ must be a `struct MD5Context *` |
52 | */ | 52 | */ |
53 | void | 53 | void |
54 | MD5Update (void *ctx_, | 54 | MHD_MD5Update (void *ctx_, |
55 | const uint8_t *input, | 55 | const uint8_t *input, |
56 | size_t len); | 56 | size_t len); |
57 | 57 | ||
@@ -62,7 +62,7 @@ MD5Update (void *ctx_, | |||
62 | * @param ctx_ must be a `struct MD5Context *` | 62 | * @param ctx_ must be a `struct MD5Context *` |
63 | */ | 63 | */ |
64 | void | 64 | void |
65 | MD5Final (void *ctx_, | 65 | MHD_MD5Final (void *ctx_, |
66 | uint8_t digest[MD5_DIGEST_SIZE]); | 66 | uint8_t digest[MD5_DIGEST_SIZE]); |
67 | 67 | ||
68 | 68 | ||
diff --git a/src/microhttpd/sha256.c b/src/microhttpd/sha256.c index 244b674a..b47a773b 100644 --- a/src/microhttpd/sha256.c +++ b/src/microhttpd/sha256.c | |||
@@ -42,7 +42,7 @@ | |||
42 | * @param ctx_ must be a `struct sha256_ctx *` | 42 | * @param ctx_ must be a `struct sha256_ctx *` |
43 | */ | 43 | */ |
44 | void | 44 | void |
45 | sha256_init (void *ctx_) | 45 | MHD_SHA256_init (void *ctx_) |
46 | { | 46 | { |
47 | struct sha256_ctx *const ctx = ctx_; | 47 | struct sha256_ctx *const ctx = ctx_; |
48 | /* Initial hash values, see FIPS PUB 180-4 paragraph 5.3.3 */ | 48 | /* Initial hash values, see FIPS PUB 180-4 paragraph 5.3.3 */ |
@@ -236,7 +236,7 @@ sha256_transform (uint32_t H[_SHA256_DIGEST_LENGTH], | |||
236 | * @param length number of bytes in @a data | 236 | * @param length number of bytes in @a data |
237 | */ | 237 | */ |
238 | void | 238 | void |
239 | sha256_update (void *ctx_, | 239 | MHD_SHA256_update (void *ctx_, |
240 | const uint8_t *data, | 240 | const uint8_t *data, |
241 | size_t length) | 241 | size_t length) |
242 | { | 242 | { |
diff --git a/src/microhttpd/sha256.h b/src/microhttpd/sha256.h index 03700080..319277ff 100644 --- a/src/microhttpd/sha256.h +++ b/src/microhttpd/sha256.h | |||
@@ -64,7 +64,7 @@ struct sha256_ctx | |||
64 | * @param ctx_ must be a `struct sha256_ctx *` | 64 | * @param ctx_ must be a `struct sha256_ctx *` |
65 | */ | 65 | */ |
66 | void | 66 | void |
67 | sha256_init (void *ctx_); | 67 | MHD_SHA256_init (void *ctx_); |
68 | 68 | ||
69 | 69 | ||
70 | /** | 70 | /** |
@@ -75,7 +75,7 @@ sha256_init (void *ctx_); | |||
75 | * @param length number of bytes in @a data | 75 | * @param length number of bytes in @a data |
76 | */ | 76 | */ |
77 | void | 77 | void |
78 | sha256_update (void *ctx_, | 78 | MHD_SHA256_update (void *ctx_, |
79 | const uint8_t *data, | 79 | const uint8_t *data, |
80 | size_t length); | 80 | size_t length); |
81 | 81 | ||
diff --git a/src/microhttpd/test_md5.c b/src/microhttpd/test_md5.c index a57fc83e..58eb1c7e 100644 --- a/src/microhttpd/test_md5.c +++ b/src/microhttpd/test_md5.c | |||
@@ -228,9 +228,9 @@ int test1_str(void) | |||
228 | struct MD5Context ctx; | 228 | struct MD5Context ctx; |
229 | uint8_t digest[MD5_DIGEST_SIZE]; | 229 | uint8_t digest[MD5_DIGEST_SIZE]; |
230 | 230 | ||
231 | MD5Init (&ctx); | 231 | MHD_MD5Init (&ctx); |
232 | MD5Update (&ctx, (const uint8_t*)data_units1[i].str_l.str, data_units1[i].str_l.len); | 232 | MHD_MD5Update (&ctx, (const uint8_t*)data_units1[i].str_l.str, data_units1[i].str_l.len); |
233 | MD5Final (&ctx, digest); | 233 | MHD_MD5Final (&ctx, digest); |
234 | num_failed += check_result (__FUNCTION__, i, digest, | 234 | num_failed += check_result (__FUNCTION__, i, digest, |
235 | data_units1[i].digest); | 235 | data_units1[i].digest); |
236 | } | 236 | } |
@@ -245,9 +245,9 @@ int test1_bin(void) | |||
245 | struct MD5Context ctx; | 245 | struct MD5Context ctx; |
246 | uint8_t digest[MD5_DIGEST_SIZE]; | 246 | uint8_t digest[MD5_DIGEST_SIZE]; |
247 | 247 | ||
248 | MD5Init (&ctx); | 248 | MHD_MD5Init (&ctx); |
249 | MD5Update (&ctx, data_units2[i].bin_l.bin, data_units2[i].bin_l.len); | 249 | MHD_MD5Update (&ctx, data_units2[i].bin_l.bin, data_units2[i].bin_l.len); |
250 | MD5Final (&ctx, digest); | 250 | MHD_MD5Final (&ctx, digest); |
251 | num_failed += check_result (__FUNCTION__, i, digest, | 251 | num_failed += check_result (__FUNCTION__, i, digest, |
252 | data_units2[i].digest); | 252 | data_units2[i].digest); |
253 | } | 253 | } |
@@ -264,10 +264,10 @@ int test2_str(void) | |||
264 | uint8_t digest[MD5_DIGEST_SIZE]; | 264 | uint8_t digest[MD5_DIGEST_SIZE]; |
265 | size_t part_s = data_units1[i].str_l.len / 4; | 265 | size_t part_s = data_units1[i].str_l.len / 4; |
266 | 266 | ||
267 | MD5Init (&ctx); | 267 | MHD_MD5Init (&ctx); |
268 | MD5Update (&ctx, (const uint8_t*)data_units1[i].str_l.str, part_s); | 268 | MHD_MD5Update (&ctx, (const uint8_t*)data_units1[i].str_l.str, part_s); |
269 | MD5Update (&ctx, (const uint8_t*)data_units1[i].str_l.str + part_s, data_units1[i].str_l.len - part_s); | 269 | MHD_MD5Update (&ctx, (const uint8_t*)data_units1[i].str_l.str + part_s, data_units1[i].str_l.len - part_s); |
270 | MD5Final (&ctx, digest); | 270 | MHD_MD5Final (&ctx, digest); |
271 | num_failed += check_result (__FUNCTION__, i, digest, | 271 | num_failed += check_result (__FUNCTION__, i, digest, |
272 | data_units1[i].digest); | 272 | data_units1[i].digest); |
273 | } | 273 | } |
@@ -283,10 +283,10 @@ int test2_bin(void) | |||
283 | uint8_t digest[MD5_DIGEST_SIZE]; | 283 | uint8_t digest[MD5_DIGEST_SIZE]; |
284 | size_t part_s = data_units2[i].bin_l.len * 2 / 3; | 284 | size_t part_s = data_units2[i].bin_l.len * 2 / 3; |
285 | 285 | ||
286 | MD5Init (&ctx); | 286 | MHD_MD5Init (&ctx); |
287 | MD5Update (&ctx, data_units2[i].bin_l.bin, part_s); | 287 | MHD_MD5Update (&ctx, data_units2[i].bin_l.bin, part_s); |
288 | MD5Update (&ctx, data_units2[i].bin_l.bin + part_s, data_units2[i].bin_l.len - part_s); | 288 | MHD_MD5Update (&ctx, data_units2[i].bin_l.bin + part_s, data_units2[i].bin_l.len - part_s); |
289 | MD5Final (&ctx, digest); | 289 | MHD_MD5Final (&ctx, digest); |
290 | num_failed += check_result (__FUNCTION__, i, digest, | 290 | num_failed += check_result (__FUNCTION__, i, digest, |
291 | data_units2[i].digest); | 291 | data_units2[i].digest); |
292 | } | 292 | } |
diff --git a/src/microhttpd/test_sha256.c b/src/microhttpd/test_sha256.c index b30ebc22..4eb0cf69 100644 --- a/src/microhttpd/test_sha256.c +++ b/src/microhttpd/test_sha256.c | |||
@@ -253,8 +253,8 @@ int test1_str(void) | |||
253 | struct sha256_ctx ctx; | 253 | struct sha256_ctx ctx; |
254 | uint8_t digest[SHA256_DIGEST_SIZE]; | 254 | uint8_t digest[SHA256_DIGEST_SIZE]; |
255 | 255 | ||
256 | sha256_init (&ctx); | 256 | MHD_SHA256_init (&ctx); |
257 | sha256_update (&ctx, (const uint8_t*)data_units1[i].str_l.str, data_units1[i].str_l.len); | 257 | MHD_SHA256_update (&ctx, (const uint8_t*)data_units1[i].str_l.str, data_units1[i].str_l.len); |
258 | sha256_finish (&ctx, digest); | 258 | sha256_finish (&ctx, digest); |
259 | num_failed += check_result (__FUNCTION__, i, digest, | 259 | num_failed += check_result (__FUNCTION__, i, digest, |
260 | data_units1[i].digest); | 260 | data_units1[i].digest); |
@@ -270,8 +270,8 @@ int test1_bin(void) | |||
270 | struct sha256_ctx ctx; | 270 | struct sha256_ctx ctx; |
271 | uint8_t digest[SHA256_DIGEST_SIZE]; | 271 | uint8_t digest[SHA256_DIGEST_SIZE]; |
272 | 272 | ||
273 | sha256_init (&ctx); | 273 | MHD_SHA256_init (&ctx); |
274 | sha256_update (&ctx, data_units2[i].bin_l.bin, data_units2[i].bin_l.len); | 274 | MHD_SHA256_update (&ctx, data_units2[i].bin_l.bin, data_units2[i].bin_l.len); |
275 | sha256_finish (&ctx, digest); | 275 | sha256_finish (&ctx, digest); |
276 | num_failed += check_result (__FUNCTION__, i, digest, | 276 | num_failed += check_result (__FUNCTION__, i, digest, |
277 | data_units2[i].digest); | 277 | data_units2[i].digest); |
@@ -289,9 +289,9 @@ int test2_str(void) | |||
289 | uint8_t digest[SHA256_DIGEST_SIZE]; | 289 | uint8_t digest[SHA256_DIGEST_SIZE]; |
290 | size_t part_s = data_units1[i].str_l.len / 4; | 290 | size_t part_s = data_units1[i].str_l.len / 4; |
291 | 291 | ||
292 | sha256_init (&ctx); | 292 | MHD_SHA256_init (&ctx); |
293 | sha256_update (&ctx, (const uint8_t*)data_units1[i].str_l.str, part_s); | 293 | MHD_SHA256_update (&ctx, (const uint8_t*)data_units1[i].str_l.str, part_s); |
294 | sha256_update (&ctx, (const uint8_t*)data_units1[i].str_l.str + part_s, data_units1[i].str_l.len - part_s); | 294 | MHD_SHA256_update (&ctx, (const uint8_t*)data_units1[i].str_l.str + part_s, data_units1[i].str_l.len - part_s); |
295 | sha256_finish (&ctx, digest); | 295 | sha256_finish (&ctx, digest); |
296 | num_failed += check_result (__FUNCTION__, i, digest, | 296 | num_failed += check_result (__FUNCTION__, i, digest, |
297 | data_units1[i].digest); | 297 | data_units1[i].digest); |
@@ -308,9 +308,9 @@ int test2_bin(void) | |||
308 | uint8_t digest[SHA256_DIGEST_SIZE]; | 308 | uint8_t digest[SHA256_DIGEST_SIZE]; |
309 | size_t part_s = data_units2[i].bin_l.len * 2 / 3; | 309 | size_t part_s = data_units2[i].bin_l.len * 2 / 3; |
310 | 310 | ||
311 | sha256_init (&ctx); | 311 | MHD_SHA256_init (&ctx); |
312 | sha256_update (&ctx, data_units2[i].bin_l.bin, part_s); | 312 | MHD_SHA256_update (&ctx, data_units2[i].bin_l.bin, part_s); |
313 | sha256_update (&ctx, data_units2[i].bin_l.bin + part_s, data_units2[i].bin_l.len - part_s); | 313 | MHD_SHA256_update (&ctx, data_units2[i].bin_l.bin + part_s, data_units2[i].bin_l.len - part_s); |
314 | sha256_finish (&ctx, digest); | 314 | sha256_finish (&ctx, digest); |
315 | num_failed += check_result (__FUNCTION__, i, digest, | 315 | num_failed += check_result (__FUNCTION__, i, digest, |
316 | data_units2[i].digest); | 316 | data_units2[i].digest); |