From: Giuseppe D'Angelo Date: Sat, 24 Mar 2012 08:50:02 +0000 (+0000) Subject: QHash security fix (2/2): enable QHash random seed X-Git-Tag: 071012110112~1235^2^2~34 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c01eaa438200edc9a3bbcd8ae1e8ded058bea268;p=profile%2Fivi%2Fqtbase.git QHash security fix (2/2): enable QHash random seed Algorithmic complexity attacks against hash tables have been known since 2003 (cf. [1, 2]), and they have been left unpatched for years until the 2011 attacks [3] against many libraries / (reference) implementations of programming languages. This patch makes qHash use the QHash seed introduced in the previous commits, thus truly randomizing bucketing in QHash. [1] http://www.cs.rice.edu/~scrosby/hash/CrosbyWallach_UsenixSec2003.pdf [2] http://perldoc.perl.org/perlsec.html#Algorithmic-Complexity-Attacks [3] http://www.ocert.org/advisories/ocert-2011-003.html Task-number: QTBUG-23529 Change-Id: Ibee9cf6aa820af5d777fcde478647665c728052a Reviewed-by: Jason McDonald --- diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h index e318872..fe6a8df 100644 --- a/src/corelib/tools/qhash.h +++ b/src/corelib/tools/qhash.h @@ -874,7 +874,7 @@ Q_OUTOFLINE_TEMPLATE typename QHash::Node **QHash::findNode(cons uint h = 0; if (d->numBuckets || ahp) { - h = qHash(akey, 0); + h = qHash(akey, d->seed); if (ahp) *ahp = h; }