<!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>[213628] trunk</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/213628">213628</a></dd>
<dt>Author</dt> <dd>jiewen_tan@apple.com</dd>
<dt>Date</dt> <dd>2017-03-08 21:50:31 -0800 (Wed, 08 Mar 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>[WebCrypto] Implement SubtleCrypto::DeriveKey method
https://bugs.webkit.org/show_bug.cgi?id=169386
&lt;rdar://problem/23789585&gt;

Reviewed by Brent Fulgham.

Source/WebCore:

This patch does following few things:
1. It implements SubtleCrypto::DeriveKey method according to the spec:
https://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-deriveKey.
2. It implements getKeyLength operations for AES-CBC, AES-KW, AES-CFB,
AES-GCM, and HMAC, which is needed by the SubtleCrypto::DeriveKey method.
3. It enables ECDH DeriveKey operation.
4. It replaces unigned long with size_t in all the crypto codes.

Tests: crypto/subtle/derive-key-malformed-parameters.html
       crypto/subtle/ecdh-import-key-derive-aes-key.html
       crypto/subtle/ecdh-import-key-derive-hmac-key-custom-length.html
       crypto/subtle/unwrap-key-malformed-parameters.html
       crypto/subtle/wrap-key-malformed-parameters.html
       crypto/workers/subtle/ecdh-import-key-derive-key.html

* CMakeLists.txt:
* DerivedSources.make:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSSubtleCryptoCustom.cpp:
(WebCore::normalizeCryptoAlgorithmParameters):
(WebCore::jsSubtleCryptoFunctionEncryptPromise):
(WebCore::jsSubtleCryptoFunctionDecryptPromise):
(WebCore::jsSubtleCryptoFunctionSignPromise):
(WebCore::jsSubtleCryptoFunctionVerifyPromise):
(WebCore::jsSubtleCryptoFunctionDigestPromise):
(WebCore::jsSubtleCryptoFunctionDeriveKeyPromise):
(WebCore::jsSubtleCryptoFunctionDeriveBitsPromise):
Remove unnecessary return statement from callbacks.
* crypto/CryptoAlgorithm.cpp:
(WebCore::CryptoAlgorithm::deriveBits):
(WebCore::CryptoAlgorithm::getKeyLength):
* crypto/CryptoAlgorithm.h:
* crypto/CryptoAlgorithmParameters.h:
* crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
(WebCore::CryptoAlgorithmAES_CBC::generateKey):
(WebCore::CryptoAlgorithmAES_CBC::getKeyLength):
* crypto/algorithms/CryptoAlgorithmAES_CBC.h:
* crypto/algorithms/CryptoAlgorithmAES_CFB.cpp:
(WebCore::CryptoAlgorithmAES_CFB::generateKey):
(WebCore::CryptoAlgorithmAES_CFB::getKeyLength):
* crypto/algorithms/CryptoAlgorithmAES_CFB.h:
* crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:
(WebCore::CryptoAlgorithmAES_GCM::generateKey):
(WebCore::CryptoAlgorithmAES_GCM::getKeyLength):
* crypto/algorithms/CryptoAlgorithmAES_GCM.h:
* crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
(WebCore::CryptoAlgorithmAES_KW::generateKey):
(WebCore::CryptoAlgorithmAES_KW::getKeyLength):
* crypto/algorithms/CryptoAlgorithmAES_KW.h:
* crypto/algorithms/CryptoAlgorithmECDH.cpp:
(WebCore::CryptoAlgorithmECDH::deriveBits):
* crypto/algorithms/CryptoAlgorithmECDH.h:
* crypto/algorithms/CryptoAlgorithmHMAC.cpp:
(WebCore::CryptoAlgorithmHMAC::getKeyLength):
* crypto/algorithms/CryptoAlgorithmHMAC.h:
* crypto/keys/CryptoKeyAES.cpp:
(WebCore::CryptoKeyAES::getKeyLength):
* crypto/keys/CryptoKeyAES.h:
* crypto/keys/CryptoKeyHMAC.cpp:
(WebCore::getKeyLengthFromHash):
(WebCore::CryptoKeyHMAC::generate):
(WebCore::CryptoKeyHMAC::getKeyLength):
* crypto/keys/CryptoKeyHMAC.h:
* crypto/mac/CryptoAlgorithmECDHMac.cpp:
(WebCore::CryptoAlgorithmECDH::platformDeriveBits):
* crypto/parameters/AesKeyParams.idl: Renamed from Source/WebCore/crypto/parameters/AesKeyGenParams.idl.
* crypto/parameters/CryptoAlgorithmAesKeyParams.h: Renamed from Source/WebCore/crypto/parameters/CryptoAlgorithmAesKeyGenParams.h.
Rename AesKeyGenParams to AesKeyParams to represent a unified dictionary for AesKeyGenParams and AesDerivedKeyParams.
* crypto/parameters/CryptoAlgorithmHmacKeyParams.h:
* crypto/parameters/CryptoAlgorithmRsaKeyGenParams.h:

LayoutTests:

* crypto/subtle/aes-generate-key-malformed-parameters-expected.txt:
* crypto/subtle/derive-key-malformed-parameters-expected.txt: Added.
* crypto/subtle/derive-key-malformed-parameters.html: Added.
* crypto/subtle/deriveKey-malformed-parameters-expected.txt: Removed.
* crypto/subtle/deriveKey-malformed-parameters.html: Removed.
* crypto/subtle/ecdh-import-key-derive-aes-key-expected.txt: Added.
* crypto/subtle/ecdh-import-key-derive-aes-key.html: Added.
* crypto/subtle/ecdh-import-key-derive-hmac-key-custom-length-expected.txt: Added.
* crypto/subtle/ecdh-import-key-derive-hmac-key-custom-length.html: Added.
* crypto/subtle/unwrap-key-malformed-parameters-expected.txt: Renamed from LayoutTests/crypto/subtle/unwrapKey-malformed-parameters-expected.txt.
* crypto/subtle/unwrap-key-malformed-parameters.html: Renamed from LayoutTests/crypto/subtle/unwrapKey-malformed-parameters.html.
* crypto/subtle/wrap-key-malformed-parameters-expected.txt: Renamed from LayoutTests/crypto/subtle/wrapKey-malformed-parameters-expected.txt.
* crypto/subtle/wrap-key-malformed-parameters.html: Renamed from LayoutTests/crypto/subtle/wrapKey-malformed-parameters.html.
A bit renaming.
* crypto/workers/subtle/ecdh-import-key-derive-key-expected.txt: Added.
* crypto/workers/subtle/ecdh-import-key-derive-key.html: Added.
* crypto/workers/subtle/resources/ecdh-import-key-derive-key.js: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestscryptosubtleaesgeneratekeymalformedparametersexpectedtxt">trunk/LayoutTests/crypto/subtle/aes-generate-key-malformed-parameters-expected.txt</a></li>
<li><a href="#trunkSourceWebCoreCMakeListstxt">trunk/Source/WebCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreDerivedSourcesmake">trunk/Source/WebCore/DerivedSources.make</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSSubtleCryptoCustomcpp">trunk/Source/WebCore/bindings/js/JSSubtleCryptoCustom.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptoCryptoAlgorithmcpp">trunk/Source/WebCore/crypto/CryptoAlgorithm.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptoCryptoAlgorithmh">trunk/Source/WebCore/crypto/CryptoAlgorithm.h</a></li>
<li><a href="#trunkSourceWebCorecryptoCryptoAlgorithmParametersh">trunk/Source/WebCore/crypto/CryptoAlgorithmParameters.h</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmAES_CBCcpp">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_CBC.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmAES_CBCh">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_CBC.h</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmAES_CFBcpp">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_CFB.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmAES_CFBh">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_CFB.h</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmAES_GCMcpp">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_GCM.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmAES_GCMh">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_GCM.h</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmAES_KWcpp">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_KW.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmAES_KWh">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_KW.h</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmECDHcpp">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmECDH.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmECDHh">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmECDH.h</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmHMACcpp">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmHMAC.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmHMACh">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmHMAC.h</a></li>
<li><a href="#trunkSourceWebCorecryptokeysCryptoKeyAEScpp">trunk/Source/WebCore/crypto/keys/CryptoKeyAES.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptokeysCryptoKeyAESh">trunk/Source/WebCore/crypto/keys/CryptoKeyAES.h</a></li>
<li><a href="#trunkSourceWebCorecryptokeysCryptoKeyHMACcpp">trunk/Source/WebCore/crypto/keys/CryptoKeyHMAC.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptokeysCryptoKeyHMACh">trunk/Source/WebCore/crypto/keys/CryptoKeyHMAC.h</a></li>
<li><a href="#trunkSourceWebCorecryptomacCryptoAlgorithmECDHMaccpp">trunk/Source/WebCore/crypto/mac/CryptoAlgorithmECDHMac.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptoparametersCryptoAlgorithmHmacKeyParamsh">trunk/Source/WebCore/crypto/parameters/CryptoAlgorithmHmacKeyParams.h</a></li>
<li><a href="#trunkSourceWebCorecryptoparametersCryptoAlgorithmRsaKeyGenParamsh">trunk/Source/WebCore/crypto/parameters/CryptoAlgorithmRsaKeyGenParams.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestscryptosubtlederivekeymalformedparametersexpectedtxt">trunk/LayoutTests/crypto/subtle/derive-key-malformed-parameters-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtlederivekeymalformedparametershtml">trunk/LayoutTests/crypto/subtle/derive-key-malformed-parameters.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtleecdhimportkeyderiveaeskeyexpectedtxt">trunk/LayoutTests/crypto/subtle/ecdh-import-key-derive-aes-key-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtleecdhimportkeyderiveaeskeyhtml">trunk/LayoutTests/crypto/subtle/ecdh-import-key-derive-aes-key.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtleecdhimportkeyderivehmackeycustomlengthexpectedtxt">trunk/LayoutTests/crypto/subtle/ecdh-import-key-derive-hmac-key-custom-length-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtleecdhimportkeyderivehmackeycustomlengthhtml">trunk/LayoutTests/crypto/subtle/ecdh-import-key-derive-hmac-key-custom-length.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtleunwrapkeymalformedparametersexpectedtxt">trunk/LayoutTests/crypto/subtle/unwrap-key-malformed-parameters-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtleunwrapkeymalformedparametershtml">trunk/LayoutTests/crypto/subtle/unwrap-key-malformed-parameters.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtlewrapkeymalformedparametersexpectedtxt">trunk/LayoutTests/crypto/subtle/wrap-key-malformed-parameters-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtlewrapkeymalformedparametershtml">trunk/LayoutTests/crypto/subtle/wrap-key-malformed-parameters.html</a></li>
<li><a href="#trunkLayoutTestscryptoworkerssubtleecdhimportkeyderivekeyexpectedtxt">trunk/LayoutTests/crypto/workers/subtle/ecdh-import-key-derive-key-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptoworkerssubtleecdhimportkeyderivekeyhtml">trunk/LayoutTests/crypto/workers/subtle/ecdh-import-key-derive-key.html</a></li>
<li><a href="#trunkLayoutTestscryptoworkerssubtleresourcesecdhimportkeyderivekeyjs">trunk/LayoutTests/crypto/workers/subtle/resources/ecdh-import-key-derive-key.js</a></li>
<li><a href="#trunkSourceWebCorecryptoparametersAesKeyParamsidl">trunk/Source/WebCore/crypto/parameters/AesKeyParams.idl</a></li>
<li><a href="#trunkSourceWebCorecryptoparametersCryptoAlgorithmAesKeyParamsh">trunk/Source/WebCore/crypto/parameters/CryptoAlgorithmAesKeyParams.h</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkLayoutTestscryptosubtlederiveKeymalformedparametersexpectedtxt">trunk/LayoutTests/crypto/subtle/deriveKey-malformed-parameters-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtlederiveKeymalformedparametershtml">trunk/LayoutTests/crypto/subtle/deriveKey-malformed-parameters.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtleunwrapKeymalformedparametersexpectedtxt">trunk/LayoutTests/crypto/subtle/unwrapKey-malformed-parameters-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtleunwrapKeymalformedparametershtml">trunk/LayoutTests/crypto/subtle/unwrapKey-malformed-parameters.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtlewrapKeymalformedparametersexpectedtxt">trunk/LayoutTests/crypto/subtle/wrapKey-malformed-parameters-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtlewrapKeymalformedparametershtml">trunk/LayoutTests/crypto/subtle/wrapKey-malformed-parameters.html</a></li>
<li><a href="#trunkSourceWebCorecryptoparametersAesKeyGenParamsidl">trunk/Source/WebCore/crypto/parameters/AesKeyGenParams.idl</a></li>
<li><a href="#trunkSourceWebCorecryptoparametersCryptoAlgorithmAesKeyGenParamsh">trunk/Source/WebCore/crypto/parameters/CryptoAlgorithmAesKeyGenParams.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (213627 => 213628)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2017-03-09 05:16:20 UTC (rev 213627)
+++ trunk/LayoutTests/ChangeLog        2017-03-09 05:50:31 UTC (rev 213628)
</span><span class="lines">@@ -1,3 +1,29 @@
</span><ins>+2017-03-08  Jiewen Tan  &lt;jiewen_tan@apple.com&gt;
+
+        [WebCrypto] Implement SubtleCrypto::DeriveKey method
+        https://bugs.webkit.org/show_bug.cgi?id=169386
+        &lt;rdar://problem/23789585&gt;
+
+        Reviewed by Brent Fulgham.
+
+        * crypto/subtle/aes-generate-key-malformed-parameters-expected.txt:
+        * crypto/subtle/derive-key-malformed-parameters-expected.txt: Added.
+        * crypto/subtle/derive-key-malformed-parameters.html: Added.
+        * crypto/subtle/deriveKey-malformed-parameters-expected.txt: Removed.
+        * crypto/subtle/deriveKey-malformed-parameters.html: Removed.
+        * crypto/subtle/ecdh-import-key-derive-aes-key-expected.txt: Added.
+        * crypto/subtle/ecdh-import-key-derive-aes-key.html: Added.
+        * crypto/subtle/ecdh-import-key-derive-hmac-key-custom-length-expected.txt: Added.
+        * crypto/subtle/ecdh-import-key-derive-hmac-key-custom-length.html: Added.
+        * crypto/subtle/unwrap-key-malformed-parameters-expected.txt: Renamed from LayoutTests/crypto/subtle/unwrapKey-malformed-parameters-expected.txt.
+        * crypto/subtle/unwrap-key-malformed-parameters.html: Renamed from LayoutTests/crypto/subtle/unwrapKey-malformed-parameters.html.
+        * crypto/subtle/wrap-key-malformed-parameters-expected.txt: Renamed from LayoutTests/crypto/subtle/wrapKey-malformed-parameters-expected.txt.
+        * crypto/subtle/wrap-key-malformed-parameters.html: Renamed from LayoutTests/crypto/subtle/wrapKey-malformed-parameters.html.
+        A bit renaming.
+        * crypto/workers/subtle/ecdh-import-key-derive-key-expected.txt: Added.
+        * crypto/workers/subtle/ecdh-import-key-derive-key.html: Added.
+        * crypto/workers/subtle/resources/ecdh-import-key-derive-key.js: Added.
+
</ins><span class="cx"> 2017-03-08  Matt Baker  &lt;mattbaker@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Web Inspector: Add DOM breakpoints UI for node/subtree modification events
</span></span></pre></div>
<a id="trunkLayoutTestscryptosubtleaesgeneratekeymalformedparametersexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/crypto/subtle/aes-generate-key-malformed-parameters-expected.txt (213627 => 213628)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/aes-generate-key-malformed-parameters-expected.txt        2017-03-09 05:16:20 UTC (rev 213627)
+++ trunk/LayoutTests/crypto/subtle/aes-generate-key-malformed-parameters-expected.txt        2017-03-09 05:50:31 UTC (rev 213628)
</span><span class="lines">@@ -3,11 +3,11 @@
</span><span class="cx"> On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-PASS crypto.subtle.generateKey(&quot;aes-cbc&quot;, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;]) rejected promise  with TypeError: Member AesKeyGenParams.length is required and must be an instance of unsigned short.
-PASS crypto.subtle.generateKey({name: &quot;aes-cbc&quot;}, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;]) rejected promise  with TypeError: Member AesKeyGenParams.length is required and must be an instance of unsigned short.
</del><ins>+PASS crypto.subtle.generateKey(&quot;aes-cbc&quot;, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;]) rejected promise  with TypeError: Member AesKeyParams.length is required and must be an instance of unsigned short.
+PASS crypto.subtle.generateKey({name: &quot;aes-cbc&quot;}, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;]) rejected promise  with TypeError: Member AesKeyParams.length is required and must be an instance of unsigned short.
</ins><span class="cx"> PASS crypto.subtle.generateKey({name: &quot;aes-cbc&quot;, length: true}, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;]) rejected promise  with OperationError (DOM Exception 34): The operation failed for an operation-specific reason.
</span><span class="cx"> PASS crypto.subtle.generateKey({name: &quot;aes-cbc&quot;, length: null}, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;]) rejected promise  with OperationError (DOM Exception 34): The operation failed for an operation-specific reason.
</span><del>-PASS crypto.subtle.generateKey({name: &quot;aes-cbc&quot;, length: undefined}, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;]) rejected promise  with TypeError: Member AesKeyGenParams.length is required and must be an instance of unsigned short.
</del><ins>+PASS crypto.subtle.generateKey({name: &quot;aes-cbc&quot;, length: undefined}, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;]) rejected promise  with TypeError: Member AesKeyParams.length is required and must be an instance of unsigned short.
</ins><span class="cx"> PASS crypto.subtle.generateKey({name: &quot;aes-cbc&quot;, length: Symbol()}, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;]) rejected promise  with TypeError: Cannot convert a symbol to a number.
</span><span class="cx"> PASS crypto.subtle.generateKey({name: &quot;aes-cbc&quot;, length: { }}, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;]) rejected promise  with OperationError (DOM Exception 34): The operation failed for an operation-specific reason.
</span><span class="cx"> PASS crypto.subtle.generateKey({name: &quot;aes-cbc&quot;, length: &quot;foo&quot;}, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;]) rejected promise  with OperationError (DOM Exception 34): The operation failed for an operation-specific reason.
</span></span></pre></div>
<a id="trunkLayoutTestscryptosubtlederivekeymalformedparametersexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/derive-key-malformed-parameters-expected.txt (0 => 213628)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/derive-key-malformed-parameters-expected.txt                                (rev 0)
+++ trunk/LayoutTests/crypto/subtle/derive-key-malformed-parameters-expected.txt        2017-03-09 05:50:31 UTC (rev 213628)
</span><span class="lines">@@ -0,0 +1,24 @@
</span><ins>+Test deriveKey operation with malformed parameters
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS crypto.subtle.deriveKey() rejected promise  with TypeError: Not enough arguments.
+PASS crypto.subtle.deriveKey(1) rejected promise  with TypeError: Not enough arguments.
+PASS crypto.subtle.deriveKey(1, 2) rejected promise  with TypeError: Not enough arguments.
+PASS crypto.subtle.deriveKey(1, 2, 3) rejected promise  with TypeError: Not enough arguments.
+PASS crypto.subtle.deriveKey(1, 2, 3, 4) rejected promise  with TypeError: Not enough arguments.
+PASS crypto.subtle.deriveKey({ name:&quot;ECDH&quot;, public:publicKey }, privateKey, &quot;AES-CBC&quot;, extractable, [&quot;encrypt&quot;]) rejected promise  with TypeError: Member AesKeyParams.length is required and must be an instance of unsigned short.
+PASS crypto.subtle.deriveKey({ name:&quot;ECDH&quot;, public:publicKey }, privateKey, &quot;RSAES-PKCS1-v1_5&quot;, extractable, [&quot;encrypt&quot;]) rejected promise  with NotSupportedError (DOM Exception 9): The operation is not supported..
+PASS crypto.subtle.deriveKey({ name:&quot;ECDH&quot;, public:publicKey }, privateKey, {name: &quot;RSA-OAEP&quot;, hash: &quot;sha-1&quot;}, extractable, [&quot;encrypt&quot;]) rejected promise  with NotSupportedError (DOM Exception 9): The operation is not supported..
+PASS crypto.subtle.deriveKey({ name:&quot;ECDH&quot;, public:publicKey }, privateKey, {name: &quot;ECDH&quot;, namedCurve: &quot;P-256&quot;}, extractable, [&quot;encrypt&quot;]) rejected promise  with NotSupportedError (DOM Exception 9): The operation is not supported..
+PASS crypto.subtle.deriveKey({ name:&quot;ECDH&quot;, public:publicKey }, wrongKey, {name: &quot;aes-cbc&quot;, length: 128}, extractable, [&quot;encrypt&quot;]) rejected promise  with InvalidAccessError (DOM Exception 15): CryptoKey doesn't match AlgorithmIdentifier.
+PASS crypto.subtle.deriveKey({ name:&quot;ECDH&quot;, public:publicKey }, wrongKey, {name: &quot;aes-cbc&quot;, length: 128}, extractable, [&quot;encrypt&quot;]) rejected promise  with InvalidAccessError (DOM Exception 15): CryptoKey doesn't support CryptoKey derivation.
+PASS crypto.subtle.deriveKey({ name:&quot;ECDH&quot;, public:publicKey }, privateKey, {name: &quot;aes-cbc&quot;, length: 1}, extractable, [&quot;encrypt&quot;]) rejected promise  with OperationError (DOM Exception 34): Cannot get key length from derivedKeyType.
+PASS crypto.subtle.deriveKey({ name:&quot;ECDH&quot;, public:publicKey }, privateKey, {name: &quot;hmac&quot;, hash: &quot;hmac&quot;}, extractable, [&quot;sign&quot;]) rejected promise  with NotSupportedError (DOM Exception 9): The operation is not supported..
+PASS crypto.subtle.deriveKey({ name:&quot;ECDH&quot;, public:publicKey }, privateKey, {name: &quot;hmac&quot;, hash: &quot;sha-1&quot;, length: 0}, extractable, [&quot;sign&quot;]) rejected promise  with TypeError: Cannot get key length from derivedKeyType.
+PASS crypto.subtle.deriveKey({ name:&quot;ECDH&quot;, public:publicKey }, privateKey, {name: &quot;aes-cbc&quot;, length: 128}, extractable, []) rejected promise  with SyntaxError (DOM Exception 12): A required parameter was missing or out-of-range.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtlederivekeymalformedparametershtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/derive-key-malformed-parameters.html (0 => 213628)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/derive-key-malformed-parameters.html                                (rev 0)
+++ trunk/LayoutTests/crypto/subtle/derive-key-malformed-parameters.html        2017-03-09 05:50:31 UTC (rev 213628)
</span><span class="lines">@@ -0,0 +1,78 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../resources/common.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;p id=&quot;description&quot;&gt;&lt;/p&gt;
+&lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
+
+&lt;script&gt;
+description(&quot;Test deriveKey operation with malformed parameters&quot;);
+
+jsTestIsAsync = true;
+
+var extractable = true;
+var jwkPrivateKey = {
+    kty: &quot;EC&quot;,
+    crv: &quot;P-256&quot;,
+    x: &quot;1FSVWieTvikFkG1NOyhkUCaMbdQhxwH6aCu4Ez-sRtA&quot;,
+    y: &quot;9jmNTLqM4cjBhdAnHcNI9YQV3O8LFmo-EdZWk8ntAaI&quot;,
+    d: &quot;ppxBSov3N8_AUcisAuvmLV4yE8e_L_BLE8bZb9Z1Xjg&quot;,
+};
+var jwkPublicKey = {
+    kty: &quot;EC&quot;,
+    crv: &quot;P-256&quot;,
+    x: &quot;1FSVWieTvikFkG1NOyhkUCaMbdQhxwH6aCu4Ez-sRtA&quot;,
+    y: &quot;9jmNTLqM4cjBhdAnHcNI9YQV3O8LFmo-EdZWk8ntAaI&quot;,
+};
+var rawKey = asciiToUint8Array(&quot;jnOw99oOZFLIEPMr&quot;);
+
+// Not enough arguments.
+shouldReject('crypto.subtle.deriveKey()');
+shouldReject('crypto.subtle.deriveKey(1)');
+shouldReject('crypto.subtle.deriveKey(1, 2)');
+shouldReject('crypto.subtle.deriveKey(1, 2, 3)');
+shouldReject('crypto.subtle.deriveKey(1, 2, 3, 4)');
+
+crypto.subtle.importKey(&quot;jwk&quot;, jwkPrivateKey, { name: &quot;ECDH&quot;, namedCurve: &quot;P-256&quot; }, extractable, [&quot;deriveKey&quot;]).then(function(result) {
+    privateKey = result;
+    return crypto.subtle.importKey(&quot;jwk&quot;, jwkPublicKey, { name: &quot;ECDH&quot;, namedCurve: &quot;P-256&quot; }, extractable, [ ]);
+}).then(function(result) {
+    publicKey = result;
+
+    // Malformed GetKeyLength AlgorithmIdentifier.
+    shouldReject('crypto.subtle.deriveKey({ name:&quot;ECDH&quot;, public:publicKey }, privateKey, &quot;AES-CBC&quot;, extractable, [&quot;encrypt&quot;])');
+    // Not support GetKeyLength AlgorithmIdentifier.
+    shouldReject('crypto.subtle.deriveKey({ name:&quot;ECDH&quot;, public:publicKey }, privateKey, &quot;RSAES-PKCS1-v1_5&quot;, extractable, [&quot;encrypt&quot;])');
+    shouldReject('crypto.subtle.deriveKey({ name:&quot;ECDH&quot;, public:publicKey }, privateKey, {name: &quot;RSA-OAEP&quot;, hash: &quot;sha-1&quot;}, extractable, [&quot;encrypt&quot;])');
+    shouldReject('crypto.subtle.deriveKey({ name:&quot;ECDH&quot;, public:publicKey }, privateKey, {name: &quot;ECDH&quot;, namedCurve: &quot;P-256&quot;}, extractable, [&quot;encrypt&quot;])');
+
+    return crypto.subtle.importKey(&quot;raw&quot;, rawKey, {name: &quot;hmac&quot;, hash: &quot;sha-1&quot;}, extractable, [&quot;sign&quot;, &quot;verify&quot;])
+}).then(function(result) {
+    wrongKey = result;
+
+    // Mismatched AlgorithmIdentifier.
+    shouldReject('crypto.subtle.deriveKey({ name:&quot;ECDH&quot;, public:publicKey }, wrongKey, {name: &quot;aes-cbc&quot;, length: 128}, extractable, [&quot;encrypt&quot;])');
+
+    return crypto.subtle.importKey(&quot;jwk&quot;, jwkPrivateKey, { name: &quot;ECDH&quot;, namedCurve: &quot;P-256&quot; }, extractable, [&quot;deriveBits&quot;]);
+}).then(function(result) {
+    wrongKey = result;
+
+    // Wrong usage.
+    shouldReject('crypto.subtle.deriveKey({ name:&quot;ECDH&quot;, public:publicKey }, wrongKey, {name: &quot;aes-cbc&quot;, length: 128}, extractable, [&quot;encrypt&quot;])');
+    // derivedKeyType with wrong AES params.
+    shouldReject('crypto.subtle.deriveKey({ name:&quot;ECDH&quot;, public:publicKey }, privateKey, {name: &quot;aes-cbc&quot;, length: 1}, extractable, [&quot;encrypt&quot;])');
+    // derivedKeyType with wrong HMAC params.
+    shouldReject('crypto.subtle.deriveKey({ name:&quot;ECDH&quot;, public:publicKey }, privateKey, {name: &quot;hmac&quot;, hash: &quot;hmac&quot;}, extractable, [&quot;sign&quot;])');
+    shouldReject('crypto.subtle.deriveKey({ name:&quot;ECDH&quot;, public:publicKey }, privateKey, {name: &quot;hmac&quot;, hash: &quot;sha-1&quot;, length: 0}, extractable, [&quot;sign&quot;])');
+    // Null usages
+    return shouldReject('crypto.subtle.deriveKey({ name:&quot;ECDH&quot;, public:publicKey }, privateKey, {name: &quot;aes-cbc&quot;, length: 128}, extractable, [])');
+}).then(finishJSTest, finishJSTest);
+
+&lt;/script&gt;
+
+&lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtlederiveKeymalformedparametersexpectedtxt"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/crypto/subtle/deriveKey-malformed-parameters-expected.txt (213627 => 213628)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/deriveKey-malformed-parameters-expected.txt        2017-03-09 05:16:20 UTC (rev 213627)
+++ trunk/LayoutTests/crypto/subtle/deriveKey-malformed-parameters-expected.txt        2017-03-09 05:50:31 UTC (rev 213628)
</span><span class="lines">@@ -1,15 +0,0 @@
</span><del>-Test deriveKey operation with malformed parameters
-
-On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
-
-
-PASS crypto.subtle.deriveKey() rejected promise  with TypeError: Not enough arguments.
-PASS crypto.subtle.deriveKey(1) rejected promise  with TypeError: Not enough arguments.
-PASS crypto.subtle.deriveKey(1, 2) rejected promise  with TypeError: Not enough arguments.
-PASS crypto.subtle.deriveKey(1, 2, 3) rejected promise  with TypeError: Not enough arguments.
-PASS crypto.subtle.deriveKey(1, 2, 3, 4) rejected promise  with TypeError: Not enough arguments.
-PASS crypto.subtle.deriveKey(&quot;ECDH&quot;, 2, 3, 4, 5) rejected promise  with NotSupportedError (DOM Exception 9): The operation is not supported..
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
</del></span></pre></div>
<a id="trunkLayoutTestscryptosubtlederiveKeymalformedparametershtml"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/crypto/subtle/deriveKey-malformed-parameters.html (213627 => 213628)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/deriveKey-malformed-parameters.html        2017-03-09 05:16:20 UTC (rev 213627)
+++ trunk/LayoutTests/crypto/subtle/deriveKey-malformed-parameters.html        2017-03-09 05:50:31 UTC (rev 213628)
</span><span class="lines">@@ -1,26 +0,0 @@
</span><del>-&lt;!DOCTYPE html&gt;
-&lt;html&gt;
-&lt;head&gt;
-&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
-&lt;script src=&quot;../resources/common.js&quot;&gt;&lt;/script&gt;
-&lt;/head&gt;
-&lt;body&gt;
-&lt;p id=&quot;description&quot;&gt;&lt;/p&gt;
-&lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
-
-&lt;script&gt;
-description(&quot;Test deriveKey operation with malformed parameters&quot;);
-
-// Not enough arguments.
-shouldReject('crypto.subtle.deriveKey()');
-shouldReject('crypto.subtle.deriveKey(1)');
-shouldReject('crypto.subtle.deriveKey(1, 2)');
-shouldReject('crypto.subtle.deriveKey(1, 2, 3)');
-shouldReject('crypto.subtle.deriveKey(1, 2, 3, 4)');
-// Not support.
-shouldReject('crypto.subtle.deriveKey(&quot;ECDH&quot;, 2, 3, 4, 5)');
-&lt;/script&gt;
-
-&lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
-&lt;/body&gt;
-&lt;/html&gt;
</del></span></pre></div>
<a id="trunkLayoutTestscryptosubtleecdhimportkeyderiveaeskeyexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/ecdh-import-key-derive-aes-key-expected.txt (0 => 213628)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/ecdh-import-key-derive-aes-key-expected.txt                                (rev 0)
+++ trunk/LayoutTests/crypto/subtle/ecdh-import-key-derive-aes-key-expected.txt        2017-03-09 05:50:31 UTC (rev 213628)
</span><span class="lines">@@ -0,0 +1,14 @@
</span><ins>+Test deriving AES Keys with imported ECDH base key
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS derivedKey.type is 'secret'
+PASS derivedKey.extractable is true
+PASS derivedKey.algorithm.name is 'AES-CBC'
+PASS derivedKey.algorithm.length is 128
+PASS derivedKey.usages is ['decrypt', 'encrypt', 'unwrapKey', 'wrapKey']
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtleecdhimportkeyderiveaeskeyhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/ecdh-import-key-derive-aes-key.html (0 => 213628)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/ecdh-import-key-derive-aes-key.html                                (rev 0)
+++ trunk/LayoutTests/crypto/subtle/ecdh-import-key-derive-aes-key.html        2017-03-09 05:50:31 UTC (rev 213628)
</span><span class="lines">@@ -0,0 +1,53 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../resources/common.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;p id=&quot;description&quot;&gt;&lt;/p&gt;
+&lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
+
+&lt;script&gt;
+description(&quot;Test deriving AES Keys with imported ECDH base key&quot;);
+
+jsTestIsAsync = true;
+
+var extractable = true;
+var jwkPrivateKey = {
+    kty: &quot;EC&quot;,
+    crv: &quot;P-256&quot;,
+    x: &quot;1FSVWieTvikFkG1NOyhkUCaMbdQhxwH6aCu4Ez-sRtA&quot;,
+    y: &quot;9jmNTLqM4cjBhdAnHcNI9YQV3O8LFmo-EdZWk8ntAaI&quot;,
+    d: &quot;ppxBSov3N8_AUcisAuvmLV4yE8e_L_BLE8bZb9Z1Xjg&quot;,
+};
+var jwkPublicKey = {
+    kty: &quot;EC&quot;,
+    crv: &quot;P-256&quot;,
+    x: &quot;1FSVWieTvikFkG1NOyhkUCaMbdQhxwH6aCu4Ez-sRtA&quot;,
+    y: &quot;9jmNTLqM4cjBhdAnHcNI9YQV3O8LFmo-EdZWk8ntAaI&quot;,
+};
+
+crypto.subtle.importKey(&quot;jwk&quot;, jwkPrivateKey, { name: &quot;ECDH&quot;, namedCurve: &quot;P-256&quot; }, extractable, [&quot;deriveKey&quot;]).then(function(result) {
+    privateKey = result;
+    return crypto.subtle.importKey(&quot;jwk&quot;, jwkPublicKey, { name: &quot;ECDH&quot;, namedCurve: &quot;P-256&quot; }, extractable, [ ]);
+}).then(function(result) {
+    publicKey = result;
+    return crypto.subtle.deriveKey({ name:&quot;ECDH&quot;, public:publicKey }, privateKey, {name: &quot;aes-cbc&quot;, length: 128}, extractable, ['decrypt', 'encrypt', 'unwrapKey', 'wrapKey']);
+}).then(function(result) {
+    derivedKey = result;
+
+    shouldBe(&quot;derivedKey.type&quot;, &quot;'secret'&quot;);
+    shouldBe(&quot;derivedKey.extractable&quot;, &quot;true&quot;);
+    shouldBe(&quot;derivedKey.algorithm.name&quot;, &quot;'AES-CBC'&quot;);
+    shouldBe(&quot;derivedKey.algorithm.length&quot;, &quot;128&quot;);
+    shouldBe(&quot;derivedKey.usages&quot;, &quot;['decrypt', 'encrypt', 'unwrapKey', 'wrapKey']&quot;);
+
+    finishJSTest();
+});
+
+&lt;/script&gt;
+
+&lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtleecdhimportkeyderivehmackeycustomlengthexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/ecdh-import-key-derive-hmac-key-custom-length-expected.txt (0 => 213628)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/ecdh-import-key-derive-hmac-key-custom-length-expected.txt                                (rev 0)
+++ trunk/LayoutTests/crypto/subtle/ecdh-import-key-derive-hmac-key-custom-length-expected.txt        2017-03-09 05:50:31 UTC (rev 213628)
</span><span class="lines">@@ -0,0 +1,15 @@
</span><ins>+Test deriving HMAC Keys with imported ECDH base key
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS derivedKey.type is 'secret'
+PASS derivedKey.extractable is true
+PASS derivedKey.algorithm.name is 'HMAC'
+PASS derivedKey.algorithm.length is 128
+PASS derivedKey.algorithm.hash.name is 'SHA-1'
+PASS derivedKey.usages is ['sign', 'verify']
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtleecdhimportkeyderivehmackeycustomlengthhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/ecdh-import-key-derive-hmac-key-custom-length.html (0 => 213628)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/ecdh-import-key-derive-hmac-key-custom-length.html                                (rev 0)
+++ trunk/LayoutTests/crypto/subtle/ecdh-import-key-derive-hmac-key-custom-length.html        2017-03-09 05:50:31 UTC (rev 213628)
</span><span class="lines">@@ -0,0 +1,54 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../resources/common.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;p id=&quot;description&quot;&gt;&lt;/p&gt;
+&lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
+
+&lt;script&gt;
+description(&quot;Test deriving HMAC Keys with imported ECDH base key&quot;);
+
+jsTestIsAsync = true;
+
+var extractable = true;
+var jwkPrivateKey = {
+    kty: &quot;EC&quot;,
+    crv: &quot;P-256&quot;,
+    x: &quot;1FSVWieTvikFkG1NOyhkUCaMbdQhxwH6aCu4Ez-sRtA&quot;,
+    y: &quot;9jmNTLqM4cjBhdAnHcNI9YQV3O8LFmo-EdZWk8ntAaI&quot;,
+    d: &quot;ppxBSov3N8_AUcisAuvmLV4yE8e_L_BLE8bZb9Z1Xjg&quot;,
+};
+var jwkPublicKey = {
+    kty: &quot;EC&quot;,
+    crv: &quot;P-256&quot;,
+    x: &quot;1FSVWieTvikFkG1NOyhkUCaMbdQhxwH6aCu4Ez-sRtA&quot;,
+    y: &quot;9jmNTLqM4cjBhdAnHcNI9YQV3O8LFmo-EdZWk8ntAaI&quot;,
+};
+
+crypto.subtle.importKey(&quot;jwk&quot;, jwkPrivateKey, { name: &quot;ECDH&quot;, namedCurve: &quot;P-256&quot; }, extractable, [&quot;deriveKey&quot;]).then(function(result) {
+    privateKey = result;
+    return crypto.subtle.importKey(&quot;jwk&quot;, jwkPublicKey, { name: &quot;ECDH&quot;, namedCurve: &quot;P-256&quot; }, extractable, [ ]);
+}).then(function(result) {
+    publicKey = result;
+    return crypto.subtle.deriveKey({ name:&quot;ECDH&quot;, public:publicKey }, privateKey, {name: &quot;hmac&quot;, hash: &quot;sha-1&quot;, length: 128}, extractable, ['sign', 'verify']);
+}).then(function(result) {
+    derivedKey = result;
+
+    shouldBe(&quot;derivedKey.type&quot;, &quot;'secret'&quot;);
+    shouldBe(&quot;derivedKey.extractable&quot;, &quot;true&quot;);
+    shouldBe(&quot;derivedKey.algorithm.name&quot;, &quot;'HMAC'&quot;);
+    shouldBe(&quot;derivedKey.algorithm.length&quot;, &quot;128&quot;);
+    shouldBe(&quot;derivedKey.algorithm.hash.name&quot;, &quot;'SHA-1'&quot;);
+    shouldBe(&quot;derivedKey.usages&quot;, &quot;['sign', 'verify']&quot;);
+
+    finishJSTest();
+});
+
+&lt;/script&gt;
+
+&lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtleunwrapkeymalformedparametersexpectedtxtfromrev213627trunkLayoutTestscryptosubtleunwrapKeymalformedparametersexpectedtxt"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/crypto/subtle/unwrap-key-malformed-parameters-expected.txt (from rev 213627, trunk/LayoutTests/crypto/subtle/unwrapKey-malformed-parameters-expected.txt) (0 => 213628)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/unwrap-key-malformed-parameters-expected.txt                                (rev 0)
+++ trunk/LayoutTests/crypto/subtle/unwrap-key-malformed-parameters-expected.txt        2017-03-09 05:50:31 UTC (rev 213628)
</span><span class="lines">@@ -0,0 +1,22 @@
</span><ins>+Test UnwrapKey operation with malformed parameters
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS crypto.subtle.unwrapKey() rejected promise  with TypeError: Not enough arguments.
+PASS crypto.subtle.unwrapKey(1) rejected promise  with TypeError: Not enough arguments.
+PASS crypto.subtle.unwrapKey(1, 2) rejected promise  with TypeError: Not enough arguments.
+PASS crypto.subtle.unwrapKey(1, 2, 3) rejected promise  with TypeError: Not enough arguments.
+PASS crypto.subtle.unwrapKey(1, 2, 3, 4) rejected promise  with TypeError: Not enough arguments.
+PASS crypto.subtle.unwrapKey(1, 2, 3, 4, 5) rejected promise  with TypeError: Not enough arguments.
+PASS crypto.subtle.unwrapKey(1, 2, 3, 4, 5, 6) rejected promise  with TypeError: Not enough arguments.
+PASS crypto.subtle.unwrapKey(&quot;raw&quot;, wrappedRawKey, unwrappingKey, &quot;HMAC&quot;, &quot;AES-CBC&quot;, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;]) rejected promise  with NotSupportedError (DOM Exception 9): The operation is not supported..
+PASS crypto.subtle.unwrapKey(&quot;raw&quot;, wrappedRawKey, unwrappingKey, aesCbcParams, &quot;AES-CBC&quot;, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;]) rejected promise  with InvalidAccessError (DOM Exception 15): Unwrapping CryptoKey doesn't match unwrap AlgorithmIdentifier.
+PASS crypto.subtle.unwrapKey(&quot;jwk&quot;, wrappedRawKey, unwrappingKey, &quot;AES-KW&quot;, &quot;AES-CBC&quot;, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;]) rejected promise  with DataError (DOM Exception 30): WrappedKey cannot be converted to a JSON object.
+PASS crypto.subtle.unwrapKey(&quot;raw&quot;, wrappedRawKey, unwrappingKey, &quot;AES-KW&quot;, &quot;AES-CBC&quot;, extractable, [ ]) rejected promise  with SyntaxError (DOM Exception 12): A required parameter was missing or out-of-range.
+PASS crypto.subtle.unwrapKey(&quot;jwk&quot;, wrappedJwkKey, unwrappingKey, aesCbcParams, {name: &quot;RSA-OAEP&quot;, hash: &quot;SHA-1&quot;}, extractable, [ ]) rejected promise  with SyntaxError (DOM Exception 12): A required parameter was missing or out-of-range.
+PASS crypto.subtle.unwrapKey(&quot;raw&quot;, wrappedRawKey, unwrappingKey, &quot;AES-KW&quot;, &quot;AES-CBC&quot;, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;]) rejected promise  with InvalidAccessError (DOM Exception 15): Unwrapping CryptoKey doesn't support unwrapKey operation.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtleunwrapkeymalformedparametershtmlfromrev213627trunkLayoutTestscryptosubtleunwrapKeymalformedparametershtml"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/crypto/subtle/unwrap-key-malformed-parameters.html (from rev 213627, trunk/LayoutTests/crypto/subtle/unwrapKey-malformed-parameters.html) (0 => 213628)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/unwrap-key-malformed-parameters.html                                (rev 0)
+++ trunk/LayoutTests/crypto/subtle/unwrap-key-malformed-parameters.html        2017-03-09 05:50:31 UTC (rev 213628)
</span><span class="lines">@@ -0,0 +1,65 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../resources/common.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;p id=&quot;description&quot;&gt;&lt;/p&gt;
+&lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
+
+&lt;script&gt;
+description(&quot;Test UnwrapKey operation with malformed parameters&quot;);
+
+jsTestIsAsync = true;
+
+var extractable = true;
+var rawKey = asciiToUint8Array(&quot;jnOw99oOZFLIEPMr&quot;);
+var aesCbcParams = {
+    name: &quot;aes-cbc&quot;,
+    iv: asciiToUint8Array(&quot;jnOw99oOZFLIEPMr&quot;),
+}
+var wrappedRawKey = hexStringToUint8Array(&quot;d64787ab3e048dbdc30bb62781c9f18e58ad7dbfc64aab16&quot;);
+var wrappedJwkKey = hexStringToUint8Array( &quot;848aa2f70ee18e2953520132a79cf479b03a8732a3cc73f8c51c68456d3c2557e8be9d5911b2a74267e282a87ffeed88dfbac38a22c26ba621f83915d7539420a4dc0b2329c585b442967367c1ea6c1126f98c4f13b7c8cb7402b86a5844c19420ea333dc33d908be89172f8bac59b403fe202f32c8eed19f431cedfc3383f536f3557163b1311ae42ee5486c6dafee968640d6b6999c687f37fba8d65cc662f1c84f16245665e4af41c98e8b63632cc1d19e2bece2154c7eab1905f3f6ab17b495cefec3508e9b451f2ea1422b97f275dfdc118f46af02040250d0e55d8d8d172b969bbcf7314a257f10b98d2c47c6c72a727acaf4c96340d590ebcebc61f73b7a868b490f3c1e17c59ea479a3b8db5574153de46cfdbb07cfc5e95ebcf7ad3d5fa057ba946d6da872c4bef3af6d7013e222c227650d0022c94d306cb14e203aad378d171c7c24f824c31b81fd18265e0de2f4b415584ebc4adeb5880c4eddbc88b854699f7aa74d6a10ca5df8978f27b5d1372b31ea67a9c4841ae101ea6ad78df0580b70358e6933ac92f7faee5320af329d8349a7b98690708a388737604be0affaa0669410d8d93dc4e4f57e14583253f11e5b27c89b84f1f3038bae6d9b37e3eb64b63ad1880627aef3b19e3e851cfae639ec4
 6dd06fd131b51f530b37260b836d9013d8ad7c8640096070f96984c528ee5e20b69f3cd98a269621cd886ccb16d9c526a87cd5c458541309bb7fa4f3337305d76fc050d39ca8b1fdb0675a11a40ffde9cebb33ddc485e5dc5e7667b08c2a3e0136d063a447aee5a8f650429c5e422a706c4c240a4d11f4a9b5782f2cba2575f0c32cb477a9f0cef97fa993977104181315ff90e46f3b12b8b00f4a7611c42b1bb53d0e6021ab21ee8ae606d9f06dfedb891763007e020977c28b46d5f33bc35c12061d90ebbe02cab58783c0cac0c6f14ed735204f23d0eb6a9fe9edea2aecb1ac213f58b42d5d96374ec70ca288a31016ba02adef43250d717e9fab8982a1a180b1f3944d450c159010fd23f354d88502ec702882ae3edd567c6a6edf3cb2e34edc13f410a25d97298ab9062ddb566576fa8b6599bba205bab55aa5f3f37edaf7733cf249e69c74da975ef249ca673da749d86babebdf55410a389720ac943f1e9d921f5d69c5789636cb904fb9263744236eade9acae889a01c237ab3436101463dfa9d92f936c1b652c80f3abba76023ebe5b9bfdd54735e3a3494de18a456967f58758e546021feef3fa3e6c239981aa06f1f7ddc415d957ff9919bbec5f36af092a81ba6c14fe644d2ee98a2fcdee2ed70b87a53ffa327b25b4569c5886b15f2bd583d6f5bd7e951a915142b
 aa08c6a9c343c200678a005fad22a337d2c5627f8c816db2525a7e121849b9da756eee68a240452849ffdb9651f998257c62e8fdcdc48dadfc3ebb18f7eb5461442008846a629ec8149c052f357bf5889095047b272bce0ff505953e7cd525b24c838ba6e9ed91922a30eeb858de8556f19f761d0287d768876346a5dcac3dbadd7a30072c9338162be5812166d961f4031f962ef668781d39d0fc69fe5f4494e31ec082d4a0140e368b69975beeba120ef9b651ead531b4d44296bd3cfe2ce7f97bb5bb4921061b12c2e1c4c10928c0980ff8d488a2282d0c056a40260167410e39664f75ff1f1249820e174eed978318a05e654b8aa6c60b70001a7a04f0aff17597dd9ab3ccc34f5ba2e352b7244dd3dccb462d7175b95ae3970ec5858e2312aac7c2c79a37b53d089f988720a4c04df6328a384004d0d51eafb9486623099a98e69be5169201c88824acc2bb0e1790889014a1797c168e98d19f0787c2935cfbc3bf24c4adad69a81e0e6adf8c21e3c4789064aa31a025dff5cc6eaba3f3e43f10a9d531f47963372120e2366b84c281ed968d9d11c1d103826c9362741e1267d1a3e8d2188761fa876b7b09617df14130c07209f1f1188ff40971b86607dee14d556a880447901c69d29cb16c027c3aae316ff00132bdfcd0e39c5e201252c9771483ccb275b0c67b3cb4dcd
 19198c7718634460254dfd6f8df4374b8bedee7dd20ce411b5f987cac2ce17492aa78f919c6d5e555000f47f7b8a9896d448bc4fc13e40a9e5c02258d509a7289f44d7250e89260233bf96702bb3d350451f03d802e0e37d9f01cce4c78869403493eb9890c2c09109d1f427f59cf091cd1c836e25a9bb065041407c2183f643bce2e72db1e7caeac42e2d8379f8b84df2cc7b1d055f42d6f62e0cb5771a14ae8872792350e5f770115a86564f60a785c53325c8c084afe214da3cac1783e2be9099d96ddbe9cc3ea3dd1d3ae50526b4afe24397420a3e4fa697613421&quot;);
