[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] 20/22: digestauth: refactored hashing asserts
From: |
gnunet |
Subject: |
[libmicrohttpd] 20/22: digestauth: refactored hashing asserts |
Date: |
Sun, 25 Sep 2022 17:43:55 +0200 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit 281b22da0e60e642a5ad528e5a25ff7ae9b2d7ed
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Fri Sep 16 13:41:28 2022 +0300
digestauth: refactored hashing asserts
---
src/microhttpd/digestauth.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/src/microhttpd/digestauth.c b/src/microhttpd/digestauth.c
index bc466d87..88668d1d 100644
--- a/src/microhttpd/digestauth.c
+++ b/src/microhttpd/digestauth.c
@@ -336,7 +336,7 @@ struct DigestAlgorithm
#if _DEBUG
bool setup; /**< The structure was set-up */
bool inited; /**< The calculation was initialised */
- bool digest_calculated; /**< The digest was calculated */
+ bool hashing; /**< Some data has been hashed, but digest is not yet
finalised */
#endif /* _DEBUG */
};
@@ -381,7 +381,7 @@ digest_setup (struct DigestAlgorithm *da,
#ifdef _DEBUG
da->setup = false;
da->inited = false;
- da->digest_calculated = false;
+ da->hashing = false;
#endif /* _DEBUG */
if (false
#ifdef MHD_MD5_SUPPORT
@@ -413,9 +413,8 @@ _MHD_static_inline void
digest_init (struct DigestAlgorithm *da)
{
mhd_assert (da->setup);
-#ifdef _DEBUG
- da->digest_calculated = false;
-#endif
+ mhd_assert (! da->hashing);
+ mhd_assert (! da->inited);
#ifdef MHD_MD5_SUPPORT
if (MHD_DIGEST_BASE_ALGO_MD5 == da->algo)
{
@@ -467,7 +466,6 @@ digest_update (struct DigestAlgorithm *da,
size_t length)
{
mhd_assert (da->inited);
- mhd_assert (! da->digest_calculated);
#ifdef MHD_MD5_SUPPORT
if (MHD_DIGEST_BASE_ALGO_MD5 == da->algo)
MHD_MD5_update (&da->ctx.md5_ctx, (const uint8_t *) data, length);
@@ -485,6 +483,9 @@ digest_update (struct DigestAlgorithm *da,
else
#endif /* MHD_SHA512_256_SUPPORT */
mhd_assert (0); /* May not happen */
+#ifdef _DEBUG
+ da->hashing = true;
+#endif
}
@@ -525,7 +526,6 @@ _MHD_static_inline void
digest_calc_hash (struct DigestAlgorithm *da, uint8_t *digest)
{
mhd_assert (da->inited);
- mhd_assert (! da->digest_calculated);
#ifdef MHD_MD5_SUPPORT
if (MHD_DIGEST_BASE_ALGO_MD5 == da->algo)
MHD_MD5_finish (&da->ctx.md5_ctx, digest);
@@ -543,7 +543,8 @@ digest_calc_hash (struct DigestAlgorithm *da, uint8_t
*digest)
#endif /* MHD_SHA512_256_SUPPORT */
mhd_assert (0); /* May not happen */
#ifdef _DEBUG
- da->digest_calculated = true;
+ da->hashing = false;
+ da->inited = false;
#endif
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [libmicrohttpd] 06/22: sha256: implemented compact code version, similarly to SHA-512/256, (continued)
- [libmicrohttpd] 06/22: sha256: implemented compact code version, similarly to SHA-512/256, gnunet, 2022/09/25
- [libmicrohttpd] 05/22: sha256: backported minor optimisations from SHA-512/256, gnunet, 2022/09/25
- [libmicrohttpd] 02/22: Fixed initialisation of old GnuTLS versions, gnunet, 2022/09/25
- [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 <=
- [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, 2022/09/25
- [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