]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Remove pointer from the input of Digest nonce hashes (#549)
authorsquidcontrib <56416132+squidcontrib@users.noreply.github.com>
Wed, 29 Jan 2020 06:10:04 +0000 (06:10 +0000)
committerAmos Jeffries <yadij@users.noreply.github.com>
Thu, 19 Mar 2020 10:49:01 +0000 (23:49 +1300)
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.

src/auth/digest/Config.cc
src/auth/digest/Config.h

index 61e9140bb36de53cce0a867ed1ae61a6ab6058bb..815afbe901897816ebcaa8b006f95f224ba8b88e 100644 (file)
@@ -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);
 
index 5a3f548099c70744737b5df68e2d4e7a319cb076..505d756bb17460a17181ea9d0ae661f81ae4d8ea 100644 (file)
@@ -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;
 };