[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] 11/22: test_{md5,sha256,sha512_256}: added more checks
From: |
gnunet |
Subject: |
[libmicrohttpd] 11/22: test_{md5,sha256,sha512_256}: added more checks |
Date: |
Sun, 25 Sep 2022 17:43:46 +0200 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit 9a3067c30fbd89609036d9fbdc1d93a7a8706abf
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Wed Sep 14 13:07:24 2022 +0300
test_{md5,sha256,sha512_256}: added more checks
---
src/microhttpd/test_md5.c | 4 ++++
src/microhttpd/test_sha256.c | 4 ++++
src/microhttpd/test_sha512_256.c | 4 ++++
3 files changed, 12 insertions(+)
diff --git a/src/microhttpd/test_md5.c b/src/microhttpd/test_md5.c
index 1b3041e7..61e61e9d 100644
--- a/src/microhttpd/test_md5.c
+++ b/src/microhttpd/test_md5.c
@@ -335,9 +335,12 @@ test2_str (void)
size_t part_s = data_units1[i].str_l.len / 4;
MHD_MD5_init (&ctx);
+ MHD_MD5_update (&ctx, (const uint8_t *) "", 0);
MHD_MD5_update (&ctx, (const uint8_t *) data_units1[i].str_l.str, part_s);
+ MHD_MD5_update (&ctx, (const uint8_t *) "", 0);
MHD_MD5_update (&ctx, (const uint8_t *) data_units1[i].str_l.str + part_s,
data_units1[i].str_l.len - part_s);
+ MHD_MD5_update (&ctx, (const uint8_t *) "", 0);
MHD_MD5_finish (&ctx, digest);
num_failed += check_result (__FUNCTION__, i, digest,
data_units1[i].digest);
@@ -360,6 +363,7 @@ test2_bin (void)
MHD_MD5_init (&ctx);
MHD_MD5_update (&ctx, data_units2[i].bin_l.bin, part_s);
+ MHD_MD5_update (&ctx, (const uint8_t *) "", 0);
MHD_MD5_update (&ctx, data_units2[i].bin_l.bin + part_s,
data_units2[i].bin_l.len - part_s);
MHD_MD5_finish (&ctx, digest);
diff --git a/src/microhttpd/test_sha256.c b/src/microhttpd/test_sha256.c
index 74061cfb..599f425f 100644
--- a/src/microhttpd/test_sha256.c
+++ b/src/microhttpd/test_sha256.c
@@ -382,11 +382,14 @@ test2_str (void)
size_t part_s = data_units1[i].str_l.len / 4;
MHD_SHA256_init (&ctx);
+ MHD_SHA256_update (&ctx, (const uint8_t *) "", 0);
MHD_SHA256_update (&ctx, (const uint8_t *) data_units1[i].str_l.str,
part_s);
+ MHD_SHA256_update (&ctx, (const uint8_t *) "", 0);
MHD_SHA256_update (&ctx, (const uint8_t *) data_units1[i].str_l.str
+ part_s,
data_units1[i].str_l.len - part_s);
+ MHD_SHA256_update (&ctx, (const uint8_t *) "", 0);
MHD_SHA256_finish (&ctx, digest);
num_failed += check_result (__FUNCTION__, i, digest,
data_units1[i].digest);
@@ -409,6 +412,7 @@ test2_bin (void)
MHD_SHA256_init (&ctx);
MHD_SHA256_update (&ctx, data_units2[i].bin_l.bin, part_s);
+ MHD_SHA256_update (&ctx, (const uint8_t *) "", 0);
MHD_SHA256_update (&ctx, data_units2[i].bin_l.bin + part_s,
data_units2[i].bin_l.len - part_s);
MHD_SHA256_finish (&ctx, digest);
diff --git a/src/microhttpd/test_sha512_256.c b/src/microhttpd/test_sha512_256.c
index 85c3a0ee..1de90c3e 100644
--- a/src/microhttpd/test_sha512_256.c
+++ b/src/microhttpd/test_sha512_256.c
@@ -489,11 +489,14 @@ test2_str (void)
size_t part_s = data_units1[i].str_l.len / 4;
MHD_SHA512_256_init (&ctx);
+ MHD_SHA512_256_update (&ctx, (const uint8_t *) "", 0);
MHD_SHA512_256_update (&ctx, (const uint8_t *) data_units1[i].str_l.str,
part_s);
+ MHD_SHA512_256_update (&ctx, (const uint8_t *) "", 0);
MHD_SHA512_256_update (&ctx, (const uint8_t *) data_units1[i].str_l.str
+ part_s,
data_units1[i].str_l.len - part_s);
+ MHD_SHA512_256_update (&ctx, (const uint8_t *) "", 0);
MHD_SHA512_256_finish (&ctx, digest);
num_failed += check_result (__FUNCTION__, i, digest,
data_units1[i].digest);
@@ -516,6 +519,7 @@ test2_bin (void)
MHD_SHA512_256_init (&ctx);
MHD_SHA512_256_update (&ctx, data_units2[i].bin_l.bin, part_s);
+ MHD_SHA512_256_update (&ctx, (const uint8_t *) "", 0);
MHD_SHA512_256_update (&ctx, data_units2[i].bin_l.bin + part_s,
data_units2[i].bin_l.len - part_s);
MHD_SHA512_256_finish (&ctx, digest);
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [libmicrohttpd] 10/22: md5: added compact code version, (continued)
- [libmicrohttpd] 10/22: md5: added compact code version, gnunet, 2022/09/25
- [libmicrohttpd] 14/22: test_{md5,sha{256,512_256}}: added long test sequence, gnunet, 2022/09/25
- [libmicrohttpd] 07/22: sha512_256: additional trick for compacter code; doxy and comment fixes, gnunet, 2022/09/25
- [libmicrohttpd] 09/22: md5: improved performance of the first round on LE arches, gnunet, 2022/09/25
- [libmicrohttpd] 17/22: digestauth: removed redundant check and report, gnunet, 2022/09/25
- [libmicrohttpd] 12/22: test_sha{256,512_256}: minor fixes, gnunet, 2022/09/25
- [libmicrohttpd] 08/22: md5: replaced public domain MD5 implementation with our own implementation, gnunet, 2022/09/25
- [libmicrohttpd] 20/22: digestauth: refactored hashing asserts, gnunet, 2022/09/25
- [libmicrohttpd] 15/22: sha{256, 512_256}: improved performance of the first steps on BE arches, gnunet, 2022/09/25
- [libmicrohttpd] 22/22: w32: sync projects with autotools, gnunet, 2022/09/25
- [libmicrohttpd] 11/22: test_{md5,sha256,sha512_256}: added more checks,
gnunet <=
- [libmicrohttpd] 16/22: test_{md5,sha{256,512_256}}: re-use of the context structure, gnunet, 2022/09/25
- [libmicrohttpd] 19/22: digestauth: used weak pseudo-random generators to avoid nonces clashes, gnunet, 2022/09/25
- [libmicrohttpd] 21/22: Implemented support for hash calculation by GnuTLS lib functions, gnunet, 2022/09/25
- [libmicrohttpd] 13/22: test_md5: added more test sequences, gnunet, 2022/09/25
- [libmicrohttpd] 18/22: digestauth: changed "slot used" detection logic, gnunet, 2022/09/25