• D
    Replace hashing algorithm with murmurhash · 72b41397
    Daniel P. Berrange 提交于
    Recent discussions have illustrated the potential for DOS attacks
    with the hash table implementations used by most languages and
    libraries.
    
       https://lwn.net/Articles/474912/
    
    libvirt has an internal hash table impl, and uses hash tables for
    a variety of purposes. The hash key generation code is pretty
    simple and thus not strongly collision resistant.
    
    This patch replaces the current libvirt hash key generator with
    the (public domain) Murmurhash3 code. In addition every hash
    table now gets a random seed value which is used to perturb the
    hashing code. This should make it impossible to mount any
    practical attack against libvirt hashing code.
    
    * bootstrap.conf: Import bitrotate module
    * src/Makefile.am: Add virhashcode.[ch]
    * src/util/util.c: Make virRandom() return a fixed 32 bit
      integer value.
    * src/util/hash.c, src/util/hash.h, src/util/cgroup.c: Replace
      hash code generation with a call to virHashCodeGen()
    * src/util/virhashcode.h, src/util/virhashcode.c: Add a new
      virHashCodeGen() API using the Murmurhash3 algorithm.
    72b41397
virhash.c 17.1 KB