commit eeb4166266659b3aa9134c70200478d1b9ab52ff
parent 46357a33c1c8bf16ca8649e2b3b18c720f54da2e
Author: Christian Grothoff <christian@grothoff.org>
Date: Mon, 17 Apr 2023 10:55:22 +0200
-fix bogus assert, use proper libgcrypt type
Diffstat:
2 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/src/microhttpd/md5_ext.c b/src/microhttpd/md5_ext.c
@@ -22,8 +22,6 @@
* @brief Wrapper for MD5 calculation performed by TLS library
* @author Karlson2k (Evgeny Grin)
*/
-
-#include <gnutls/crypto.h>
#include "md5_ext.h"
#include "mhd_assert.h"
@@ -39,14 +37,16 @@ void
MHD_MD5_init_one_time (struct Md5CtxExt *ctx)
{
ctx->handle = NULL;
- ctx->ext_error = gnutls_hash_init (&ctx->handle, GNUTLS_DIG_MD5);
+ ctx->ext_error = gnutls_hash_init (&ctx->handle,
+ GNUTLS_DIG_MD5);
if ((0 != ctx->ext_error) && (NULL != ctx->handle))
{
gnutls_free (ctx->handle);
ctx->handle = NULL;
}
else
- mhd_assert (NULL != ctx->handle);
+ mhd_assert ( (NULL != ctx->handle) ||
+ (0 != ctx->ext_error) );
}
diff --git a/src/microhttpd/md5_ext.h b/src/microhttpd/md5_ext.h
@@ -16,13 +16,11 @@
License along with GNU libmicrohttpd.
If not, see <http://www.gnu.org/licenses/>.
*/
-
/**
* @file microhttpd/md5_ext.h
* @brief Wrapper declarations for MD5 calculation performed by TLS library
* @author Karlson2k (Evgeny Grin)
*/
-
#ifndef MHD_MD5_EXT_H
#define MHD_MD5_EXT_H 1
@@ -31,6 +29,7 @@
#ifdef HAVE_STDDEF_H
#include <stddef.h> /* for size_t */
#endif /* HAVE_STDDEF_H */
+#include <gnutls/crypto.h>
/**
* Size of MD5 resulting digest in bytes
@@ -38,8 +37,6 @@
*/
#define MD5_DIGEST_SIZE (16)
-/* Actual declaration is in GnuTLS lib header */
-struct hash_hd_st;
/**
* Indicates that struct Md5CtxExt has 'ext_error'
@@ -51,7 +48,7 @@ struct hash_hd_st;
*/
struct Md5CtxExt
{
- struct hash_hd_st *handle; /**< Hash calculation handle */
+ gnutls_hash_hd_t handle; /**< Hash calculation handle */
int ext_error; /**< Non-zero if external error occurs during init or hashing */
};