commit 3c63be9051816682ce18b77c4ba912bbfcf56469 parent 58d1aef753d9d049354aff18c9fdf50cd738d23d Author: Evgeny Grin (Karlson2k) <k2k@narod.ru> Date: Fri, 13 May 2022 15:07:32 +0300 digestauth: cosmetics Diffstat:
| M | src/microhttpd/digestauth.c | | | 9 | ++++++++- |
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/microhttpd/digestauth.c b/src/microhttpd/digestauth.c @@ -50,6 +50,12 @@ */ #define REUSE_TIMEOUT 30 +/** + * The maximum value of artificial timestamp difference to avoid clashes. + * The value must be suitable for bitwise AND operation. + */ +#define DAUTH_JUMPBACK_MAX (0x7F) + /** * 48 bit value in bytes @@ -1048,7 +1054,8 @@ calculate_add_nonce_with_retry (struct MHD_Connection *const connection, base2 = _MHD_ROTL32 (base2, (((base4 >> 4) ^ base4) % 32)); base3 = ((uint16_t) (base2 >> 16)) ^ ((uint16_t) base2); base4 = ((uint8_t) (base3 >> 8)) ^ ((uint8_t) base3); - timestamp2 -= (base4 & 0x7f); /* Use up to 127 ms difference */ + /* Use up to 127 ms difference */ + timestamp2 -= (base4 & DAUTH_JUMPBACK_MAX); if (timestamp1 == timestamp2) timestamp2 -= 2; }