gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libmicrohttpd] branch master updated: {md5,sha256}_ext.c: comments adde


From: gnunet
Subject: [libmicrohttpd] branch master updated: {md5,sha256}_ext.c: comments added
Date: Mon, 17 Apr 2023 14:42:35 +0200

This is an automated email from the git hooks/post-receive script.

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

The following commit(s) were added to refs/heads/master by this push:
     new e1b0fc41 {md5,sha256}_ext.c: comments added
e1b0fc41 is described below

commit e1b0fc4101c2a81a46246e7d27babbf9b4491ce6
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Mon Apr 17 15:42:25 2023 +0300

    {md5,sha256}_ext.c: comments added
---
 src/microhttpd/md5_ext.c    | 6 ++++--
 src/microhttpd/sha256_ext.c | 5 ++++-
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/microhttpd/md5_ext.c b/src/microhttpd/md5_ext.c
index a5de6c22..b7fff4b8 100644
--- a/src/microhttpd/md5_ext.c
+++ b/src/microhttpd/md5_ext.c
@@ -41,12 +41,14 @@ MHD_MD5_init_one_time (struct Md5CtxExt *ctx)
                                      GNUTLS_DIG_MD5);
   if ((0 != ctx->ext_error) && (NULL != ctx->handle))
   {
+    /* GnuTLS may return initialisation error and set the handle at the
+       same time. Such handle cannot be used for calculations.
+       Note: GnuTLS may also return an error and NOT set the handle. */
     gnutls_free (ctx->handle);
     ctx->handle = NULL;
   }
   else
-    mhd_assert ( (NULL != ctx->handle) ||
-                 (0 != ctx->ext_error) );
+    mhd_assert (NULL != ctx->handle); /* If error is not returned, the handle 
must not be NULL */
 }
 
 
diff --git a/src/microhttpd/sha256_ext.c b/src/microhttpd/sha256_ext.c
index d1c2a6ed..f8cae555 100644
--- a/src/microhttpd/sha256_ext.c
+++ b/src/microhttpd/sha256_ext.c
@@ -42,11 +42,14 @@ MHD_SHA256_init_one_time (struct Sha256CtxExt *ctx)
   ctx->ext_error = gnutls_hash_init (&ctx->handle, GNUTLS_DIG_SHA256);
   if ((0 != ctx->ext_error) && (NULL != ctx->handle))
   {
+    /* GnuTLS may return initialisation error and set the handle at the
+       same time. Such handle cannot be used for calculations.
+       Note: GnuTLS may also return an error and NOT set the handle. */
     gnutls_free (ctx->handle);
     ctx->handle = NULL;
   }
   else
-    mhd_assert (NULL != ctx->handle);
+    mhd_assert (NULL != ctx->handle); /* If error is not returned, the handle 
must not be NULL */
 }
 
 

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]