Changeset 160228 in webkit


Ignore:
Timestamp:
Dec 6, 2013 10:54:00 AM (10 years ago)
Author:
commit-queue@webkit.org
Message:

Define SHA1 hash size in SHA1.h and use it at various places.
https://bugs.webkit.org/show_bug.cgi?id=125345

Patch by Laszlo Vidacs <lac@inf.u-szeged.hu> on 2013-12-06
Reviewed by Darin Adler.

Use SHA1::hashSize instead of local variables.

Source/JavaScriptCore:

  • bytecode/CodeBlockHash.cpp:

(JSC::CodeBlockHash::CodeBlockHash): use SHA1::hashSize

Source/WebCore:

  • Modules/websockets/WebSocketHandshake.cpp:

(WebCore::WebSocketHandshake::getExpectedWebSocketAccept):

  • platform/network/soup/ResourceHandleSoup.cpp:

(WebCore::HostTLSCertificateSet::computeCertificateHash):

Source/WTF:

  • wtf/SHA1.h: define SHA1 hash size
Location:
trunk/Source
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r160221 r160228  
     12013-12-06  Laszlo Vidacs  <lac@inf.u-szeged.hu>
     2
     3        Define SHA1 hash size in SHA1.h and use it at various places.
     4        https://bugs.webkit.org/show_bug.cgi?id=125345
     5
     6        Reviewed by Darin Adler.
     7
     8        Use SHA1::hashSize instead of local variables.
     9
     10        * bytecode/CodeBlockHash.cpp:
     11        (JSC::CodeBlockHash::CodeBlockHash): use SHA1::hashSize
     12
    1132013-12-05  Michael Saboff  <msaboff@apple.com>
    214
  • trunk/Source/JavaScriptCore/bytecode/CodeBlockHash.cpp

    r153296 r160228  
    4343    SHA1 sha1;
    4444    sha1.addBytes(sourceCode.toUTF8());
    45     Vector<uint8_t, 20> digest;
     45    Vector<uint8_t, SHA1::hashSize> digest;
    4646    sha1.computeHash(digest);
    4747    m_hash += digest[0] | (digest[1] << 8) | (digest[2] << 16) | (digest[3] << 24);
  • trunk/Source/WTF/ChangeLog

    r160210 r160228  
     12013-12-06  Laszlo Vidacs  <lac@inf.u-szeged.hu>
     2
     3        Define SHA1 hash size in SHA1.h and use it at various places.
     4        https://bugs.webkit.org/show_bug.cgi?id=125345
     5
     6        Reviewed by Darin Adler.
     7
     8        Use SHA1::hashSize instead of local variables.
     9
     10        * wtf/SHA1.h: define SHA1 hash size
     11
    1122013-12-05  Iain Lane  <iain.lane@canonical.com>
    213
  • trunk/Source/WTF/wtf/SHA1.h

    r136199 r160228  
    6565    // Compute the hex digest directly. Pass a limit less than 40 if you want a shorter digest.
    6666    WTF_EXPORT_PRIVATE CString computeHexDigest();
    67    
     67
     68    // Size of the SHA1 hash
     69    WTF_EXPORT_PRIVATE static const size_t hashSize = 20;
     70
    6871private:
    6972    void finalize();
  • trunk/Source/WebCore/ChangeLog

    r160227 r160228  
     12013-12-06  Laszlo Vidacs  <lac@inf.u-szeged.hu>
     2
     3        Define SHA1 hash size in SHA1.h and use it at various places.
     4        https://bugs.webkit.org/show_bug.cgi?id=125345
     5
     6        Reviewed by Darin Adler.
     7
     8        Use SHA1::hashSize instead of local variables.
     9
     10        * Modules/websockets/WebSocketHandshake.cpp:
     11        (WebCore::WebSocketHandshake::getExpectedWebSocketAccept):
     12        * platform/network/soup/ResourceHandleSoup.cpp:
     13        (WebCore::HostTLSCertificateSet::computeCertificateHash):
     14
    1152013-12-06  Dan Bernstein  <mitz@apple.com>
    216
  • trunk/Source/WebCore/Modules/websockets/WebSocketHandshake.cpp

    r159390 r160228  
    110110{
    111111    static const char* const webSocketKeyGUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
    112     static const size_t sha1HashSize = 20; // FIXME: This should be defined in SHA1.h.
    113112    SHA1 sha1;
    114113    CString keyData = secWebSocketKey.ascii();
    115114    sha1.addBytes(reinterpret_cast<const uint8_t*>(keyData.data()), keyData.length());
    116115    sha1.addBytes(reinterpret_cast<const uint8_t*>(webSocketKeyGUID), strlen(webSocketKeyGUID));
    117     Vector<uint8_t, sha1HashSize> hash;
     116    Vector<uint8_t, SHA1::hashSize> hash;
    118117    sha1.computeHash(hash);
    119     return base64Encode(hash.data(), sha1HashSize);
     118    return base64Encode(hash.data(), SHA1::hashSize);
    120119}
    121120
  • trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp

    r157624 r160228  
    206206            return String();
    207207
    208         static const size_t sha1HashSize = 20;
    209208        SHA1 sha1;
    210209        sha1.addBytes(certificateData->data, certificateData->len);
    211210
    212         Vector<uint8_t, sha1HashSize> digest;
     211        Vector<uint8_t, SHA1::hashSize> digest;
    213212        sha1.computeHash(digest);
    214213
    215         return base64Encode(reinterpret_cast<const char*>(digest.data()), sha1HashSize);
     214        return base64Encode(reinterpret_cast<const char*>(digest.data()), SHA1::hashSize);
    216215    }
    217216
Note: See TracChangeset for help on using the changeset viewer.