libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

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

{md5,sha256}_ext.c: comments added

Diffstat:
Msrc/microhttpd/md5_ext.c | 6++++--
Msrc/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 @@ -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 @@ -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 */ }