<!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>[214362] trunk/Source</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/214362">214362</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2017-03-24 11:56:57 -0700 (Fri, 24 Mar 2017)</dd>
</dl>
<h3>Log Message</h3>
<pre>Unreviewed, rolling out <a href="http://trac.webkit.org/projects/webkit/changeset/214329">r214329</a>.
Significantly regressed Speedometer
Reverted changeset:
"window.crypto.getRandomValues() uses the insecure RC4 RNG"
https://bugs.webkit.org/show_bug.cgi?id=169623
http://trac.webkit.org/changeset/214329</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFwtfCryptographicallyRandomNumbercpp">trunk/Source/WTF/wtf/CryptographicallyRandomNumber.cpp</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</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="#trunkSourceWebCorecryptoCryptoKeycpp">trunk/Source/WebCore/crypto/CryptoKey.cpp</a></li>
<li><a href="#trunkSourceWebCorepageCryptocpp">trunk/Source/WebCore/page/Crypto.cpp</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCorecryptomacCryptoKeyMaccpp">trunk/Source/WebCore/crypto/mac/CryptoKeyMac.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (214361 => 214362)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog        2017-03-24 18:41:42 UTC (rev 214361)
+++ trunk/Source/WTF/ChangeLog        2017-03-24 18:56:57 UTC (rev 214362)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2017-03-24 Chris Dumez <cdumez@apple.com>
+
+ Unreviewed, rolling out r214329.
+
+ Significantly regressed Speedometer
+
+ Reverted changeset:
+
+ "window.crypto.getRandomValues() uses the insecure RC4 RNG"
+ https://bugs.webkit.org/show_bug.cgi?id=169623
+ http://trac.webkit.org/changeset/214329
+
</ins><span class="cx"> 2017-03-24 Andreas Kling <akling@apple.com>
</span><span class="cx">
</span><span class="cx"> Make inactive web processes behave as though under memory pressure.
</span></span></pre></div>
<a id="trunkSourceWTFwtfCryptographicallyRandomNumbercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/CryptographicallyRandomNumber.cpp (214361 => 214362)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/CryptographicallyRandomNumber.cpp        2017-03-24 18:41:42 UTC (rev 214361)
+++ trunk/Source/WTF/wtf/CryptographicallyRandomNumber.cpp        2017-03-24 18:56:57 UTC (rev 214362)
</span><span class="lines">@@ -1,46 +1,179 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2017 Igalia S.L.
</del><ins>+ * Copyright (c) 1996, David Mazieres <dm@uun.org>
+ * Copyright (c) 2008, Damien Miller <djm@openbsd.org>
</ins><span class="cx"> *
</span><del>- * 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.
</del><ins>+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
</ins><span class="cx"> *
</span><del>- * 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.
</del><ins>+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
</ins><span class="cx"> */
</span><span class="cx">
</span><ins>+/*
+ * Arc4 random number generator for OpenBSD.
+ *
+ * This code is derived from section 17.1 of Applied Cryptography,
+ * second edition, which describes a stream cipher allegedly
+ * compatible with RSA Labs "RC4" cipher (the actual description of
+ * which is a trade secret). The same algorithm is used as a stream
+ * cipher called "arcfour" in Tatu Ylonen's ssh package.
+ *
+ * RC4 is a registered trademark of RSA Laboratories.
+ */
+
</ins><span class="cx"> #include "config.h"
</span><span class="cx"> #include "CryptographicallyRandomNumber.h"
</span><span class="cx">
</span><ins>+#include "NeverDestroyed.h"
</ins><span class="cx"> #include "OSRandomSource.h"
</span><ins>+#include <mutex>
+#include <wtf/Lock.h>
</ins><span class="cx">
</span><span class="cx"> namespace WTF {
</span><span class="cx">
</span><ins>+namespace {
+
+class ARC4Stream {
+public:
+ ARC4Stream();
+
+ uint8_t i;
+ uint8_t j;
+ uint8_t s[256];
+};
+
+class ARC4RandomNumberGenerator {
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ ARC4RandomNumberGenerator();
+
+ uint32_t randomNumber();
+ void randomValues(void* buffer, size_t length);
+
+private:
+ inline void addRandomData(unsigned char *data, int length);
+ void stir();
+ void stirIfNeeded();
+ inline uint8_t getByte();
+ inline uint32_t getWord();
+
+ ARC4Stream m_stream;
+ int m_count;
+ Lock m_mutex;
+};
+
+ARC4Stream::ARC4Stream()
+{
+ for (int n = 0; n < 256; n++)
+ s[n] = n;
+ i = 0;
+ j = 0;
+}
+
+ARC4RandomNumberGenerator::ARC4RandomNumberGenerator()
+ : m_count(0)
+{
+}
+
+void ARC4RandomNumberGenerator::addRandomData(unsigned char* data, int length)
+{
+ m_stream.i--;
+ for (int n = 0; n < 256; n++) {
+ m_stream.i++;
+ uint8_t si = m_stream.s[m_stream.i];
+ m_stream.j += si + data[n % length];
+ m_stream.s[m_stream.i] = m_stream.s[m_stream.j];
+ m_stream.s[m_stream.j] = si;
+ }
+ m_stream.j = m_stream.i;
+}
+
+void ARC4RandomNumberGenerator::stir()
+{
+ unsigned char randomness[128];
+ size_t length = sizeof(randomness);
+ cryptographicallyRandomValuesFromOS(randomness, length);
+ addRandomData(randomness, length);
+
+ // Discard early keystream, as per recommendations in:
+ // http://www.wisdom.weizmann.ac.il/~itsik/RC4/Papers/Rc4_ksa.ps
+ for (int i = 0; i < 256; i++)
+ getByte();
+ m_count = 1600000;
+}
+
+void ARC4RandomNumberGenerator::stirIfNeeded()
+{
+ if (m_count <= 0)
+ stir();
+}
+
+uint8_t ARC4RandomNumberGenerator::getByte()
+{
+ m_stream.i++;
+ uint8_t si = m_stream.s[m_stream.i];
+ m_stream.j += si;
+ uint8_t sj = m_stream.s[m_stream.j];
+ m_stream.s[m_stream.i] = sj;
+ m_stream.s[m_stream.j] = si;
+ return (m_stream.s[(si + sj) & 0xff]);
+}
+
+uint32_t ARC4RandomNumberGenerator::getWord()
+{
+ uint32_t val;
+ val = getByte() << 24;
+ val |= getByte() << 16;
+ val |= getByte() << 8;
+ val |= getByte();
+ return val;
+}
+
+uint32_t ARC4RandomNumberGenerator::randomNumber()
+{
+ std::lock_guard<Lock> lock(m_mutex);
+
+ m_count -= 4;
+ stirIfNeeded();
+ return getWord();
+}
+
+void ARC4RandomNumberGenerator::randomValues(void* buffer, size_t length)
+{
+ std::lock_guard<Lock> lock(m_mutex);
+
+ unsigned char* result = reinterpret_cast<unsigned char*>(buffer);
+ stirIfNeeded();
+ while (length--) {
+ m_count--;
+ stirIfNeeded();
+ result[length] = getByte();
+ }
+}
+
+ARC4RandomNumberGenerator& sharedRandomNumberGenerator()
+{
+ static NeverDestroyed<ARC4RandomNumberGenerator> randomNumberGenerator;
+
+ return randomNumberGenerator;
+}
+
+}
+
</ins><span class="cx"> uint32_t cryptographicallyRandomNumber()
</span><span class="cx"> {
</span><del>- uint32_t result;
- cryptographicallyRandomValues(&result, sizeof(result));
- return result;
</del><ins>+ return sharedRandomNumberGenerator().randomNumber();
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-// FIXME: It is slow to always get the values directly from the OS.
</del><span class="cx"> void cryptographicallyRandomValues(void* buffer, size_t length)
</span><span class="cx"> {
</span><del>- cryptographicallyRandomValuesFromOS(static_cast<unsigned char*>(buffer), length);
</del><ins>+ sharedRandomNumberGenerator().randomValues(buffer, length);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (214361 => 214362)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-03-24 18:41:42 UTC (rev 214361)
+++ trunk/Source/WebCore/ChangeLog        2017-03-24 18:56:57 UTC (rev 214362)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2017-03-24 Chris Dumez <cdumez@apple.com>
+
+ Unreviewed, rolling out r214329.
+
+ Significantly regressed Speedometer
+
+ Reverted changeset:
+
+ "window.crypto.getRandomValues() uses the insecure RC4 RNG"
+ https://bugs.webkit.org/show_bug.cgi?id=169623
+ http://trac.webkit.org/changeset/214329
+
</ins><span class="cx"> 2017-03-24 Yoav Weiss <yoav@yoav.ws>
</span><span class="cx">
</span><span class="cx"> Add a warning for unused link preloads.
</span></span></pre></div>
<a id="trunkSourceWebCorePlatformMaccmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/PlatformMac.cmake (214361 => 214362)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/PlatformMac.cmake        2017-03-24 18:41:42 UTC (rev 214361)
+++ trunk/Source/WebCore/PlatformMac.cmake        2017-03-24 18:56:57 UTC (rev 214362)
</span><span class="lines">@@ -218,6 +218,7 @@
</span><span class="cx"> crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp
</span><span class="cx"> crypto/mac/CryptoAlgorithmRegistryMac.cpp
</span><span class="cx"> crypto/mac/CryptoKeyECMac.cpp
</span><ins>+ crypto/mac/CryptoKeyMac.cpp
</ins><span class="cx"> crypto/mac/CryptoKeyRSAMac.cpp
</span><span class="cx"> crypto/mac/SerializedCryptoKeyWrapMac.mm
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (214361 => 214362)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2017-03-24 18:41:42 UTC (rev 214361)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2017-03-24 18:56:57 UTC (rev 214362)
</span><span class="lines">@@ -6514,6 +6514,7 @@
</span><span class="cx">                 E19AC3F41824DC7900349426 /* CryptoAlgorithmSHA512.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E19AC3EC1824DC7900349426 /* CryptoAlgorithmSHA512.cpp */; };
</span><span class="cx">                 E19AC3F51824DC7900349426 /* CryptoAlgorithmSHA512.h in Headers */ = {isa = PBXBuildFile; fileRef = E19AC3ED1824DC7900349426 /* CryptoAlgorithmSHA512.h */; };
</span><span class="cx">                 E19AC3F71824E5D100349426 /* CryptoAlgorithmAesKeyGenParamsDeprecated.h in Headers */ = {isa = PBXBuildFile; fileRef = E19AC3F61824E5D100349426 /* CryptoAlgorithmAesKeyGenParamsDeprecated.h */; };
</span><ins>+                E19AC3F9182566F700349426 /* CryptoKeyMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E19AC3F8182566F700349426 /* CryptoKeyMac.cpp */; };
</ins><span class="cx">                 E19DA29C18189ADD00088BC8 /* CryptoAlgorithmHmacKeyParamsDeprecated.h in Headers */ = {isa = PBXBuildFile; fileRef = E19DA29B18189ADD00088BC8 /* CryptoAlgorithmHmacKeyParamsDeprecated.h */; };
</span><span class="cx">                 E1A1470811102B1500EEC0F3 /* ContainerNodeAlgorithms.h in Headers */ = {isa = PBXBuildFile; fileRef = E1A1470711102B1500EEC0F3 /* ContainerNodeAlgorithms.h */; };
</span><span class="cx">                 E1A3162D134BC32D007C9A4F /* WebNSAttributedStringExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = E1A3162B134BC32D007C9A4F /* WebNSAttributedStringExtras.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -14980,6 +14981,7 @@
</span><span class="cx">                 E19AC3EC1824DC7900349426 /* CryptoAlgorithmSHA512.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CryptoAlgorithmSHA512.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 E19AC3ED1824DC7900349426 /* CryptoAlgorithmSHA512.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CryptoAlgorithmSHA512.h; sourceTree = "<group>"; };
</span><span class="cx">                 E19AC3F61824E5D100349426 /* CryptoAlgorithmAesKeyGenParamsDeprecated.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CryptoAlgorithmAesKeyGenParamsDeprecated.h; sourceTree = "<group>"; };
</span><ins>+                E19AC3F8182566F700349426 /* CryptoKeyMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CryptoKeyMac.cpp; sourceTree = "<group>"; };
</ins><span class="cx">                 E19DA29B18189ADD00088BC8 /* CryptoAlgorithmHmacKeyParamsDeprecated.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CryptoAlgorithmHmacKeyParamsDeprecated.h; sourceTree = "<group>"; };
</span><span class="cx">                 E1A1470711102B1500EEC0F3 /* ContainerNodeAlgorithms.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContainerNodeAlgorithms.h; sourceTree = "<group>"; };
</span><span class="cx">                 E1A3162B134BC32D007C9A4F /* WebNSAttributedStringExtras.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebNSAttributedStringExtras.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -24243,6 +24245,7 @@
</span><span class="cx">                                 E1233F0E185A4130008DFAF5 /* CryptoAlgorithmRSAES_PKCS1_v1_5Mac.cpp */,
</span><span class="cx">                                 E1C266D618317AB4003F8B33 /* CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp */,
</span><span class="cx">                                 5750A97A1E69161600705C4A /* CryptoKeyECMac.cpp */,
</span><ins>+                                E19AC3F8182566F700349426 /* CryptoKeyMac.cpp */,
</ins><span class="cx">                                 E164FAA418315E1A00DB4E61 /* CryptoKeyRSAMac.cpp */,
</span><span class="cx">                                 E18DF33618AAF14D00773E59 /* SerializedCryptoKeyWrapMac.mm */,
</span><span class="cx">                         );
</span><span class="lines">@@ -30579,6 +30582,7 @@
</span><span class="cx">                                 5750A9741E68D00000705C4A /* CryptoKeyEC.cpp in Sources */,
</span><span class="cx">                                 5750A97B1E69161600705C4A /* CryptoKeyECMac.cpp in Sources */,
</span><span class="cx">                                 E125F8351822F18A00D84CD9 /* CryptoKeyHMAC.cpp in Sources */,
</span><ins>+                                E19AC3F9182566F700349426 /* CryptoKeyMac.cpp in Sources */,
</ins><span class="cx">                                 57E657E01E71397800F941CA /* CryptoKeyRaw.cpp in Sources */,
</span><span class="cx">                                 57E2336B1DCC262400F28D01 /* CryptoKeyRSA.cpp in Sources */,
</span><span class="cx">                                 E164FAA518315E1A00DB4E61 /* CryptoKeyRSAMac.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoCryptoKeycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/CryptoKey.cpp (214361 => 214362)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/CryptoKey.cpp        2017-03-24 18:41:42 UTC (rev 214361)
+++ trunk/Source/WebCore/crypto/CryptoKey.cpp        2017-03-24 18:56:57 UTC (rev 214362)
</span><span class="lines">@@ -68,6 +68,7 @@
</span><span class="cx"> return result;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !OS(DARWIN) || PLATFORM(GTK)
</ins><span class="cx"> Vector<uint8_t> CryptoKey::randomData(size_t size)
</span><span class="cx"> {
</span><span class="cx"> Vector<uint8_t> result(size);
</span><span class="lines">@@ -74,6 +75,7 @@
</span><span class="cx"> cryptographicallyRandomValues(result.data(), result.size());
</span><span class="cx"> return result;
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorecryptomacCryptoKeyMaccppfromrev214361trunkSourceWTFwtfCryptographicallyRandomNumbercpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/crypto/mac/CryptoKeyMac.cpp (from rev 214361, trunk/Source/WTF/wtf/CryptographicallyRandomNumber.cpp) (0 => 214362)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/mac/CryptoKeyMac.cpp         (rev 0)
+++ trunk/Source/WebCore/crypto/mac/CryptoKeyMac.cpp        2017-03-24 18:56:57 UTC (rev 214362)
</span><span class="lines">@@ -0,0 +1,45 @@
</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.
+ */
+
+#include "config.h"
+#include "CryptoKey.h"
+
+#if ENABLE(SUBTLE_CRYPTO)
+
+#include "CommonCryptoUtilities.h"
+
+namespace WebCore {
+
+Vector<uint8_t> CryptoKey::randomData(size_t size)
+{
+ Vector<uint8_t> result(size);
+ int rc = CCRandomCopyBytes(kCCRandomDefault, result.data(), result.size());
+ RELEASE_ASSERT(rc == kCCSuccess);
+ return result;
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(SUBTLE_CRYPTO)
</ins></span></pre></div>
<a id="trunkSourceWebCorepageCryptocpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Crypto.cpp (214361 => 214362)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Crypto.cpp        2017-03-24 18:41:42 UTC (rev 214361)
+++ trunk/Source/WebCore/page/Crypto.cpp        2017-03-24 18:56:57 UTC (rev 214362)
</span><span class="lines">@@ -31,6 +31,9 @@
</span><span class="cx"> #include "config.h"
</span><span class="cx"> #include "Crypto.h"
</span><span class="cx">
</span><ins>+#if OS(DARWIN)
+#include "CommonCryptoUtilities.h"
+#endif
</ins><span class="cx"> #include "Document.h"
</span><span class="cx"> #include "ExceptionCode.h"
</span><span class="cx"> #include "SubtleCrypto.h"
</span><span class="lines">@@ -58,7 +61,12 @@
</span><span class="cx"> return Exception { TYPE_MISMATCH_ERR };
</span><span class="cx"> if (array.byteLength() > 65536)
</span><span class="cx"> return Exception { QUOTA_EXCEEDED_ERR };
</span><ins>+#if OS(DARWIN)
+ int rc = CCRandomCopyBytes(kCCRandomDefault, array.baseAddress(), array.byteLength());
+ RELEASE_ASSERT(rc == kCCSuccess);
+#else
</ins><span class="cx"> cryptographicallyRandomValues(array.baseAddress(), array.byteLength());
</span><ins>+#endif
</ins><span class="cx"> return { };
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>