aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Grin (Karlson2k) <k2k@narod.ru>2022-05-13 15:07:32 +0300
committerEvgeny Grin (Karlson2k) <k2k@narod.ru>2022-05-13 15:18:49 +0300
commit3c63be9051816682ce18b77c4ba912bbfcf56469 (patch)
treee361ccf0f7d3b59d6340b0c2d6fa2055e7f740ba
parent58d1aef753d9d049354aff18c9fdf50cd738d23d (diff)
downloadlibmicrohttpd-3c63be9051816682ce18b77c4ba912bbfcf56469.tar.gz
libmicrohttpd-3c63be9051816682ce18b77c4ba912bbfcf56469.zip
digestauth: cosmetics
-rw-r--r--src/microhttpd/digestauth.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/microhttpd/digestauth.c b/src/microhttpd/digestauth.c
index d870902e..3154088f 100644
--- a/src/microhttpd/digestauth.c
+++ b/src/microhttpd/digestauth.c
@@ -50,6 +50,12 @@
50 */ 50 */
51#define REUSE_TIMEOUT 30 51#define REUSE_TIMEOUT 30
52 52
53/**
54 * The maximum value of artificial timestamp difference to avoid clashes.
55 * The value must be suitable for bitwise AND operation.
56 */
57#define DAUTH_JUMPBACK_MAX (0x7F)
58
53 59
54/** 60/**
55 * 48 bit value in bytes 61 * 48 bit value in bytes
@@ -1048,7 +1054,8 @@ calculate_add_nonce_with_retry (struct MHD_Connection *const connection,
1048 base2 = _MHD_ROTL32 (base2, (((base4 >> 4) ^ base4) % 32)); 1054 base2 = _MHD_ROTL32 (base2, (((base4 >> 4) ^ base4) % 32));
1049 base3 = ((uint16_t) (base2 >> 16)) ^ ((uint16_t) base2); 1055 base3 = ((uint16_t) (base2 >> 16)) ^ ((uint16_t) base2);
1050 base4 = ((uint8_t) (base3 >> 8)) ^ ((uint8_t) base3); 1056 base4 = ((uint8_t) (base3 >> 8)) ^ ((uint8_t) base3);
1051 timestamp2 -= (base4 & 0x7f); /* Use up to 127 ms difference */ 1057 /* Use up to 127 ms difference */
1058 timestamp2 -= (base4 & DAUTH_JUMPBACK_MAX);
1052 if (timestamp1 == timestamp2) 1059 if (timestamp1 == timestamp2)
1053 timestamp2 -= 2; 1060 timestamp2 -= 2;
1054 } 1061 }