diff options
author | Giuseppe D'Angelo <dangelog@gmail.com> | 2012-03-24 08:36:52 +0000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-04-03 19:12:13 +0200 |
commit | 33984e72abf6c3aa1fed37740d8731c96f68d6e2 (patch) | |
tree | 5856aae74d79ee32251bfaa5ec45a867f40ac131 /src/corelib/tools/qhash.h | |
parent | 911eed0f90d84b22db69f43eda33ca4ee4965b52 (diff) |
QHash security fix (1/2): add global QHash 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 adds a global integer, to be used as a seed for the hash
function itself. The seed is randomly initialized the first time a
QHash detaches from shared_null.
Right now the seed is not used at all -- another patch will modify
qHash to make use of it.
[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: I7519e4c02b9c2794d1c14079b01330eb356e9c65
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools/qhash.h')
-rw-r--r-- | src/corelib/tools/qhash.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h index ef003c8a71..1e0c0534ac 100644 --- a/src/corelib/tools/qhash.h +++ b/src/corelib/tools/qhash.h @@ -123,6 +123,7 @@ struct Q_CORE_EXPORT QHashData short userNumBits; short numBits; int numBuckets; + uint seed; uint sharable : 1; uint strictAlignment : 1; uint reserved : 30; |