Changeset 206850 in webkit


Ignore:
Timestamp:
Oct 5, 2016 11:39:14 PM (8 years ago)
Author:
Michael Catanzaro
Message:

[SOUP] HostTLSCertificateSet should not use SHA-1 hashes to compare certificates
https://bugs.webkit.org/show_bug.cgi?id=162965

Reviewed by Carlos Garcia Campos.

Use SHA-256 instead.

No new tests, covered by TestSSL.

  • platform/network/soup/SoupNetworkSession.cpp:

(WebCore::HostTLSCertificateSet::computeCertificateHash):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r206849 r206850  
     12016-10-05  Michael Catanzaro  <mcatanzaro@igalia.com>
     2
     3        [SOUP] HostTLSCertificateSet should not use SHA-1 hashes to compare certificates
     4        https://bugs.webkit.org/show_bug.cgi?id=162965
     5
     6        Reviewed by Carlos Garcia Campos.
     7
     8        Use SHA-256 instead.
     9
     10        No new tests, covered by TestSSL.
     11
     12        * platform/network/soup/SoupNetworkSession.cpp:
     13        (WebCore::HostTLSCertificateSet::computeCertificateHash):
     14
    1152016-10-05  Michael Catanzaro  <mcatanzaro@igalia.com>
    216
  • trunk/Source/WebCore/platform/network/soup/SoupNetworkSession.cpp

    r206807 r206850  
    3232#include "AuthenticationChallenge.h"
    3333#include "CookieJarSoup.h"
     34#include "CryptoDigest.h"
    3435#include "FileSystem.h"
    3536#include "GUniquePtrSoup.h"
     
    4041#include <wtf/HashSet.h>
    4142#include <wtf/NeverDestroyed.h>
    42 #include <wtf/SHA1.h>
    4343#include <wtf/text/Base64.h>
    4444#include <wtf/text/CString.h>
     
    7878            return String();
    7979
    80         SHA1 sha1;
    81         sha1.addBytes(certificateData->data, certificateData->len);
    82 
    83         SHA1::Digest digest;
    84         sha1.computeHash(digest);
    85 
    86         return base64Encode(reinterpret_cast<const char*>(digest.data()), SHA1::hashSize);
     80        auto digest = CryptoDigest::create(CryptoDigest::Algorithm::SHA_256);
     81        digest->addBytes(certificateData->data, certificateData->len);
     82
     83        auto hash = digest->computeHash();
     84        return base64Encode(reinterpret_cast<const char*>(hash.data()), hash.size());
    8785    }
    8886
Note: See TracChangeset for help on using the changeset viewer.