+
+// Not enough arguments.
+shouldReject('crypto.subtle.unwrapKey()');
+shouldReject('crypto.subtle.unwrapKey(1)');
+shouldReject('crypto.subtle.unwrapKey(1, 2)');
+shouldReject('crypto.subtle.unwrapKey(1, 2, 3)');
+shouldReject('crypto.subtle.unwrapKey(1, 2, 3, 4)');
+shouldReject('crypto.subtle.unwrapKey(1, 2, 3, 4, 5)');
+shouldReject('crypto.subtle.unwrapKey(1, 2, 3, 4, 5, 6)');
+
+crypto.subtle.importKey(&quot;raw&quot;, rawKey, &quot;aes-kw&quot;, extractable, [&quot;wrapKey&quot;, &quot;unwrapKey&quot;]).then(function(result) {
+    unwrappingKey = result;
+
+    // Wrong AlgorithmIdentifier
+    shouldReject('crypto.subtle.unwrapKey(&quot;raw&quot;, wrappedRawKey, unwrappingKey, &quot;HMAC&quot;, &quot;AES-CBC&quot;, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;])');
+    shouldReject('crypto.subtle.unwrapKey(&quot;raw&quot;, wrappedRawKey, unwrappingKey, aesCbcParams, &quot;AES-CBC&quot;, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;])');
+    // Wrong format
+    return shouldReject('crypto.subtle.unwrapKey(&quot;jwk&quot;, wrappedRawKey, unwrappingKey, &quot;AES-KW&quot;, &quot;AES-CBC&quot;, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;])');
+}).then(function() {
+    // Empty usages
+    return shouldReject('crypto.subtle.unwrapKey(&quot;raw&quot;, wrappedRawKey, unwrappingKey, &quot;AES-KW&quot;, &quot;AES-CBC&quot;, extractable, [ ])');
+}).then(function() {
+    return crypto.subtle.importKey(&quot;raw&quot;, rawKey, &quot;aes-cbc&quot;, extractable, [&quot;wrapKey&quot;, &quot;unwrapKey&quot;]);
+}).then(function(result) {
+    unwrappingKey = result;
+
+    // Empty usages
+    return shouldReject('crypto.subtle.unwrapKey(&quot;jwk&quot;, wrappedJwkKey, unwrappingKey, aesCbcParams, {name: &quot;RSA-OAEP&quot;, hash: &quot;SHA-1&quot;}, extractable, [ ])');
+}).then(function() {
+    return crypto.subtle.importKey(&quot;raw&quot;, rawKey, &quot;aes-kw&quot;, extractable, [&quot;wrapKey&quot;]);
+}).then(function(result) {
+    unwrappingKey = result;
+
+    // Wrong usage
+    shouldReject('crypto.subtle.unwrapKey(&quot;raw&quot;, wrappedRawKey, unwrappingKey, &quot;AES-KW&quot;, &quot;AES-CBC&quot;, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;])').then(finishJSTest);
+});
+
+&lt;/script&gt;
+
+&lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtleunwrapKeymalformedparametersexpectedtxt"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/crypto/subtle/unwrapKey-malformed-parameters-expected.txt (213627 => 213628)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/unwrapKey-malformed-parameters-expected.txt        2017-03-09 05:16:20 UTC (rev 213627)
+++ trunk/LayoutTests/crypto/subtle/unwrapKey-malformed-parameters-expected.txt        2017-03-09 05:50:31 UTC (rev 213628)
</span><span class="lines">@@ -1,22 +0,0 @@
</span><del>-Test UnwrapKey operation with malformed parameters
-
-On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
-
-
-PASS crypto.subtle.unwrapKey() rejected promise  with TypeError: Not enough arguments.
-PASS crypto.subtle.unwrapKey(1) rejected promise  with TypeError: Not enough arguments.
-PASS crypto.subtle.unwrapKey(1, 2) rejected promise  with TypeError: Not enough arguments.
-PASS crypto.subtle.unwrapKey(1, 2, 3) rejected promise  with TypeError: Not enough arguments.
-PASS crypto.subtle.unwrapKey(1, 2, 3, 4) rejected promise  with TypeError: Not enough arguments.
-PASS crypto.subtle.unwrapKey(1, 2, 3, 4, 5) rejected promise  with TypeError: Not enough arguments.
-PASS crypto.subtle.unwrapKey(1, 2, 3, 4, 5, 6) rejected promise  with TypeError: Not enough arguments.
-PASS crypto.subtle.unwrapKey(&quot;raw&quot;, wrappedRawKey, unwrappingKey, &quot;HMAC&quot;, &quot;AES-CBC&quot;, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;]) rejected promise  with NotSupportedError (DOM Exception 9): The operation is not supported..
-PASS crypto.subtle.unwrapKey(&quot;raw&quot;, wrappedRawKey, unwrappingKey, aesCbcParams, &quot;AES-CBC&quot;, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;]) rejected promise  with InvalidAccessError (DOM Exception 15): Unwrapping CryptoKey doesn't match unwrap AlgorithmIdentifier.
-PASS crypto.subtle.unwrapKey(&quot;jwk&quot;, wrappedRawKey, unwrappingKey, &quot;AES-KW&quot;, &quot;AES-CBC&quot;, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;]) rejected promise  with DataError (DOM Exception 30): WrappedKey cannot be converted to a JSON object.
-PASS crypto.subtle.unwrapKey(&quot;raw&quot;, wrappedRawKey, unwrappingKey, &quot;AES-KW&quot;, &quot;AES-CBC&quot;, extractable, [ ]) rejected promise  with SyntaxError (DOM Exception 12): A required parameter was missing or out-of-range.
-PASS crypto.subtle.unwrapKey(&quot;jwk&quot;, wrappedJwkKey, unwrappingKey, aesCbcParams, {name: &quot;RSA-OAEP&quot;, hash: &quot;SHA-1&quot;}, extractable, [ ]) rejected promise  with SyntaxError (DOM Exception 12): A required parameter was missing or out-of-range.
-PASS crypto.subtle.unwrapKey(&quot;raw&quot;, wrappedRawKey, unwrappingKey, &quot;AES-KW&quot;, &quot;AES-CBC&quot;, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;]) rejected promise  with InvalidAccessError (DOM Exception 15): Unwrapping CryptoKey doesn't support unwrapKey operation.
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
</del></span></pre></div>
<a id="trunkLayoutTestscryptosubtleunwrapKeymalformedparametershtml"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/crypto/subtle/unwrapKey-malformed-parameters.html (213627 => 213628)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/unwrapKey-malformed-parameters.html        2017-03-09 05:16:20 UTC (rev 213627)
+++ trunk/LayoutTests/crypto/subtle/unwrapKey-malformed-parameters.html        2017-03-09 05:50:31 UTC (rev 213628)
</span><span class="lines">@@ -1,65 +0,0 @@
</span><del>-&lt;!DOCTYPE html&gt;
-&lt;html&gt;
-&lt;head&gt;
-&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
-&lt;script src=&quot;../resources/common.js&quot;&gt;&lt;/script&gt;
-&lt;/head&gt;
-&lt;body&gt;
-&lt;p id=&quot;description&quot;&gt;&lt;/p&gt;
-&lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
-
-&lt;script&gt;
-description(&quot;Test UnwrapKey operation with malformed parameters&quot;);
-
-jsTestIsAsync = true;
-
-var extractable = true;
-var rawKey = asciiToUint8Array(&quot;jnOw99oOZFLIEPMr&quot;);
-var aesCbcParams = {
-    name: &quot;aes-cbc&quot;,
-    iv: asciiToUint8Array(&quot;jnOw99oOZFLIEPMr&quot;),
-}
-var wrappedRawKey = hexStringToUint8Array(&quot;d64787ab3e048dbdc30bb62781c9f18e58ad7dbfc64aab16&quot;);
-var wrappedJwkKey = hexStringToUint8Array( &quot;848aa2f70ee18e2953520132a79cf479b03a8732a3cc73f8c51c68456d3c2557e8be9d5911b2a74267e282a87ffeed88dfbac38a22c26ba621f83915d7539420a4dc0b2329c585b442967367c1ea6c1126f98c4f13b7c8cb7402b86a5844c19420ea333dc33d908be89172f8bac59b403fe202f32c8eed19f431cedfc3383f536f3557163b1311ae42ee5486c6dafee968640d6b6999c687f37fba8d65cc662f1c84f16245665e4af41c98e8b63632cc1d19e2bece2154c7eab1905f3f6ab17b495cefec3508e9b451f2ea1422b97f275dfdc118f46af02040250d0e55d8d8d172b969bbcf7314a257f10b98d2c47c6c72a727acaf4c96340d590ebcebc61f73b7a868b490f3c1e17c59ea479a3b8db5574153de46cfdbb07cfc5e95ebcf7ad3d5fa057ba946d6da872c4bef3af6d7013e222c227650d0022c94d306cb14e203aad378d171c7c24f824c31b81fd18265e0de2f4b415584ebc4adeb5880c4eddbc88b854699f7aa74d6a10ca5df8978f27b5d1372b31ea67a9c4841ae101ea6ad78df0580b70358e6933ac92f7faee5320af329d8349a7b98690708a388737604be0affaa0669410d8d93dc4e4f57e14583253f11e5b27c89b84f1f3038bae6d9b37e3eb64b63ad1880627aef3b19e3e851cfae639ec4
 6dd06fd131b51f530b37260b836d9013d8ad7c8640096070f96984c528ee5e20b69f3cd98a269621cd886ccb16d9c526a87cd5c458541309bb7fa4f3337305d76fc050d39ca8b1fdb0675a11a40ffde9cebb33ddc485e5dc5e7667b08c2a3e0136d063a447aee5a8f650429c5e422a706c4c240a4d11f4a9b5782f2cba2575f0c32cb477a9f0cef97fa993977104181315ff90e46f3b12b8b00f4a7611c42b1bb53d0e6021ab21ee8ae606d9f06dfedb891763007e020977c28b46d5f33bc35c12061d90ebbe02cab58783c0cac0c6f14ed735204f23d0eb6a9fe9edea2aecb1ac213f58b42d5d96374ec70ca288a31016ba02adef43250d717e9fab8982a1a180b1f3944d450c159010fd23f354d88502ec702882ae3edd567c6a6edf3cb2e34edc13f410a25d97298ab9062ddb566576fa8b6599bba205bab55aa5f3f37edaf7733cf249e69c74da975ef249ca673da749d86babebdf55410a389720ac943f1e9d921f5d69c5789636cb904fb9263744236eade9acae889a01c237ab3436101463dfa9d92f936c1b652c80f3abba76023ebe5b9bfdd54735e3a3494de18a456967f58758e546021feef3fa3e6c239981aa06f1f7ddc415d957ff9919bbec5f36af092a81ba6c14fe644d2ee98a2fcdee2ed70b87a53ffa327b25b4569c5886b15f2bd583d6f5bd7e951a915142b
 aa08c6a9c343c200678a005fad22a337d2c5627f8c816db2525a7e121849b9da756eee68a240452849ffdb9651f998257c62e8fdcdc48dadfc3ebb18f7eb5461442008846a629ec8149c052f357bf5889095047b272bce0ff505953e7cd525b24c838ba6e9ed91922a30eeb858de8556f19f761d0287d768876346a5dcac3dbadd7a30072c9338162be5812166d961f4031f962ef668781d39d0fc69fe5f4494e31ec082d4a0140e368b69975beeba120ef9b651ead531b4d44296bd3cfe2ce7f97bb5bb4921061b12c2e1c4c10928c0980ff8d488a2282d0c056a40260167410e39664f75ff1f1249820e174eed978318a05e654b8aa6c60b70001a7a04f0aff17597dd9ab3ccc34f5ba2e352b7244dd3dccb462d7175b95ae3970ec5858e2312aac7c2c79a37b53d089f988720a4c04df6328a384004d0d51eafb9486623099a98e69be5169201c88824acc2bb0e1790889014a1797c168e98d19f0787c2935cfbc3bf24c4adad69a81e0e6adf8c21e3c4789064aa31a025dff5cc6eaba3f3e43f10a9d531f47963372120e2366b84c281ed968d9d11c1d103826c9362741e1267d1a3e8d2188761fa876b7b09617df14130c07209f1f1188ff40971b86607dee14d556a880447901c69d29cb16c027c3aae316ff00132bdfcd0e39c5e201252c9771483ccb275b0c67b3cb4dcd
 19198c7718634460254dfd6f8df4374b8bedee7dd20ce411b5f987cac2ce17492aa78f919c6d5e555000f47f7b8a9896d448bc4fc13e40a9e5c02258d509a7289f44d7250e89260233bf96702bb3d350451f03d802e0e37d9f01cce4c78869403493eb9890c2c09109d1f427f59cf091cd1c836e25a9bb065041407c2183f643bce2e72db1e7caeac42e2d8379f8b84df2cc7b1d055f42d6f62e0cb5771a14ae8872792350e5f770115a86564f60a785c53325c8c084afe214da3cac1783e2be9099d96ddbe9cc3ea3dd1d3ae50526b4afe24397420a3e4fa697613421&quot;);
