libmicrohttpd2

HTTP server C library (MHD 2.x, alpha)
Log | Files | Refs | README | LICENSE

commit 76f520489e77b865eb22f9816fe184491f4065f7
parent 16ced8f07f9ebc7dd26e3dd82ea47d61228311df
Author: Christian Grothoff <christian@grothoff.org>
Date:   Thu, 25 Dec 2025 12:30:08 +0100

-better mbedtls version test

Diffstat:
Msrc/mhd2/mhd_str.h | 19++++++++++---------
Msrc/mhd2/sha512_256_ext_mbedtls.c | 7++++---
Msrc/tests/unit/test_str_to_value.c | 10++++++----
3 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/src/mhd2/mhd_str.h b/src/mhd2/mhd_str.h @@ -202,6 +202,7 @@ mhd_str_to_uppercase_bin_n (size_t size, const char *restrict inbuff, char *restrict outbuff) MHD_FN_PAR_NONNULL_ALL_ MHD_FN_PAR_IN_SIZE_ (2,1) MHD_FN_PAR_OUT_SIZE_ (3,1); + #endif /* mhd_HAVE_STR_TO_UPPER */ /** @@ -320,7 +321,7 @@ MHD_FN_PAR_IN_SIZE_ (3,4); * @param[out] out_val pointer to uint_fast64_t to store result of conversion * @return non-zero number of characters processed on succeed, * zero if no digit is found or resulting value is larger - * then possible to store in uint_fast64_t + * than possible to store in uint_fast64_t */ MHD_INTERNAL size_t mhd_str_to_uint64 (const char *restrict str, @@ -339,7 +340,7 @@ MHD_FN_PAR_OUT_ (2); * @param[out] out_val pointer to uint_fast64_t to store result of conversion * @return non-zero number of characters processed on succeed, * zero if no digit is found or resulting value is larger - * then possible to store in uint_fast64_t + * than possible to store in uint_fast64_t */ MHD_INTERNAL size_t mhd_str_to_uint64_n (const char *restrict str, @@ -356,7 +357,7 @@ MHD_FN_PAR_NONNULL_ALL_ MHD_FN_PAR_IN_SIZE_ (1,2) MHD_FN_PAR_OUT_ (3); * @param[out] out_val pointer to uint_fast32_t to store result of conversion * @return non-zero number of characters processed on succeed, * zero if no digit is found or resulting value is larger - * then possible to store in uint_fast32_t + * than possible to store in uint_fast32_t */ MHD_INTERNAL size_t mhd_strx_to_uint32 (const char *restrict str, @@ -376,7 +377,7 @@ MHD_FN_PAR_IN_ (1) MHD_FN_PAR_OUT_ (2); * @param[out] out_val pointer to uint_fast32_t to store result of conversion * @return non-zero number of characters processed on succeed, * zero if no digit is found or resulting value is larger - * then possible to store in uint_fast32_t + * than possible to store in uint_fast32_t */ MHD_INTERNAL size_t mhd_strx_to_uint32_n (const char *restrict str, @@ -393,7 +394,7 @@ MHD_FN_PAR_NONNULL_ALL_ MHD_FN_PAR_IN_SIZE_ (1,2) MHD_FN_PAR_OUT_ (3); * @param[out] out_val pointer to uint_fast64_t to store result of conversion * @return non-zero number of characters processed on succeed, * zero if no digit is found or resulting value is larger - * then possible to store in uint_fast64_t + * than possible to store in uint_fast64_t */ MHD_INTERNAL size_t mhd_strx_to_uint64 (const char *restrict str, @@ -413,7 +414,7 @@ MHD_FN_PAR_IN_ (1) MHD_FN_PAR_OUT_ (2); * @param[out] out_val pointer to uint_fast64_t to store result of conversion * @return non-zero number of characters processed on succeed, * zero if no digit is found or resulting value is larger - * then possible to store in uint_fast64_t + * than possible to store in uint_fast64_t */ MHD_INTERNAL size_t mhd_strx_to_uint64_n (const char *restrict str, @@ -439,7 +440,7 @@ MHD_FN_PAR_NONNULL_ALL_ MHD_FN_PAR_IN_SIZE_ (1,2) MHD_FN_PAR_OUT_ (3); * @param base the numeric base, 10 or 16 * @return non-zero number of characters processed on succeed, * zero if no digit is found, resulting value is larger - * then @a max_val, @a val_size is not 4 or 8 + * than @a max_val, @a val_size is not 4 or 8 * or @a base is not 10 or 16 */ MHD_INTERNAL size_t @@ -982,7 +983,7 @@ mhd_str_starts_with_token_req_param ( struct mhd_BufferConst *restrict par_value, bool *restrict par_value_needs_unquote) MHD_FN_PAR_NONNULL_ALL_ -MHD_FN_PAR_IN_(1) MHD_FN_PAR_IN_(2) MHD_FN_PAR_IN_(3) -MHD_FN_PAR_OUT_(4) MHD_FN_PAR_OUT_ (5); +MHD_FN_PAR_IN_ (1) MHD_FN_PAR_IN_ (2) MHD_FN_PAR_IN_ (3) +MHD_FN_PAR_OUT_ (4) MHD_FN_PAR_OUT_ (5); #endif /* MHD_STR_H */ diff --git a/src/mhd2/sha512_256_ext_mbedtls.c b/src/mhd2/sha512_256_ext_mbedtls.c @@ -44,6 +44,7 @@ #include <stdlib.h> #include <string.h> #define MBEDTLS_ALLOW_PRIVATE_ACCESS 1 +#include <mbedtls/build_info.h> #include <mbedtls/sha512.h> #define MHD_SHA512_256_Context mbedtls_sha512_context #include "sha512_256_ext.h" @@ -70,7 +71,7 @@ init512_256 (struct mhd_Sha512_256CtxExt *ctx) mbedtls_sha512_init (ctx->handle); /* is384=0 for SHA-512 */ -#if MBEDTLS_CONFIG_VERSION >= 0x04000000 +#if MBEDTLS_VERSION_MAJOR >= 4 ctx->ext_error = mbedtls_sha512_starts_ret (ctx->handle, 0); if (0 != ctx->ext_error) @@ -138,7 +139,7 @@ mhd_SHA512_256_update (struct mhd_Sha512_256CtxExt *ctx, const uint8_t *data) { mhd_assert (0 != size); -#if MBEDTLS_CONFIG_VERSION >= 0x04000000 +#if MBEDTLS_VERSION_MAJOR >= 4 if (0 == ctx->ext_error) ctx->ext_error = mbedtls_sha512_update_ret (ctx->handle, data, @@ -165,7 +166,7 @@ mhd_SHA512_256_finish_reset (struct mhd_Sha512_256CtxExt *ctx, if (0 == ctx->ext_error) { -#if MBEDTLS_CONFIG_VERSION >= 0x04000000 +#if MBEDTLS_VERSION_MAJOR >= 4 ctx->ext_error = mbedtls_sha512_finish_ret (ctx->handle, full_digest); #else diff --git a/src/tests/unit/test_str_to_value.c b/src/tests/unit/test_str_to_value.c @@ -1154,9 +1154,11 @@ check_strx_to_uint32_valid (void) fprintf (stderr, "FAILED: mhd_strx_to_uint32(\"%s\", ->0x%" PRIX64 ") returned %" - PRIuPTR ", while expecting %d." - " Locale: %s\n", n_prnt (t->str.str), (uint64_t) rv, - (uintptr_t) rs, (int) t->num_of_digt, + PRIuPTR " digits, while expecting %d." + " Locale: %s\n", + n_prnt (t->str.str), (uint64_t) rv, + (uintptr_t) rs, + (int) t->num_of_digt, get_current_locale_str ()); } if (rv != t->val) @@ -1220,7 +1222,7 @@ check_strx_to_uint32_all_chars (void) fprintf (stderr, "FAILED: mhd_strx_to_uint32(\"%s\", ->0x%" PRIX64 ") returned %" - PRIuPTR ", while expecting zero." + PRIuPTR " digits, while expecting zero." " Locale: %s\n", n_prnt (test_str), (uint64_t) rv, (uintptr_t) rs, get_current_locale_str ()); }