<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[197575] trunk/Source/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/197575">197575</a></dd>
<dt>Author</dt> <dd>dbates@webkit.org</dd>
<dt>Date</dt> <dd>2016-03-04 11:26:23 -0800 (Fri, 04 Mar 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Move CryptoDigest to WebCore/platform
https://bugs.webkit.org/show_bug.cgi?id=155008
&lt;rdar://problem/24969787&gt;

Reviewed by Brent Fulgham.

CryptoDigest provides a platform-independent interface for interacting with platform-
specific cryptographic hashing services. We currently make use of this code as part
of the implementation of Web Crypto. This code will also be beneficial as part of
implementing support for Content Security Policy inline script and inline stylesheet
hashes. We should move CryptoDigest to WebCore/platform to convey that it a general
purpose platform abstraction.

* CMakeLists.txt: Add include directory WebCore/platform/crypto.
* PlatformEfl.cmake: Add file platform/crypto/gnutls/CryptoDigestGnuTLS.cpp and
remove file crypto/gnutls/CryptoDigestGnuTLS.cpp.
* PlatformGTK.cmake: Ditto.
* PlatformMac.cmake: Add file platform/crypto/mac/CryptoDigestMac.cpp and
remove file crypto/mac/CryptoDigestMac.cpp.
* WebCore.xcodeproj/project.pbxproj:
* crypto/algorithms/CryptoAlgorithmSHA1.cpp:
(WebCore::CryptoAlgorithmSHA1::digest): Substitute &quot;CryptoDigest::Algorithm&quot; for &quot;CryptoAlgorithmIdentifier&quot;.
* crypto/algorithms/CryptoAlgorithmSHA224.cpp:
(WebCore::CryptoAlgorithmSHA224::digest): Ditto.
* crypto/algorithms/CryptoAlgorithmSHA256.cpp:
(WebCore::CryptoAlgorithmSHA256::digest): Ditto.
* crypto/algorithms/CryptoAlgorithmSHA384.cpp:
(WebCore::CryptoAlgorithmSHA384::digest): Ditto.
* crypto/algorithms/CryptoAlgorithmSHA512.cpp:
(WebCore::CryptoAlgorithmSHA512::digest): Ditto.
* crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp:
(WebCore::getCryptoDigestAlgorithm): Converts a CryptoAlgorithmIdentifier enumerator to a
CryptoDigest::Algorithm enumerator, if applicable.
(WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign): Write in terms of WebCore::getCryptoDigestAlgorithm().
(WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformVerify): Ditto.
* platform/crypto/CryptoDigest.h: Renamed from Source/WebCore/crypto/CryptoDigest.h. Also added enum CryptoDigest::Algorithm
and changed constructor to take this enum.
* platform/crypto/gnutls/CryptoDigestGnuTLS.cpp: Renamed from Source/WebCore/crypto/gnutls/CryptoDigestGnuTLS.cpp.
(WebCore::CryptoDigest::CryptoDigest): Substitute &quot;CryptoDigest::Algorithm&quot; for &quot;CryptoAlgorithmIdentifier&quot;.
(WebCore::CryptoDigest::~CryptoDigest): Ditto.
(WebCore::CryptoDigest::create): Ditto.
(WebCore::CryptoDigest::addBytes): Ditto.
(WebCore::CryptoDigest::computeHash): Ditto.
* platform/crypto/mac/CryptoDigestMac.cpp: Renamed from Source/WebCore/crypto/mac/CryptoDigestMac.cpp.
(WebCore::toSHA1Context): Ditto.
(WebCore::toSHA224Context): Ditto.
(WebCore::toSHA256Context): Ditto.
(WebCore::toSHA384Context): Ditto.
(WebCore::toSHA512Context): Ditto.
(WebCore::CryptoDigest::CryptoDigest): Ditto.
(WebCore::CryptoDigest::~CryptoDigest): Ditto.
(WebCore::CryptoDigest::create): Ditto.
(WebCore::CryptoDigest::addBytes): Ditto.
(WebCore::CryptoDigest::computeHash): Ditto.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreCMakeListstxt">trunk/Source/WebCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorePlatformEflcmake">trunk/Source/WebCore/PlatformEfl.cmake</a></li>
<li><a href="#trunkSourceWebCorePlatformGTKcmake">trunk/Source/WebCore/PlatformGTK.cmake</a></li>
<li><a href="#trunkSourceWebCorePlatformMaccmake">trunk/Source/WebCore/PlatformMac.cmake</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmSHA1cpp">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA1.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmSHA224cpp">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA224.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmSHA256cpp">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA256.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmSHA384cpp">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA384.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmSHA512cpp">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA512.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptomacCryptoAlgorithmRSASSA_PKCS1_v1_5Maccpp">trunk/Source/WebCore/crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li>trunk/Source/WebCore/platform/crypto/</li>
<li><a href="#trunkSourceWebCoreplatformcryptoCryptoDigesth">trunk/Source/WebCore/platform/crypto/CryptoDigest.h</a></li>
<li>trunk/Source/WebCore/platform/crypto/gnutls/</li>
<li><a href="#trunkSourceWebCoreplatformcryptognutlsCryptoDigestGnuTLScpp">trunk/Source/WebCore/platform/crypto/gnutls/CryptoDigestGnuTLS.cpp</a></li>
<li>trunk/Source/WebCore/platform/crypto/mac/</li>
<li><a href="#trunkSourceWebCoreplatformcryptomacCryptoDigestMaccpp">trunk/Source/WebCore/platform/crypto/mac/CryptoDigestMac.cpp</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebCorecryptoCryptoDigesth">trunk/Source/WebCore/crypto/CryptoDigest.h</a></li>
<li><a href="#trunkSourceWebCorecryptognutlsCryptoDigestGnuTLScpp">trunk/Source/WebCore/crypto/gnutls/CryptoDigestGnuTLS.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptomacCryptoDigestMaccpp">trunk/Source/WebCore/crypto/mac/CryptoDigestMac.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/CMakeLists.txt (197574 => 197575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/CMakeLists.txt        2016-03-04 19:13:25 UTC (rev 197574)
+++ trunk/Source/WebCore/CMakeLists.txt        2016-03-04 19:26:23 UTC (rev 197575)
</span><span class="lines">@@ -69,6 +69,7 @@
</span><span class="cx">     &quot;${WEBCORE_DIR}/platform&quot;
</span><span class="cx">     &quot;${WEBCORE_DIR}/platform/animation&quot;
</span><span class="cx">     &quot;${WEBCORE_DIR}/platform/audio&quot;
</span><ins>+    &quot;${WEBCORE_DIR}/platform/crypto&quot;
</ins><span class="cx">     &quot;${WEBCORE_DIR}/platform/graphics&quot;
</span><span class="cx">     &quot;${WEBCORE_DIR}/platform/graphics/cpu/arm&quot;
</span><span class="cx">     &quot;${WEBCORE_DIR}/platform/graphics/cpu/arm/filters&quot;
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (197574 => 197575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-03-04 19:13:25 UTC (rev 197574)
+++ trunk/Source/WebCore/ChangeLog        2016-03-04 19:26:23 UTC (rev 197575)
</span><span class="lines">@@ -1,3 +1,60 @@
</span><ins>+2016-03-04  Daniel Bates  &lt;dabates@apple.com&gt;
+
+        Move CryptoDigest to WebCore/platform
+        https://bugs.webkit.org/show_bug.cgi?id=155008
+        &lt;rdar://problem/24969787&gt;
+
+        Reviewed by Brent Fulgham.
+
+        CryptoDigest provides a platform-independent interface for interacting with platform-
+        specific cryptographic hashing services. We currently make use of this code as part
+        of the implementation of Web Crypto. This code will also be beneficial as part of
+        implementing support for Content Security Policy inline script and inline stylesheet
+        hashes. We should move CryptoDigest to WebCore/platform to convey that it a general
+        purpose platform abstraction.
+
+        * CMakeLists.txt: Add include directory WebCore/platform/crypto.
+        * PlatformEfl.cmake: Add file platform/crypto/gnutls/CryptoDigestGnuTLS.cpp and
+        remove file crypto/gnutls/CryptoDigestGnuTLS.cpp.
+        * PlatformGTK.cmake: Ditto.
+        * PlatformMac.cmake: Add file platform/crypto/mac/CryptoDigestMac.cpp and
+        remove file crypto/mac/CryptoDigestMac.cpp.
+        * WebCore.xcodeproj/project.pbxproj:
+        * crypto/algorithms/CryptoAlgorithmSHA1.cpp:
+        (WebCore::CryptoAlgorithmSHA1::digest): Substitute &quot;CryptoDigest::Algorithm&quot; for &quot;CryptoAlgorithmIdentifier&quot;.
+        * crypto/algorithms/CryptoAlgorithmSHA224.cpp:
+        (WebCore::CryptoAlgorithmSHA224::digest): Ditto.
+        * crypto/algorithms/CryptoAlgorithmSHA256.cpp:
+        (WebCore::CryptoAlgorithmSHA256::digest): Ditto.
+        * crypto/algorithms/CryptoAlgorithmSHA384.cpp:
+        (WebCore::CryptoAlgorithmSHA384::digest): Ditto.
+        * crypto/algorithms/CryptoAlgorithmSHA512.cpp:
+        (WebCore::CryptoAlgorithmSHA512::digest): Ditto.
+        * crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp:
+        (WebCore::getCryptoDigestAlgorithm): Converts a CryptoAlgorithmIdentifier enumerator to a
+        CryptoDigest::Algorithm enumerator, if applicable.
+        (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign): Write in terms of WebCore::getCryptoDigestAlgorithm().
+        (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformVerify): Ditto.
+        * platform/crypto/CryptoDigest.h: Renamed from Source/WebCore/crypto/CryptoDigest.h. Also added enum CryptoDigest::Algorithm
+        and changed constructor to take this enum.
+        * platform/crypto/gnutls/CryptoDigestGnuTLS.cpp: Renamed from Source/WebCore/crypto/gnutls/CryptoDigestGnuTLS.cpp.
+        (WebCore::CryptoDigest::CryptoDigest): Substitute &quot;CryptoDigest::Algorithm&quot; for &quot;CryptoAlgorithmIdentifier&quot;.
+        (WebCore::CryptoDigest::~CryptoDigest): Ditto.
+        (WebCore::CryptoDigest::create): Ditto.
+        (WebCore::CryptoDigest::addBytes): Ditto.
+        (WebCore::CryptoDigest::computeHash): Ditto.
+        * platform/crypto/mac/CryptoDigestMac.cpp: Renamed from Source/WebCore/crypto/mac/CryptoDigestMac.cpp.
+        (WebCore::toSHA1Context): Ditto.
+        (WebCore::toSHA224Context): Ditto.
+        (WebCore::toSHA256Context): Ditto.
+        (WebCore::toSHA384Context): Ditto.
+        (WebCore::toSHA512Context): Ditto.
+        (WebCore::CryptoDigest::CryptoDigest): Ditto.
+        (WebCore::CryptoDigest::~CryptoDigest): Ditto.
+        (WebCore::CryptoDigest::create): Ditto.
+        (WebCore::CryptoDigest::addBytes): Ditto.
+        (WebCore::CryptoDigest::computeHash): Ditto.
+
</ins><span class="cx"> 2016-03-04  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Whitespace causes font-variant: all-small-caps to synthesize
</span></span></pre></div>
<a id="trunkSourceWebCorePlatformEflcmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/PlatformEfl.cmake (197574 => 197575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/PlatformEfl.cmake        2016-03-04 19:13:25 UTC (rev 197574)
+++ trunk/Source/WebCore/PlatformEfl.cmake        2016-03-04 19:26:23 UTC (rev 197575)
</span><span class="lines">@@ -88,6 +88,8 @@
</span><span class="cx"> 
</span><span class="cx">     platform/audio/efl/AudioBusEfl.cpp
</span><span class="cx"> 
</span><ins>+    platform/crypto/gnutls/CryptoDigestGnuTLS.cpp
+
</ins><span class="cx">     platform/efl/BatteryProviderEfl.cpp
</span><span class="cx">     platform/efl/CursorEfl.cpp
</span><span class="cx">     platform/efl/DragDataEfl.cpp
</span><span class="lines">@@ -432,7 +434,6 @@
</span><span class="cx">         crypto/gnutls/CryptoAlgorithmRSASSA_PKCS1_v1_5GnuTLS.cpp
</span><span class="cx">         crypto/gnutls/CryptoAlgorithmRSA_OAEPGnuTLS.cpp
</span><span class="cx">         crypto/gnutls/CryptoAlgorithmRegistryGnuTLS.cpp
</span><del>-        crypto/gnutls/CryptoDigestGnuTLS.cpp
</del><span class="cx">         crypto/gnutls/CryptoKeyRSAGnuTLS.cpp
</span><span class="cx">         crypto/gnutls/SerializedCryptoKeyWrapGnuTLS.cpp
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorePlatformGTKcmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/PlatformGTK.cmake (197574 => 197575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/PlatformGTK.cmake        2016-03-04 19:13:25 UTC (rev 197574)
+++ trunk/Source/WebCore/PlatformGTK.cmake        2016-03-04 19:26:23 UTC (rev 197575)
</span><span class="lines">@@ -82,6 +82,8 @@
</span><span class="cx"> 
</span><span class="cx">     platform/audio/glib/AudioBusGLib.cpp
</span><span class="cx"> 
</span><ins>+    platform/crypto/gnutls/CryptoDigestGnuTLS.cpp
+
</ins><span class="cx">     platform/geoclue/GeolocationProviderGeoclue1.cpp
</span><span class="cx">     platform/geoclue/GeolocationProviderGeoclue2.cpp
</span><span class="cx"> 
</span><span class="lines">@@ -807,7 +809,6 @@
</span><span class="cx">         crypto/gnutls/CryptoAlgorithmRSASSA_PKCS1_v1_5GnuTLS.cpp
</span><span class="cx">         crypto/gnutls/CryptoAlgorithmRSA_OAEPGnuTLS.cpp
</span><span class="cx">         crypto/gnutls/CryptoAlgorithmRegistryGnuTLS.cpp
</span><del>-        crypto/gnutls/CryptoDigestGnuTLS.cpp
</del><span class="cx">         crypto/gnutls/CryptoKeyRSAGnuTLS.cpp
</span><span class="cx">         crypto/gnutls/SerializedCryptoKeyWrapGnuTLS.cpp
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorePlatformMaccmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/PlatformMac.cmake (197574 => 197575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/PlatformMac.cmake        2016-03-04 19:13:25 UTC (rev 197574)
+++ trunk/Source/WebCore/PlatformMac.cmake        2016-03-04 19:26:23 UTC (rev 197575)
</span><span class="lines">@@ -218,7 +218,6 @@
</span><span class="cx">     crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp
</span><span class="cx">     crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp
</span><span class="cx">     crypto/mac/CryptoAlgorithmRegistryMac.cpp
</span><del>-    crypto/mac/CryptoDigestMac.cpp
</del><span class="cx">     crypto/mac/CryptoKeyMac.cpp
</span><span class="cx">     crypto/mac/CryptoKeyRSAMac.cpp
</span><span class="cx">     crypto/mac/SerializedCryptoKeyWrapMac.mm
</span><span class="lines">@@ -340,6 +339,8 @@
</span><span class="cx">     platform/cocoa/VNodeTrackerCocoa.cpp
</span><span class="cx">     platform/cocoa/WebCoreNSErrorExtras.mm
</span><span class="cx"> 
</span><ins>+    platform/crypto/mac/CryptoDigestMac.cpp
+
</ins><span class="cx">     platform/graphics/DisplayRefreshMonitor.cpp
</span><span class="cx">     platform/graphics/DisplayRefreshMonitorManager.cpp
</span><span class="cx">     platform/graphics/FontPlatformData.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (197574 => 197575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-03-04 19:13:25 UTC (rev 197574)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-03-04 19:26:23 UTC (rev 197575)
</span><span class="lines">@@ -14550,8 +14550,8 @@
</span><span class="cx">                 E1F80B89183172A2007885C3 /* JSCryptoKeyPairCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCryptoKeyPairCustom.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E1F80B8B183172B5007885C3 /* JSCryptoKeyPair.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCryptoKeyPair.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E1F80B8C183172B5007885C3 /* JSCryptoKeyPair.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCryptoKeyPair.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                E1FE13621834351100892F13 /* CryptoDigestMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CryptoDigestMac.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
-                E1FE136618343A1000892F13 /* CryptoDigest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CryptoDigest.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><ins>+                E1FE13621834351100892F13 /* CryptoDigestMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CryptoDigestMac.cpp; path = crypto/mac/CryptoDigestMac.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                E1FE136618343A1000892F13 /* CryptoDigest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CryptoDigest.h; path = crypto/CryptoDigest.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 E1FE1368183FE1AB00892F13 /* CryptoAlgorithmRSA_OAEP.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CryptoAlgorithmRSA_OAEP.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E1FE1369183FE1AB00892F13 /* CryptoAlgorithmRSA_OAEP.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CryptoAlgorithmRSA_OAEP.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E1FE136E183FECF000892F13 /* CryptoAlgorithmRSA_OAEPMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CryptoAlgorithmRSA_OAEPMac.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -22791,6 +22791,7 @@
</span><span class="cx">                                 FD31604012B026A300C1A359 /* audio */,
</span><span class="cx">                                 1AE42F670AA4B8CB00C8612D /* cf */,
</span><span class="cx">                                 A5C974CE11485FDA0066F2AB /* cocoa */,
</span><ins>+                                CE50D8CE1C8932ED0072EA5A /* crypto */,
</ins><span class="cx">                                 B2A015910AF6CD53006BCE0E /* graphics */,
</span><span class="cx">                                 A59E3C1B11580F340072928E /* ios */,
</span><span class="cx">                                 6582A14809999D6C00BEEB6D /* mac */,
</span><span class="lines">@@ -23176,6 +23177,23 @@
</span><span class="cx">                         path = ios;
</span><span class="cx">                         sourceTree = &quot;&lt;group&gt;&quot;;
</span><span class="cx">                 };
</span><ins>+                CE50D8CE1C8932ED0072EA5A /* crypto */ = {
+                        isa = PBXGroup;
+                        children = (
+                                CE50D8CF1C8932FB0072EA5A /* mac */,
+                                E1FE136618343A1000892F13 /* CryptoDigest.h */,
+                        );
+                        name = crypto;
+                        sourceTree = &quot;&lt;group&gt;&quot;;
+                };
+                CE50D8CF1C8932FB0072EA5A /* mac */ = {
+                        isa = PBXGroup;
+                        children = (
+                                E1FE13621834351100892F13 /* CryptoDigestMac.cpp */,
+                        );
+                        name = mac;
+                        sourceTree = &quot;&lt;group&gt;&quot;;
+                };
</ins><span class="cx">                 DF9AFD6F13FC31B00015FEB7 /* objc */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><span class="lines">@@ -23230,7 +23248,6 @@
</span><span class="cx">                                 E1FE136E183FECF000892F13 /* CryptoAlgorithmRSA_OAEPMac.cpp */,
</span><span class="cx">                                 E1233F0E185A4130008DFAF5 /* CryptoAlgorithmRSAES_PKCS1_v1_5Mac.cpp */,
</span><span class="cx">                                 E1C266D618317AB4003F8B33 /* CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp */,
</span><del>-                                E1FE13621834351100892F13 /* CryptoDigestMac.cpp */,
</del><span class="cx">                                 E19AC3F8182566F700349426 /* CryptoKeyMac.cpp */,
</span><span class="cx">                                 E164FAA418315E1A00DB4E61 /* CryptoKeyRSAMac.cpp */,
</span><span class="cx">                                 E18DF33618AAF14D00773E59 /* SerializedCryptoKeyWrapMac.mm */,
</span><span class="lines">@@ -23421,7 +23438,6 @@
</span><span class="cx">                                 E1C657261816F9FE00256CDD /* CryptoAlgorithmParameters.h */,
</span><span class="cx">                                 E1FF8F6A180DB5BE00132674 /* CryptoAlgorithmRegistry.cpp */,
</span><span class="cx">                                 E1FF8F6B180DB5BE00132674 /* CryptoAlgorithmRegistry.h */,
</span><del>-                                E1FE136618343A1000892F13 /* CryptoDigest.h */,
</del><span class="cx">                                 E157A8E218173A3A009F821D /* CryptoKey.cpp */,
</span><span class="cx">                                 E157A8E318173A3A009F821D /* CryptoKey.h */,
</span><span class="cx">                                 E157A8DC18172C2C009F821D /* CryptoKey.idl */,
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoCryptoDigesth"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/crypto/CryptoDigest.h (197574 => 197575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/CryptoDigest.h        2016-03-04 19:13:25 UTC (rev 197574)
+++ trunk/Source/WebCore/crypto/CryptoDigest.h        2016-03-04 19:26:23 UTC (rev 197575)
</span><span class="lines">@@ -1,57 +0,0 @@
</span><del>-/*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef CryptoDigest_h
-#define CryptoDigest_h
-
-#include &quot;CryptoAlgorithmIdentifier.h&quot;
-#include &lt;wtf/Noncopyable.h&gt;
-#include &lt;wtf/Vector.h&gt;
-
-#if ENABLE(SUBTLE_CRYPTO)
-
-namespace WebCore {
-
-struct CryptoDigestContext;
-
-class CryptoDigest {
-    WTF_MAKE_NONCOPYABLE(CryptoDigest);
-public:
-    static std::unique_ptr&lt;CryptoDigest&gt; create(CryptoAlgorithmIdentifier);
-    ~CryptoDigest();
-
-    void addBytes(const void* input, size_t length);
-    Vector&lt;uint8_t&gt; computeHash();
-
-private:
-    CryptoDigest();
-
-    std::unique_ptr&lt;CryptoDigestContext&gt; m_context;
-};
-
-} // namespace WebCore
-
-#endif // ENABLE(SUBTLE_CRYPTO)
-#endif // CryptoDigest_h
</del></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmSHA1cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA1.cpp (197574 => 197575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA1.cpp        2016-03-04 19:13:25 UTC (rev 197574)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA1.cpp        2016-03-04 19:26:23 UTC (rev 197575)
</span><span class="lines">@@ -54,7 +54,7 @@
</span><span class="cx"> 
</span><span class="cx"> void CryptoAlgorithmSHA1::digest(const CryptoAlgorithmParameters&amp;, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;)
</span><span class="cx"> {
</span><del>-    std::unique_ptr&lt;CryptoDigest&gt; digest = CryptoDigest::create(CryptoAlgorithmIdentifier::SHA_1);
</del><ins>+    std::unique_ptr&lt;CryptoDigest&gt; digest = CryptoDigest::create(CryptoDigest::Algorithm::SHA_1);
</ins><span class="cx">     if (!digest) {
</span><span class="cx">         failureCallback();
</span><span class="cx">         return;
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmSHA224cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA224.cpp (197574 => 197575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA224.cpp        2016-03-04 19:13:25 UTC (rev 197574)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA224.cpp        2016-03-04 19:26:23 UTC (rev 197575)
</span><span class="lines">@@ -54,7 +54,7 @@
</span><span class="cx"> 
</span><span class="cx"> void CryptoAlgorithmSHA224::digest(const CryptoAlgorithmParameters&amp;, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;)
</span><span class="cx"> {
</span><del>-    std::unique_ptr&lt;CryptoDigest&gt; digest = CryptoDigest::create(CryptoAlgorithmIdentifier::SHA_224);
</del><ins>+    std::unique_ptr&lt;CryptoDigest&gt; digest = CryptoDigest::create(CryptoDigest::Algorithm::SHA_224);
</ins><span class="cx">     if (!digest) {
</span><span class="cx">         failureCallback();
</span><span class="cx">         return;
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmSHA256cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA256.cpp (197574 => 197575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA256.cpp        2016-03-04 19:13:25 UTC (rev 197574)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA256.cpp        2016-03-04 19:26:23 UTC (rev 197575)
</span><span class="lines">@@ -54,7 +54,7 @@
</span><span class="cx"> 
</span><span class="cx"> void CryptoAlgorithmSHA256::digest(const CryptoAlgorithmParameters&amp;, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;)
</span><span class="cx"> {
</span><del>-    std::unique_ptr&lt;CryptoDigest&gt; digest = CryptoDigest::create(CryptoAlgorithmIdentifier::SHA_256);
</del><ins>+    std::unique_ptr&lt;CryptoDigest&gt; digest = CryptoDigest::create(CryptoDigest::Algorithm::SHA_256);
</ins><span class="cx">     if (!digest) {
</span><span class="cx">         failureCallback();
</span><span class="cx">         return;
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmSHA384cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA384.cpp (197574 => 197575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA384.cpp        2016-03-04 19:13:25 UTC (rev 197574)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA384.cpp        2016-03-04 19:26:23 UTC (rev 197575)
</span><span class="lines">@@ -54,7 +54,7 @@
</span><span class="cx"> 
</span><span class="cx"> void CryptoAlgorithmSHA384::digest(const CryptoAlgorithmParameters&amp;, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;)
</span><span class="cx"> {
</span><del>-    std::unique_ptr&lt;CryptoDigest&gt; digest = CryptoDigest::create(CryptoAlgorithmIdentifier::SHA_384);
</del><ins>+    std::unique_ptr&lt;CryptoDigest&gt; digest = CryptoDigest::create(CryptoDigest::Algorithm::SHA_384);
</ins><span class="cx">     if (!digest) {
</span><span class="cx">         failureCallback();
</span><span class="cx">         return;
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmSHA512cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA512.cpp (197574 => 197575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA512.cpp        2016-03-04 19:13:25 UTC (rev 197574)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA512.cpp        2016-03-04 19:26:23 UTC (rev 197575)
</span><span class="lines">@@ -54,7 +54,7 @@
</span><span class="cx"> 
</span><span class="cx"> void CryptoAlgorithmSHA512::digest(const CryptoAlgorithmParameters&amp;, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;)
</span><span class="cx"> {
</span><del>-    std::unique_ptr&lt;CryptoDigest&gt; digest = CryptoDigest::create(CryptoAlgorithmIdentifier::SHA_512);
</del><ins>+    std::unique_ptr&lt;CryptoDigest&gt; digest = CryptoDigest::create(CryptoDigest::Algorithm::SHA_512);
</ins><span class="cx">     if (!digest) {
</span><span class="cx">         failureCallback();
</span><span class="cx">         return;
</span></span></pre></div>
<a id="trunkSourceWebCorecryptognutlsCryptoDigestGnuTLScpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/crypto/gnutls/CryptoDigestGnuTLS.cpp (197574 => 197575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/gnutls/CryptoDigestGnuTLS.cpp        2016-03-04 19:13:25 UTC (rev 197574)
+++ trunk/Source/WebCore/crypto/gnutls/CryptoDigestGnuTLS.cpp        2016-03-04 19:26:23 UTC (rev 197575)
</span><span class="lines">@@ -1,108 +0,0 @@
</span><del>-/*
- * Copyright (C) 2014 Igalia S.L. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include &quot;config.h&quot;
-#include &quot;CryptoDigest.h&quot;
-
-#if ENABLE(SUBTLE_CRYPTO)
-
-#include &lt;gnutls/gnutls.h&gt;
-#include &lt;gnutls/crypto.h&gt;
-
-namespace WebCore {
-
-struct CryptoDigestContext {
-    gnutls_digest_algorithm_t algorithm;
-    gnutls_hash_hd_t hash;
-};
-
-CryptoDigest::CryptoDigest()
-    : m_context(new CryptoDigestContext)
-{
-}
-
-CryptoDigest::~CryptoDigest()
-{
-    gnutls_hash_deinit(m_context-&gt;hash, 0);
-}
-
-std::unique_ptr&lt;CryptoDigest&gt; CryptoDigest::create(CryptoAlgorithmIdentifier algorithm)
-{
-    gnutls_digest_algorithm_t gnutlsAlgorithm;
-
-    switch (algorithm) {
-    case CryptoAlgorithmIdentifier::SHA_1: {
-        gnutlsAlgorithm = GNUTLS_DIG_SHA1;
-        break;
-    }
-    case CryptoAlgorithmIdentifier::SHA_224: {
-        gnutlsAlgorithm = GNUTLS_DIG_SHA224;
-        break;
-    }
-    case CryptoAlgorithmIdentifier::SHA_256: {
-        gnutlsAlgorithm = GNUTLS_DIG_SHA256;
-        break;
-    }
-    case CryptoAlgorithmIdentifier::SHA_384: {
-        gnutlsAlgorithm = GNUTLS_DIG_SHA384;
-        break;
-    }
-    case CryptoAlgorithmIdentifier::SHA_512: {
-        gnutlsAlgorithm = GNUTLS_DIG_SHA512;
-        break;
-    }
-    default:
-        return nullptr;
-    }
-
-    std::unique_ptr&lt;CryptoDigest&gt; digest(new CryptoDigest);
-    digest-&gt;m_context-&gt;algorithm = gnutlsAlgorithm;
-
-    int ret = gnutls_hash_init(&amp;digest-&gt;m_context-&gt;hash, gnutlsAlgorithm);
-    if (ret != GNUTLS_E_SUCCESS)
-        return nullptr;
-
-    return digest;
-}
-
-void CryptoDigest::addBytes(const void* input, size_t length)
-{
-    gnutls_hash(m_context-&gt;hash, input, length);
-}
-
-Vector&lt;uint8_t&gt; CryptoDigest::computeHash()
-{
-    Vector&lt;uint8_t&gt; result;
-    int digestLen = gnutls_hash_get_len(m_context-&gt;algorithm);
-    result.resize(digestLen);
-
-    gnutls_hash_output(m_context-&gt;hash, result.data());
-
-    return result;
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(SUBTLE_CRYPTO)
</del></span></pre></div>
<a id="trunkSourceWebCorecryptomacCryptoAlgorithmRSASSA_PKCS1_v1_5Maccpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp (197574 => 197575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp        2016-03-04 19:13:25 UTC (rev 197574)
+++ trunk/Source/WebCore/crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp        2016-03-04 19:26:23 UTC (rev 197575)
</span><span class="lines">@@ -36,6 +36,29 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><ins>+inline bool getCryptoDigestAlgorithm(CryptoAlgorithmIdentifier hashFunction, CryptoDigest::Algorithm&amp; algorithm)
+{
+    switch (hashFunction) {
+    case CryptoAlgorithmIdentifier::SHA_1:
+        algorithm = CryptoDigest::Algorithm::SHA_1;
+        return true;
+    case CryptoAlgorithmIdentifier::SHA_224:
+        algorithm = CryptoDigest::Algorithm::SHA_224;
+        return true;
+    case CryptoAlgorithmIdentifier::SHA_256:
+        algorithm = CryptoDigest::Algorithm::SHA_256;
+        return true;
+    case CryptoAlgorithmIdentifier::SHA_384:
+        algorithm = CryptoDigest::Algorithm::SHA_384;
+        return true;
+    case CryptoAlgorithmIdentifier::SHA_512:
+        algorithm = CryptoDigest::Algorithm::SHA_512;
+        return true;
+    default:
+        return false;
+    }
+}
+
</ins><span class="cx"> void CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign(const CryptoAlgorithmRsaSsaParams&amp; parameters, const CryptoKeyRSA&amp; key, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp; ec)
</span><span class="cx"> {
</span><span class="cx">     CCDigestAlgorithm digestAlgorithm;
</span><span class="lines">@@ -44,7 +67,13 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    std::unique_ptr&lt;CryptoDigest&gt; digest = CryptoDigest::create(parameters.hash);
</del><ins>+    CryptoDigest::Algorithm cryptoDigestAlgorithm;
+    if (!getCryptoDigestAlgorithm(parameters.hash, cryptoDigestAlgorithm)) {
+        ec = NOT_SUPPORTED_ERR;
+        return;
+    }
+
+    std::unique_ptr&lt;CryptoDigest&gt; digest = CryptoDigest::create(cryptoDigestAlgorithm);
</ins><span class="cx">     if (!digest) {
</span><span class="cx">         ec = NOT_SUPPORTED_ERR;
</span><span class="cx">         return;
</span><span class="lines">@@ -75,7 +104,13 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    std::unique_ptr&lt;CryptoDigest&gt; digest = CryptoDigest::create(parameters.hash);
</del><ins>+    CryptoDigest::Algorithm cryptoDigestAlgorithm;
+    if (!getCryptoDigestAlgorithm(parameters.hash, cryptoDigestAlgorithm)) {
+        ec = NOT_SUPPORTED_ERR;
+        return;
+    }
+
+    std::unique_ptr&lt;CryptoDigest&gt; digest = CryptoDigest::create(cryptoDigestAlgorithm);
</ins><span class="cx">     if (!digest) {
</span><span class="cx">         ec = NOT_SUPPORTED_ERR;
</span><span class="cx">         return;
</span></span></pre></div>
<a id="trunkSourceWebCorecryptomacCryptoDigestMaccpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/crypto/mac/CryptoDigestMac.cpp (197574 => 197575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/mac/CryptoDigestMac.cpp        2016-03-04 19:13:25 UTC (rev 197574)
+++ trunk/Source/WebCore/crypto/mac/CryptoDigestMac.cpp        2016-03-04 19:26:23 UTC (rev 197575)
</span><span class="lines">@@ -1,191 +0,0 @@
</span><del>-/*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include &quot;config.h&quot;
-#include &quot;CryptoDigest.h&quot;
-
-#if ENABLE(SUBTLE_CRYPTO)
-
-#include &lt;CommonCrypto/CommonCrypto.h&gt;
-
-namespace WebCore {
-
-struct CryptoDigestContext {
-    CryptoAlgorithmIdentifier algorithm;
-    void* ccContext;
-};
-
-inline CC_SHA1_CTX* toSHA1Context(CryptoDigestContext* context)
-{
-    ASSERT(context-&gt;algorithm == CryptoAlgorithmIdentifier::SHA_1);
-    return static_cast&lt;CC_SHA1_CTX*&gt;(context-&gt;ccContext);
-}
-inline CC_SHA256_CTX* toSHA224Context(CryptoDigestContext* context)
-{
-    ASSERT(context-&gt;algorithm == CryptoAlgorithmIdentifier::SHA_224);
-    return static_cast&lt;CC_SHA256_CTX*&gt;(context-&gt;ccContext);
-}
-inline CC_SHA256_CTX* toSHA256Context(CryptoDigestContext* context)
-{
-    ASSERT(context-&gt;algorithm == CryptoAlgorithmIdentifier::SHA_256);
-    return static_cast&lt;CC_SHA256_CTX*&gt;(context-&gt;ccContext);
-}
-inline CC_SHA512_CTX* toSHA384Context(CryptoDigestContext* context)
-{
-    ASSERT(context-&gt;algorithm == CryptoAlgorithmIdentifier::SHA_384);
-    return static_cast&lt;CC_SHA512_CTX*&gt;(context-&gt;ccContext);
-}
-inline CC_SHA512_CTX* toSHA512Context(CryptoDigestContext* context)
-{
-    ASSERT(context-&gt;algorithm == CryptoAlgorithmIdentifier::SHA_512);
-    return static_cast&lt;CC_SHA512_CTX*&gt;(context-&gt;ccContext);
-}
-
-CryptoDigest::CryptoDigest()
-    : m_context(new CryptoDigestContext)
-{
-}
-
-CryptoDigest::~CryptoDigest()
-{
-    switch (m_context-&gt;algorithm) {
-    case CryptoAlgorithmIdentifier::SHA_1:
-        delete toSHA1Context(m_context.get());
-        return;
-    case CryptoAlgorithmIdentifier::SHA_224:
-        delete toSHA224Context(m_context.get());
-        return;
-    case CryptoAlgorithmIdentifier::SHA_256:
-        delete toSHA256Context(m_context.get());
-        return;
-    case CryptoAlgorithmIdentifier::SHA_384:
-        delete toSHA384Context(m_context.get());
-        return;
-    case CryptoAlgorithmIdentifier::SHA_512:
-        delete toSHA512Context(m_context.get());
-        return;
-    default:
-        ASSERT_NOT_REACHED();
-    }
-}
-
-
-std::unique_ptr&lt;CryptoDigest&gt; CryptoDigest::create(CryptoAlgorithmIdentifier algorithm)
-{
-    std::unique_ptr&lt;CryptoDigest&gt; digest(new CryptoDigest);
-    digest-&gt;m_context-&gt;algorithm = algorithm;
-
-    switch (algorithm) {
-    case CryptoAlgorithmIdentifier::SHA_1: {
-        CC_SHA1_CTX* context = new CC_SHA1_CTX;
-        digest-&gt;m_context-&gt;ccContext = context;
-        CC_SHA1_Init(context);
-        return digest;
-    }
-    case CryptoAlgorithmIdentifier::SHA_224: {
-        CC_SHA256_CTX* context = new CC_SHA256_CTX;
-        digest-&gt;m_context-&gt;ccContext = context;
-        CC_SHA224_Init(context);
-        return digest;
-    }
-    case CryptoAlgorithmIdentifier::SHA_256: {
-        CC_SHA256_CTX* context = new CC_SHA256_CTX;
-        digest-&gt;m_context-&gt;ccContext = context;
-        CC_SHA256_Init(context);
-        return digest;
-    }
-    case CryptoAlgorithmIdentifier::SHA_384: {
-        CC_SHA512_CTX* context = new CC_SHA512_CTX;
-        digest-&gt;m_context-&gt;ccContext = context;
-        CC_SHA384_Init(context);
-        return digest;
-    }
-    case CryptoAlgorithmIdentifier::SHA_512: {
-        CC_SHA512_CTX* context = new CC_SHA512_CTX;
-        digest-&gt;m_context-&gt;ccContext = context;
-        CC_SHA512_Init(context);
-        return digest;
-    }
-    default:
-        return nullptr;
-    }
-}
-
-void CryptoDigest::addBytes(const void* input, size_t length)
-{
-    switch (m_context-&gt;algorithm) {
-    case CryptoAlgorithmIdentifier::SHA_1:
-        CC_SHA1_Update(toSHA1Context(m_context.get()), input, length);
-        return;
-    case CryptoAlgorithmIdentifier::SHA_224:
-        CC_SHA224_Update(toSHA224Context(m_context.get()), input, length);
-        return;
-    case CryptoAlgorithmIdentifier::SHA_256:
-        CC_SHA256_Update(toSHA256Context(m_context.get()), input, length);
-        return;
-    case CryptoAlgorithmIdentifier::SHA_384:
-        CC_SHA384_Update(toSHA384Context(m_context.get()), input, length);
-        return;
-    case CryptoAlgorithmIdentifier::SHA_512:
-        CC_SHA512_Update(toSHA512Context(m_context.get()), input, length);
-        return;
-    default:
-        ASSERT_NOT_REACHED();
-    }
-}
-
-Vector&lt;uint8_t&gt; CryptoDigest::computeHash()
-{
-    Vector&lt;uint8_t&gt; result;
-    switch (m_context-&gt;algorithm) {
-    case CryptoAlgorithmIdentifier::SHA_1:
-        result.resize(CC_SHA1_DIGEST_LENGTH);
-        CC_SHA1_Final(result.data(), toSHA1Context(m_context.get()));
-        break;
-    case CryptoAlgorithmIdentifier::SHA_224:
-        result.resize(CC_SHA224_DIGEST_LENGTH);
-        CC_SHA224_Final(result.data(), toSHA224Context(m_context.get()));
-        break;
-    case CryptoAlgorithmIdentifier::SHA_256:
-        result.resize(CC_SHA256_DIGEST_LENGTH);
-        CC_SHA256_Final(result.data(), toSHA256Context(m_context.get()));
-        break;
-    case CryptoAlgorithmIdentifier::SHA_384:
-        result.resize(CC_SHA384_DIGEST_LENGTH);
-        CC_SHA384_Final(result.data(), toSHA384Context(m_context.get()));
-        break;
-    case CryptoAlgorithmIdentifier::SHA_512:
-        result.resize(CC_SHA512_DIGEST_LENGTH);
-        CC_SHA512_Final(result.data(), toSHA512Context(m_context.get()));
-        break;
-    default:
-        ASSERT_NOT_REACHED();
-    }
-    return result;
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(SUBTLE_CRYPTO)
</del></span></pre></div>
<a id="trunkSourceWebCoreplatformcryptoCryptoDigesthfromrev197574trunkSourceWebCorecryptoCryptoDigesth"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/crypto/CryptoDigest.h (from rev 197574, trunk/Source/WebCore/crypto/CryptoDigest.h) (0 => 197575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/crypto/CryptoDigest.h                                (rev 0)
+++ trunk/Source/WebCore/platform/crypto/CryptoDigest.h        2016-03-04 19:26:23 UTC (rev 197575)
</span><span class="lines">@@ -0,0 +1,60 @@
</span><ins>+/*
+ * Copyright (C) 2013, 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CryptoDigest_h
+#define CryptoDigest_h
+
+#include &lt;wtf/Noncopyable.h&gt;
+#include &lt;wtf/Vector.h&gt;
+
+namespace WebCore {
+
+struct CryptoDigestContext;
+
+class CryptoDigest {
+    WTF_MAKE_NONCOPYABLE(CryptoDigest);
+public:
+    enum class Algorithm {
+        SHA_1,
+        SHA_224,
+        SHA_256,
+        SHA_384,
+        SHA_512,
+    };
+    static std::unique_ptr&lt;CryptoDigest&gt; create(Algorithm);
+    ~CryptoDigest();
+
+    void addBytes(const void* input, size_t length);
+    Vector&lt;uint8_t&gt; computeHash();
+
+private:
+    CryptoDigest();
+
+    std::unique_ptr&lt;CryptoDigestContext&gt; m_context;
+};
+
+} // namespace WebCore
+
+#endif // CryptoDigest_h
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformcryptognutlsCryptoDigestGnuTLScppfromrev197574trunkSourceWebCorecryptognutlsCryptoDigestGnuTLScpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/crypto/gnutls/CryptoDigestGnuTLS.cpp (from rev 197574, trunk/Source/WebCore/crypto/gnutls/CryptoDigestGnuTLS.cpp) (0 => 197575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/crypto/gnutls/CryptoDigestGnuTLS.cpp                                (rev 0)
+++ trunk/Source/WebCore/platform/crypto/gnutls/CryptoDigestGnuTLS.cpp        2016-03-04 19:26:23 UTC (rev 197575)
</span><span class="lines">@@ -0,0 +1,102 @@
</span><ins>+/*
+ * Copyright (C) 2014 Igalia S.L. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;CryptoDigest.h&quot;
+
+#include &lt;gnutls/gnutls.h&gt;
+#include &lt;gnutls/crypto.h&gt;
+
+namespace WebCore {
+
+struct CryptoDigestContext {
+    gnutls_digest_algorithm_t algorithm;
+    gnutls_hash_hd_t hash;
+};
+
+CryptoDigest::CryptoDigest()
+    : m_context(new CryptoDigestContext)
+{
+}
+
+CryptoDigest::~CryptoDigest()
+{
+    gnutls_hash_deinit(m_context-&gt;hash, 0);
+}
+
+std::unique_ptr&lt;CryptoDigest&gt; CryptoDigest::create(CryptoDigest::Algorithm algorithm)
+{
+    gnutls_digest_algorithm_t gnutlsAlgorithm;
+
+    switch (algorithm) {
+    case CryptoDigest::Algorithm::SHA_1: {
+        gnutlsAlgorithm = GNUTLS_DIG_SHA1;
+        break;
+    }
+    case CryptoDigest::Algorithm::SHA_224: {
+        gnutlsAlgorithm = GNUTLS_DIG_SHA224;
+        break;
+    }
+    case CryptoDigest::Algorithm::SHA_256: {
+        gnutlsAlgorithm = GNUTLS_DIG_SHA256;
+        break;
+    }
+    case CryptoDigest::Algorithm::SHA_384: {
+        gnutlsAlgorithm = GNUTLS_DIG_SHA384;
+        break;
+    }
+    case CryptoDigest::Algorithm::SHA_512: {
+        gnutlsAlgorithm = GNUTLS_DIG_SHA512;
+        break;
+    }
+    }
+
+    std::unique_ptr&lt;CryptoDigest&gt; digest(new CryptoDigest);
+    digest-&gt;m_context-&gt;algorithm = gnutlsAlgorithm;
+
+    int ret = gnutls_hash_init(&amp;digest-&gt;m_context-&gt;hash, gnutlsAlgorithm);
+    if (ret != GNUTLS_E_SUCCESS)
+        return nullptr;
+
+    return digest;
+}
+
+void CryptoDigest::addBytes(const void* input, size_t length)
+{
+    gnutls_hash(m_context-&gt;hash, input, length);
+}
+
+Vector&lt;uint8_t&gt; CryptoDigest::computeHash()
+{
+    Vector&lt;uint8_t&gt; result;
+    int digestLen = gnutls_hash_get_len(m_context-&gt;algorithm);
+    result.resize(digestLen);
+
+    gnutls_hash_output(m_context-&gt;hash, result.data());
+
+    return result;
+}
+
+} // namespace WebCore
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformcryptomacCryptoDigestMaccppfromrev197574trunkSourceWebCorecryptomacCryptoDigestMaccpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/crypto/mac/CryptoDigestMac.cpp (from rev 197574, trunk/Source/WebCore/crypto/mac/CryptoDigestMac.cpp) (0 => 197575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/crypto/mac/CryptoDigestMac.cpp                                (rev 0)
+++ trunk/Source/WebCore/platform/crypto/mac/CryptoDigestMac.cpp        2016-03-04 19:26:23 UTC (rev 197575)
</span><span class="lines">@@ -0,0 +1,179 @@
</span><ins>+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;CryptoDigest.h&quot;
+
+#include &lt;CommonCrypto/CommonCrypto.h&gt;
+
+namespace WebCore {
+
+struct CryptoDigestContext {
+    CryptoDigest::Algorithm algorithm;
+    void* ccContext;
+};
+
+inline CC_SHA1_CTX* toSHA1Context(CryptoDigestContext* context)
+{
+    ASSERT(context-&gt;algorithm == CryptoDigest::Algorithm::SHA_1);
+    return static_cast&lt;CC_SHA1_CTX*&gt;(context-&gt;ccContext);
+}
+inline CC_SHA256_CTX* toSHA224Context(CryptoDigestContext* context)
+{
+    ASSERT(context-&gt;algorithm == CryptoDigest::Algorithm::SHA_224);
+    return static_cast&lt;CC_SHA256_CTX*&gt;(context-&gt;ccContext);
+}
+inline CC_SHA256_CTX* toSHA256Context(CryptoDigestContext* context)
+{
+    ASSERT(context-&gt;algorithm == CryptoDigest::Algorithm::SHA_256);
+    return static_cast&lt;CC_SHA256_CTX*&gt;(context-&gt;ccContext);
+}
+inline CC_SHA512_CTX* toSHA384Context(CryptoDigestContext* context)
+{
+    ASSERT(context-&gt;algorithm == CryptoDigest::Algorithm::SHA_384);
+    return static_cast&lt;CC_SHA512_CTX*&gt;(context-&gt;ccContext);
+}
+inline CC_SHA512_CTX* toSHA512Context(CryptoDigestContext* context)
+{
+    ASSERT(context-&gt;algorithm == CryptoDigest::Algorithm::SHA_512);
+    return static_cast&lt;CC_SHA512_CTX*&gt;(context-&gt;ccContext);
+}
+
+CryptoDigest::CryptoDigest()
+    : m_context(new CryptoDigestContext)
+{
+}
+
+CryptoDigest::~CryptoDigest()
+{
+    switch (m_context-&gt;algorithm) {
+    case CryptoDigest::Algorithm::SHA_1:
+        delete toSHA1Context(m_context.get());
+        return;
+    case CryptoDigest::Algorithm::SHA_224:
+        delete toSHA224Context(m_context.get());
+        return;
+    case CryptoDigest::Algorithm::SHA_256:
+        delete toSHA256Context(m_context.get());
+        return;
+    case CryptoDigest::Algorithm::SHA_384:
+        delete toSHA384Context(m_context.get());
+        return;
+    case CryptoDigest::Algorithm::SHA_512:
+        delete toSHA512Context(m_context.get());
+        return;
+    }
+}
+
+
+std::unique_ptr&lt;CryptoDigest&gt; CryptoDigest::create(CryptoDigest::Algorithm algorithm)
+{
+    std::unique_ptr&lt;CryptoDigest&gt; digest(new CryptoDigest);
+    digest-&gt;m_context-&gt;algorithm = algorithm;
+
+    switch (algorithm) {
+    case CryptoDigest::Algorithm::SHA_1: {
+        CC_SHA1_CTX* context = new CC_SHA1_CTX;
+        digest-&gt;m_context-&gt;ccContext = context;
+        CC_SHA1_Init(context);
+        return digest;
+    }
+    case CryptoDigest::Algorithm::SHA_224: {
+        CC_SHA256_CTX* context = new CC_SHA256_CTX;
+        digest-&gt;m_context-&gt;ccContext = context;
+        CC_SHA224_Init(context);
+        return digest;
+    }
+    case CryptoDigest::Algorithm::SHA_256: {
+        CC_SHA256_CTX* context = new CC_SHA256_CTX;
+        digest-&gt;m_context-&gt;ccContext = context;
+        CC_SHA256_Init(context);
+        return digest;
+    }
+    case CryptoDigest::Algorithm::SHA_384: {
+        CC_SHA512_CTX* context = new CC_SHA512_CTX;
+        digest-&gt;m_context-&gt;ccContext = context;
+        CC_SHA384_Init(context);
+        return digest;
+    }
+    case CryptoDigest::Algorithm::SHA_512: {
+        CC_SHA512_CTX* context = new CC_SHA512_CTX;
+        digest-&gt;m_context-&gt;ccContext = context;
+        CC_SHA512_Init(context);
+        return digest;
+    }
+    }
+}
+
+void CryptoDigest::addBytes(const void* input, size_t length)
+{
+    switch (m_context-&gt;algorithm) {
+    case CryptoDigest::Algorithm::SHA_1:
+        CC_SHA1_Update(toSHA1Context(m_context.get()), input, length);
+        return;
+    case CryptoDigest::Algorithm::SHA_224:
+        CC_SHA224_Update(toSHA224Context(m_context.get()), input, length);
+        return;
+    case CryptoDigest::Algorithm::SHA_256:
+        CC_SHA256_Update(toSHA256Context(m_context.get()), input, length);
+        return;
+    case CryptoDigest::Algorithm::SHA_384:
+        CC_SHA384_Update(toSHA384Context(m_context.get()), input, length);
+        return;
+    case CryptoDigest::Algorithm::SHA_512:
+        CC_SHA512_Update(toSHA512Context(m_context.get()), input, length);
+        return;
+    }
+}
+
+Vector&lt;uint8_t&gt; CryptoDigest::computeHash()
+{
+    Vector&lt;uint8_t&gt; result;
+    switch (m_context-&gt;algorithm) {
+    case CryptoDigest::Algorithm::SHA_1:
+        result.resize(CC_SHA1_DIGEST_LENGTH);
+        CC_SHA1_Final(result.data(), toSHA1Context(m_context.get()));
+        break;
+    case CryptoDigest::Algorithm::SHA_224:
+        result.resize(CC_SHA224_DIGEST_LENGTH);
+        CC_SHA224_Final(result.data(), toSHA224Context(m_context.get()));
+        break;
+    case CryptoDigest::Algorithm::SHA_256:
+        result.resize(CC_SHA256_DIGEST_LENGTH);
+        CC_SHA256_Final(result.data(), toSHA256Context(m_context.get()));
+        break;
+    case CryptoDigest::Algorithm::SHA_384:
+        result.resize(CC_SHA384_DIGEST_LENGTH);
+        CC_SHA384_Final(result.data(), toSHA384Context(m_context.get()));
+        break;
+    case CryptoDigest::Algorithm::SHA_512:
+        result.resize(CC_SHA512_DIGEST_LENGTH);
+        CC_SHA512_Final(result.data(), toSHA512Context(m_context.get()));
+        break;
+    }
+    return result;
+}
+
+} // namespace WebCore
</ins></span></pre>
</div>
</div>

</body>
</html>