-
-// Not enough arguments.
-shouldReject('crypto.subtle.unwrapKey()');
-shouldReject('crypto.subtle.unwrapKey(1)');
-shouldReject('crypto.subtle.unwrapKey(1, 2)');
-shouldReject('crypto.subtle.unwrapKey(1, 2, 3)');
-shouldReject('crypto.subtle.unwrapKey(1, 2, 3, 4)');
-shouldReject('crypto.subtle.unwrapKey(1, 2, 3, 4, 5)');
-shouldReject('crypto.subtle.unwrapKey(1, 2, 3, 4, 5, 6)');
-
-crypto.subtle.importKey(&quot;raw&quot;, rawKey, &quot;aes-kw&quot;, extractable, [&quot;wrapKey&quot;, &quot;unwrapKey&quot;]).then(function(result) {
-    unwrappingKey = result;
-
-    // Wrong AlgorithmIdentifier
-    shouldReject('crypto.subtle.unwrapKey(&quot;raw&quot;, wrappedRawKey, unwrappingKey, &quot;HMAC&quot;, &quot;AES-CBC&quot;, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;])');
-    shouldReject('crypto.subtle.unwrapKey(&quot;raw&quot;, wrappedRawKey, unwrappingKey, aesCbcParams, &quot;AES-CBC&quot;, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;])');
-    // Wrong format
-    return shouldReject('crypto.subtle.unwrapKey(&quot;jwk&quot;, wrappedRawKey, unwrappingKey, &quot;AES-KW&quot;, &quot;AES-CBC&quot;, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;])');
-}).then(function() {
-    // Empty usages
-    return shouldReject('crypto.subtle.unwrapKey(&quot;raw&quot;, wrappedRawKey, unwrappingKey, &quot;AES-KW&quot;, &quot;AES-CBC&quot;, extractable, [ ])');
-}).then(function() {
-    return crypto.subtle.importKey(&quot;raw&quot;, rawKey, &quot;aes-cbc&quot;, extractable, [&quot;wrapKey&quot;, &quot;unwrapKey&quot;]);
-}).then(function(result) {
-    unwrappingKey = result;
-
-    // Empty usages
-    return shouldReject('crypto.subtle.unwrapKey(&quot;jwk&quot;, wrappedJwkKey, unwrappingKey, aesCbcParams, {name: &quot;RSA-OAEP&quot;, hash: &quot;SHA-1&quot;}, extractable, [ ])');
-}).then(function() {
-    return crypto.subtle.importKey(&quot;raw&quot;, rawKey, &quot;aes-kw&quot;, extractable, [&quot;wrapKey&quot;]);
-}).then(function(result) {
-    unwrappingKey = result;
-
-    // Wrong usage
-    shouldReject('crypto.subtle.unwrapKey(&quot;raw&quot;, wrappedRawKey, unwrappingKey, &quot;AES-KW&quot;, &quot;AES-CBC&quot;, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;])').then(finishJSTest);
-});
-
-&lt;/script&gt;
-
-&lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
-&lt;/body&gt;
-&lt;/html&gt;
</del></span></pre></div>
<a id="trunkLayoutTestscryptosubtlewrapkeymalformedparametersexpectedtxtfromrev213627trunkLayoutTestscryptosubtlewrapKeymalformedparametersexpectedtxt"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/crypto/subtle/wrap-key-malformed-parameters-expected.txt (from rev 213627, trunk/LayoutTests/crypto/subtle/wrapKey-malformed-parameters-expected.txt) (0 => 213628)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/wrap-key-malformed-parameters-expected.txt                                (rev 0)
+++ trunk/LayoutTests/crypto/subtle/wrap-key-malformed-parameters-expected.txt        2017-03-09 05:50:31 UTC (rev 213628)
</span><span class="lines">@@ -0,0 +1,17 @@
</span><ins>+Test WrapKey operation with malformed parameters
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS crypto.subtle.wrapKey() rejected promise  with TypeError: Not enough arguments.
+PASS crypto.subtle.wrapKey(1) rejected promise  with TypeError: Not enough arguments.
+PASS crypto.subtle.wrapKey(1, 2) rejected promise  with TypeError: Not enough arguments.
+PASS crypto.subtle.wrapKey(1, 2, 3) rejected promise  with TypeError: Not enough arguments.
+PASS crypto.subtle.wrapKey(&quot;raw&quot;, key, wrappingKey, &quot;HMAC&quot;) rejected promise  with NotSupportedError (DOM Exception 9): The operation is not supported..
+PASS crypto.subtle.wrapKey(&quot;raw&quot;, key, wrappingKey, aesCbcParams) rejected promise  with InvalidAccessError (DOM Exception 15): Wrapping CryptoKey doesn't match AlgorithmIdentifier.
+PASS crypto.subtle.wrapKey(&quot;raw&quot;, key, wrappingKey, &quot;AES-KW&quot;) rejected promise  with InvalidAccessError (DOM Exception 15): The CryptoKey is nonextractable.
+PASS crypto.subtle.wrapKey(&quot;raw&quot;, key, wrappingKey, &quot;AES-KW&quot;) rejected promise  with InvalidAccessError (DOM Exception 15): Wrapping CryptoKey doesn't support wrapKey operation.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtlewrapkeymalformedparametershtmlfromrev213627trunkLayoutTestscryptosubtlewrapKeymalformedparametershtml"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/crypto/subtle/wrap-key-malformed-parameters.html (from rev 213627, trunk/LayoutTests/crypto/subtle/wrapKey-malformed-parameters.html) (0 => 213628)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/wrap-key-malformed-parameters.html                                (rev 0)
+++ trunk/LayoutTests/crypto/subtle/wrap-key-malformed-parameters.html        2017-03-09 05:50:31 UTC (rev 213628)
</span><span class="lines">@@ -0,0 +1,54 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../resources/common.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;p id=&quot;description&quot;&gt;&lt;/p&gt;
+&lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
+
+&lt;script&gt;
+description(&quot;Test WrapKey operation with malformed parameters&quot;);
+
+jsTestIsAsync = true;
+
+var extractable = true;
+var nonExtractable = false;
+var rawKey = asciiToUint8Array(&quot;jnOw99oOZFLIEPMr&quot;);
+var aesCbcParams = {
+    name: &quot;aes-cbc&quot;,
+    iv: asciiToUint8Array(&quot;jnOw99oOZFLIEPMr&quot;),
+}
+
+// Not enough arguments.
+shouldReject('crypto.subtle.wrapKey()');
+shouldReject('crypto.subtle.wrapKey(1)');
+shouldReject('crypto.subtle.wrapKey(1, 2)');
+shouldReject('crypto.subtle.wrapKey(1, 2, 3)');
+
+crypto.subtle.importKey(&quot;raw&quot;, rawKey, &quot;aes-kw&quot;, extractable, [&quot;wrapKey&quot;, &quot;unwrapKey&quot;]).then(function(result) {
+    wrappingKey = result;
+    return crypto.subtle.importKey(&quot;raw&quot;, rawKey, &quot;aes-cbc&quot;, nonExtractable, [&quot;encrypt&quot;, &quot;decrypt&quot;]);
+}).then(function(result) {
+    key = result;
+
+    // Wrong AlgorithmIdentifier
+    shouldReject('crypto.subtle.wrapKey(&quot;raw&quot;, key, wrappingKey, &quot;HMAC&quot;)');
+    shouldReject('crypto.subtle.wrapKey(&quot;raw&quot;, key, wrappingKey, aesCbcParams)');
+    // Non-extractable
+    shouldReject('crypto.subtle.wrapKey(&quot;raw&quot;, key, wrappingKey, &quot;AES-KW&quot;)');
+
+    return crypto.subtle.importKey(&quot;raw&quot;, rawKey, &quot;aes-kw&quot;, extractable, [&quot;unwrapKey&quot;]);
+}).then(function(result) {
+    wrappingKey = result;
+
+    // Wrong usage
+    shouldReject('crypto.subtle.wrapKey(&quot;raw&quot;, key, wrappingKey, &quot;AES-KW&quot;)').then(finishJSTest);
+});
+
+&lt;/script&gt;
+
+&lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtlewrapKeymalformedparametersexpectedtxt"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/crypto/subtle/wrapKey-malformed-parameters-expected.txt (213627 => 213628)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/wrapKey-malformed-parameters-expected.txt        2017-03-09 05:16:20 UTC (rev 213627)
+++ trunk/LayoutTests/crypto/subtle/wrapKey-malformed-parameters-expected.txt        2017-03-09 05:50:31 UTC (rev 213628)
</span><span class="lines">@@ -1,17 +0,0 @@
</span><del>-Test WrapKey operation with malformed parameters
-
-On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
-
-
-PASS crypto.subtle.wrapKey() rejected promise  with TypeError: Not enough arguments.
-PASS crypto.subtle.wrapKey(1) rejected promise  with TypeError: Not enough arguments.
-PASS crypto.subtle.wrapKey(1, 2) rejected promise  with TypeError: Not enough arguments.
-PASS crypto.subtle.wrapKey(1, 2, 3) rejected promise  with TypeError: Not enough arguments.
-PASS crypto.subtle.wrapKey(&quot;raw&quot;, key, wrappingKey, &quot;HMAC&quot;) rejected promise  with NotSupportedError (DOM Exception 9): The operation is not supported..
-PASS crypto.subtle.wrapKey(&quot;raw&quot;, key, wrappingKey, aesCbcParams) rejected promise  with InvalidAccessError (DOM Exception 15): Wrapping CryptoKey doesn't match AlgorithmIdentifier.
-PASS crypto.subtle.wrapKey(&quot;raw&quot;, key, wrappingKey, &quot;AES-KW&quot;) rejected promise  with InvalidAccessError (DOM Exception 15): The CryptoKey is nonextractable.
-PASS crypto.subtle.wrapKey(&quot;raw&quot;, key, wrappingKey, &quot;AES-KW&quot;) rejected promise  with InvalidAccessError (DOM Exception 15): Wrapping CryptoKey doesn't support wrapKey operation.
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
</del></span></pre></div>
<a id="trunkLayoutTestscryptosubtlewrapKeymalformedparametershtml"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/crypto/subtle/wrapKey-malformed-parameters.html (213627 => 213628)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/wrapKey-malformed-parameters.html        2017-03-09 05:16:20 UTC (rev 213627)
+++ trunk/LayoutTests/crypto/subtle/wrapKey-malformed-parameters.html        2017-03-09 05:50:31 UTC (rev 213628)
</span><span class="lines">@@ -1,54 +0,0 @@
</span><del>-&lt;!DOCTYPE html&gt;
-&lt;html&gt;
-&lt;head&gt;
-&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
-&lt;script src=&quot;../resources/common.js&quot;&gt;&lt;/script&gt;
-&lt;/head&gt;
-&lt;body&gt;
-&lt;p id=&quot;description&quot;&gt;&lt;/p&gt;
-&lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
-
-&lt;script&gt;
-description(&quot;Test WrapKey operation with malformed parameters&quot;);
-
-jsTestIsAsync = true;
-
-var extractable = true;
-var nonExtractable = false;
-var rawKey = asciiToUint8Array(&quot;jnOw99oOZFLIEPMr&quot;);
-var aesCbcParams = {
-    name: &quot;aes-cbc&quot;,
-    iv: asciiToUint8Array(&quot;jnOw99oOZFLIEPMr&quot;),
-}
-
-// Not enough arguments.
-shouldReject('crypto.subtle.wrapKey()');
-shouldReject('crypto.subtle.wrapKey(1)');
-shouldReject('crypto.subtle.wrapKey(1, 2)');
-shouldReject('crypto.subtle.wrapKey(1, 2, 3)');
-
-crypto.subtle.importKey(&quot;raw&quot;, rawKey, &quot;aes-kw&quot;, extractable, [&quot;wrapKey&quot;, &quot;unwrapKey&quot;]).then(function(result) {
-    wrappingKey = result;
-    return crypto.subtle.importKey(&quot;raw&quot;, rawKey, &quot;aes-cbc&quot;, nonExtractable, [&quot;encrypt&quot;, &quot;decrypt&quot;]);
-}).then(function(result) {
-    key = result;
-
-    // Wrong AlgorithmIdentifier
-    shouldReject('crypto.subtle.wrapKey(&quot;raw&quot;, key, wrappingKey, &quot;HMAC&quot;)');
-    shouldReject('crypto.subtle.wrapKey(&quot;raw&quot;, key, wrappingKey, aesCbcParams)');
-    // Non-extractable
-    shouldReject('crypto.subtle.wrapKey(&quot;raw&quot;, key, wrappingKey, &quot;AES-KW&quot;)');
-
-    return crypto.subtle.importKey(&quot;raw&quot;, rawKey, &quot;aes-kw&quot;, extractable, [&quot;unwrapKey&quot;]);
-}).then(function(result) {
-    wrappingKey = result;
-
-    // Wrong usage
-    shouldReject('crypto.subtle.wrapKey(&quot;raw&quot;, key, wrappingKey, &quot;AES-KW&quot;)').then(finishJSTest);
-});
-
-&lt;/script&gt;
-
-&lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
-&lt;/body&gt;
-&lt;/html&gt;
</del></span></pre></div>
<a id="trunkLayoutTestscryptoworkerssubtleecdhimportkeyderivekeyexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/workers/subtle/ecdh-import-key-derive-key-expected.txt (0 => 213628)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/workers/subtle/ecdh-import-key-derive-key-expected.txt                                (rev 0)
+++ trunk/LayoutTests/crypto/workers/subtle/ecdh-import-key-derive-key-expected.txt        2017-03-09 05:50:31 UTC (rev 213628)
</span><span class="lines">@@ -0,0 +1,15 @@
</span><ins>+[Worker] Test deriving AES Keys with imported ECDH base key in workers
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Starting worker: resources/ecdh-import-key-derive-key.js
+PASS [Worker] derivedKey.type is 'secret'
+PASS [Worker] derivedKey.extractable is true
+PASS [Worker] derivedKey.algorithm.name is 'AES-CBC'
+PASS [Worker] derivedKey.algorithm.length is 128
+PASS [Worker] derivedKey.usages is ['decrypt', 'encrypt', 'unwrapKey', 'wrapKey']
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptoworkerssubtleecdhimportkeyderivekeyhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/workers/subtle/ecdh-import-key-derive-key.html (0 => 213628)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/workers/subtle/ecdh-import-key-derive-key.html                                (rev 0)
+++ trunk/LayoutTests/crypto/workers/subtle/ecdh-import-key-derive-key.html        2017-03-09 05:50:31 UTC (rev 213628)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+    &lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+    &lt;script&gt;
+        worker = startWorker('resources/ecdh-import-key-derive-key.js');
+    &lt;/script&gt;
+    &lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestscryptoworkerssubtleresourcesecdhimportkeyderivekeyjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/workers/subtle/resources/ecdh-import-key-derive-key.js (0 => 213628)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/workers/subtle/resources/ecdh-import-key-derive-key.js                                (rev 0)
+++ trunk/LayoutTests/crypto/workers/subtle/resources/ecdh-import-key-derive-key.js        2017-03-09 05:50:31 UTC (rev 213628)
</span><span class="lines">@@ -0,0 +1,39 @@
</span><ins>+importScripts('../../../../resources/js-test-pre.js');
+importScripts(&quot;../../../resources/common.js&quot;);
+
+description(&quot;Test deriving AES Keys with imported ECDH base key in workers&quot;);
+
+jsTestIsAsync = true;
+
+var extractable = true;
+var jwkPrivateKey = {
+    kty: &quot;EC&quot;,
+    crv: &quot;P-256&quot;,
+    x: &quot;1FSVWieTvikFkG1NOyhkUCaMbdQhxwH6aCu4Ez-sRtA&quot;,
+    y: &quot;9jmNTLqM4cjBhdAnHcNI9YQV3O8LFmo-EdZWk8ntAaI&quot;,
+    d: &quot;ppxBSov3N8_AUcisAuvmLV4yE8e_L_BLE8bZb9Z1Xjg&quot;,
+};
+var jwkPublicKey = {
+    kty: &quot;EC&quot;,
+    crv: &quot;P-256&quot;,
+    x: &quot;1FSVWieTvikFkG1NOyhkUCaMbdQhxwH6aCu4Ez-sRtA&quot;,
+    y: &quot;9jmNTLqM4cjBhdAnHcNI9YQV3O8LFmo-EdZWk8ntAaI&quot;,
+};
+
+crypto.subtle.importKey(&quot;jwk&quot;, jwkPrivateKey, { name: &quot;ECDH&quot;, namedCurve: &quot;P-256&quot; }, extractable, [&quot;deriveKey&quot;]).then(function(result) {
+    privateKey = result;
+    return crypto.subtle.importKey(&quot;jwk&quot;, jwkPublicKey, { name: &quot;ECDH&quot;, namedCurve: &quot;P-256&quot; }, extractable, [ ]);
+}).then(function(result) {
+    publicKey = result;
+    return crypto.subtle.deriveKey({ name:&quot;ECDH&quot;, public:publicKey }, privateKey, {name: &quot;aes-cbc&quot;, length: 128}, extractable, ['decrypt', 'encrypt', 'unwrapKey', 'wrapKey']);
+}).then(function(result) {
+    derivedKey = result;
+
+    shouldBe(&quot;derivedKey.type&quot;, &quot;'secret'&quot;);
+    shouldBe(&quot;derivedKey.extractable&quot;, &quot;true&quot;);
+    shouldBe(&quot;derivedKey.algorithm.name&quot;, &quot;'AES-CBC'&quot;);
+    shouldBe(&quot;derivedKey.algorithm.length&quot;, &quot;128&quot;);
+    shouldBe(&quot;derivedKey.usages&quot;, &quot;['decrypt', 'encrypt', 'unwrapKey', 'wrapKey']&quot;);
+
+    finishJSTest();
+});
</ins></span></pre></div>
<a id="trunkSourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/CMakeLists.txt (213627 => 213628)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/CMakeLists.txt        2017-03-09 05:16:20 UTC (rev 213627)
+++ trunk/Source/WebCore/CMakeLists.txt        2017-03-09 05:50:31 UTC (rev 213628)
</span><span class="lines">@@ -342,7 +342,7 @@
</span><span class="cx"> 
</span><span class="cx">     crypto/parameters/AesCbcCfbParams.idl
</span><span class="cx">     crypto/parameters/AesGcmParams.idl
</span><del>-    crypto/parameters/AesKeyGenParams.idl
</del><ins>+    crypto/parameters/AesKeyParams.idl
</ins><span class="cx">     crypto/parameters/EcKeyParams.idl
</span><span class="cx">     crypto/parameters/EcdhKeyDeriveParams.idl
</span><span class="cx">     crypto/parameters/HmacKeyParams.idl
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (213627 => 213628)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-03-09 05:16:20 UTC (rev 213627)
+++ trunk/Source/WebCore/ChangeLog        2017-03-09 05:50:31 UTC (rev 213628)
</span><span class="lines">@@ -1,3 +1,82 @@
</span><ins>+2017-03-08  Jiewen Tan  &lt;jiewen_tan@apple.com&gt;
+
+        [WebCrypto] Implement SubtleCrypto::DeriveKey method
+        https://bugs.webkit.org/show_bug.cgi?id=169386
+        &lt;rdar://problem/23789585&gt;
+
+        Reviewed by Brent Fulgham.
+
+        This patch does following few things:
+        1. It implements SubtleCrypto::DeriveKey method according to the spec:
+        https://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-deriveKey.
+        2. It implements getKeyLength operations for AES-CBC, AES-KW, AES-CFB,
+        AES-GCM, and HMAC, which is needed by the SubtleCrypto::DeriveKey method.
+        3. It enables ECDH DeriveKey operation.
+        4. It replaces unigned long with size_t in all the crypto codes.
+
+        Tests: crypto/subtle/derive-key-malformed-parameters.html
+               crypto/subtle/ecdh-import-key-derive-aes-key.html
+               crypto/subtle/ecdh-import-key-derive-hmac-key-custom-length.html
+               crypto/subtle/unwrap-key-malformed-parameters.html
+               crypto/subtle/wrap-key-malformed-parameters.html
+               crypto/workers/subtle/ecdh-import-key-derive-key.html
+
+        * CMakeLists.txt:
+        * DerivedSources.make:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/JSSubtleCryptoCustom.cpp:
+        (WebCore::normalizeCryptoAlgorithmParameters):
+        (WebCore::jsSubtleCryptoFunctionEncryptPromise):
+        (WebCore::jsSubtleCryptoFunctionDecryptPromise):
+        (WebCore::jsSubtleCryptoFunctionSignPromise):
+        (WebCore::jsSubtleCryptoFunctionVerifyPromise):
+        (WebCore::jsSubtleCryptoFunctionDigestPromise):
+        (WebCore::jsSubtleCryptoFunctionDeriveKeyPromise):
+        (WebCore::jsSubtleCryptoFunctionDeriveBitsPromise):
+        Remove unnecessary return statement from callbacks.
+        * crypto/CryptoAlgorithm.cpp:
+        (WebCore::CryptoAlgorithm::deriveBits):
+        (WebCore::CryptoAlgorithm::getKeyLength):
+        * crypto/CryptoAlgorithm.h:
+        * crypto/CryptoAlgorithmParameters.h:
+        * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
+        (WebCore::CryptoAlgorithmAES_CBC::generateKey):
+        (WebCore::CryptoAlgorithmAES_CBC::getKeyLength):
+        * crypto/algorithms/CryptoAlgorithmAES_CBC.h:
+        * crypto/algorithms/CryptoAlgorithmAES_CFB.cpp:
+        (WebCore::CryptoAlgorithmAES_CFB::generateKey):
+        (WebCore::CryptoAlgorithmAES_CFB::getKeyLength):
+        * crypto/algorithms/CryptoAlgorithmAES_CFB.h:
+        * crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:
+        (WebCore::CryptoAlgorithmAES_GCM::generateKey):
+        (WebCore::CryptoAlgorithmAES_GCM::getKeyLength):
+        * crypto/algorithms/CryptoAlgorithmAES_GCM.h:
+        * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
+        (WebCore::CryptoAlgorithmAES_KW::generateKey):
+        (WebCore::CryptoAlgorithmAES_KW::getKeyLength):
+        * crypto/algorithms/CryptoAlgorithmAES_KW.h:
+        * crypto/algorithms/CryptoAlgorithmECDH.cpp:
+        (WebCore::CryptoAlgorithmECDH::deriveBits):
+        * crypto/algorithms/CryptoAlgorithmECDH.h:
+        * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
+        (WebCore::CryptoAlgorithmHMAC::getKeyLength):
+        * crypto/algorithms/CryptoAlgorithmHMAC.h:
+        * crypto/keys/CryptoKeyAES.cpp:
+        (WebCore::CryptoKeyAES::getKeyLength):
+        * crypto/keys/CryptoKeyAES.h:
+        * crypto/keys/CryptoKeyHMAC.cpp:
+        (WebCore::getKeyLengthFromHash):
+        (WebCore::CryptoKeyHMAC::generate):
+        (WebCore::CryptoKeyHMAC::getKeyLength):
+        * crypto/keys/CryptoKeyHMAC.h:
+        * crypto/mac/CryptoAlgorithmECDHMac.cpp:
+        (WebCore::CryptoAlgorithmECDH::platformDeriveBits):
+        * crypto/parameters/AesKeyParams.idl: Renamed from Source/WebCore/crypto/parameters/AesKeyGenParams.idl.
+        * crypto/parameters/CryptoAlgorithmAesKeyParams.h: Renamed from Source/WebCore/crypto/parameters/CryptoAlgorithmAesKeyGenParams.h.
+        Rename AesKeyGenParams to AesKeyParams to represent a unified dictionary for AesKeyGenParams and AesDerivedKeyParams.
+        * crypto/parameters/CryptoAlgorithmHmacKeyParams.h:
+        * crypto/parameters/CryptoAlgorithmRsaKeyGenParams.h:
+
</ins><span class="cx"> 2017-03-08  Wenson Hsieh  &lt;wenson_hsieh@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Add plumbing for WebCore to notify WebKit2 when an edit drag has concluded
</span></span></pre></div>
<a id="trunkSourceWebCoreDerivedSourcesmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/DerivedSources.make (213627 => 213628)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/DerivedSources.make        2017-03-09 05:16:20 UTC (rev 213627)
+++ trunk/Source/WebCore/DerivedSources.make        2017-03-09 05:50:31 UTC (rev 213628)
</span><span class="lines">@@ -274,7 +274,7 @@
</span><span class="cx">     $(WebCore)/crypto/WebKitSubtleCrypto.idl \
</span><span class="cx">     $(WebCore)/crypto/parameters/AesCbcCfbParams.idl \
</span><span class="cx">     $(WebCore)/crypto/parameters/AesGcmParams.idl \
</span><del>-    $(WebCore)/crypto/parameters/AesKeyGenParams.idl \
</del><ins>+    $(WebCore)/crypto/parameters/AesKeyParams.idl \
</ins><span class="cx">     $(WebCore)/crypto/parameters/EcKeyParams.idl \
</span><span class="cx">     $(WebCore)/crypto/parameters/EcdhKeyDeriveParams.idl \
</span><span class="cx">     $(WebCore)/crypto/parameters/HmacKeyParams.idl \
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (213627 => 213628)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2017-03-09 05:16:20 UTC (rev 213627)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2017-03-09 05:50:31 UTC (rev 213628)
</span><span class="lines">@@ -2382,11 +2382,11 @@
</span><span class="cx">                 576814351E6FE3E800E77754 /* CryptoAlgorithmECDHMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 576814341E6FE3E800E77754 /* CryptoAlgorithmECDHMac.cpp */; };
</span><span class="cx">                 576814401E709FA100E77754 /* JSEcdhKeyDeriveParams.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5768143D1E709C3600E77754 /* JSEcdhKeyDeriveParams.cpp */; };
</span><span class="cx">                 576814411E709FA400E77754 /* JSEcdhKeyDeriveParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 5768143E1E709C3600E77754 /* JSEcdhKeyDeriveParams.h */; };
</span><ins>+                576814441E70CB1B00E77754 /* JSAesKeyParams.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 576814421E70CB1000E77754 /* JSAesKeyParams.cpp */; };
+                576814451E70CB1F00E77754 /* JSAesKeyParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 576814431E70CB1000E77754 /* JSAesKeyParams.h */; };
</ins><span class="cx">                 5768E4341DB7524500D0A4F7 /* JSRsaHashedKeyGenParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 5768E4331DB7524500D0A4F7 /* JSRsaHashedKeyGenParams.h */; };
</span><span class="cx">                 5768E4361DB7527400D0A4F7 /* JSRsaHashedKeyGenParams.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5768E4351DB7527300D0A4F7 /* JSRsaHashedKeyGenParams.cpp */; };
</span><del>-                577483121DADC55D00716EF9 /* CryptoAlgorithmAesKeyGenParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 577483111DADC55D00716EF9 /* CryptoAlgorithmAesKeyGenParams.h */; };
-                577483141DAEC2EB00716EF9 /* JSAesKeyGenParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 577483131DAEC2EA00716EF9 /* JSAesKeyGenParams.h */; };
-                577483161DAEC32300716EF9 /* JSAesKeyGenParams.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 577483151DAEC32200716EF9 /* JSAesKeyGenParams.cpp */; };
</del><ins>+                577483121DADC55D00716EF9 /* CryptoAlgorithmAesKeyParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 577483111DADC55D00716EF9 /* CryptoAlgorithmAesKeyParams.h */; };
</ins><span class="cx">                 577483191DB4491F00716EF9 /* CryptoAlgorithmHmacKeyParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 577483181DB4491F00716EF9 /* CryptoAlgorithmHmacKeyParams.h */; };
</span><span class="cx">                 5778BD821DA4806C009E3009 /* SubtleCrypto.h in Headers */ = {isa = PBXBuildFile; fileRef = 5778BD811DA4802C009E3009 /* SubtleCrypto.h */; };
</span><span class="cx">                 5778BD841DA4817B009E3009 /* SubtleCrypto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5778BD831DA4817B009E3009 /* SubtleCrypto.cpp */; };
</span><span class="lines">@@ -9816,12 +9816,12 @@
</span><span class="cx">                 576814341E6FE3E800E77754 /* CryptoAlgorithmECDHMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CryptoAlgorithmECDHMac.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 5768143D1E709C3600E77754 /* JSEcdhKeyDeriveParams.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSEcdhKeyDeriveParams.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 5768143E1E709C3600E77754 /* JSEcdhKeyDeriveParams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSEcdhKeyDeriveParams.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                576814421E70CB1000E77754 /* JSAesKeyParams.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSAesKeyParams.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                576814431E70CB1000E77754 /* JSAesKeyParams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSAesKeyParams.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 5768E4331DB7524500D0A4F7 /* JSRsaHashedKeyGenParams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSRsaHashedKeyGenParams.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 5768E4351DB7527300D0A4F7 /* JSRsaHashedKeyGenParams.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSRsaHashedKeyGenParams.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                577483101DADC49900716EF9 /* AesKeyGenParams.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = AesKeyGenParams.idl; sourceTree = &quot;&lt;group&gt;&quot;; };
-                577483111DADC55D00716EF9 /* CryptoAlgorithmAesKeyGenParams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CryptoAlgorithmAesKeyGenParams.h; sourceTree = &quot;&lt;group&gt;&quot;; };
-                577483131DAEC2EA00716EF9 /* JSAesKeyGenParams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSAesKeyGenParams.h; sourceTree = &quot;&lt;group&gt;&quot;; };
-                577483151DAEC32200716EF9 /* JSAesKeyGenParams.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSAesKeyGenParams.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><ins>+                577483101DADC49900716EF9 /* AesKeyParams.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = AesKeyParams.idl; sourceTree = &quot;&lt;group&gt;&quot;; };
+                577483111DADC55D00716EF9 /* CryptoAlgorithmAesKeyParams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CryptoAlgorithmAesKeyParams.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 577483171DB1FE8900716EF9 /* HmacKeyParams.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = HmacKeyParams.idl; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 577483181DB4491F00716EF9 /* CryptoAlgorithmHmacKeyParams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CryptoAlgorithmHmacKeyParams.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 5778BD801DA4733E009E3009 /* SubtleCrypto.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SubtleCrypto.idl; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -10001,8 +10001,8 @@
</span><span class="cx">                 5DB1BC6810715A6400EFAA49 /* TransformSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TransformSource.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 5DB1BC6910715A6400EFAA49 /* TransformSourceLibxslt.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TransformSourceLibxslt.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 5DFEBAB618592B6D00C75BEB /* WebKitAvailability.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitAvailability.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                5E16A2E21BFA64FB0029A21E /* MediaEndpointPeerConnection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; path = MediaEndpointPeerConnection.cpp; sourceTree = &quot;&lt;group&gt;&quot;; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
-                5E16A2E31BFA64FB0029A21E /* MediaEndpointPeerConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = MediaEndpointPeerConnection.h; sourceTree = &quot;&lt;group&gt;&quot;; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
</del><ins>+                5E16A2E21BFA64FB0029A21E /* MediaEndpointPeerConnection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaEndpointPeerConnection.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5E16A2E31BFA64FB0029A21E /* MediaEndpointPeerConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaEndpointPeerConnection.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 5E2C434D1BCEE2E50001E2BC /* PeerConnectionBackend.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PeerConnectionBackend.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 5E2C43541BCEE30D0001E2BC /* RTCPeerConnection.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = RTCPeerConnection.js; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 5E2C43551BCEE30D0001E2BC /* RTCPeerConnectionInternals.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = RTCPeerConnectionInternals.js; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -23682,11 +23682,11 @@
</span><span class="cx">                         children = (
</span><span class="cx">                                 572093D11DDCEA4B00310AB0 /* AesCbcCfbParams.idl */,
</span><span class="cx">                                 57B5F8071E5D19F200F34F90 /* AesGcmParams.idl */,
</span><del>-                                577483101DADC49900716EF9 /* AesKeyGenParams.idl */,
</del><ins>+                                577483101DADC49900716EF9 /* AesKeyParams.idl */,
</ins><span class="cx">                                 572093D21DDCEB9A00310AB0 /* CryptoAlgorithmAesCbcCfbParams.h */,
</span><span class="cx">                                 E125F8391824104800D84CD9 /* CryptoAlgorithmAesCbcParamsDeprecated.h */,
</span><span class="cx">                                 57B5F8081E5D1A9800F34F90 /* CryptoAlgorithmAesGcmParams.h */,
</span><del>-                                577483111DADC55D00716EF9 /* CryptoAlgorithmAesKeyGenParams.h */,
</del><ins>+                                577483111DADC55D00716EF9 /* CryptoAlgorithmAesKeyParams.h */,
</ins><span class="cx">                                 E19AC3F61824E5D100349426 /* CryptoAlgorithmAesKeyGenParamsDeprecated.h */,
</span><span class="cx">                                 5750A97D1E6A13EF00705C4A /* CryptoAlgorithmEcKeyParams.h */,
</span><span class="cx">                                 576814291E6F99C100E77754 /* CryptoAlgorithmEcdhKeyDeriveParams.h */,
</span><span class="lines">@@ -23867,8 +23867,8 @@
</span><span class="cx">                                 570440591E53936200356601 /* JSAesCbcCfbParams.h */,
</span><span class="cx">                                 57B5F80A1E5D22DA00F34F90 /* JSAesGcmParams.cpp */,
</span><span class="cx">                                 57B5F80B1E5D22DA00F34F90 /* JSAesGcmParams.h */,
</span><del>-                                577483151DAEC32200716EF9 /* JSAesKeyGenParams.cpp */,
-                                577483131DAEC2EA00716EF9 /* JSAesKeyGenParams.h */,
</del><ins>+                                576814421E70CB1000E77754 /* JSAesKeyParams.cpp */,
+                                576814431E70CB1000E77754 /* JSAesKeyParams.h */,
</ins><span class="cx">                                 5739E1301DAC7FD100E14383 /* JSCryptoAlgorithmParameters.cpp */,
</span><span class="cx">                                 5739E12E1DAC7F7800E14383 /* JSCryptoAlgorithmParameters.h */,
</span><span class="cx">                                 E157A8DE1817331C009F821D /* JSCryptoKey.cpp */,
</span><span class="lines">@@ -25882,7 +25882,7 @@
</span><span class="cx">                                 E1FE137B184D21BB00892F13 /* CryptoAlgorithmAES_KW.h in Headers */,
</span><span class="cx">                                 572093D31DDCEB9A00310AB0 /* CryptoAlgorithmAesCbcCfbParams.h in Headers */,
</span><span class="cx">                                 E125F83A1824104800D84CD9 /* CryptoAlgorithmAesCbcParamsDeprecated.h in Headers */,
</span><del>-                                577483121DADC55D00716EF9 /* CryptoAlgorithmAesKeyGenParams.h in Headers */,
</del><ins>+                                577483121DADC55D00716EF9 /* CryptoAlgorithmAesKeyParams.h in Headers */,
</ins><span class="cx">                                 E19AC3F71824E5D100349426 /* CryptoAlgorithmAesKeyGenParamsDeprecated.h in Headers */,
</span><span class="cx">                                 E125F8321822F11B00D84CD9 /* CryptoAlgorithmHMAC.h in Headers */,
</span><span class="cx">                                 577483191DB4491F00716EF9 /* CryptoAlgorithmHmacKeyParams.h in Headers */,
</span><span class="lines">@@ -26737,7 +26737,6 @@
</span><span class="cx">                                 44EFF6431A6FF92700D45EEC /* IOTypesSPI.h in Headers */,
</span><span class="cx">                                 07AC47021952102100EE9723 /* ISOVTTCue.h in Headers */,
</span><span class="cx">                                 418F88050FF957AF0080F045 /* JSAbstractWorker.h in Headers */,
</span><del>-                                577483141DAEC2EB00716EF9 /* JSAesKeyGenParams.h in Headers */,
</del><span class="cx">                                 FDA15ECA12B03F50003A583A /* JSAnalyserNode.h in Headers */,
</span><span class="cx">                                 12A253E31C8FFF6600C22295 /* JSAnimatable.h in Headers */,
</span><span class="cx">                                 120DE3FD1C87E18400B6D4DD /* JSAnimationEffect.h in Headers */,
</span><span class="lines">@@ -26749,6 +26748,7 @@
</span><span class="cx">                                 7C6523161E00DBB500677F22 /* JSApplePayPaymentContact.h in Headers */,
</span><span class="cx">                                 7C6523181E00DBB500677F22 /* JSApplePayPaymentMethod.h in Headers */,
</span><span class="cx">                                 1AE96A8D1D1A0DDD00B86768 /* JSApplePayPaymentMethodSelectedEvent.h in Headers */,
</span><ins>+                                576814451E70CB1F00E77754 /* JSAesKeyParams.h in Headers */,
</ins><span class="cx">                                 7C65231A1E00DBB500677F22 /* JSApplePayPaymentPass.h in Headers */,
</span><span class="cx">                                 7C6579F21E00856600E3A27A /* JSApplePayPaymentRequest.h in Headers */,
</span><span class="cx">                                 1AE96A8F1D1A0DDD00B86768 /* JSApplePaySession.h in Headers */,
</span><span class="lines">@@ -30584,7 +30584,6 @@
</span><span class="cx">                                 AD9FF6E11908391D003B61E0 /* IOSurfacePoolCocoa.mm in Sources */,
</span><span class="cx">                                 07AC47011952102100EE9723 /* ISOVTTCue.cpp in Sources */,
</span><span class="cx">                                 418F88040FF957AE0080F045 /* JSAbstractWorker.cpp in Sources */,
</span><del>-                                577483161DAEC32300716EF9 /* JSAesKeyGenParams.cpp in Sources */,
</del><span class="cx">                                 FDA15EC912B03F50003A583A /* JSAnalyserNode.cpp in Sources */,
</span><span class="cx">                                 31A795C61888BADC00382F90 /* JSANGLEInstancedArrays.cpp in Sources */,
</span><span class="cx">                                 12A253E21C8FFF6600C22295 /* JSAnimatable.cpp in Sources */,
</span><span class="lines">@@ -30847,6 +30846,7 @@
</span><span class="cx">                                 A80E7E980A1A83E3007FB8C5 /* JSHTMLInputElement.cpp in Sources */,
</span><span class="cx">                                 A6148A7812E41E3B0044A784 /* JSHTMLKeygenElement.cpp in Sources */,
</span><span class="cx">                                 1AE2AB210A1CE63B00B42B25 /* JSHTMLLabelElement.cpp in Sources */,
</span><ins>+                                576814441E70CB1B00E77754 /* JSAesKeyParams.cpp in Sources */,
</ins><span class="cx">                                 1AE2AB230A1CE63B00B42B25 /* JSHTMLLegendElement.cpp in Sources */,
</span><span class="cx">                                 1AE2AB250A1CE63B00B42B25 /* JSHTMLLIElement.cpp in Sources */,
</span><span class="cx">                                 A80E7B100A19D606007FB8C5 /* JSHTMLLinkElement.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSSubtleCryptoCustomcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSSubtleCryptoCustom.cpp (213627 => 213628)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSSubtleCryptoCustom.cpp        2017-03-09 05:16:20 UTC (rev 213627)
+++ trunk/Source/WebCore/bindings/js/JSSubtleCryptoCustom.cpp        2017-03-09 05:50:31 UTC (rev 213628)
</span><span class="lines">@@ -32,7 +32,7 @@
</span><span class="cx"> #include &quot;CryptoAlgorithmRegistry.h&quot;
</span><span class="cx"> #include &quot;JSAesCbcCfbParams.h&quot;
</span><span class="cx"> #include &quot;JSAesGcmParams.h&quot;
</span><del>-#include &quot;JSAesKeyGenParams.h&quot;
</del><ins>+#include &quot;JSAesKeyParams.h&quot;
</ins><span class="cx"> #include &quot;JSCryptoAlgorithmParameters.h&quot;
</span><span class="cx"> #include &quot;JSCryptoKey.h&quot;
</span><span class="cx"> #include &quot;JSCryptoKeyPair.h&quot;
</span><span class="lines">@@ -61,12 +61,12 @@
</span><span class="cx">     Sign,
</span><span class="cx">     Verify,
</span><span class="cx">     Digest,
</span><del>-    DeriveKey,
</del><ins>+    GenerateKey,
</ins><span class="cx">     DeriveBits,
</span><del>-    GenerateKey,
</del><span class="cx">     ImportKey,
</span><span class="cx">     WrapKey,
</span><del>-    UnwrapKey
</del><ins>+    UnwrapKey,
+    GetKeyLength
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> static std::unique_ptr&lt;CryptoAlgorithmParameters&gt; normalizeCryptoAlgorithmParameters(ExecState&amp;, JSValue, Operations);
</span><span class="lines">@@ -160,9 +160,6 @@
</span><span class="cx">                 return nullptr;
</span><span class="cx">             }
</span><span class="cx">             break;
</span><del>-        case Operations::DeriveKey:
-            throwNotSupportedError(state, scope);
-            return nullptr;
</del><span class="cx">         case Operations::DeriveBits:
</span><span class="cx">             switch (*identifier) {
</span><span class="cx">             case CryptoAlgorithmIdentifier::ECDH: {
</span><span class="lines">@@ -207,9 +204,9 @@
</span><span class="cx">             case CryptoAlgorithmIdentifier::AES_GCM:
</span><span class="cx">             case CryptoAlgorithmIdentifier::AES_CFB:
</span><span class="cx">             case CryptoAlgorithmIdentifier::AES_KW: {
</span><del>-                auto params = convertDictionary&lt;CryptoAlgorithmAesKeyGenParams&gt;(state, value);
</del><ins>+                auto params = convertDictionary&lt;CryptoAlgorithmAesKeyParams&gt;(state, value);
</ins><span class="cx">                 RETURN_IF_EXCEPTION(scope, nullptr);
</span><del>-                result = std::make_unique&lt;CryptoAlgorithmAesKeyGenParams&gt;(params);
</del><ins>+                result = std::make_unique&lt;CryptoAlgorithmAesKeyParams&gt;(params);
</ins><span class="cx">                 break;
</span><span class="cx">             }
</span><span class="cx">             case CryptoAlgorithmIdentifier::HMAC: {
</span><span class="lines">@@ -286,6 +283,32 @@
</span><span class="cx">                 return nullptr;
</span><span class="cx">             }
</span><span class="cx">             break;
</span><ins>+        case Operations::GetKeyLength:
+            switch (*identifier) {
+            case CryptoAlgorithmIdentifier::AES_CTR:
+            case CryptoAlgorithmIdentifier::AES_CBC:
+            case CryptoAlgorithmIdentifier::AES_CMAC:
+            case CryptoAlgorithmIdentifier::AES_GCM:
+            case CryptoAlgorithmIdentifier::AES_CFB:
+            case CryptoAlgorithmIdentifier::AES_KW: {
+                auto params = convertDictionary&lt;CryptoAlgorithmAesKeyParams&gt;(state, value);
+                RETURN_IF_EXCEPTION(scope, nullptr);
+                result = std::make_unique&lt;CryptoAlgorithmAesKeyParams&gt;(params);
+                break;
+            }
+            case CryptoAlgorithmIdentifier::HMAC: {
+                auto params = convertDictionary&lt;CryptoAlgorithmHmacKeyParams&gt;(state, value);
+                RETURN_IF_EXCEPTION(scope, nullptr);
+                params.hashIdentifier = toHashIdentifier(state, params.hash);
+                RETURN_IF_EXCEPTION(scope, nullptr);
+                result = std::make_unique&lt;CryptoAlgorithmHmacKeyParams&gt;(params);
+                break;
+            }
+            default:
+                throwNotSupportedError(state, scope);
+                return nullptr;
+            }
+            break;
</ins><span class="cx">         default:
</span><span class="cx">             ASSERT_NOT_REACHED();
</span><span class="cx">             return nullptr;
</span><span class="lines">@@ -487,7 +510,6 @@
</span><span class="cx"> 
</span><span class="cx">     auto callback = [capturedPromise = promise.copyRef()](const Vector&lt;uint8_t&gt;&amp; cipherText) mutable {
</span><span class="cx">         fulfillPromiseWithArrayBuffer(WTFMove(capturedPromise), cipherText.data(), cipherText.size());
</span><del>-        return;
</del><span class="cx">     };
</span><span class="cx">     auto exceptionCallback = [capturedPromise = WTFMove(promise)](ExceptionCode ec) mutable {
</span><span class="cx">         rejectWithException(WTFMove(capturedPromise), ec);
</span><span class="lines">@@ -535,7 +557,6 @@
</span><span class="cx"> 
</span><span class="cx">     auto callback = [capturedPromise = promise.copyRef()](const Vector&lt;uint8_t&gt;&amp; plainText) mutable {
</span><span class="cx">         fulfillPromiseWithArrayBuffer(WTFMove(capturedPromise), plainText.data(), plainText.size());
</span><del>-        return;
</del><span class="cx">     };
</span><span class="cx">     auto exceptionCallback = [capturedPromise = WTFMove(promise)](ExceptionCode ec) mutable {
</span><span class="cx">         rejectWithException(WTFMove(capturedPromise), ec);
</span><span class="lines">@@ -583,7 +604,6 @@
</span><span class="cx"> 
</span><span class="cx">     auto callback = [capturedPromise = promise.copyRef()](const Vector&lt;uint8_t&gt;&amp; signature) mutable {
</span><span class="cx">         fulfillPromiseWithArrayBuffer(WTFMove(capturedPromise), signature.data(), signature.size());
</span><del>-        return;
</del><span class="cx">     };
</span><span class="cx">     auto exceptionCallback = [capturedPromise = WTFMove(promise)](ExceptionCode ec) mutable {
</span><span class="cx">         rejectWithException(WTFMove(capturedPromise), ec);
</span><span class="lines">@@ -634,7 +654,6 @@
</span><span class="cx"> 
</span><span class="cx">     auto callback = [capturedPromise = promise.copyRef()](bool result) mutable {
</span><span class="cx">         capturedPromise-&gt;resolve&lt;IDLBoolean&gt;(result);
</span><del>-        return;
</del><span class="cx">     };
</span><span class="cx">     auto exceptionCallback = [capturedPromise = WTFMove(promise)](ExceptionCode ec) mutable {
</span><span class="cx">         rejectWithException(WTFMove(capturedPromise), ec);
</span><span class="lines">@@ -669,7 +688,6 @@
</span><span class="cx"> 
</span><span class="cx">     auto callback = [capturedPromise = promise.copyRef()](const Vector&lt;uint8_t&gt;&amp; digest) mutable {
</span><span class="cx">         fulfillPromiseWithArrayBuffer(WTFMove(capturedPromise), digest.data(), digest.size());
</span><del>-        return;
</del><span class="cx">     };
</span><span class="cx">     auto exceptionCallback = [capturedPromise = WTFMove(promise)](ExceptionCode ec) mutable {
</span><span class="cx">         rejectWithException(WTFMove(capturedPromise), ec);
</span><span class="lines">@@ -743,11 +761,81 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    auto params = normalizeCryptoAlgorithmParameters(state, state.uncheckedArgument(0), Operations::DeriveKey);
</del><ins>+    auto params = normalizeCryptoAlgorithmParameters(state, state.uncheckedArgument(0), Operations::DeriveBits);
</ins><span class="cx">     RETURN_IF_EXCEPTION(scope, void());
</span><span class="cx"> 
</span><del>-    // We should always return a NOT_SUPPORTED_ERR since we currently don't support any algorithms that has deriveKey operation.
-    ASSERT_NOT_REACHED();
</del><ins>+    auto baseKey = toCryptoKey(state, state.uncheckedArgument(1));
+    RETURN_IF_EXCEPTION(scope, void());
+
+    auto importParams = normalizeCryptoAlgorithmParameters(state, state.uncheckedArgument(2), Operations::ImportKey);
+    RETURN_IF_EXCEPTION(scope, void());
+
+    auto getLengthParams = normalizeCryptoAlgorithmParameters(state, state.uncheckedArgument(2), Operations::GetKeyLength);
+    RETURN_IF_EXCEPTION(scope, void());
+
+    auto extractable = state.uncheckedArgument(3).toBoolean(&amp;state);
+    RETURN_IF_EXCEPTION(scope, void());
+
+    auto keyUsages = cryptoKeyUsageBitmapFromJSValue(state, state.uncheckedArgument(4));
+    RETURN_IF_EXCEPTION(scope, void());
+
+    if (params-&gt;identifier != baseKey-&gt;algorithmIdentifier()) {
+        promise-&gt;reject(INVALID_ACCESS_ERR, ASCIILiteral(&quot;CryptoKey doesn't match AlgorithmIdentifier&quot;));
+        return;
+    }
+
+    if (!baseKey-&gt;allows(CryptoKeyUsageDeriveKey)) {
+        promise-&gt;reject(INVALID_ACCESS_ERR, ASCIILiteral(&quot;CryptoKey doesn't support CryptoKey derivation&quot;));
+        return;
+    }
+
+    auto getLengthAlgorithm = CryptoAlgorithmRegistry::singleton().create(getLengthParams-&gt;identifier);
+    if (UNLIKELY(!getLengthAlgorithm)) {
+        throwNotSupportedError(state, scope);
+        return;
+    }
+    auto result = getLengthAlgorithm-&gt;getKeyLength(*getLengthParams);
+    if (result.hasException()) {
+        promise-&gt;reject(result.releaseException().code(), ASCIILiteral(&quot;Cannot get key length from derivedKeyType&quot;));
+        return;
+    }
+    size_t length = result.releaseReturnValue();
+
+    auto importAlgorithm = CryptoAlgorithmRegistry::singleton().create(importParams-&gt;identifier);
+    if (UNLIKELY(!importAlgorithm)) {
+        throwNotSupportedError(state, scope);
+        return;
+    }
+
+    auto algorithm = CryptoAlgorithmRegistry::singleton().create(params-&gt;identifier);
+    if (UNLIKELY(!algorithm)) {
+        throwNotSupportedError(state, scope);
+        return;
+    }
+
+    auto callback = [promise = promise.copyRef(), importAlgorithm, importParams = WTFMove(importParams), extractable, keyUsages](const Vector&lt;uint8_t&gt;&amp; derivedKey) mutable {
+        // FIXME: https://bugs.webkit.org/show_bug.cgi?id=169395
+        KeyData data = derivedKey;
+        auto callback = [capturedPromise = promise.copyRef()](CryptoKey&amp; key) mutable {
+            if ((key.type() == CryptoKeyType::Private || key.type() == CryptoKeyType::Secret) &amp;&amp; !key.usagesBitmap()) {
+                rejectWithException(WTFMove(capturedPromise), SYNTAX_ERR);
+                return;
+            }
+            capturedPromise-&gt;resolve&lt;IDLInterface&lt;CryptoKey&gt;&gt;(key);
+        };
+        auto exceptionCallback = [capturedPromise = WTFMove(promise)](ExceptionCode ec) mutable {
+            rejectWithException(WTFMove(capturedPromise), ec);
+        };
+
+        importAlgorithm-&gt;importKey(SubtleCrypto::KeyFormat::Raw, WTFMove(data), WTFMove(importParams), extractable, keyUsages, WTFMove(callback), WTFMove(exceptionCallback));
+    };
+    auto exceptionCallback = [capturedPromise = WTFMove(promise)](ExceptionCode ec) mutable {
+        rejectWithException(WTFMove(capturedPromise), ec);
+    };
+
+    auto subtle = jsDynamicDowncast&lt;JSSubtleCrypto*&gt;(vm, state.thisValue());
+    ASSERT(subtle);
+    algorithm-&gt;deriveBits(WTFMove(params), baseKey.releaseNonNull(), length, WTFMove(callback), WTFMove(exceptionCallback), *scriptExecutionContextFromExecState(&amp;state), subtle-&gt;wrapped().workQueue());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static void jsSubtleCryptoFunctionDeriveBitsPromise(ExecState&amp; state, Ref&lt;DeferredPromise&gt;&amp;&amp; promise)
</span><span class="lines">@@ -787,7 +875,6 @@
</span><span class="cx"> 
</span><span class="cx">     auto callback = [capturedPromise = promise.copyRef()](const Vector&lt;uint8_t&gt;&amp; derivedKey) mutable {
</span><span class="cx">         fulfillPromiseWithArrayBuffer(WTFMove(capturedPromise), derivedKey.data(), derivedKey.size());
</span><del>-        return;
</del><span class="cx">     };
</span><span class="cx">     auto exceptionCallback = [capturedPromise = WTFMove(promise)](ExceptionCode ec) mutable {
</span><span class="cx">         rejectWithException(WTFMove(capturedPromise), ec);
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoCryptoAlgorithmcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/CryptoAlgorithm.cpp (213627 => 213628)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/CryptoAlgorithm.cpp        2017-03-09 05:16:20 UTC (rev 213627)
+++ trunk/Source/WebCore/crypto/CryptoAlgorithm.cpp        2017-03-09 05:50:31 UTC (rev 213628)
</span><span class="lines">@@ -62,7 +62,7 @@
</span><span class="cx">     exceptionCallback(NOT_SUPPORTED_ERR);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithm::deriveBits(std::unique_ptr&lt;CryptoAlgorithmParameters&gt;&amp;&amp;, Ref&lt;CryptoKey&gt;&amp;&amp;, unsigned long, VectorCallback&amp;&amp;, ExceptionCallback&amp;&amp; exceptionCallback, ScriptExecutionContext&amp;, WorkQueue&amp;)
</del><ins>+void CryptoAlgorithm::deriveBits(std::unique_ptr&lt;CryptoAlgorithmParameters&gt;&amp;&amp;, Ref&lt;CryptoKey&gt;&amp;&amp;, size_t, VectorCallback&amp;&amp;, ExceptionCallback&amp;&amp; exceptionCallback, ScriptExecutionContext&amp;, WorkQueue&amp;)
</ins><span class="cx"> {
</span><span class="cx">     exceptionCallback(NOT_SUPPORTED_ERR);
</span><span class="cx"> }
</span><span class="lines">@@ -87,6 +87,11 @@
</span><span class="cx">     exceptionCallback(NOT_SUPPORTED_ERR);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+ExceptionOr&lt;size_t&gt; CryptoAlgorithm::getKeyLength(const CryptoAlgorithmParameters&amp;)
+{
+    return Exception { NOT_SUPPORTED_ERR };
+}
+
</ins><span class="cx"> ExceptionOr&lt;void&gt; CryptoAlgorithm::encrypt(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp;)
</span><span class="cx"> {
</span><span class="cx">     return Exception { NOT_SUPPORTED_ERR };
</span><span class="lines">@@ -122,7 +127,7 @@
</span><span class="cx">     return Exception { NOT_SUPPORTED_ERR };
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-ExceptionOr&lt;void&gt; CryptoAlgorithm::deriveBits(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp;, unsigned long, VectorCallback&amp;&amp;, VoidCallback&amp;&amp;)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithm::deriveBits(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp;, size_t, VectorCallback&amp;&amp;, VoidCallback&amp;&amp;)
</ins><span class="cx"> {
</span><span class="cx">     return Exception { NOT_SUPPORTED_ERR };
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoCryptoAlgorithmh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/CryptoAlgorithm.h (213627 => 213628)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/CryptoAlgorithm.h        2017-03-09 05:16:20 UTC (rev 213627)
+++ trunk/Source/WebCore/crypto/CryptoAlgorithm.h        2017-03-09 05:50:31 UTC (rev 213628)
</span><span class="lines">@@ -61,6 +61,7 @@
</span><span class="cx">     using BoolCallback = WTF::Function&lt;void(bool)&gt;;
</span><span class="cx">     using KeyCallback = WTF::Function&lt;void(CryptoKey&amp;)&gt;;
</span><span class="cx">     using KeyOrKeyPairCallback = WTF::Function&lt;void(KeyOrKeyPair&amp;&amp;)&gt;;
</span><ins>+    // FIXME: https://bugs.webkit.org/show_bug.cgi?id=169395
</ins><span class="cx">     using VectorCallback = WTF::Function&lt;void(const Vector&lt;uint8_t&gt;&amp;)&gt;;
</span><span class="cx">     using VoidCallback = WTF::Function&lt;void()&gt;;
</span><span class="cx">     using ExceptionCallback = WTF::Function&lt;void(ExceptionCode)&gt;;
</span><span class="lines">@@ -72,12 +73,13 @@
</span><span class="cx">     virtual void verify(Ref&lt;CryptoKey&gt;&amp;&amp;, Vector&lt;uint8_t&gt;&amp;&amp; signature, Vector&lt;uint8_t&gt;&amp;&amp;, BoolCallback&amp;&amp;, ExceptionCallback&amp;&amp;, ScriptExecutionContext&amp;, WorkQueue&amp;);
</span><span class="cx">     virtual void digest(Vector&lt;uint8_t&gt;&amp;&amp;, VectorCallback&amp;&amp;, ExceptionCallback&amp;&amp;, ScriptExecutionContext&amp;, WorkQueue&amp;);
</span><span class="cx">     virtual void generateKey(const CryptoAlgorithmParameters&amp;, bool extractable, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&amp;&amp;, ExceptionCallback&amp;&amp;, ScriptExecutionContext&amp;);
</span><del>-    virtual void deriveBits(std::unique_ptr&lt;CryptoAlgorithmParameters&gt;&amp;&amp;, Ref&lt;CryptoKey&gt;&amp;&amp;, unsigned long length, VectorCallback&amp;&amp;, ExceptionCallback&amp;&amp;, ScriptExecutionContext&amp;, WorkQueue&amp;);
</del><ins>+    virtual void deriveBits(std::unique_ptr&lt;CryptoAlgorithmParameters&gt;&amp;&amp;, Ref&lt;CryptoKey&gt;&amp;&amp;, size_t length, VectorCallback&amp;&amp;, ExceptionCallback&amp;&amp;, ScriptExecutionContext&amp;, WorkQueue&amp;);
</ins><span class="cx">     // FIXME: https://bugs.webkit.org/show_bug.cgi?id=169262
</span><span class="cx">     virtual void importKey(SubtleCrypto::KeyFormat, KeyData&amp;&amp;, const std::unique_ptr&lt;CryptoAlgorithmParameters&gt;&amp;&amp;, bool extractable, CryptoKeyUsageBitmap, KeyCallback&amp;&amp;, ExceptionCallback&amp;&amp;);
</span><span class="cx">     virtual void exportKey(SubtleCrypto::KeyFormat, Ref&lt;CryptoKey&gt;&amp;&amp;, KeyDataCallback&amp;&amp;, ExceptionCallback&amp;&amp;);
</span><span class="cx">     virtual void wrapKey(Ref&lt;CryptoKey&gt;&amp;&amp;, Vector&lt;uint8_t&gt;&amp;&amp;, VectorCallback&amp;&amp;, ExceptionCallback&amp;&amp;);
</span><span class="cx">     virtual void unwrapKey(Ref&lt;CryptoKey&gt;&amp;&amp;, Vector&lt;uint8_t&gt;&amp;&amp;, VectorCallback&amp;&amp;, ExceptionCallback&amp;&amp;);
</span><ins>+    virtual ExceptionOr&lt;size_t&gt; getKeyLength(const CryptoAlgorithmParameters&amp;);
</ins><span class="cx"> 
</span><span class="cx">     // The following will be deprecated.
</span><span class="cx">     virtual ExceptionOr&lt;void&gt; encrypt(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback);
</span><span class="lines">@@ -87,7 +89,7 @@
</span><span class="cx">     virtual ExceptionOr&lt;void&gt; digest(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback);
</span><span class="cx">     virtual ExceptionOr&lt;void&gt; generateKey(const CryptoAlgorithmParametersDeprecated&amp;, bool extractable, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ScriptExecutionContext&amp;);
</span><span class="cx">     virtual ExceptionOr&lt;void&gt; deriveKey(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp; baseKey, CryptoAlgorithm* derivedKeyType, bool extractable, CryptoKeyUsageBitmap, KeyCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback);
</span><del>-    virtual ExceptionOr&lt;void&gt; deriveBits(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp; baseKey, unsigned long length, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback);
</del><ins>+    virtual ExceptionOr&lt;void&gt; deriveBits(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp; baseKey, size_t length, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback);
</ins><span class="cx">     virtual ExceptionOr&lt;void&gt; importKey(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKeyData&amp;, bool extractable, CryptoKeyUsageBitmap, KeyCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback);
</span><span class="cx"> 
</span><span class="cx">     // These are only different from encrypt/decrypt because some algorithms may not expose encrypt/decrypt.
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoCryptoAlgorithmParametersh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/CryptoAlgorithmParameters.h (213627 => 213628)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/CryptoAlgorithmParameters.h        2017-03-09 05:16:20 UTC (rev 213627)
+++ trunk/Source/WebCore/crypto/CryptoAlgorithmParameters.h        2017-03-09 05:50:31 UTC (rev 213628)
</span><span class="lines">@@ -39,7 +39,7 @@
</span><span class="cx">         None,
</span><span class="cx">         AesCbcCfbParams,
</span><span class="cx">         AesGcmParams,
</span><del>-        AesKeyGenParams,
</del><ins>+        AesKeyParams,
</ins><span class="cx">         EcKeyParams,
</span><span class="cx">         EcdhKeyDeriveParams,
</span><span class="cx">         HmacKeyParams,
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmAES_CBCcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_CBC.cpp (213627 => 213628)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_CBC.cpp        2017-03-09 05:16:20 UTC (rev 213627)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_CBC.cpp        2017-03-09 05:50:31 UTC (rev 213628)
</span><span class="lines">@@ -30,8 +30,8 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;CryptoAlgorithmAesCbcCfbParams.h&quot;
</span><span class="cx"> #include &quot;CryptoAlgorithmAesCbcParamsDeprecated.h&quot;
</span><del>-#include &quot;CryptoAlgorithmAesKeyGenParams.h&quot;
</del><span class="cx"> #include &quot;CryptoAlgorithmAesKeyGenParamsDeprecated.h&quot;
</span><ins>+#include &quot;CryptoAlgorithmAesKeyParams.h&quot;
</ins><span class="cx"> #include &quot;CryptoKeyAES.h&quot;
</span><span class="cx"> #include &quot;CryptoKeyDataOctetSequence.h&quot;
</span><span class="cx"> #include &quot;ExceptionCode.h&quot;
</span><span class="lines">@@ -90,7 +90,7 @@
</span><span class="cx"> 
</span><span class="cx"> void CryptoAlgorithmAES_CBC::generateKey(const CryptoAlgorithmParameters&amp; parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyOrKeyPairCallback&amp;&amp; callback, ExceptionCallback&amp;&amp; exceptionCallback, ScriptExecutionContext&amp;)
</span><span class="cx"> {
</span><del>-    const auto&amp; aesParameters = downcast&lt;CryptoAlgorithmAesKeyGenParams&gt;(parameters);
</del><ins>+    const auto&amp; aesParameters = downcast&lt;CryptoAlgorithmAesKeyParams&gt;(parameters);
</ins><span class="cx"> 
</span><span class="cx">     if (usagesAreInvalidForCryptoAlgorithmAES_CBC(usages)) {
</span><span class="cx">         exceptionCallback(SYNTAX_ERR);
</span><span class="lines">@@ -186,6 +186,11 @@
</span><span class="cx">     callback(format, WTFMove(result));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+ExceptionOr&lt;size_t&gt; CryptoAlgorithmAES_CBC::getKeyLength(const CryptoAlgorithmParameters&amp; parameters)
+{
+    return CryptoKeyAES::getKeyLength(parameters);
+}
+
</ins><span class="cx"> ExceptionOr&lt;void&gt; CryptoAlgorithmAES_CBC::encrypt(const CryptoAlgorithmParametersDeprecated&amp; parameters, const CryptoKey&amp; key, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback)
</span><span class="cx"> {
</span><span class="cx">     auto&amp; aesCBCParameters = downcast&lt;CryptoAlgorithmAesCbcParamsDeprecated&gt;(parameters);
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmAES_CBCh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_CBC.h (213627 => 213628)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_CBC.h        2017-03-09 05:16:20 UTC (rev 213627)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_CBC.h        2017-03-09 05:50:31 UTC (rev 213628)
</span><span class="lines">@@ -49,6 +49,7 @@
</span><span class="cx">     void generateKey(const CryptoAlgorithmParameters&amp;, bool extractable, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&amp;&amp;, ExceptionCallback&amp;&amp;, ScriptExecutionContext&amp;) final;
</span><span class="cx">     void importKey(SubtleCrypto::KeyFormat, KeyData&amp;&amp;, const std::unique_ptr&lt;CryptoAlgorithmParameters&gt;&amp;&amp;, bool extractable, CryptoKeyUsageBitmap, KeyCallback&amp;&amp;, ExceptionCallback&amp;&amp;) final;
</span><span class="cx">     void exportKey(SubtleCrypto::KeyFormat, Ref&lt;CryptoKey&gt;&amp;&amp;, KeyDataCallback&amp;&amp;, ExceptionCallback&amp;&amp;) final;
</span><ins>+    ExceptionOr&lt;size_t&gt; getKeyLength(const CryptoAlgorithmParameters&amp;) final;
</ins><span class="cx"> 
</span><span class="cx">     ExceptionOr&lt;void&gt; encrypt(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback) final;
</span><span class="cx">     ExceptionOr&lt;void&gt; decrypt(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback) final;
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmAES_CFBcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_CFB.cpp (213627 => 213628)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_CFB.cpp        2017-03-09 05:16:20 UTC (rev 213627)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_CFB.cpp        2017-03-09 05:50:31 UTC (rev 213628)
</span><span class="lines">@@ -29,7 +29,7 @@
</span><span class="cx"> #if ENABLE(SUBTLE_CRYPTO)
</span><span class="cx"> 
</span><span class="cx"> #include &quot;CryptoAlgorithmAesCbcCfbParams.h&quot;
</span><del>-#include &quot;CryptoAlgorithmAesKeyGenParams.h&quot;
</del><ins>+#include &quot;CryptoAlgorithmAesKeyParams.h&quot;
</ins><span class="cx"> #include &quot;CryptoKeyAES.h&quot;
</span><span class="cx"> #include &quot;ExceptionCode.h&quot;
</span><span class="cx"> 
</span><span class="lines">@@ -79,7 +79,7 @@
</span><span class="cx"> 
</span><span class="cx"> void CryptoAlgorithmAES_CFB::generateKey(const CryptoAlgorithmParameters&amp; parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyOrKeyPairCallback&amp;&amp; callback, ExceptionCallback&amp;&amp; exceptionCallback, ScriptExecutionContext&amp;)
</span><span class="cx"> {
</span><del>-    const auto&amp; aesParameters = downcast&lt;CryptoAlgorithmAesKeyGenParams&gt;(parameters);
</del><ins>+    const auto&amp; aesParameters = downcast&lt;CryptoAlgorithmAesKeyParams&gt;(parameters);
</ins><span class="cx"> 
</span><span class="cx">     if (usagesAreInvalidForCryptoAlgorithmAES_CFB(usages)) {
</span><span class="cx">         exceptionCallback(SYNTAX_ERR);
</span><span class="lines">@@ -175,6 +175,11 @@
</span><span class="cx">     callback(format, WTFMove(result));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+ExceptionOr&lt;size_t&gt; CryptoAlgorithmAES_CFB::getKeyLength(const CryptoAlgorithmParameters&amp; parameters)
+{
+    return CryptoKeyAES::getKeyLength(parameters);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+}
+
</ins><span class="cx"> #endif // ENABLE(SUBTLE_CRYPTO)
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmAES_CFBh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_CFB.h (213627 => 213628)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_CFB.h        2017-03-09 05:16:20 UTC (rev 213627)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_CFB.h        2017-03-09 05:50:31 UTC (rev 213628)
</span><span class="lines">@@ -48,6 +48,7 @@
</span><span class="cx">     void generateKey(const CryptoAlgorithmParameters&amp;, bool extractable, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&amp;&amp;, ExceptionCallback&amp;&amp;, ScriptExecutionContext&amp;) final;
</span><span class="cx">     void importKey(SubtleCrypto::KeyFormat, KeyData&amp;&amp;, const std::unique_ptr&lt;CryptoAlgorithmParameters&gt;&amp;&amp;, bool extractable, CryptoKeyUsageBitmap, KeyCallback&amp;&amp;, ExceptionCallback&amp;&amp;) final;
</span><span class="cx">     void exportKey(SubtleCrypto::KeyFormat, Ref&lt;CryptoKey&gt;&amp;&amp;, KeyDataCallback&amp;&amp;, ExceptionCallback&amp;&amp;) final;
</span><ins>+    ExceptionOr&lt;size_t&gt; getKeyLength(const CryptoAlgorithmParameters&amp;) final;
</ins><span class="cx"> 
</span><span class="cx">     void platformEncrypt(std::unique_ptr&lt;CryptoAlgorithmParameters&gt;&amp;&amp;, Ref&lt;CryptoKey&gt;&amp;&amp;, Vector&lt;uint8_t&gt;&amp;&amp;, VectorCallback&amp;&amp;, ExceptionCallback&amp;&amp;, ScriptExecutionContext&amp;, WorkQueue&amp;);
</span><span class="cx">     void platformDecrypt(std::unique_ptr&lt;CryptoAlgorithmParameters&gt;&amp;&amp;, Ref&lt;CryptoKey&gt;&amp;&amp;, Vector&lt;uint8_t&gt;&amp;&amp;, VectorCallback&amp;&amp;, ExceptionCallback&amp;&amp;, ScriptExecutionContext&amp;, WorkQueue&amp;);
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmAES_GCMcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_GCM.cpp (213627 => 213628)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_GCM.cpp        2017-03-09 05:16:20 UTC (rev 213627)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_GCM.cpp        2017-03-09 05:50:31 UTC (rev 213628)
</span><span class="lines">@@ -29,7 +29,7 @@
</span><span class="cx"> #if ENABLE(SUBTLE_CRYPTO)
</span><span class="cx"> 
</span><span class="cx"> #include &quot;CryptoAlgorithmAesGcmParams.h&quot;
</span><del>-#include &quot;CryptoAlgorithmAesKeyGenParams.h&quot;
</del><ins>+#include &quot;CryptoAlgorithmAesKeyParams.h&quot;
</ins><span class="cx"> #include &quot;CryptoKeyAES.h&quot;
</span><span class="cx"> #include &quot;ExceptionCode.h&quot;
</span><span class="cx"> 
</span><span class="lines">@@ -128,7 +128,7 @@
</span><span class="cx"> 
</span><span class="cx"> void CryptoAlgorithmAES_GCM::generateKey(const CryptoAlgorithmParameters&amp; parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyOrKeyPairCallback&amp;&amp; callback, ExceptionCallback&amp;&amp; exceptionCallback, ScriptExecutionContext&amp;)
</span><span class="cx"> {
</span><del>-    const auto&amp; aesParameters = downcast&lt;CryptoAlgorithmAesKeyGenParams&gt;(parameters);
</del><ins>+    const auto&amp; aesParameters = downcast&lt;CryptoAlgorithmAesKeyParams&gt;(parameters);
</ins><span class="cx"> 
</span><span class="cx">     if (usagesAreInvalidForCryptoAlgorithmAES_GCM(usages)) {
</span><span class="cx">         exceptionCallback(SYNTAX_ERR);
</span><span class="lines">@@ -224,6 +224,11 @@
</span><span class="cx">     callback(format, WTFMove(result));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+ExceptionOr&lt;size_t&gt; CryptoAlgorithmAES_GCM::getKeyLength(const CryptoAlgorithmParameters&amp; parameters)
+{
+    return CryptoKeyAES::getKeyLength(parameters);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+}
+
</ins><span class="cx"> #endif // ENABLE(SUBTLE_CRYPTO)
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmAES_GCMh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_GCM.h (213627 => 213628)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_GCM.h        2017-03-09 05:16:20 UTC (rev 213627)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_GCM.h        2017-03-09 05:50:31 UTC (rev 213628)
</span><span class="lines">@@ -48,6 +48,7 @@
</span><span class="cx">     void generateKey(const CryptoAlgorithmParameters&amp;, bool extractable, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&amp;&amp;, ExceptionCallback&amp;&amp;, ScriptExecutionContext&amp;) final;
</span><span class="cx">     void importKey(SubtleCrypto::KeyFormat, KeyData&amp;&amp;, const std::unique_ptr&lt;CryptoAlgorithmParameters&gt;&amp;&amp;, bool extractable, CryptoKeyUsageBitmap, KeyCallback&amp;&amp;, ExceptionCallback&amp;&amp;) final;
</span><span class="cx">     void exportKey(SubtleCrypto::KeyFormat, Ref&lt;CryptoKey&gt;&amp;&amp;, KeyDataCallback&amp;&amp;, ExceptionCallback&amp;&amp;) final;
</span><ins>+    ExceptionOr&lt;size_t&gt; getKeyLength(const CryptoAlgorithmParameters&amp;) final;
</ins><span class="cx"> 
</span><span class="cx">     void platformEncrypt(std::unique_ptr&lt;CryptoAlgorithmParameters&gt;&amp;&amp;, Ref&lt;CryptoKey&gt;&amp;&amp;, Vector&lt;uint8_t&gt;&amp;&amp;, VectorCallback&amp;&amp;, ExceptionCallback&amp;&amp;, ScriptExecutionContext&amp;, WorkQueue&amp;);
</span><span class="cx">     void platformDecrypt(std::unique_ptr&lt;CryptoAlgorithmParameters&gt;&amp;&amp;, Ref&lt;CryptoKey&gt;&amp;&amp;, Vector&lt;uint8_t&gt;&amp;&amp;, VectorCallback&amp;&amp;, ExceptionCallback&amp;&amp;, ScriptExecutionContext&amp;, WorkQueue&amp;);
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmAES_KWcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_KW.cpp (213627 => 213628)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_KW.cpp        2017-03-09 05:16:20 UTC (rev 213627)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_KW.cpp        2017-03-09 05:50:31 UTC (rev 213628)
</span><span class="lines">@@ -28,8 +28,8 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(SUBTLE_CRYPTO)
</span><span class="cx"> 
</span><del>-#include &quot;CryptoAlgorithmAesKeyGenParams.h&quot;
</del><span class="cx"> #include &quot;CryptoAlgorithmAesKeyGenParamsDeprecated.h&quot;
</span><ins>+#include &quot;CryptoAlgorithmAesKeyParams.h&quot;
</ins><span class="cx"> #include &quot;CryptoKeyAES.h&quot;
</span><span class="cx"> #include &quot;CryptoKeyDataOctetSequence.h&quot;
</span><span class="cx"> #include &quot;ExceptionCode.h&quot;
</span><span class="lines">@@ -71,7 +71,7 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    auto result = CryptoKeyAES::generate(CryptoAlgorithmIdentifier::AES_KW, downcast&lt;CryptoAlgorithmAesKeyGenParams&gt;(parameters).length, extractable, usages);
</del><ins>+    auto result = CryptoKeyAES::generate(CryptoAlgorithmIdentifier::AES_KW, downcast&lt;CryptoAlgorithmAesKeyParams&gt;(parameters).length, extractable, usages);
</ins><span class="cx">     if (!result) {
</span><span class="cx">         exceptionCallback(OperationError);
</span><span class="cx">         return;
</span><span class="lines">@@ -173,6 +173,11 @@
</span><span class="cx">     platformUnwrapKey(WTFMove(key), WTFMove(data), WTFMove(callback), WTFMove(exceptionCallback));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+ExceptionOr&lt;size_t&gt; CryptoAlgorithmAES_KW::getKeyLength(const CryptoAlgorithmParameters&amp; parameters)
+{
+    return CryptoKeyAES::getKeyLength(parameters);
+}
+
</ins><span class="cx"> ExceptionOr&lt;void&gt; CryptoAlgorithmAES_KW::encryptForWrapKey(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp; key, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback)
</span><span class="cx"> {
</span><span class="cx">     if (!keyAlgorithmMatches(key))
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmAES_KWh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_KW.h (213627 => 213628)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_KW.h        2017-03-09 05:16:20 UTC (rev 213627)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_KW.h        2017-03-09 05:50:31 UTC (rev 213628)
</span><span class="lines">@@ -48,6 +48,7 @@
</span><span class="cx">     void exportKey(SubtleCrypto::KeyFormat, Ref&lt;CryptoKey&gt;&amp;&amp;, KeyDataCallback&amp;&amp;, ExceptionCallback&amp;&amp;) final;
</span><span class="cx">     void wrapKey(Ref&lt;CryptoKey&gt;&amp;&amp;, Vector&lt;uint8_t&gt;&amp;&amp;, VectorCallback&amp;&amp;, ExceptionCallback&amp;&amp;) final;
</span><span class="cx">     void unwrapKey(Ref&lt;CryptoKey&gt;&amp;&amp;, Vector&lt;uint8_t&gt;&amp;&amp;, VectorCallback&amp;&amp;, ExceptionCallback&amp;&amp;) final;
</span><ins>+    ExceptionOr&lt;size_t&gt; getKeyLength(const CryptoAlgorithmParameters&amp;) final;
</ins><span class="cx"> 
</span><span class="cx">     ExceptionOr&lt;void&gt; encryptForWrapKey(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback) final;
</span><span class="cx">     ExceptionOr&lt;void&gt; decryptForUnwrapKey(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback) final;
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmECDHcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmECDH.cpp (213627 => 213628)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmECDH.cpp        2017-03-09 05:16:20 UTC (rev 213627)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmECDH.cpp        2017-03-09 05:50:31 UTC (rev 213628)
</span><span class="lines">@@ -66,7 +66,7 @@
</span><span class="cx">     callback(WTFMove(pair));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmECDH::deriveBits(std::unique_ptr&lt;CryptoAlgorithmParameters&gt;&amp;&amp; parameters, Ref&lt;CryptoKey&gt;&amp;&amp; baseKey, unsigned long length, VectorCallback&amp;&amp; callback, ExceptionCallback&amp;&amp; exceptionCallback, ScriptExecutionContext&amp; context, WorkQueue&amp; workQueue)
</del><ins>+void CryptoAlgorithmECDH::deriveBits(std::unique_ptr&lt;CryptoAlgorithmParameters&gt;&amp;&amp; parameters, Ref&lt;CryptoKey&gt;&amp;&amp; baseKey, size_t length, VectorCallback&amp;&amp; callback, ExceptionCallback&amp;&amp; exceptionCallback, ScriptExecutionContext&amp; context, WorkQueue&amp; workQueue)
</ins><span class="cx"> {
</span><span class="cx">     // We only accept length that is a multiple of 8.
</span><span class="cx">     if (length % 8) {
</span><span class="lines">@@ -97,7 +97,7 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    auto unifiedCallback = [callback = WTFMove(callback), exceptionCallback = WTFMove(exceptionCallback)](std::optional&lt;Vector&lt;uint8_t&gt;&gt;&amp;&amp; derivedKey, unsigned long length) mutable {
</del><ins>+    auto unifiedCallback = [callback = WTFMove(callback), exceptionCallback = WTFMove(exceptionCallback)](std::optional&lt;Vector&lt;uint8_t&gt;&gt;&amp;&amp; derivedKey, size_t length) mutable {
</ins><span class="cx">         if (!derivedKey) {
</span><span class="cx">             exceptionCallback(OperationError);
</span><span class="cx">             return;
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmECDHh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmECDH.h (213627 => 213628)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmECDH.h        2017-03-09 05:16:20 UTC (rev 213627)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmECDH.h        2017-03-09 05:50:31 UTC (rev 213628)
</span><span class="lines">@@ -42,12 +42,12 @@
</span><span class="cx">     CryptoAlgorithmIdentifier identifier() const final;
</span><span class="cx"> 
</span><span class="cx">     void generateKey(const CryptoAlgorithmParameters&amp;, bool extractable, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&amp;&amp;, ExceptionCallback&amp;&amp;, ScriptExecutionContext&amp;) final;
</span><del>-    void deriveBits(std::unique_ptr&lt;CryptoAlgorithmParameters&gt;&amp;&amp;, Ref&lt;CryptoKey&gt;&amp;&amp;, unsigned long length, VectorCallback&amp;&amp;, ExceptionCallback&amp;&amp;, ScriptExecutionContext&amp;, WorkQueue&amp;) final;
</del><ins>+    void deriveBits(std::unique_ptr&lt;CryptoAlgorithmParameters&gt;&amp;&amp;, Ref&lt;CryptoKey&gt;&amp;&amp;, size_t length, VectorCallback&amp;&amp;, ExceptionCallback&amp;&amp;, ScriptExecutionContext&amp;, WorkQueue&amp;) final;
</ins><span class="cx">     void importKey(SubtleCrypto::KeyFormat, KeyData&amp;&amp;, const std::unique_ptr&lt;CryptoAlgorithmParameters&gt;&amp;&amp;, bool extractable, CryptoKeyUsageBitmap, KeyCallback&amp;&amp;, ExceptionCallback&amp;&amp;) final;
</span><span class="cx">     void exportKey(SubtleCrypto::KeyFormat, Ref&lt;CryptoKey&gt;&amp;&amp;, KeyDataCallback&amp;&amp;, ExceptionCallback&amp;&amp;) final;
</span><span class="cx"> 
</span><del>-    using Callback = Function&lt;void(std::optional&lt;Vector&lt;uint8_t&gt;&gt;&amp;&amp;, unsigned long)&gt;;
-    void platformDeriveBits(Ref&lt;CryptoKey&gt;&amp;&amp; baseKey, Ref&lt;CryptoKey&gt;&amp;&amp; publicKey, unsigned long length, Callback&amp;&amp;, ScriptExecutionContext&amp;, WorkQueue&amp;);
</del><ins>+    using Callback = Function&lt;void(std::optional&lt;Vector&lt;uint8_t&gt;&gt;&amp;&amp;, size_t)&gt;;
+    void platformDeriveBits(Ref&lt;CryptoKey&gt;&amp;&amp; baseKey, Ref&lt;CryptoKey&gt;&amp;&amp; publicKey, size_t length, Callback&amp;&amp;, ScriptExecutionContext&amp;, WorkQueue&amp;);
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmHMACcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmHMAC.cpp (213627 => 213628)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmHMAC.cpp        2017-03-09 05:16:20 UTC (rev 213627)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmHMAC.cpp        2017-03-09 05:50:31 UTC (rev 213628)
</span><span class="lines">@@ -197,6 +197,11 @@
</span><span class="cx">     callback(format, WTFMove(result));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+ExceptionOr&lt;size_t&gt; CryptoAlgorithmHMAC::getKeyLength(const CryptoAlgorithmParameters&amp; parameters)
+{
+    return CryptoKeyHMAC::getKeyLength(parameters);
+}
+
</ins><span class="cx"> ExceptionOr&lt;void&gt; CryptoAlgorithmHMAC::sign(const CryptoAlgorithmParametersDeprecated&amp; parameters, const CryptoKey&amp; key, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback)
</span><span class="cx"> {
</span><span class="cx">     auto&amp; hmacParameters = downcast&lt;CryptoAlgorithmHmacParamsDeprecated&gt;(parameters);
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmHMACh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmHMAC.h (213627 => 213628)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmHMAC.h        2017-03-09 05:16:20 UTC (rev 213627)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmHMAC.h        2017-03-09 05:50:31 UTC (rev 213628)
</span><span class="lines">@@ -49,6 +49,7 @@
</span><span class="cx">     void generateKey(const CryptoAlgorithmParameters&amp;, bool extractable, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&amp;&amp;, ExceptionCallback&amp;&amp;, ScriptExecutionContext&amp;) final;
</span><span class="cx">     void importKey(SubtleCrypto::KeyFormat, KeyData&amp;&amp;, const std::unique_ptr&lt;CryptoAlgorithmParameters&gt;&amp;&amp;, bool extractable, CryptoKeyUsageBitmap, KeyCallback&amp;&amp;, ExceptionCallback&amp;&amp;) final;
</span><span class="cx">     void exportKey(SubtleCrypto::KeyFormat, Ref&lt;CryptoKey&gt;&amp;&amp;, KeyDataCallback&amp;&amp;, ExceptionCallback&amp;&amp;) final;
</span><ins>+    ExceptionOr&lt;size_t&gt; getKeyLength(const CryptoAlgorithmParameters&amp;) final;
</ins><span class="cx"> 
</span><span class="cx">     // The following will be deprecated.
</span><span class="cx">     ExceptionOr&lt;void&gt; sign(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback) final;
</span></span></pre></div>
<a id="trunkSourceWebCorecryptokeysCryptoKeyAEScpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/keys/CryptoKeyAES.cpp (213627 => 213628)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/keys/CryptoKeyAES.cpp        2017-03-09 05:16:20 UTC (rev 213627)
+++ trunk/Source/WebCore/crypto/keys/CryptoKeyAES.cpp        2017-03-09 05:50:31 UTC (rev 213628)
</span><span class="lines">@@ -28,8 +28,11 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(SUBTLE_CRYPTO)
</span><span class="cx"> 
</span><ins>+#include &quot;CryptoAlgorithmAesKeyParams.h&quot;
</ins><span class="cx"> #include &quot;CryptoAlgorithmRegistry.h&quot;
</span><span class="cx"> #include &quot;CryptoKeyDataOctetSequence.h&quot;
</span><ins>+#include &quot;ExceptionCode.h&quot;
+#include &quot;ExceptionOr.h&quot;
</ins><span class="cx"> #include &quot;JsonWebKey.h&quot;
</span><span class="cx"> #include &lt;wtf/text/Base64.h&gt;
</span><span class="cx"> #include &lt;wtf/text/WTFString.h&gt;
</span><span class="lines">@@ -114,6 +117,14 @@
</span><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+ExceptionOr&lt;size_t&gt; CryptoKeyAES::getKeyLength(const CryptoAlgorithmParameters&amp; parameters)
+{
+    auto&amp; aesParameters = downcast&lt;CryptoAlgorithmAesKeyParams&gt;(parameters);
+    if (!lengthIsValid(aesParameters.length))
+        return Exception { OperationError };
+    return aesParameters.length;
+}
+
</ins><span class="cx"> std::unique_ptr&lt;KeyAlgorithm&gt; CryptoKeyAES::buildAlgorithm() const
</span><span class="cx"> {
</span><span class="cx">     return std::make_unique&lt;AesKeyAlgorithm&gt;(CryptoAlgorithmRegistry::singleton().name(algorithmIdentifier()), m_key.size() * 8);
</span></span></pre></div>
<a id="trunkSourceWebCorecryptokeysCryptoKeyAESh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/keys/CryptoKeyAES.h (213627 => 213628)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/keys/CryptoKeyAES.h        2017-03-09 05:16:20 UTC (rev 213627)
+++ trunk/Source/WebCore/crypto/keys/CryptoKeyAES.h        2017-03-09 05:50:31 UTC (rev 213628)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;CryptoAlgorithmIdentifier.h&quot;
</span><span class="cx"> #include &quot;CryptoKey.h&quot;
</span><ins>+#include &quot;ExceptionOr.h&quot;
</ins><span class="cx"> #include &lt;wtf/Function.h&gt;
</span><span class="cx"> #include &lt;wtf/Vector.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -34,6 +35,8 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><ins>+class CryptoAlgorithmParameters;
+
</ins><span class="cx"> struct JsonWebKey;
</span><span class="cx"> 
</span><span class="cx"> class AesKeyAlgorithm final : public KeyAlgorithm {
</span><span class="lines">@@ -76,6 +79,8 @@
</span><span class="cx">     const Vector&lt;uint8_t&gt;&amp; key() const { return m_key; }
</span><span class="cx">     JsonWebKey exportJwk() const;
</span><span class="cx"> 
</span><ins>+    static ExceptionOr&lt;size_t&gt; getKeyLength(const CryptoAlgorithmParameters&amp;);
+
</ins><span class="cx"> private:
</span><span class="cx">     CryptoKeyAES(CryptoAlgorithmIdentifier, const Vector&lt;uint8_t&gt;&amp; key, bool extractable, CryptoKeyUsageBitmap);
</span><span class="cx">     CryptoKeyAES(CryptoAlgorithmIdentifier, Vector&lt;uint8_t&gt;&amp;&amp; key, bool extractable, CryptoKeyUsageBitmap);
</span></span></pre></div>
<a id="trunkSourceWebCorecryptokeysCryptoKeyHMACcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/keys/CryptoKeyHMAC.cpp (213627 => 213628)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/keys/CryptoKeyHMAC.cpp        2017-03-09 05:16:20 UTC (rev 213627)
+++ trunk/Source/WebCore/crypto/keys/CryptoKeyHMAC.cpp        2017-03-09 05:50:31 UTC (rev 213628)
</span><span class="lines">@@ -31,6 +31,8 @@
</span><span class="cx"> #include &quot;CryptoAlgorithmHmacKeyParams.h&quot;
</span><span class="cx"> #include &quot;CryptoAlgorithmRegistry.h&quot;
</span><span class="cx"> #include &quot;CryptoKeyDataOctetSequence.h&quot;
</span><ins>+#include &quot;ExceptionCode.h&quot;
+#include &quot;ExceptionOr.h&quot;
</ins><span class="cx"> #include &quot;JsonWebKey.h&quot;
</span><span class="cx"> #include &lt;wtf/text/Base64.h&gt;
</span><span class="cx"> #include &lt;wtf/text/WTFString.h&gt;
</span><span class="lines">@@ -37,6 +39,22 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><ins>+static size_t getKeyLengthFromHash(CryptoAlgorithmIdentifier hash)
+{
+    switch (hash) {
+    case CryptoAlgorithmIdentifier::SHA_1:
+    case CryptoAlgorithmIdentifier::SHA_224:
+    case CryptoAlgorithmIdentifier::SHA_256:
+        return 512;
+    case CryptoAlgorithmIdentifier::SHA_384:
+    case CryptoAlgorithmIdentifier::SHA_512:
+        return 1024;
+    default:
+        ASSERT_NOT_REACHED();
+        return 0;
+    }
+}
+
</ins><span class="cx"> CryptoKeyHMAC::CryptoKeyHMAC(const Vector&lt;uint8_t&gt;&amp; key, CryptoAlgorithmIdentifier hash, bool extractable, CryptoKeyUsageBitmap usage)
</span><span class="cx">     : CryptoKey(CryptoAlgorithmIdentifier::HMAC, CryptoKeyType::Secret, extractable, usage)
</span><span class="cx">     , m_hash(hash)
</span><span class="lines">@@ -58,19 +76,9 @@
</span><span class="cx"> RefPtr&lt;CryptoKeyHMAC&gt; CryptoKeyHMAC::generate(size_t lengthBits, CryptoAlgorithmIdentifier hash, bool extractable, CryptoKeyUsageBitmap usages)
</span><span class="cx"> {
</span><span class="cx">     if (!lengthBits) {
</span><del>-        switch (hash) {
-        case CryptoAlgorithmIdentifier::SHA_1:
-        case CryptoAlgorithmIdentifier::SHA_224:
-        case CryptoAlgorithmIdentifier::SHA_256:
-            lengthBits = 512;
-            break;
-        case CryptoAlgorithmIdentifier::SHA_384:
-        case CryptoAlgorithmIdentifier::SHA_512:
-            lengthBits = 1024;
-            break;
-        default:
</del><ins>+        lengthBits = getKeyLengthFromHash(hash);
+        if (!lengthBits)
</ins><span class="cx">             return nullptr;
</span><del>-        }
</del><span class="cx">     }
</span><span class="cx">     // CommonHMAC only supports key length that is a multiple of 8. Therefore, here we are a little bit different
</span><span class="cx">     // from the spec as of 11 December 2014: https://www.w3.org/TR/WebCryptoAPI/#hmac-operations
</span><span class="lines">@@ -124,6 +132,17 @@
</span><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+ExceptionOr&lt;size_t&gt; CryptoKeyHMAC::getKeyLength(const CryptoAlgorithmParameters&amp; parameters)
+{
+    auto&amp; aesParameters = downcast&lt;CryptoAlgorithmHmacKeyParams&gt;(parameters);
+
+    size_t result = aesParameters.length ? *(aesParameters.length) : getKeyLengthFromHash(aesParameters.hashIdentifier);
+    if (result)
+        return result;
+
+    return Exception { TypeError };
+}
+
</ins><span class="cx"> std::unique_ptr&lt;KeyAlgorithm&gt; CryptoKeyHMAC::buildAlgorithm() const
</span><span class="cx"> {
</span><span class="cx">     return std::make_unique&lt;HmacKeyAlgorithm&gt;(CryptoAlgorithmRegistry::singleton().name(algorithmIdentifier()),
</span></span></pre></div>
<a id="trunkSourceWebCorecryptokeysCryptoKeyHMACh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/keys/CryptoKeyHMAC.h (213627 => 213628)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/keys/CryptoKeyHMAC.h        2017-03-09 05:16:20 UTC (rev 213627)
+++ trunk/Source/WebCore/crypto/keys/CryptoKeyHMAC.h        2017-03-09 05:50:31 UTC (rev 213628)
</span><span class="lines">@@ -28,11 +28,14 @@
</span><span class="cx"> #if ENABLE(SUBTLE_CRYPTO)
</span><span class="cx"> 
</span><span class="cx"> #include &quot;CryptoKey.h&quot;
</span><ins>+#include &quot;ExceptionOr.h&quot;
</ins><span class="cx"> #include &lt;wtf/Function.h&gt;
</span><span class="cx"> #include &lt;wtf/Vector.h&gt;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><ins>+class CryptoAlgorithmParameters;
+
</ins><span class="cx"> struct JsonWebKey;
</span><span class="cx"> 
</span><span class="cx"> class HmacKeyAlgorithm final : public KeyAlgorithm {
</span><span class="lines">@@ -74,6 +77,8 @@
</span><span class="cx"> 
</span><span class="cx">     CryptoAlgorithmIdentifier hashAlgorithmIdentifier() const { return m_hash; }
</span><span class="cx"> 
</span><ins>+    static ExceptionOr&lt;size_t&gt; getKeyLength(const CryptoAlgorithmParameters&amp;);
+
</ins><span class="cx"> private:
</span><span class="cx">     CryptoKeyHMAC(const Vector&lt;uint8_t&gt;&amp; key, CryptoAlgorithmIdentifier hash, bool extractable, CryptoKeyUsageBitmap);
</span><span class="cx">     CryptoKeyHMAC(Vector&lt;uint8_t&gt;&amp;&amp; key, CryptoAlgorithmIdentifier hash, bool extractable, CryptoKeyUsageBitmap);
</span></span></pre></div>
<a id="trunkSourceWebCorecryptomacCryptoAlgorithmECDHMaccpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/mac/CryptoAlgorithmECDHMac.cpp (213627 => 213628)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/mac/CryptoAlgorithmECDHMac.cpp        2017-03-09 05:16:20 UTC (rev 213627)
+++ trunk/Source/WebCore/crypto/mac/CryptoAlgorithmECDHMac.cpp        2017-03-09 05:50:31 UTC (rev 213628)
</span><span class="lines">@@ -34,7 +34,7 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmECDH::platformDeriveBits(Ref&lt;CryptoKey&gt;&amp;&amp; baseKey, Ref&lt;CryptoKey&gt;&amp;&amp; publicKey, unsigned long length, Callback&amp;&amp; callback, ScriptExecutionContext&amp; context, WorkQueue&amp; workQueue)
</del><ins>+void CryptoAlgorithmECDH::platformDeriveBits(Ref&lt;CryptoKey&gt;&amp;&amp; baseKey, Ref&lt;CryptoKey&gt;&amp;&amp; publicKey, size_t length, Callback&amp;&amp; callback, ScriptExecutionContext&amp; context, WorkQueue&amp; workQueue)
</ins><span class="cx"> {
</span><span class="cx">     context.ref();
</span><span class="cx">     workQueue.dispatch([baseKey = WTFMove(baseKey), publicKey = WTFMove(publicKey), length, callback = WTFMove(callback), &amp;context]() mutable {
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoparametersAesKeyGenParamsidl"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/crypto/parameters/AesKeyGenParams.idl (213627 => 213628)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/parameters/AesKeyGenParams.idl        2017-03-09 05:16:20 UTC (rev 213627)
+++ trunk/Source/WebCore/crypto/parameters/AesKeyGenParams.idl        2017-03-09 05:50:31 UTC (rev 213628)
</span><span class="lines">@@ -1,32 +0,0 @@
</span><del>-/*
- * Copyright (C) 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.
- */
-
-[
-    Conditional=SUBTLE_CRYPTO,
-    ImplementedAs=CryptoAlgorithmAesKeyGenParams
-] dictionary AesKeyGenParams : CryptoAlgorithmParameters {
-    // The length, in bits, of the key.
-    [EnforceRange] required unsigned short length;
-};
</del></span></pre></div>
<a id="trunkSourceWebCorecryptoparametersAesKeyParamsidlfromrev213627trunkSourceWebCorecryptoparametersAesKeyGenParamsidl"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/crypto/parameters/AesKeyParams.idl (from rev 213627, trunk/Source/WebCore/crypto/parameters/AesKeyGenParams.idl) (0 => 213628)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/parameters/AesKeyParams.idl                                (rev 0)
+++ trunk/Source/WebCore/crypto/parameters/AesKeyParams.idl        2017-03-09 05:50:31 UTC (rev 213628)
</span><span class="lines">@@ -0,0 +1,35 @@
</span><ins>+/*
+ * Copyright (C) 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.
+ */
+
+// This is a unified dictionary for AesDerivedKeyParams and AesKeyGenParams.
+// https://www.w3.org/TR/WebCryptoAPI/#aes-derivedkey-params, and
+// https://www.w3.org/TR/WebCryptoAPI/#aes-keygen-params
+[
+    Conditional=SUBTLE_CRYPTO,
+    ImplementedAs=CryptoAlgorithmAesKeyParams
+] dictionary AesKeyParams : CryptoAlgorithmParameters {
+    // The length, in bits, of the key.
+    [EnforceRange] required unsigned short length;
+};
</ins></span></pre></div>
<a id="trunkSourceWebCorecryptoparametersCryptoAlgorithmAesKeyGenParamsh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/crypto/parameters/CryptoAlgorithmAesKeyGenParams.h (213627 => 213628)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/parameters/CryptoAlgorithmAesKeyGenParams.h        2017-03-09 05:16:20 UTC (rev 213627)
+++ trunk/Source/WebCore/crypto/parameters/CryptoAlgorithmAesKeyGenParams.h        2017-03-09 05:50:31 UTC (rev 213628)
</span><span class="lines">@@ -1,45 +0,0 @@
</span><del>-/*
- * Copyright (C) 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.
- */
-
-#pragma once
-
-#include &quot;CryptoAlgorithmParameters.h&quot;
-
-#if ENABLE(SUBTLE_CRYPTO)
-
-namespace WebCore {
-
-class CryptoAlgorithmAesKeyGenParams final : public CryptoAlgorithmParameters {
-public:
-    unsigned short length;
-
-    Class parametersClass() const final { return Class::AesKeyGenParams; }
-};
-
-} // namespace WebCore
-
-SPECIALIZE_TYPE_TRAITS_CRYPTO_ALGORITHM_PARAMETERS(AesKeyGenParams)
-
-#endif // ENABLE(SUBTLE_CRYPTO)
</del></span></pre></div>
<a id="trunkSourceWebCorecryptoparametersCryptoAlgorithmAesKeyParamshfromrev213627trunkSourceWebCorecryptoparametersCryptoAlgorithmAesKeyGenParamsh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/crypto/parameters/CryptoAlgorithmAesKeyParams.h (from rev 213627, trunk/Source/WebCore/crypto/parameters/CryptoAlgorithmAesKeyGenParams.h) (0 => 213628)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/parameters/CryptoAlgorithmAesKeyParams.h                                (rev 0)
+++ trunk/Source/WebCore/crypto/parameters/CryptoAlgorithmAesKeyParams.h        2017-03-09 05:50:31 UTC (rev 213628)
</span><span class="lines">@@ -0,0 +1,45 @@
</span><ins>+/*
+ * Copyright (C) 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.
+ */
+
+#pragma once
+
+#include &quot;CryptoAlgorithmParameters.h&quot;
+
+#if ENABLE(SUBTLE_CRYPTO)
+
+namespace WebCore {
+
+class CryptoAlgorithmAesKeyParams final : public CryptoAlgorithmParameters {
+public:
+    unsigned short length;
+
+    Class parametersClass() const final { return Class::AesKeyParams; }
+};
+
+} // namespace WebCore
+
+SPECIALIZE_TYPE_TRAITS_CRYPTO_ALGORITHM_PARAMETERS(AesKeyParams)
+
+#endif // ENABLE(SUBTLE_CRYPTO)
</ins></span></pre></div>
<a id="trunkSourceWebCorecryptoparametersCryptoAlgorithmHmacKeyParamsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/parameters/CryptoAlgorithmHmacKeyParams.h (213627 => 213628)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/parameters/CryptoAlgorithmHmacKeyParams.h        2017-03-09 05:16:20 UTC (rev 213627)
+++ trunk/Source/WebCore/crypto/parameters/CryptoAlgorithmHmacKeyParams.h        2017-03-09 05:50:31 UTC (rev 213628)
</span><span class="lines">@@ -37,7 +37,7 @@
</span><span class="cx">     // FIXME: Consider merging hash and hashIdentifier.
</span><span class="cx">     JSC::JSValue hash;
</span><span class="cx">     CryptoAlgorithmIdentifier hashIdentifier;
</span><del>-    std::optional&lt;unsigned long&gt; length;
</del><ins>+    std::optional&lt;size_t&gt; length;
</ins><span class="cx"> 
</span><span class="cx">     Class parametersClass() const final { return Class::HmacKeyParams; }
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoparametersCryptoAlgorithmRsaKeyGenParamsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/parameters/CryptoAlgorithmRsaKeyGenParams.h (213627 => 213628)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/parameters/CryptoAlgorithmRsaKeyGenParams.h        2017-03-09 05:16:20 UTC (rev 213627)
+++ trunk/Source/WebCore/crypto/parameters/CryptoAlgorithmRsaKeyGenParams.h        2017-03-09 05:50:31 UTC (rev 213628)
</span><span class="lines">@@ -35,7 +35,7 @@
</span><span class="cx"> 
</span><span class="cx"> class CryptoAlgorithmRsaKeyGenParams : public CryptoAlgorithmParameters {
</span><span class="cx"> public:
</span><del>-    unsigned long modulusLength;
</del><ins>+    size_t modulusLength;
</ins><span class="cx">     RefPtr&lt;Uint8Array&gt; publicExponent;
</span><span class="cx"> 
</span><span class="cx">     Class parametersClass() const override { return Class::RsaKeyGenParams; }
</span></span></pre>
</div>
</div>

</body>
</html>