aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Grin (Karlson2k) <k2k@narod.ru>2022-07-22 08:50:04 +0300
committerEvgeny Grin (Karlson2k) <k2k@narod.ru>2022-07-28 07:21:33 +0300
commit012a2d3bb1ac56ada756e6640a8e7c7cd3120af4 (patch)
treeeb4bf5ba368c6903ff0a8c3b0d84a24b20e25497
parent0194db857cb96909d833435d2aa05f076efdcabb (diff)
downloadlibmicrohttpd-012a2d3bb1ac56ada756e6640a8e7c7cd3120af4.tar.gz
libmicrohttpd-012a2d3bb1ac56ada756e6640a8e7c7cd3120af4.zip
Updated Digest Auth enums in the header
-rw-r--r--src/include/microhttpd.h182
1 files changed, 157 insertions, 25 deletions
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h
index 626d359e..dac05e85 100644
--- a/src/include/microhttpd.h
+++ b/src/include/microhttpd.h
@@ -96,7 +96,7 @@ extern "C"
96 * they are parsed as decimal numbers. 96 * they are parsed as decimal numbers.
97 * Example: 0x01093001 = 1.9.30-1. 97 * Example: 0x01093001 = 1.9.30-1.
98 */ 98 */
99#define MHD_VERSION 0x00097522 99#define MHD_VERSION 0x00097523
100 100
101/* If generic headers don't work on your platform, include headers 101/* If generic headers don't work on your platform, include headers
102 which define 'va_list', 'size_t', 'ssize_t', 'intptr_t', 'off_t', 102 which define 'va_list', 'size_t', 'ssize_t', 'intptr_t', 'off_t',
@@ -4347,23 +4347,26 @@ enum MHD_DigestBaseAlgo
4347 * Invalid hash algorithm value 4347 * Invalid hash algorithm value
4348 */ 4348 */
4349 MHD_DIGEST_BASE_ALGO_INVALID = 0, 4349 MHD_DIGEST_BASE_ALGO_INVALID = 0,
4350
4350 /** 4351 /**
4351 * MD5 hash algorithm. 4352 * MD5 hash algorithm.
4352 * As specified by RFC1321 4353 * As specified by RFC1321
4353 */ 4354 */
4354 MHD_DIGEST_BASE_ALGO_MD5 = (1 << 0), 4355 MHD_DIGEST_BASE_ALGO_MD5 = (1 << 0),
4356
4355 /** 4357 /**
4356 * SHA-256 has algorithm. 4358 * SHA-256 hash algorithm.
4357 * As specified by FIPS PUB 180-4 4359 * As specified by FIPS PUB 180-4
4358 */ 4360 */
4359 MHD_DIGEST_BASE_ALGO_SHA256 = (1 << 1), 4361 MHD_DIGEST_BASE_ALGO_SHA256 = (1 << 1),
4362
4360 /** 4363 /**
4361 * SHA-512/256 has algorithm. 4364 * SHA-512/256 hash algorithm.
4362 * Not supported for calculations, only supported for parsing of 4365 * Not supported for calculations, only supported for parsing of
4363 * client's authorisation headers. 4366 * client's authorisation headers.
4364 */ 4367 */
4365 MHD_DIGEST_BASE_ALGO_SHA512_256 = (1 << 2) 4368 MHD_DIGEST_BASE_ALGO_SHA512_256 = (1 << 2)
4366}; 4369} _MHD_FIXED_FLAGS_ENUM;
4367 4370
4368/** 4371/**
4369 * The flag indicating digest calculation types, 4372 * The flag indicating digest calculation types,
@@ -4373,13 +4376,6 @@ enum MHD_DigestBaseAlgo
4373#define MHD_DIGEST_AUTH_ALGO3_NON_SESSION (1 << 6) 4376#define MHD_DIGEST_AUTH_ALGO3_NON_SESSION (1 << 6)
4374 4377
4375/** 4378/**
4376 * The flag indicating non-session algorithm types,
4377 * like 'MD5' or 'SHA-256'.
4378 * @note Available since #MHD_VERSION 0x00097519
4379 */
4380#define MHD_DIGEST_AUTH_ALGO3_NON_SESSION (1 << 6)
4381
4382/**
4383 * The flag indicating session algorithm types, 4379 * The flag indicating session algorithm types,
4384 * like 'MD5-sess' or 'SHA-256-sess'. 4380 * like 'MD5-sess' or 'SHA-256-sess'.
4385 * @note Available since #MHD_VERSION 0x00097519 4381 * @note Available since #MHD_VERSION 0x00097519
@@ -4390,7 +4386,7 @@ enum MHD_DigestBaseAlgo
4390 * Digest algorithm identification 4386 * Digest algorithm identification
4391 * @warning Do not be confused with #MHD_DigestAuthAlgorithm, 4387 * @warning Do not be confused with #MHD_DigestAuthAlgorithm,
4392 * which uses other values! 4388 * which uses other values!
4393 * @note Available since #MHD_VERSION 0x00097519 4389 * @note Available since #MHD_VERSION 0x00097523
4394 */ 4390 */
4395enum MHD_DigestAuthAlgo3 4391enum MHD_DigestAuthAlgo3
4396{ 4392{
@@ -4400,57 +4396,140 @@ enum MHD_DigestAuthAlgo3
4400 * cannot by identified. 4396 * cannot by identified.
4401 */ 4397 */
4402 MHD_DIGEST_AUTH_ALGO3_INVALID = 0, 4398 MHD_DIGEST_AUTH_ALGO3_INVALID = 0,
4399
4403 /** 4400 /**
4404 * The 'MD5' algorithm. 4401 * The 'MD5' algorithm, non-session version.
4405 */ 4402 */
4406 MHD_DIGEST_AUTH_ALGO3_MD5 = 4403 MHD_DIGEST_AUTH_ALGO3_MD5 =
4407 MHD_DIGEST_BASE_ALGO_MD5 | MHD_DIGEST_AUTH_ALGO3_NON_SESSION, 4404 MHD_DIGEST_BASE_ALGO_MD5 | MHD_DIGEST_AUTH_ALGO3_NON_SESSION,
4405
4408 /** 4406 /**
4409 * The 'MD5-sess' algorithm. 4407 * The 'MD5-sess' algorithm.
4410 * Not supported by MHD. 4408 * Not supported by MHD for authentication.
4411 */ 4409 */
4412 MHD_DIGEST_AUTH_ALGO3_MD5_SESSION = 4410 MHD_DIGEST_AUTH_ALGO3_MD5_SESSION =
4413 MHD_DIGEST_BASE_ALGO_MD5 | MHD_DIGEST_AUTH_ALGO3_SESSION, 4411 MHD_DIGEST_BASE_ALGO_MD5 | MHD_DIGEST_AUTH_ALGO3_SESSION,
4412
4414 /** 4413 /**
4415 * The 'SHA-256' algorithm. 4414 * The 'SHA-256' algorithm, non-session version.
4416 */ 4415 */
4417 MHD_DIGEST_AUTH_ALGO3_SHA256 = 4416 MHD_DIGEST_AUTH_ALGO3_SHA256 =
4418 MHD_DIGEST_BASE_ALGO_SHA256 | MHD_DIGEST_AUTH_ALGO3_NON_SESSION, 4417 MHD_DIGEST_BASE_ALGO_SHA256 | MHD_DIGEST_AUTH_ALGO3_NON_SESSION,
4418
4419 /** 4419 /**
4420 * The 'SHA-256-sess' algorithm. 4420 * The 'SHA-256-sess' algorithm.
4421 * Not supported by MHD. 4421 * Not supported by MHD for authentication.
4422 */ 4422 */
4423 MHD_DIGEST_AUTH_ALGO3_SHA256_SESSION = 4423 MHD_DIGEST_AUTH_ALGO3_SHA256_SESSION =
4424 MHD_DIGEST_BASE_ALGO_SHA256 | MHD_DIGEST_AUTH_ALGO3_SESSION, 4424 MHD_DIGEST_BASE_ALGO_SHA256 | MHD_DIGEST_AUTH_ALGO3_SESSION,
4425
4425 /** 4426 /**
4426 * The 'SHA-512-256' (SHA-512/256) algorithm. 4427 * The 'SHA-512-256' (SHA-512/256) algorithm.
4427 * Not supported by MHD. 4428 * Not supported by MHD for authentication.
4428 */ 4429 */
4429 MHD_DIGEST_AUTH_ALGO3_SHA512_256 = 4430 MHD_DIGEST_AUTH_ALGO3_SHA512_256 =
4430 MHD_DIGEST_BASE_ALGO_SHA512_256 | MHD_DIGEST_AUTH_ALGO3_NON_SESSION, 4431 MHD_DIGEST_BASE_ALGO_SHA512_256 | MHD_DIGEST_AUTH_ALGO3_NON_SESSION,
4432
4431 /** 4433 /**
4432 * The 'SHA-512-256-sess' (SHA-512/256 session) algorithm. 4434 * The 'SHA-512-256-sess' (SHA-512/256 session) algorithm.
4433 * Not supported by MHD. 4435 * Not supported by MHD for authentication.
4434 */ 4436 */
4435 MHD_DIGEST_AUTH_ALGO3_SHA512_256_SESSION = 4437 MHD_DIGEST_AUTH_ALGO3_SHA512_256_SESSION =
4436 MHD_DIGEST_BASE_ALGO_SHA512_256 | MHD_DIGEST_AUTH_ALGO3_SESSION, 4438 MHD_DIGEST_BASE_ALGO_SHA512_256 | MHD_DIGEST_AUTH_ALGO3_SESSION,
4439};
4440
4441/**
4442 * Digest algorithm identification, allow multiple selection.
4443 *
4444 * #MHD_DigestAuthAlgo3 always can be casted to #MHD_DigestAuthMultiAlgo3, but
4445 * not vice versa.
4446 *
4447 * @note Available since #MHD_VERSION 0x00097523
4448 */
4449enum MHD_DigestAuthMultiAlgo3
4450{
4451 /**
4452 * Unknown or wrong algorithm type.
4453 */
4454 MHD_DIGEST_AUTH_MULT_ALGO3_INVALID = MHD_DIGEST_AUTH_ALGO3_INVALID,
4455
4456 /**
4457 * The 'MD5' algorithm, non-session version.
4458 */
4459 MHD_DIGEST_AUTH_MULT_ALGO3_MD5 = MHD_DIGEST_AUTH_ALGO3_MD5,
4460
4461 /**
4462 * The 'MD5-sess' algorithm.
4463 * Not supported by MHD for authentication.
4464 * Reserved value.
4465 */
4466 MHD_DIGEST_AUTH_MULT_ALGO3_MD5_SESSION = MHD_DIGEST_AUTH_ALGO3_MD5_SESSION,
4467
4468 /**
4469 * The 'SHA-256' algorithm, non-session version.
4470 */
4471 MHD_DIGEST_AUTH_MULT_ALGO3_SHA256 = MHD_DIGEST_AUTH_ALGO3_SHA256,
4472
4473 /**
4474 * The 'SHA-256-sess' algorithm.
4475 * Not supported by MHD for authentication.
4476 * Reserved value.
4477 */
4478 MHD_DIGEST_AUTH_MULT_ALGO3_SHA256_SESSION =
4479 MHD_DIGEST_AUTH_ALGO3_SHA256_SESSION,
4480
4481 /**
4482 * The 'SHA-512-256' (SHA-512/256) algorithm.
4483 * Not supported by MHD for authentication.
4484 * Reserved value.
4485 */
4486 MHD_DIGEST_AUTH_MULT_ALGO3_SHA512_256 = MHD_DIGEST_AUTH_ALGO3_SHA512_256,
4487
4488 /**
4489 * The 'SHA-512-256-sess' (SHA-512/256 session) algorithm.
4490 * Not supported by MHD for authentication.
4491 * Reserved value.
4492 */
4493 MHD_DIGEST_AUTH_MULT_ALGO3_SHA512_256_SESSION =
4494 MHD_DIGEST_AUTH_ALGO3_SHA512_256_SESSION,
4495
4437 /** 4496 /**
4438 * Any non-session algorithm, MHD will choose. 4497 * Any non-session algorithm, MHD will choose.
4439 */ 4498 */
4440 MHD_DIGEST_AUTH_ALGO3_ANY_NON_SESSION = 4499 MHD_DIGEST_AUTH_MULT_ALGO3_ANY_NON_SESSION =
4441 (0x3F) | MHD_DIGEST_AUTH_ALGO3_NON_SESSION, 4500 (0x3F) | MHD_DIGEST_AUTH_ALGO3_NON_SESSION,
4501
4442 /** 4502 /**
4443 * Any session algorithm, MHD will choose. 4503 * Any session algorithm, MHD will choose.
4444 * Not supported by MHD. 4504 * Not supported by MHD.
4505 * Reserved value.
4445 */ 4506 */
4446 MHD_DIGEST_AUTH_ALGO3_ANY_SESSION = 4507 MHD_DIGEST_AUTH_MULT_ALGO3_ANY_SESSION =
4447 (0x3F) | MHD_DIGEST_AUTH_ALGO3_SESSION, 4508 (0x3F) | MHD_DIGEST_AUTH_ALGO3_SESSION,
4509
4510 /**
4511 * The 'MD5' algorithm, session or non-session.
4512 * Not supported by MHD.
4513 * Reserved value.
4514 */
4515 MHD_DIGEST_AUTH_MULT_ALGO3_MD5_ANY =
4516 MHD_DIGEST_AUTH_MULT_ALGO3_MD5 | MHD_DIGEST_AUTH_MULT_ALGO3_MD5_SESSION,
4517
4518 /**
4519 * The 'SHA-256' algorithm, session or non-session.
4520 * Not supported by MHD.
4521 * Reserved value.
4522 */
4523 MHD_DIGEST_AUTH_MULT_ALGO3_SHA256_ANY =
4524 MHD_DIGEST_AUTH_MULT_ALGO3_SHA256
4525 | MHD_DIGEST_AUTH_MULT_ALGO3_SHA256_SESSION,
4526
4448 /** 4527 /**
4449 * Any algorithm, MHD will choose. 4528 * Any algorithm, MHD will choose.
4450 */ 4529 */
4451 MHD_DIGEST_AUTH_ALGO3_ANY = 4530 MHD_DIGEST_AUTH_MULT_ALGO3_ANY =
4452 (0x3F) | MHD_DIGEST_AUTH_ALGO3_NON_SESSION | MHD_DIGEST_AUTH_ALGO3_SESSION 4531 (0x3F) | MHD_DIGEST_AUTH_ALGO3_NON_SESSION | MHD_DIGEST_AUTH_ALGO3_SESSION
4453} _MHD_FLAGS_ENUM; 4532};
4454 4533
4455/** 4534/**
4456 * The type of username used by client in Digest Authorization header 4535 * The type of username used by client in Digest Authorization header
@@ -4464,10 +4543,12 @@ enum MHD_DigestAuthUsernameType
4464 * This should be treated as an error. 4543 * This should be treated as an error.
4465 */ 4544 */
4466 MHD_DIGEST_AUTH_UNAME_TYPE_MISSING = 0, 4545 MHD_DIGEST_AUTH_UNAME_TYPE_MISSING = 0,
4546
4467 /** 4547 /**
4468 * The 'username' parameter is used to specify the username. 4548 * The 'username' parameter is used to specify the username.
4469 */ 4549 */
4470 MHD_DIGEST_AUTH_UNAME_TYPE_STANDARD = 1, 4550 MHD_DIGEST_AUTH_UNAME_TYPE_STANDARD = 1,
4551
4471 /** 4552 /**
4472 * The username is specified by 'username*' parameter with 4553 * The username is specified by 'username*' parameter with
4473 * the extended notation (see RFC 5987 #section-3.2.1). 4554 * the extended notation (see RFC 5987 #section-3.2.1).
@@ -4475,11 +4556,13 @@ enum MHD_DigestAuthUsernameType
4475 * the way how username value is encoded in the header. 4556 * the way how username value is encoded in the header.
4476 */ 4557 */
4477 MHD_DIGEST_AUTH_UNAME_TYPE_EXTENDED = 2, 4558 MHD_DIGEST_AUTH_UNAME_TYPE_EXTENDED = 2,
4559
4478 /** 4560 /**
4479 * The username provided in form of 'userhash' as 4561 * The username provided in form of 'userhash' as
4480 * specified by RFC 7616 #section-3.4.4. 4562 * specified by RFC 7616 #section-3.4.4.
4481 */ 4563 */
4482 MHD_DIGEST_AUTH_UNAME_TYPE_USERHASH = 3, 4564 MHD_DIGEST_AUTH_UNAME_TYPE_USERHASH = 3,
4565
4483 /** 4566 /**
4484 * The invalid combination of username parameters are used by client. 4567 * The invalid combination of username parameters are used by client.
4485 * Either: 4568 * Either:
@@ -4503,20 +4586,69 @@ enum MHD_DigestAuthQOP
4503 * cannot by identified. 4586 * cannot by identified.
4504 */ 4587 */
4505 MHD_DIGEST_AUTH_QOP_INVALID = 0, 4588 MHD_DIGEST_AUTH_QOP_INVALID = 0,
4589
4506 /** 4590 /**
4507 * No QOP value. 4591 * No QOP parameter.
4592 * Match old RFC 2069 specification.
4593 * Not supported by MHD for authentication.
4508 */ 4594 */
4509 MHD_DIGEST_AUTH_QOP_NONE = 1 << 0, 4595 MHD_DIGEST_AUTH_QOP_NONE = 1 << 0,
4596
4510 /** 4597 /**
4511 * The 'auth' QOP type. 4598 * The 'auth' QOP type.
4512 */ 4599 */
4513 MHD_DIGEST_AUTH_QOP_AUTH = 1 << 1, 4600 MHD_DIGEST_AUTH_QOP_AUTH = 1 << 1,
4601
4514 /** 4602 /**
4515 * The 'auth-int' QOP type. 4603 * The 'auth-int' QOP type.
4516 * Not supported by MHD. 4604 * Not supported by MHD for authentication.
4517 */ 4605 */
4518 MHD_DIGEST_AUTH_QOP_AUTH_INT = 1 << 2 4606 MHD_DIGEST_AUTH_QOP_AUTH_INT = 1 << 2
4519} _MHD_FLAGS_ENUM; 4607} _MHD_FIXED_FLAGS_ENUM;
4608
4609/**
4610 * The QOP ('quality of protection') types, multiple selection.
4611 *
4612 * #MHD_DigestAuthQOP always can be casted to #MHD_DigestAuthMultiQOP, but
4613 * not vice versa.
4614 *
4615 * @note Available since #MHD_VERSION 0x00097523
4616 */
4617enum MHD_DigestAuthMultiQOP
4618{
4619 /**
4620 * Invalid/unknown QOP.
4621 */
4622 MHD_DIGEST_AUTH_MULT_QOP_INVALID = MHD_DIGEST_AUTH_QOP_INVALID,
4623
4624 /**
4625 * No QOP parameter.
4626 * Match old RFC 2069 specification.
4627 * Not supported by MHD.
4628 * Reserved value.
4629 */
4630 MHD_DIGEST_AUTH_MULT_QOP_NONE = MHD_DIGEST_AUTH_QOP_NONE,
4631
4632 /**
4633 * The 'auth' QOP type.
4634 */
4635 MHD_DIGEST_AUTH_MULT_QOP_AUTH = MHD_DIGEST_AUTH_QOP_AUTH,
4636
4637 /**
4638 * The 'auth-int' QOP type.
4639 * Not supported by MHD.
4640 * Reserved value.
4641 */
4642 MHD_DIGEST_AUTH_MULT_QOP_AUTH_INT = MHD_DIGEST_AUTH_QOP_AUTH_INT,
4643
4644 /**
4645 * Any 'auth' QOP type ('auth' or 'auth-int').
4646 * Not supported by MHD.
4647 * Reserved value.
4648 */
4649 MHD_DIGEST_AUTH_MULT_QOP_AUTH_ANY =
4650 MHD_DIGEST_AUTH_QOP_AUTH | MHD_DIGEST_AUTH_QOP_AUTH_INT
4651} _MHD_FIXED_ENUM;
4520 4652
4521/** 4653/**
4522 * The invalid value of 'nc' parameter in client Digest Authorization header. 4654 * The invalid value of 'nc' parameter in client Digest Authorization header.