<!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>[164181] 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/164181">164181</a></dd>
<dt>Author</dt> <dd>ap@apple.com</dd>
<dt>Date</dt> <dd>2014-02-15 15:26:21 -0800 (Sat, 15 Feb 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>[Mac] All WebKit clients should encrypt WebCrypto keys automatically
https://bugs.webkit.org/show_bug.cgi?id=128852
Reviewed by Oliver Hunt.
Source/WebCore:
Install a persistent master key in Keychain on first use of WebCrypto key serialization.
The key is per application, protected with ACL.
* English.lproj/Localizable.strings:
* WebCore.exp.in:
* crypto/SerializedCryptoKeyWrap.h:
* crypto/mac/SerializedCryptoKeyWrapMac.mm:
(WebCore::masterKeyAccountNameForCurrentApplication):
(WebCore::getDefaultWebCryptoMasterKey):
(WebCore::createAndStoreMasterKey):
(WebCore::findMasterKey):
* platform/LocalizedStrings.cpp:
(WebCore::webCryptoMasterKeyKeychainLabel):
(WebCore::webCryptoMasterKeyKeychainComment):
* platform/LocalizedStrings.h:
Source/WebKit/mac:
* WebCoreSupport/WebChromeClient.mm:
(WebChromeClient::wrapCryptoKey):
(WebChromeClient::unwrapCryptoKey):
Call the default implementation if key is not provided by a client.
Source/WebKit2:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::wrapCryptoKey):
(WebKit::WebPageProxy::unwrapCryptoKey):
Call the default implementation if key is not provided by a client.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreEnglishlprojLocalizablestrings">trunk/Source/WebCore/English.lproj/Localizable.strings</a></li>
<li><a href="#trunkSourceWebCoreWebCoreexpin">trunk/Source/WebCore/WebCore.exp.in</a></li>
<li><a href="#trunkSourceWebCorecryptoSerializedCryptoKeyWraph">trunk/Source/WebCore/crypto/SerializedCryptoKeyWrap.h</a></li>
<li><a href="#trunkSourceWebCorecryptomacSerializedCryptoKeyWrapMacmm">trunk/Source/WebCore/crypto/mac/SerializedCryptoKeyWrapMac.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformLocalizedStringscpp">trunk/Source/WebCore/platform/LocalizedStrings.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformLocalizedStringsh">trunk/Source/WebCore/platform/LocalizedStrings.h</a></li>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacWebCoreSupportWebChromeClientmm">trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxycpp">trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (164180 => 164181)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-02-15 22:32:05 UTC (rev 164180)
+++ trunk/Source/WebCore/ChangeLog        2014-02-15 23:26:21 UTC (rev 164181)
</span><span class="lines">@@ -1,3 +1,26 @@
</span><ins>+2014-02-15 Alexey Proskuryakov <ap@apple.com>
+
+ [Mac] All WebKit clients should encrypt WebCrypto keys automatically
+ https://bugs.webkit.org/show_bug.cgi?id=128852
+
+ Reviewed by Oliver Hunt.
+
+ Install a persistent master key in Keychain on first use of WebCrypto key serialization.
+ The key is per application, protected with ACL.
+
+ * English.lproj/Localizable.strings:
+ * WebCore.exp.in:
+ * crypto/SerializedCryptoKeyWrap.h:
+ * crypto/mac/SerializedCryptoKeyWrapMac.mm:
+ (WebCore::masterKeyAccountNameForCurrentApplication):
+ (WebCore::getDefaultWebCryptoMasterKey):
+ (WebCore::createAndStoreMasterKey):
+ (WebCore::findMasterKey):
+ * platform/LocalizedStrings.cpp:
+ (WebCore::webCryptoMasterKeyKeychainLabel):
+ (WebCore::webCryptoMasterKeyKeychainComment):
+ * platform/LocalizedStrings.h:
+
</ins><span class="cx"> 2014-02-15 Ryosuke Niwa <rniwa@webkit.org>
</span><span class="cx">
</span><span class="cx"> computeSelectionStart and computeSelectionEnd shouldn't trigger synchronous layout
</span></span></pre></div>
<a id="trunkSourceWebCoreEnglishlprojLocalizablestrings"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/English.lproj/Localizable.strings (164180 => 164181)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/English.lproj/Localizable.strings        2014-02-15 22:32:05 UTC (rev 164180)
+++ trunk/Source/WebCore/English.lproj/Localizable.strings        2014-02-15 23:26:21 UTC (rev 164181)
</span><span class="lines">@@ -40,6 +40,9 @@
</span><span class="cx"> /* Visible name of the web process. The argument is the application name. */
</span><span class="cx"> "%@ Web Content" = "%@ Web Content";
</span><span class="cx">
</span><ins>+/* Name of application's single WebCrypto master key in Keychain */
+"%@ WebCrypto Master Key" = "%@ WebCrypto Master Key";
+
</ins><span class="cx"> /* Label to describe the number of files selected in a file upload control that allows multiple files */
</span><span class="cx"> "%d files" = "%d files";
</span><span class="cx">
</span><span class="lines">@@ -595,6 +598,9 @@
</span><span class="cx"> /* Undo action name */
</span><span class="cx"> "Use Standard Ligatures (Undo action name)" = "Use Standard Ligatures";
</span><span class="cx">
</span><ins>+/* Description of WebCrypto master keys in Keychain */
+"Used to encrypt WebCrypto keys in persistent storage, such as IndexedDB" = "Used to encrypt WebCrypto keys in persistent storage, such as IndexedDB";
+
</ins><span class="cx"> /* Web Inspector window title */
</span><span class="cx"> "Web Inspector — %@" = "Web Inspector — %@";
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (164180 => 164181)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in        2014-02-15 22:32:05 UTC (rev 164180)
+++ trunk/Source/WebCore/WebCore.exp.in        2014-02-15 23:26:21 UTC (rev 164181)
</span><span class="lines">@@ -2625,6 +2625,7 @@
</span><span class="cx"> _wkCTFontTransformGlyphs
</span><span class="cx"> __ZN7WebCore23wrapSerializedCryptoKeyERKN3WTF6VectorIhLm0ENS0_15CrashOnOverflowEEES5_RS3_
</span><span class="cx"> __ZN7WebCore25unwrapSerializedCryptoKeyERKN3WTF6VectorIhLm0ENS0_15CrashOnOverflowEEES5_RS3_
</span><ins>+__ZN7WebCore28getDefaultWebCryptoMasterKeyERN3WTF6VectorIhLm0ENS0_15CrashOnOverflowEEE
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> #if ENABLE(3D_RENDERING)
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoSerializedCryptoKeyWraph"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/SerializedCryptoKeyWrap.h (164180 => 164181)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/SerializedCryptoKeyWrap.h        2014-02-15 22:32:05 UTC (rev 164180)
+++ trunk/Source/WebCore/crypto/SerializedCryptoKeyWrap.h        2014-02-15 23:26:21 UTC (rev 164181)
</span><span class="lines">@@ -33,6 +33,8 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><ins>+bool getDefaultWebCryptoMasterKey(Vector<uint8_t>&);
+
</ins><span class="cx"> bool wrapSerializedCryptoKey(const Vector<uint8_t>& masterKey, const Vector<uint8_t>& key, Vector<uint8_t>& result);
</span><span class="cx"> bool unwrapSerializedCryptoKey(const Vector<uint8_t>& masterKey, const Vector<uint8_t>& wrappedKey, Vector<uint8_t>& key);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorecryptomacSerializedCryptoKeyWrapMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/mac/SerializedCryptoKeyWrapMac.mm (164180 => 164181)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/mac/SerializedCryptoKeyWrapMac.mm        2014-02-15 22:32:05 UTC (rev 164180)
+++ trunk/Source/WebCore/crypto/mac/SerializedCryptoKeyWrapMac.mm        2014-02-15 23:26:21 UTC (rev 164181)
</span><span class="lines">@@ -29,9 +29,12 @@
</span><span class="cx"> #if ENABLE(SUBTLE_CRYPTO)
</span><span class="cx">
</span><span class="cx"> #include "CommonCryptoUtilities.h"
</span><ins>+#include "LocalizedStrings.h"
</ins><span class="cx"> #include <CommonCrypto/CommonSymmetricKeywrap.h>
</span><ins>+#include <wtf/text/Base64.h>
</ins><span class="cx"> #include <wtf/text/CString.h>
</span><span class="cx"> #include <wtf/CryptographicUtilities.h>
</span><ins>+#include <wtf/RetainPtr.h>
</ins><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="lines">@@ -42,6 +45,8 @@
</span><span class="cx"> const NSString* encryptedKeyKey = @"encryptedKey";
</span><span class="cx"> const NSString* tagKey = @"tag";
</span><span class="cx">
</span><ins>+const size_t masterKeySizeInBytes = 16;
+
</ins><span class="cx"> inline Vector<uint8_t> vectorFromNSData(NSData* data)
</span><span class="cx"> {
</span><span class="cx"> Vector<uint8_t> result;
</span><span class="lines">@@ -49,6 +54,109 @@
</span><span class="cx"> return result;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+
+bool getDefaultWebCryptoMasterKey(Vector<uint8_t>& masterKey)
+{
+ // FIXME: Implement.
+ masterKey.resize(masterKeySizeInBytes);
+ memset(masterKey.data(), 0, masterKey.size());
+ return true;
+}
+
+#else
+
+static NSString* masterKeyAccountNameForCurrentApplication()
+{
+ return [NSString stringWithFormat:@"com.apple.WebKit.WebCrypto.master+%@", [[NSRunningApplication currentApplication] bundleIdentifier]];
+}
+
+static bool createAndStoreMasterKey(Vector<uint8_t>& masterKeyData)
+{
+ masterKeyData.resize(masterKeySizeInBytes);
+ CCRandomCopyBytes(kCCRandomDefault, masterKeyData.data(), masterKeyData.size());
+
+ NSString *localizedItemName = webCryptoMasterKeyKeychainLabel([[NSRunningApplication currentApplication] localizedName]);
+
+ SecAccessRef accessRef;
+ OSStatus status = SecAccessCreate((CFStringRef)localizedItemName, nullptr, &accessRef);
+ if (status) {
+ WTFLogAlways("Cannot create a security access object for storing WebCrypto master key, error %d", (int)status);
+ return nullptr;
+ }
+ RetainPtr<SecAccessRef> access = adoptCF(accessRef);
+
+ RetainPtr<CFArrayRef> acls = adoptCF(SecAccessCopyMatchingACLList(accessRef, kSecACLAuthorizationExportClear));
+ SecACLRef acl = (SecACLRef)CFArrayGetValueAtIndex(acls.get(), 0);
+
+ SecTrustedApplicationRef trustedAppRef;
+ status = SecTrustedApplicationCreateFromPath(0, &trustedAppRef);
+ if (status) {
+ WTFLogAlways("Cannot create a trusted application object for storing WebCrypto master key, error %d", (int)status);
+ return nullptr;
+ }
+ RetainPtr<SecTrustedApplicationRef> trustedApp = adoptCF(trustedAppRef);
+
+ status = SecACLSetContents(acl, (CFArrayRef)@[ (id)trustedApp.get() ], (CFStringRef)localizedItemName, kSecKeychainPromptRequirePassphase);
+ if (status) {
+ WTFLogAlways("Cannot set ACL for WebCrypto master key, error %d", (int)status);
+ return nullptr;
+ }
+
+ Vector<char> base64EncodedMasterKeyData;
+ base64Encode(masterKeyData, base64EncodedMasterKeyData);
+
+ // Cannot use kSecClassKey because of <rdar://problem/16068207>.
+ NSDictionary *attributes = @{
+ (id)kSecClass : (id)kSecClassGenericPassword,
+ (id)kSecAttrSynchronizable : @NO,
+ (id)kSecAttrIsPermanent : @YES,
+ (id)kSecAttrAccess : (id)access.get(),
+ (id)kSecAttrComment : webCryptoMasterKeyKeychainComment(),
+ (id)kSecAttrLabel : localizedItemName,
+ (id)kSecAttrAccount : masterKeyAccountNameForCurrentApplication(),
+ (id)kSecValueData : [NSData dataWithBytes:base64EncodedMasterKeyData.data() length:base64EncodedMasterKeyData.size()],
+ };
+
+ status = SecItemAdd((CFDictionaryRef)attributes, nullptr);
+ if (status) {
+ WTFLogAlways("Cannot store WebCrypto master key, error %d", (int)status);
+ return nullptr;
+ }
+ return true;
+}
+
+static bool findMasterKey(Vector<uint8_t>& masterKeyData)
+{
+ NSDictionary *query = @{
+ (id)kSecClass : (id)kSecClassGenericPassword,
+ (id)kSecAttrAccount : masterKeyAccountNameForCurrentApplication(),
+ (id)kSecReturnData : @YES,
+ };
+
+ CFDataRef keyDataRef;
+ OSStatus status = SecItemCopyMatching((CFDictionaryRef)query, (CFTypeRef*)&keyDataRef);
+ if (status) {
+ if (status != errSecItemNotFound && status != errSecUserCanceled)
+ WTFLogAlways("Could not find WebCrypto master key in Keychain, error %d", (int)status);
+ return false;
+ }
+ RetainPtr<CFDataRef> keyData = adoptCF(keyDataRef);
+
+ Vector<uint8_t> base64EncodedMasterKeyData = vectorFromNSData((NSData *)keyData.get());
+ return base64Decode((const char*)base64EncodedMasterKeyData.data(), base64EncodedMasterKeyData.size(), masterKeyData);
+}
+
+bool getDefaultWebCryptoMasterKey(Vector<uint8_t>& masterKey)
+{
+ if (!findMasterKey(masterKey) && !createAndStoreMasterKey(masterKey))
+ return false;
+ RELEASE_ASSERT(masterKey.size() == masterKeySizeInBytes);
+ return true;
+}
+
+#endif
+
</ins><span class="cx"> bool wrapSerializedCryptoKey(const Vector<uint8_t>& masterKey, const Vector<uint8_t>& key, Vector<uint8_t>& result)
</span><span class="cx"> {
</span><span class="cx"> Vector<uint8_t> kek(16);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformLocalizedStringscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/LocalizedStrings.cpp (164180 => 164181)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/LocalizedStrings.cpp        2014-02-15 22:32:05 UTC (rev 164180)
+++ trunk/Source/WebCore/platform/LocalizedStrings.cpp        2014-02-15 23:26:21 UTC (rev 164181)
</span><span class="lines">@@ -1118,4 +1118,16 @@
</span><span class="cx"> return formatLocalizedString(WEB_UI_STRING("Show in blocked plug-in", "Title of the context menu item to show when PDFPlugin was used instead of a blocked plugin"));
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if ENABLE(SUBTLE_CRYPTO)
+String webCryptoMasterKeyKeychainLabel(const String& localizedApplicationName)
+{
+ return formatLocalizedString(WEB_UI_STRING("%@ WebCrypto Master Key", "Name of application's single WebCrypto master key in Keychain"), localizedApplicationName.createCFString().get());
+}
+
+String webCryptoMasterKeyKeychainComment()
+{
+ return WEB_UI_STRING("Used to encrypt WebCrypto keys in persistent storage, such as IndexedDB", "Description of WebCrypto master keys in Keychain");
+}
+#endif
+
</ins><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformLocalizedStringsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/LocalizedStrings.h (164180 => 164181)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/LocalizedStrings.h        2014-02-15 22:32:05 UTC (rev 164180)
+++ trunk/Source/WebCore/platform/LocalizedStrings.h        2014-02-15 23:26:21 UTC (rev 164181)
</span><span class="lines">@@ -263,6 +263,11 @@
</span><span class="cx">
</span><span class="cx"> String useBlockedPlugInContextMenuTitle();
</span><span class="cx">
</span><ins>+#if ENABLE(SUBTLE_CRYPTO)
+ String webCryptoMasterKeyKeychainLabel(const String& localizedApplicationName);
+ String webCryptoMasterKeyKeychainComment();
+#endif
+
</ins><span class="cx"> #define WEB_UI_STRING(string, description) WebCore::localizedString(string)
</span><span class="cx"> #define WEB_UI_STRING_KEY(string, key, description) WebCore::localizedString(key)
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (164180 => 164181)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/ChangeLog        2014-02-15 22:32:05 UTC (rev 164180)
+++ trunk/Source/WebKit/mac/ChangeLog        2014-02-15 23:26:21 UTC (rev 164181)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2014-02-15 Alexey Proskuryakov <ap@apple.com>
+
+ [Mac] All WebKit clients should encrypt WebCrypto keys automatically
+ https://bugs.webkit.org/show_bug.cgi?id=128852
+
+ Reviewed by Oliver Hunt.
+
+ * WebCoreSupport/WebChromeClient.mm:
+ (WebChromeClient::wrapCryptoKey):
+ (WebChromeClient::unwrapCryptoKey):
+ Call the default implementation if key is not provided by a client.
+
</ins><span class="cx"> 2014-02-14 Anders Carlsson <andersca@apple.com>
</span><span class="cx">
</span><span class="cx"> Control tints don't update inside WebViews
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebCoreSupportWebChromeClientmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm (164180 => 164181)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm        2014-02-15 22:32:05 UTC (rev 164180)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm        2014-02-15 23:26:21 UTC (rev 164181)
</span><span class="lines">@@ -1002,27 +1002,27 @@
</span><span class="cx"> #if ENABLE(SUBTLE_CRYPTO)
</span><span class="cx"> bool WebChromeClient::wrapCryptoKey(const Vector<uint8_t>& key, Vector<uint8_t>& wrappedKey) const
</span><span class="cx"> {
</span><ins>+ Vector<uint8_t> masterKey;
</ins><span class="cx"> SEL selector = @selector(webCryptoMasterKeyForWebView:);
</span><del>- if (![[m_webView UIDelegate] respondsToSelector:selector])
</del><ins>+ if ([[m_webView UIDelegate] respondsToSelector:selector]) {
+ NSData *keyData = CallUIDelegate(m_webView, selector);
+ masterKey.append((uint8_t*)[keyData bytes], [keyData length]);
+ } else if (!getDefaultWebCryptoMasterKey(masterKey))
</ins><span class="cx"> return false;
</span><span class="cx">
</span><del>- NSData* keyData = CallUIDelegate(m_webView, selector);
-
- Vector<uint8_t> masterKey;
- masterKey.append((uint8_t*)[keyData bytes], [keyData length]);
</del><span class="cx"> return wrapSerializedCryptoKey(masterKey, key, wrappedKey);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool WebChromeClient::unwrapCryptoKey(const Vector<uint8_t>& wrappedKey, Vector<uint8_t>& key) const
</span><span class="cx"> {
</span><ins>+ Vector<uint8_t> masterKey;
</ins><span class="cx"> SEL selector = @selector(webCryptoMasterKeyForWebView:);
</span><del>- if (![[m_webView UIDelegate] respondsToSelector:selector])
</del><ins>+ if ([[m_webView UIDelegate] respondsToSelector:selector]) {
+ NSData *keyData = CallUIDelegate(m_webView, selector);
+ masterKey.append((uint8_t*)[keyData bytes], [keyData length]);
+ } else if (!getDefaultWebCryptoMasterKey(masterKey))
</ins><span class="cx"> return false;
</span><span class="cx">
</span><del>- NSData *keyData = CallUIDelegate(m_webView, selector);
-
- Vector<uint8_t> masterKey;
- masterKey.append((uint8_t*)[keyData bytes], [keyData length]);
</del><span class="cx"> return unwrapSerializedCryptoKey(masterKey, wrappedKey, key);
</span><span class="cx"> }
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (164180 => 164181)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-02-15 22:32:05 UTC (rev 164180)
+++ trunk/Source/WebKit2/ChangeLog        2014-02-15 23:26:21 UTC (rev 164181)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2014-02-15 Alexey Proskuryakov <ap@apple.com>
+
+ [Mac] All WebKit clients should encrypt WebCrypto keys automatically
+ https://bugs.webkit.org/show_bug.cgi?id=128852
+
+ Reviewed by Oliver Hunt.
+
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::wrapCryptoKey):
+ (WebKit::WebPageProxy::unwrapCryptoKey):
+ Call the default implementation if key is not provided by a client.
+
</ins><span class="cx"> 2014-02-15 Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com>
</span><span class="cx">
</span><span class="cx"> [EFL][WK2] Stop calling mktemp(3).
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (164180 => 164181)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2014-02-15 22:32:05 UTC (rev 164180)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2014-02-15 23:26:21 UTC (rev 164181)
</span><span class="lines">@@ -4483,25 +4483,29 @@
</span><span class="cx"> #if ENABLE(SUBTLE_CRYPTO)
</span><span class="cx"> void WebPageProxy::wrapCryptoKey(const Vector<uint8_t>& key, bool& succeeded, Vector<uint8_t>& wrappedKey)
</span><span class="cx"> {
</span><ins>+ Vector<uint8_t> masterKey;
</ins><span class="cx"> RefPtr<API::Data> keyData = m_process->context().client().copyWebCryptoMasterKey(&m_process->context());
</span><del>- if (!keyData) {
</del><ins>+ if (keyData)
+ masterKey = keyData->dataReference().vector();
+ else if (!getDefaultWebCryptoMasterKey(masterKey)) {
</ins><span class="cx"> succeeded = false;
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- Vector<uint8_t> masterKey = keyData->dataReference().vector();
</del><span class="cx"> succeeded = wrapSerializedCryptoKey(masterKey, key, wrappedKey);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebPageProxy::unwrapCryptoKey(const Vector<uint8_t>& wrappedKey, bool& succeeded, Vector<uint8_t>& key)
</span><span class="cx"> {
</span><ins>+ Vector<uint8_t> masterKey;
</ins><span class="cx"> RefPtr<API::Data> keyData = m_process->context().client().copyWebCryptoMasterKey(&m_process->context());
</span><del>- if (!keyData) {
</del><ins>+ if (keyData)
+ masterKey = keyData->dataReference().vector();
+ else if (!getDefaultWebCryptoMasterKey(masterKey)) {
</ins><span class="cx"> succeeded = false;
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- Vector<uint8_t> masterKey = keyData->dataReference().vector();
</del><span class="cx"> succeeded = unwrapSerializedCryptoKey(masterKey, wrappedKey, key);
</span><span class="cx"> }
</span><span class="cx"> #endif
</span></span></pre>
</div>
</div>
</body>
</html>