[Win] Implement CryptoDigest
authordbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 10 Mar 2016 01:09:03 +0000 (01:09 +0000)
committerdbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 10 Mar 2016 01:09:03 +0000 (01:09 +0000)
commit20a8c362ed41cf55a4f8d2aadb8d5f14e02bcabe
treebd739be03525e71d6cb68d98eec35d8181d017b8
parentcf4a039d2e2674579be8b5e28ae5c373bc4f1494
[Win] Implement CryptoDigest
https://bugs.webkit.org/show_bug.cgi?id=155247
<rdar://problem/25065843>

Reviewed by Brent Fulgham.

Implement the CryptoDigest abstraction for Windows so that we can compute cryptographically
secure hashes. This will allow us to support Content Security Policy inline script and inline
stylesheet hashes on Windows.

* PlatformWin.cmake: Add file CryptoDigestWin.cpp.
* PlatformWinCairo.cmake: Ditto.
* platform/crypto/win/CryptoDigestWin.cpp: Added.
(WebCore::CryptoDigest::CryptoDigest): Instantiate a CryptoDigestContext object.
(WebCore::CryptoDigest::~CryptoDigest): Destroy the cryptographic service provider and hash
object if non-null.
(WebCore::CryptoDigest::create): Acquire a handle to a cryptographic service provider (HCRYPTPROV)
and a handle to a hash object (HCRYPTHASH).
(WebCore::CryptoDigest::addBytes): Add the contents of the specified buffer to the hash object.
(WebCore::CryptoDigest::computeHash): Compute and return a Vector of bytes that represent the digest.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@197905 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/PlatformWin.cmake
Source/WebCore/PlatformWinCairo.cmake
Source/WebCore/platform/crypto/win/CryptoDigestWin.cpp [new file with mode: 0644]