From: squidcontrib <56416132+squidcontrib@users.noreply.github.com> Date: Wed, 29 Jan 2020 06:10:04 +0000 (+0000) Subject: Remove pointer from the input of Digest nonce hashes (#549) X-Git-Tag: 4.15-20210522-snapshot~168 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b863968374cc519f2d587a36206446beb56c1d2b;p=thirdparty%2Fsquid.git Remove pointer from the input of Digest nonce hashes (#549) This is a follow-up to #491 (b20ce97), which hashed what was previously revealed as plaintext. Removing the pointer from the input to the hash removes the possibility that someone could recover a pointer by reversing a hash. Having the pointer as input was not adding anything: Squid remembers all outstanding nonces, so it really only requires uniqueness, which is already guaranteed by the authenticateDigestNonceFindNonce loop. --- diff --git a/src/auth/digest/Config.cc b/src/auth/digest/Config.cc index 61e9140bb3..815afbe901 100644 --- a/src/auth/digest/Config.cc +++ b/src/auth/digest/Config.cc @@ -157,10 +157,10 @@ authenticateDigestNonceNew(void) * really bad timing with expiry and creation). Using a random * component in the nonce allows us to loop to find a unique nonce. * We use H(nonce_data) so the nonce is meaningless to the reciever. - * So our nonce looks like hex(H(timestamp,pointertohash,randomdata)) + * So our nonce looks like hex(H(timestamp,randomdata)) * And even if our randomness is not very random we don't really care - * - the timestamp and memory pointer also guarantee local uniqueness - * in the input to the hash function. + * - the timestamp also guarantees local uniqueness in the input to + * the hash function. */ // NP: this will likely produce the same randomness sequences for each worker // since they should all start within the 1-second resolution of seed value. @@ -170,7 +170,6 @@ authenticateDigestNonceNew(void) /* create a new nonce */ newnonce->nc = 0; newnonce->flags.valid = true; - newnonce->noncedata.self = newnonce; newnonce->noncedata.creationtime = current_time.tv_sec; newnonce->noncedata.randomdata = newRandomData(mt); diff --git a/src/auth/digest/Config.h b/src/auth/digest/Config.h index 5a3f548099..505d756bb1 100644 --- a/src/auth/digest/Config.h +++ b/src/auth/digest/Config.h @@ -32,8 +32,6 @@ typedef struct _digest_nonce_h digest_nonce_h; /* data to be encoded into the nonce's hex representation */ struct _digest_nonce_data { time_t creationtime; - /* in memory address of the nonce struct (similar purpose to an ETag) */ - digest_nonce_h *self; uint32_t randomdata; };