commit 899e26205a2dfca9885eb87c460c02124922f493
parent 0ea5d514477a8b109a922afe5cdd1343d94c63bd
Author: Christian Grothoff <christian@grothoff.org>
Date: Mon, 17 Jan 2022 10:51:03 +0100
fix capitalization of SHA-256 / MD5 as per RFC 7616 as reported on the mailinglist by Ahmet Kermen
Diffstat:
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/microhttpd/digestauth.c b/src/microhttpd/digestauth.c
@@ -128,7 +128,7 @@ struct DigestAlgorithm
void *ctx;
/**
- * Name of the algorithm, "md5" or "sha-256"
+ * Name of the algorithm, "MD5" or "SHA-256"
*/
const char *alg;
@@ -198,8 +198,8 @@ cvthex (const unsigned char *bin,
* calculate H(A1) from given hash as per RFC2617 spec
* and store the * result in 'sessionkey'.
*
- * @param alg The hash algorithm used, can be "md5" or "md5-sess"
- * or "sha-256" or "sha-256-sess"
+ * @param alg The hash algorithm used, can be "MD5" or "MD5-sess"
+ * or "SHA-256" or "SHA-256-sess"
* Note that the rest of the code does not support the the "-sess" variants!
* @param[in,out] da digest implementation, must match @a alg; the
* da->sessionkey will be initialized to the digest in HEX
@@ -218,9 +218,9 @@ digest_calc_ha1_from_digest (const char *alg,
{
const unsigned int digest_size = da->digest_size;
if ( (MHD_str_equal_caseless_ (alg,
- "md5-sess")) ||
+ "MD5-sess")) ||
(MHD_str_equal_caseless_ (alg,
- "sha-256-sess")) )
+ "SHA-256-sess")) )
{
uint8_t dig[VLA_ARRAY_LEN_DIGEST (digest_size)];
@@ -260,8 +260,8 @@ digest_calc_ha1_from_digest (const char *alg,
* calculate H(A1) from username, realm and password as per RFC2617 spec
* and store the result in 'sessionkey'.
*
- * @param alg The hash algorithm used, can be "md5" or "md5-sess"
- * or "sha-256" or "sha-256-sess"
+ * @param alg The hash algorithm used, can be "MD5" or "MD5-sess"
+ * or "SHA-256" or "SHA-256-sess"
* @param username A `char *' pointer to the username value
* @param realm A `char *' pointer to the realm value
* @param password A `char *' pointer to the password value
@@ -1197,7 +1197,7 @@ MHD_digest_auth_check (struct MHD_Connection *connection,
case MHD_DIGEST_ALG_MD5: \
da.digest_size = MD5_DIGEST_SIZE; \
da.ctx = &ctx.md5; \
- da.alg = "md5"; \
+ da.alg = "MD5"; \
da.sessionkey = skey.md5; \
da.init = &MHD_MD5Init; \
da.update = &MHD_MD5Update; \
@@ -1208,7 +1208,7 @@ MHD_digest_auth_check (struct MHD_Connection *connection,
case MHD_DIGEST_ALG_SHA256: \
da.digest_size = SHA256_DIGEST_SIZE; \
da.ctx = &ctx.sha256; \
- da.alg = "sha-256"; \
+ da.alg = "SHA-256"; \
da.sessionkey = skey.sha256; \
da.init = &MHD_SHA256_init; \
da.update = &MHD_SHA256_update; \