<!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>[208669] trunk/Source/WebCore</title>
</head>
<body>

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

<h3>Log Message</h3>
<pre>Move crypto code from ExceptionCode to ExceptionOr
https://bugs.webkit.org/show_bug.cgi?id=164698

Reviewed by Sam Weinig.

* bindings/js/JSCryptoAlgorithmDictionary.cpp:
(WebCore::JSCryptoAlgorithmDictionary::getAlgorithmIdentifier):
Use the new identifier function instead of getIdentifierForName.
* bindings/js/JSSubtleCryptoCustom.cpp:
(WebCore::normalizeCryptoAlgorithmParameters): Ditto.
(WebCore::toCryptoKeyUsageBitmap): Removed a stray meaningless const.
(WebCore::jsSubtleCryptoFunctionGenerateKeyPromise): Pass
ScriptExecutionContext as a reference instead of a pointer.

* bindings/js/JSWebKitSubtleCryptoCustom.cpp:
(WebCore::createAlgorithmFromJSValue): Use the more efficient version
of setDOMException that uses scope.
(WebCore::JSWebKitSubtleCrypto::encrypt): Ditto. Also updated to use
ExceptionOr instead of ExceptionCode.
(WebCore::JSWebKitSubtleCrypto::decrypt): Ditto.
(WebCore::JSWebKitSubtleCrypto::sign): Ditto.
(WebCore::JSWebKitSubtleCrypto::verify): Ditto.
(WebCore::JSWebKitSubtleCrypto::digest): Ditto.
(WebCore::JSWebKitSubtleCrypto::generateKey): Ditto.
(WebCore::importKey): Ditto.
(WebCore::JSWebKitSubtleCrypto::wrapKey): Ditto.
(WebCore::JSWebKitSubtleCrypto::unwrapKey): Ditto.

* crypto/CryptoAlgorithm.cpp:
(WebCore::CryptoAlgorithm::CryptoAlgorithm): Deleted.
(WebCore::CryptoAlgorithm::~CryptoAlgorithm): Deleted.
(WebCore::CryptoAlgorithm::generateKey): Use ExceptionOr.
(WebCore::CryptoAlgorithm::encrypt): Ditto.
(WebCore::CryptoAlgorithm::decrypt): Ditto.
(WebCore::CryptoAlgorithm::sign): Ditto.
(WebCore::CryptoAlgorithm::verify): Ditto.
(WebCore::CryptoAlgorithm::digest): Ditto.
(WebCore::CryptoAlgorithm::deriveKey): Ditto.
(WebCore::CryptoAlgorithm::deriveBits): Ditto.
(WebCore::CryptoAlgorithm::importKey): Ditto.
(WebCore::CryptoAlgorithm::encryptForWrapKey): Ditto.
(WebCore::CryptoAlgorithm::decryptForUnwrapKey): Ditto.
* crypto/CryptoAlgorithm.h: Use ExceptionOr.
Moved the destructor into the header since it's more efficient for
derived classes to have it inlined. Removed the protected constructor
because since there are pure virtual functions in the class, there is
no risk of anyone misusing the public constructor.

* crypto/CryptoAlgorithmRegistry.cpp:
(WebCore::CryptoAlgorithmRegistry::identifier): Renamed from
getIdentifierForName and changed to use an Optional rather than
using a boolean plus an out argument.
(WebCore::CryptoAlgorithmRegistry::name): Renamed to name from
nameForIdentifier. Also updated to share a single map containing
both names and constructors.
(WebCore::CryptoAlgorithmRegistry::create): Share single map as above.
(WebCore::CryptoAlgorithmRegistry::registerAlgorithm): Updated assertions
to a mroe straightforward style. Share single map for names and constructors.
* crypto/CryptoAlgorithmRegistry.h: Updated for above.

* crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
(WebCore::CryptoAlgorithmAES_CBC::CryptoAlgorithmAES_CBC): Deleted.
(WebCore::CryptoAlgorithmAES_CBC::~CryptoAlgorithmAES_CBC): Deleted.
(WebCore::CryptoAlgorithmAES_CBC::keyAlgorithmMatches): Use references, ExceptionOr.
(WebCore::CryptoAlgorithmAES_CBC::generateKey): Ditto.
(WebCore::CryptoAlgorithmAES_CBC::encrypt): Ditto.
(WebCore::CryptoAlgorithmAES_CBC::decrypt): Ditto.
(WebCore::CryptoAlgorithmAES_CBC::importKey): Ditto.
* crypto/algorithms/CryptoAlgorithmAES_CBC.h: Updated for above.
Also use constexpr for s_name and s_identifier.

* crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
(WebCore::CryptoAlgorithmAES_KW::CryptoAlgorithmAES_KW): Deleted.
(WebCore::CryptoAlgorithmAES_KW::~CryptoAlgorithmAES_KW): Deleted.
(WebCore::CryptoAlgorithmAES_KW::keyAlgorithmMatches): Use references, ExceptionOr.
(WebCore::CryptoAlgorithmAES_KW::generateKey): Ditto.
(WebCore::CryptoAlgorithmAES_KW::importKey): Ditto.
(WebCore::CryptoAlgorithmAES_KW::encryptForWrapKey): Ditto.
(WebCore::CryptoAlgorithmAES_KW::decryptForUnwrapKey): Ditto.
* crypto/algorithms/CryptoAlgorithmAES_KW.h: Updated for above.
Also use constexpr for s_name and s_identifier.

* crypto/algorithms/CryptoAlgorithmHMAC.cpp:
(WebCore::CryptoAlgorithmHMAC::CryptoAlgorithmHMAC): Deleted.
(WebCore::CryptoAlgorithmHMAC::~CryptoAlgorithmHMAC): Deleted.
(WebCore::CryptoAlgorithmHMAC::generateKey): Use references, ExceptionOr.
(WebCore::CryptoAlgorithmHMAC::sign): Ditto.
(WebCore::CryptoAlgorithmHMAC::verify): Ditto.
(WebCore::CryptoAlgorithmHMAC::importKey): Ditto.
* crypto/algorithms/CryptoAlgorithmHMAC.h: Updated for above.
Also use constexpr for s_name and s_identifier.

* crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
(WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::CryptoAlgorithmRSAES_PKCS1_v1_5): Deleted.
(WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::~CryptoAlgorithmRSAES_PKCS1_v1_5): Deleted.
(WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::generateKey): Use references, ExceptionOr.
(WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::encrypt): Ditto.
(WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::decrypt): Ditto.
(WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::importKey): Ditto.
* crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h: Updated for above.
Also use constexpr for s_name and s_identifier.

* crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
(WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::CryptoAlgorithmRSASSA_PKCS1_v1_5): Deleted.
(WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::~CryptoAlgorithmRSASSA_PKCS1_v1_5): Deleted.
(WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::generateKey): Use references, ExceptionOr.
(WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::sign): Ditto.
(WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::verify): Ditto.
(WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey): Ditto.
* crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h: Updated for above.
Also use constexpr for s_name and s_identifier.

* crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
(WebCore::CryptoAlgorithmRSA_OAEP::CryptoAlgorithmRSA_OAEP): Deleted.
(WebCore::CryptoAlgorithmRSA_OAEP::~CryptoAlgorithmRSA_OAEP): Deleted.
(WebCore::CryptoAlgorithmRSA_OAEP::generateKey): Use references, ExceptionOr.
(WebCore::CryptoAlgorithmRSA_OAEP::encrypt): Ditto.
(WebCore::CryptoAlgorithmRSA_OAEP::decrypt): Ditto.
(WebCore::CryptoAlgorithmRSA_OAEP::importKey): Ditto.
* crypto/algorithms/CryptoAlgorithmRSA_OAEP.h: Updated for above.
Also use constexpr for s_name and s_identifier.

* crypto/algorithms/CryptoAlgorithmSHA1.cpp:
(WebCore::CryptoAlgorithmSHA1::CryptoAlgorithmSHA1): Deleted.
(WebCore::CryptoAlgorithmSHA1::~CryptoAlgorithmSHA1): Deleted.
(WebCore::CryptoAlgorithmSHA1::digest): Use ExceptionOr.
* crypto/algorithms/CryptoAlgorithmSHA1.h: Updated for above.
Also use constexpr for s_name and s_identifier.

* crypto/algorithms/CryptoAlgorithmSHA224.cpp:
(WebCore::CryptoAlgorithmSHA224::CryptoAlgorithmSHA224): Deleted.
(WebCore::CryptoAlgorithmSHA224::~CryptoAlgorithmSHA224): Deleted.
(WebCore::CryptoAlgorithmSHA224::digest): Use ExceptionOr.
* crypto/algorithms/CryptoAlgorithmSHA224.h: Updated for above.
Also use constexpr for s_name and s_identifier.

* crypto/algorithms/CryptoAlgorithmSHA256.cpp:
(WebCore::CryptoAlgorithmSHA256::CryptoAlgorithmSHA256): Deleted.
(WebCore::CryptoAlgorithmSHA256::~CryptoAlgorithmSHA256): Deleted.
(WebCore::CryptoAlgorithmSHA256::digest): Use ExceptionOr.
* crypto/algorithms/CryptoAlgorithmSHA256.h: Updated for above.
Also use constexpr for s_name and s_identifier.

* crypto/algorithms/CryptoAlgorithmSHA384.cpp:
(WebCore::CryptoAlgorithmSHA384::CryptoAlgorithmSHA384): Deleted.
(WebCore::CryptoAlgorithmSHA384::~CryptoAlgorithmSHA384): Deleted.
(WebCore::CryptoAlgorithmSHA384::digest): Use ExceptionOr.
* crypto/algorithms/CryptoAlgorithmSHA384.h: Updated for above.
Also use constexpr for s_name and s_identifier.

* crypto/algorithms/CryptoAlgorithmSHA512.cpp:
(WebCore::CryptoAlgorithmSHA512::CryptoAlgorithmSHA512): Deleted.
(WebCore::CryptoAlgorithmSHA512::~CryptoAlgorithmSHA512): Deleted.
(WebCore::CryptoAlgorithmSHA512::digest): Use ExceptionOr.
* crypto/algorithms/CryptoAlgorithmSHA512.h: Updated for above.
Also use constexpr for s_name and s_identifier.

* crypto/gcrypt/CryptoAlgorithmHMACGCrypt.cpp:
(WebCore::calculateSignature): Use Optional instead of a boolean
return value and an out argument.
(WebCore::CryptoAlgorithmHMAC::platformSign): Use ExceptionOr.
(WebCore::CryptoAlgorithmHMAC::platformVerify): Ditto.
* crypto/gnutls/CryptoAlgorithmAES_CBCGnuTLS.cpp:
(WebCore::CryptoAlgorithmAES_CBC::platformEncrypt): Ditto.
(WebCore::CryptoAlgorithmAES_CBC::platformDecrypt): Ditto.
* crypto/gnutls/CryptoAlgorithmAES_KWGnuTLS.cpp:
(WebCore::CryptoAlgorithmAES_KW::platformEncrypt): Ditto.
(WebCore::CryptoAlgorithmAES_KW::platformDecrypt): Ditto.
* crypto/gnutls/CryptoAlgorithmHMACGnuTLS.cpp:
(WebCore::CryptoAlgorithmHMAC::platformSign): Ditto.
(WebCore::CryptoAlgorithmHMAC::platformVerify): Ditto.
* crypto/gnutls/CryptoAlgorithmRSAES_PKCS1_v1_5GnuTLS.cpp:
(WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformEncrypt): Ditto.
(WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformDecrypt): Ditto.
* crypto/gnutls/CryptoAlgorithmRSASSA_PKCS1_v1_5GnuTLS.cpp:
(WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign): Ditto.
(WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformVerify): Ditto.
* crypto/gnutls/CryptoAlgorithmRSA_OAEPGnuTLS.cpp:
(WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt): Ditto.
(WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt): Ditto.

* crypto/keys/CryptoKeyAES.cpp:
(WebCore::CryptoKeyAES::buildAlgorithm): Updated to use name instead
of nameForIdentifier.
* crypto/keys/CryptoKeyHMAC.cpp: Ditto.
(WebCore::CryptoKeyHMAC::buildAlgorithm):

* crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:
(WebCore::CryptoAlgorithmAES_CBC::platformEncrypt): Use ExceptionOr.
(WebCore::CryptoAlgorithmAES_CBC::platformDecrypt): Ditto.
* crypto/mac/CryptoAlgorithmAES_KWMac.cpp:
(WebCore::CryptoAlgorithmAES_KW::platformEncrypt): Ditto.
(WebCore::CryptoAlgorithmAES_KW::platformDecrypt): Ditto.
* crypto/mac/CryptoAlgorithmHMACMac.cpp:
(WebCore::commonCryptoHMACAlgorithm): Renamed from
getCommonCryptoHMACAlgorithm and changed to use Optional instead of
a boolean return value and an out argument.
(WebCore::CryptoAlgorithmHMAC::platformSign): Use ExceptionOr.
(WebCore::CryptoAlgorithmHMAC::platformVerify): Ditto.
* crypto/mac/CryptoAlgorithmRSAES_PKCS1_v1_5Mac.cpp:
(WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformEncrypt): Ditto.
(WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformDecrypt): Ditto.
* crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp:
(WebCore::cryptoDigestAlgorithm): Renamed from
getCryptoDigestAlgorithm and changed to use Optional instead of
a boolean return value and an out argument.
(WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign): Use ExceptionOr.
(WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformVerify): Ditto.
* crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp:
(WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt): Ditto.
(WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt): Ditto.

* crypto/mac/CryptoKeyRSAMac.cpp:
(WebCore::CryptoKeyRSA::buildAlgorithm): Updated to use name instead
of nameForIdentifier.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSCryptoAlgorithmDictionarycpp">trunk/Source/WebCore/bindings/js/JSCryptoAlgorithmDictionary.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSSubtleCryptoCustomcpp">trunk/Source/WebCore/bindings/js/JSSubtleCryptoCustom.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSWebKitSubtleCryptoCustomcpp">trunk/Source/WebCore/bindings/js/JSWebKitSubtleCryptoCustom.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="#trunkSourceWebCorecryptoCryptoAlgorithmRegistrycpp">trunk/Source/WebCore/crypto/CryptoAlgorithmRegistry.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptoCryptoAlgorithmRegistryh">trunk/Source/WebCore/crypto/CryptoAlgorithmRegistry.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_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="#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="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmRSAES_PKCS1_v1_5cpp">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmRSAES_PKCS1_v1_5h">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmRSASSA_PKCS1_v1_5cpp">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmRSASSA_PKCS1_v1_5h">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmRSA_OAEPcpp">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmRSA_OAEPh">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSA_OAEP.h</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmSHA1cpp">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA1.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmSHA1h">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA1.h</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmSHA224cpp">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA224.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmSHA224h">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA224.h</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmSHA256cpp">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA256.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmSHA256h">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA256.h</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmSHA384cpp">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA384.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmSHA384h">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA384.h</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmSHA512cpp">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA512.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmSHA512h">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA512.h</a></li>
<li><a href="#trunkSourceWebCorecryptogcryptCryptoAlgorithmHMACGCryptcpp">trunk/Source/WebCore/crypto/gcrypt/CryptoAlgorithmHMACGCrypt.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptognutlsCryptoAlgorithmAES_CBCGnuTLScpp">trunk/Source/WebCore/crypto/gnutls/CryptoAlgorithmAES_CBCGnuTLS.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptognutlsCryptoAlgorithmAES_KWGnuTLScpp">trunk/Source/WebCore/crypto/gnutls/CryptoAlgorithmAES_KWGnuTLS.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptognutlsCryptoAlgorithmHMACGnuTLScpp">trunk/Source/WebCore/crypto/gnutls/CryptoAlgorithmHMACGnuTLS.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptognutlsCryptoAlgorithmRSAES_PKCS1_v1_5GnuTLScpp">trunk/Source/WebCore/crypto/gnutls/CryptoAlgorithmRSAES_PKCS1_v1_5GnuTLS.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptognutlsCryptoAlgorithmRSASSA_PKCS1_v1_5GnuTLScpp">trunk/Source/WebCore/crypto/gnutls/CryptoAlgorithmRSASSA_PKCS1_v1_5GnuTLS.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptognutlsCryptoAlgorithmRSA_OAEPGnuTLScpp">trunk/Source/WebCore/crypto/gnutls/CryptoAlgorithmRSA_OAEPGnuTLS.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptokeysCryptoKeyAEScpp">trunk/Source/WebCore/crypto/keys/CryptoKeyAES.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptokeysCryptoKeyHMACcpp">trunk/Source/WebCore/crypto/keys/CryptoKeyHMAC.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptomacCryptoAlgorithmAES_CBCMaccpp">trunk/Source/WebCore/crypto/mac/CryptoAlgorithmAES_CBCMac.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptomacCryptoAlgorithmAES_KWMaccpp">trunk/Source/WebCore/crypto/mac/CryptoAlgorithmAES_KWMac.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptomacCryptoAlgorithmHMACMaccpp">trunk/Source/WebCore/crypto/mac/CryptoAlgorithmHMACMac.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptomacCryptoAlgorithmRSAES_PKCS1_v1_5Maccpp">trunk/Source/WebCore/crypto/mac/CryptoAlgorithmRSAES_PKCS1_v1_5Mac.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptomacCryptoAlgorithmRSASSA_PKCS1_v1_5Maccpp">trunk/Source/WebCore/crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptomacCryptoAlgorithmRSA_OAEPMaccpp">trunk/Source/WebCore/crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptomacCryptoKeyRSAMaccpp">trunk/Source/WebCore/crypto/mac/CryptoKeyRSAMac.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (208668 => 208669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-11-13 10:05:43 UTC (rev 208668)
+++ trunk/Source/WebCore/ChangeLog        2016-11-13 18:31:14 UTC (rev 208669)
</span><span class="lines">@@ -1,3 +1,221 @@
</span><ins>+2016-11-13  Darin Adler  &lt;darin@apple.com&gt;
+
+        Move crypto code from ExceptionCode to ExceptionOr
+        https://bugs.webkit.org/show_bug.cgi?id=164698
+
+        Reviewed by Sam Weinig.
+
+        * bindings/js/JSCryptoAlgorithmDictionary.cpp:
+        (WebCore::JSCryptoAlgorithmDictionary::getAlgorithmIdentifier):
+        Use the new identifier function instead of getIdentifierForName.
+        * bindings/js/JSSubtleCryptoCustom.cpp:
+        (WebCore::normalizeCryptoAlgorithmParameters): Ditto.
+        (WebCore::toCryptoKeyUsageBitmap): Removed a stray meaningless const.
+        (WebCore::jsSubtleCryptoFunctionGenerateKeyPromise): Pass
+        ScriptExecutionContext as a reference instead of a pointer.
+
+        * bindings/js/JSWebKitSubtleCryptoCustom.cpp:
+        (WebCore::createAlgorithmFromJSValue): Use the more efficient version
+        of setDOMException that uses scope.
+        (WebCore::JSWebKitSubtleCrypto::encrypt): Ditto. Also updated to use
+        ExceptionOr instead of ExceptionCode.
+        (WebCore::JSWebKitSubtleCrypto::decrypt): Ditto.
+        (WebCore::JSWebKitSubtleCrypto::sign): Ditto.
+        (WebCore::JSWebKitSubtleCrypto::verify): Ditto.
+        (WebCore::JSWebKitSubtleCrypto::digest): Ditto.
+        (WebCore::JSWebKitSubtleCrypto::generateKey): Ditto.
+        (WebCore::importKey): Ditto.
+        (WebCore::JSWebKitSubtleCrypto::wrapKey): Ditto.
+        (WebCore::JSWebKitSubtleCrypto::unwrapKey): Ditto.
+
+        * crypto/CryptoAlgorithm.cpp:
+        (WebCore::CryptoAlgorithm::CryptoAlgorithm): Deleted.
+        (WebCore::CryptoAlgorithm::~CryptoAlgorithm): Deleted.
+        (WebCore::CryptoAlgorithm::generateKey): Use ExceptionOr.
+        (WebCore::CryptoAlgorithm::encrypt): Ditto.
+        (WebCore::CryptoAlgorithm::decrypt): Ditto.
+        (WebCore::CryptoAlgorithm::sign): Ditto.
+        (WebCore::CryptoAlgorithm::verify): Ditto.
+        (WebCore::CryptoAlgorithm::digest): Ditto.
+        (WebCore::CryptoAlgorithm::deriveKey): Ditto.
+        (WebCore::CryptoAlgorithm::deriveBits): Ditto.
+        (WebCore::CryptoAlgorithm::importKey): Ditto.
+        (WebCore::CryptoAlgorithm::encryptForWrapKey): Ditto.
+        (WebCore::CryptoAlgorithm::decryptForUnwrapKey): Ditto.
+        * crypto/CryptoAlgorithm.h: Use ExceptionOr.
+        Moved the destructor into the header since it's more efficient for
+        derived classes to have it inlined. Removed the protected constructor
+        because since there are pure virtual functions in the class, there is
+        no risk of anyone misusing the public constructor.
+
+        * crypto/CryptoAlgorithmRegistry.cpp:
+        (WebCore::CryptoAlgorithmRegistry::identifier): Renamed from
+        getIdentifierForName and changed to use an Optional rather than
+        using a boolean plus an out argument.
+        (WebCore::CryptoAlgorithmRegistry::name): Renamed to name from
+        nameForIdentifier. Also updated to share a single map containing
+        both names and constructors.
+        (WebCore::CryptoAlgorithmRegistry::create): Share single map as above.
+        (WebCore::CryptoAlgorithmRegistry::registerAlgorithm): Updated assertions
+        to a mroe straightforward style. Share single map for names and constructors.
+        * crypto/CryptoAlgorithmRegistry.h: Updated for above.
+
+        * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
+        (WebCore::CryptoAlgorithmAES_CBC::CryptoAlgorithmAES_CBC): Deleted.
+        (WebCore::CryptoAlgorithmAES_CBC::~CryptoAlgorithmAES_CBC): Deleted.
+        (WebCore::CryptoAlgorithmAES_CBC::keyAlgorithmMatches): Use references, ExceptionOr.
+        (WebCore::CryptoAlgorithmAES_CBC::generateKey): Ditto.
+        (WebCore::CryptoAlgorithmAES_CBC::encrypt): Ditto.
+        (WebCore::CryptoAlgorithmAES_CBC::decrypt): Ditto.
+        (WebCore::CryptoAlgorithmAES_CBC::importKey): Ditto.
+        * crypto/algorithms/CryptoAlgorithmAES_CBC.h: Updated for above.
+        Also use constexpr for s_name and s_identifier.
+
+        * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
+        (WebCore::CryptoAlgorithmAES_KW::CryptoAlgorithmAES_KW): Deleted.
+        (WebCore::CryptoAlgorithmAES_KW::~CryptoAlgorithmAES_KW): Deleted.
+        (WebCore::CryptoAlgorithmAES_KW::keyAlgorithmMatches): Use references, ExceptionOr.
+        (WebCore::CryptoAlgorithmAES_KW::generateKey): Ditto.
+        (WebCore::CryptoAlgorithmAES_KW::importKey): Ditto.
+        (WebCore::CryptoAlgorithmAES_KW::encryptForWrapKey): Ditto.
+        (WebCore::CryptoAlgorithmAES_KW::decryptForUnwrapKey): Ditto.
+        * crypto/algorithms/CryptoAlgorithmAES_KW.h: Updated for above.
+        Also use constexpr for s_name and s_identifier.
+
+        * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
+        (WebCore::CryptoAlgorithmHMAC::CryptoAlgorithmHMAC): Deleted.
+        (WebCore::CryptoAlgorithmHMAC::~CryptoAlgorithmHMAC): Deleted.
+        (WebCore::CryptoAlgorithmHMAC::generateKey): Use references, ExceptionOr.
+        (WebCore::CryptoAlgorithmHMAC::sign): Ditto.
+        (WebCore::CryptoAlgorithmHMAC::verify): Ditto.
+        (WebCore::CryptoAlgorithmHMAC::importKey): Ditto.
+        * crypto/algorithms/CryptoAlgorithmHMAC.h: Updated for above.
+        Also use constexpr for s_name and s_identifier.
+
+        * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
+        (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::CryptoAlgorithmRSAES_PKCS1_v1_5): Deleted.
+        (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::~CryptoAlgorithmRSAES_PKCS1_v1_5): Deleted.
+        (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::generateKey): Use references, ExceptionOr.
+        (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::encrypt): Ditto.
+        (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::decrypt): Ditto.
+        (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::importKey): Ditto.
+        * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h: Updated for above.
+        Also use constexpr for s_name and s_identifier.
+
+        * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
+        (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::CryptoAlgorithmRSASSA_PKCS1_v1_5): Deleted.
+        (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::~CryptoAlgorithmRSASSA_PKCS1_v1_5): Deleted.
+        (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::generateKey): Use references, ExceptionOr.
+        (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::sign): Ditto.
+        (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::verify): Ditto.
+        (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey): Ditto.
+        * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h: Updated for above.
+        Also use constexpr for s_name and s_identifier.
+
+        * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
+        (WebCore::CryptoAlgorithmRSA_OAEP::CryptoAlgorithmRSA_OAEP): Deleted.
+        (WebCore::CryptoAlgorithmRSA_OAEP::~CryptoAlgorithmRSA_OAEP): Deleted.
+        (WebCore::CryptoAlgorithmRSA_OAEP::generateKey): Use references, ExceptionOr.
+        (WebCore::CryptoAlgorithmRSA_OAEP::encrypt): Ditto.
+        (WebCore::CryptoAlgorithmRSA_OAEP::decrypt): Ditto.
+        (WebCore::CryptoAlgorithmRSA_OAEP::importKey): Ditto.
+        * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h: Updated for above.
+        Also use constexpr for s_name and s_identifier.
+
+        * crypto/algorithms/CryptoAlgorithmSHA1.cpp:
+        (WebCore::CryptoAlgorithmSHA1::CryptoAlgorithmSHA1): Deleted.
+        (WebCore::CryptoAlgorithmSHA1::~CryptoAlgorithmSHA1): Deleted.
+        (WebCore::CryptoAlgorithmSHA1::digest): Use ExceptionOr.
+        * crypto/algorithms/CryptoAlgorithmSHA1.h: Updated for above.
+        Also use constexpr for s_name and s_identifier.
+
+        * crypto/algorithms/CryptoAlgorithmSHA224.cpp:
+        (WebCore::CryptoAlgorithmSHA224::CryptoAlgorithmSHA224): Deleted.
+        (WebCore::CryptoAlgorithmSHA224::~CryptoAlgorithmSHA224): Deleted.
+        (WebCore::CryptoAlgorithmSHA224::digest): Use ExceptionOr.
+        * crypto/algorithms/CryptoAlgorithmSHA224.h: Updated for above.
+        Also use constexpr for s_name and s_identifier.
+
+        * crypto/algorithms/CryptoAlgorithmSHA256.cpp:
+        (WebCore::CryptoAlgorithmSHA256::CryptoAlgorithmSHA256): Deleted.
+        (WebCore::CryptoAlgorithmSHA256::~CryptoAlgorithmSHA256): Deleted.
+        (WebCore::CryptoAlgorithmSHA256::digest): Use ExceptionOr.
+        * crypto/algorithms/CryptoAlgorithmSHA256.h: Updated for above.
+        Also use constexpr for s_name and s_identifier.
+
+        * crypto/algorithms/CryptoAlgorithmSHA384.cpp:
+        (WebCore::CryptoAlgorithmSHA384::CryptoAlgorithmSHA384): Deleted.
+        (WebCore::CryptoAlgorithmSHA384::~CryptoAlgorithmSHA384): Deleted.
+        (WebCore::CryptoAlgorithmSHA384::digest): Use ExceptionOr.
+        * crypto/algorithms/CryptoAlgorithmSHA384.h: Updated for above.
+        Also use constexpr for s_name and s_identifier.
+
+        * crypto/algorithms/CryptoAlgorithmSHA512.cpp:
+        (WebCore::CryptoAlgorithmSHA512::CryptoAlgorithmSHA512): Deleted.
+        (WebCore::CryptoAlgorithmSHA512::~CryptoAlgorithmSHA512): Deleted.
+        (WebCore::CryptoAlgorithmSHA512::digest): Use ExceptionOr.
+        * crypto/algorithms/CryptoAlgorithmSHA512.h: Updated for above.
+        Also use constexpr for s_name and s_identifier.
+
+        * crypto/gcrypt/CryptoAlgorithmHMACGCrypt.cpp:
+        (WebCore::calculateSignature): Use Optional instead of a boolean
+        return value and an out argument.
+        (WebCore::CryptoAlgorithmHMAC::platformSign): Use ExceptionOr.
+        (WebCore::CryptoAlgorithmHMAC::platformVerify): Ditto.
+        * crypto/gnutls/CryptoAlgorithmAES_CBCGnuTLS.cpp:
+        (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt): Ditto.
+        (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt): Ditto.
+        * crypto/gnutls/CryptoAlgorithmAES_KWGnuTLS.cpp:
+        (WebCore::CryptoAlgorithmAES_KW::platformEncrypt): Ditto.
+        (WebCore::CryptoAlgorithmAES_KW::platformDecrypt): Ditto.
+        * crypto/gnutls/CryptoAlgorithmHMACGnuTLS.cpp:
+        (WebCore::CryptoAlgorithmHMAC::platformSign): Ditto.
+        (WebCore::CryptoAlgorithmHMAC::platformVerify): Ditto.
+        * crypto/gnutls/CryptoAlgorithmRSAES_PKCS1_v1_5GnuTLS.cpp:
+        (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformEncrypt): Ditto.
+        (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformDecrypt): Ditto.
+        * crypto/gnutls/CryptoAlgorithmRSASSA_PKCS1_v1_5GnuTLS.cpp:
+        (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign): Ditto.
+        (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformVerify): Ditto.
+        * crypto/gnutls/CryptoAlgorithmRSA_OAEPGnuTLS.cpp:
+        (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt): Ditto.
+        (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt): Ditto.
+
+        * crypto/keys/CryptoKeyAES.cpp:
+        (WebCore::CryptoKeyAES::buildAlgorithm): Updated to use name instead
+        of nameForIdentifier.
+        * crypto/keys/CryptoKeyHMAC.cpp: Ditto.
+        (WebCore::CryptoKeyHMAC::buildAlgorithm):
+
+        * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:
+        (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt): Use ExceptionOr.
+        (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt): Ditto.
+        * crypto/mac/CryptoAlgorithmAES_KWMac.cpp:
+        (WebCore::CryptoAlgorithmAES_KW::platformEncrypt): Ditto.
+        (WebCore::CryptoAlgorithmAES_KW::platformDecrypt): Ditto.
+        * crypto/mac/CryptoAlgorithmHMACMac.cpp:
+        (WebCore::commonCryptoHMACAlgorithm): Renamed from
+        getCommonCryptoHMACAlgorithm and changed to use Optional instead of
+        a boolean return value and an out argument.
+        (WebCore::CryptoAlgorithmHMAC::platformSign): Use ExceptionOr.
+        (WebCore::CryptoAlgorithmHMAC::platformVerify): Ditto.
+        * crypto/mac/CryptoAlgorithmRSAES_PKCS1_v1_5Mac.cpp:
+        (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformEncrypt): Ditto.
+        (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformDecrypt): Ditto.
+        * crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp:
+        (WebCore::cryptoDigestAlgorithm): Renamed from
+        getCryptoDigestAlgorithm and changed to use Optional instead of
+        a boolean return value and an out argument.
+        (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign): Use ExceptionOr.
+        (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformVerify): Ditto.
+        * crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp:
+        (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt): Ditto.
+        (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt): Ditto.
+
+        * crypto/mac/CryptoKeyRSAMac.cpp:
+        (WebCore::CryptoKeyRSA::buildAlgorithm): Updated to use name instead
+        of nameForIdentifier.
+
</ins><span class="cx"> 2016-11-13  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Use #pragma once in WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSCryptoAlgorithmDictionarycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSCryptoAlgorithmDictionary.cpp (208668 => 208669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSCryptoAlgorithmDictionary.cpp        2016-11-13 10:05:43 UTC (rev 208668)
+++ trunk/Source/WebCore/bindings/js/JSCryptoAlgorithmDictionary.cpp        2016-11-13 18:31:14 UTC (rev 208669)
</span><span class="lines">@@ -87,11 +87,13 @@
</span><span class="cx">         return false;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (!CryptoAlgorithmRegistry::singleton().getIdentifierForName(algorithmName, algorithmIdentifier)) {
</del><ins>+    auto identifier = CryptoAlgorithmRegistry::singleton().identifier(algorithmName);
+    if (!identifier) {
</ins><span class="cx">         setDOMException(exec, NOT_SUPPORTED_ERR);
</span><span class="cx">         return false;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    algorithmIdentifier = *identifier;
</ins><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSSubtleCryptoCustomcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSSubtleCryptoCustom.cpp (208668 => 208669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSSubtleCryptoCustom.cpp        2016-11-13 10:05:43 UTC (rev 208668)
+++ trunk/Source/WebCore/bindings/js/JSSubtleCryptoCustom.cpp        2016-11-13 18:31:14 UTC (rev 208669)
</span><span class="lines">@@ -81,8 +81,8 @@
</span><span class="cx">         auto params = convertDictionary&lt;CryptoAlgorithmParameters&gt;(state, value);
</span><span class="cx">         RETURN_IF_EXCEPTION(scope, nullptr);
</span><span class="cx"> 
</span><del>-        CryptoAlgorithmIdentifier identifier;
-        if (!CryptoAlgorithmRegistry::singleton().getIdentifierForName(params.name, identifier)) {
</del><ins>+        auto identifier = CryptoAlgorithmRegistry::singleton().identifier(params.name);
+        if (!identifier) {
</ins><span class="cx">             setDOMException(&amp;state, NOT_SUPPORTED_ERR);
</span><span class="cx">             return nullptr;
</span><span class="cx">         }
</span><span class="lines">@@ -90,7 +90,7 @@
</span><span class="cx">         std::unique_ptr&lt;CryptoAlgorithmParameters&gt; result;
</span><span class="cx">         switch (operation) {
</span><span class="cx">         case Operations::Digest:
</span><del>-            switch (identifier) {
</del><ins>+            switch (*identifier) {
</ins><span class="cx">             case CryptoAlgorithmIdentifier::SHA_1:
</span><span class="cx">             case CryptoAlgorithmIdentifier::SHA_224:
</span><span class="cx">             case CryptoAlgorithmIdentifier::SHA_256:
</span><span class="lines">@@ -104,7 +104,7 @@
</span><span class="cx">             }
</span><span class="cx">             break;
</span><span class="cx">         case Operations::GenerateKey:
</span><del>-            switch (identifier) {
</del><ins>+            switch (*identifier) {
</ins><span class="cx">             case CryptoAlgorithmIdentifier::RSAES_PKCS1_v1_5: {
</span><span class="cx">                 auto params = convertDictionary&lt;CryptoAlgorithmRsaKeyGenParams&gt;(state, value);
</span><span class="cx">                 RETURN_IF_EXCEPTION(scope, nullptr);
</span><span class="lines">@@ -146,7 +146,7 @@
</span><span class="cx">             }
</span><span class="cx">             break;
</span><span class="cx">         case Operations::ImportKey:
</span><del>-            switch (identifier) {
</del><ins>+            switch (*identifier) {
</ins><span class="cx">             case CryptoAlgorithmIdentifier::RSAES_PKCS1_v1_5:
</span><span class="cx">                 result = std::make_unique&lt;CryptoAlgorithmParameters&gt;(params);
</span><span class="cx">                 break;
</span><span class="lines">@@ -186,7 +186,7 @@
</span><span class="cx">             return nullptr;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        result-&gt;identifier = identifier;
</del><ins>+        result-&gt;identifier = *identifier;
</ins><span class="cx">         return result;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -194,7 +194,7 @@
</span><span class="cx">     return nullptr;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static CryptoKeyUsageBitmap toCryptoKeyUsageBitmap(const CryptoKeyUsage usage)
</del><ins>+static CryptoKeyUsageBitmap toCryptoKeyUsageBitmap(CryptoKeyUsage usage)
</ins><span class="cx"> {
</span><span class="cx">     switch (usage) {
</span><span class="cx">     case CryptoKeyUsage::Encrypt:
</span><span class="lines">@@ -353,7 +353,7 @@
</span><span class="cx">     // The spec suggests we should perform the following task asynchronously regardless what kind of keys it produces
</span><span class="cx">     // as of 11 December 2014: https://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-generateKey
</span><span class="cx">     // That's simply not efficient for AES and HMAC keys. Therefore, we perform it as an async task conditionally.
</span><del>-    algorithm-&gt;generateKey(WTFMove(params), extractable, keyUsages, WTFMove(callback), WTFMove(exceptionCallback), scriptExecutionContextFromExecState(&amp;state));
</del><ins>+    algorithm-&gt;generateKey(WTFMove(params), extractable, keyUsages, WTFMove(callback), WTFMove(exceptionCallback), *scriptExecutionContextFromExecState(&amp;state));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static void jsSubtleCryptoFunctionImportKeyPromise(ExecState&amp; state, Ref&lt;DeferredPromise&gt;&amp;&amp; promise)
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSWebKitSubtleCryptoCustomcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSWebKitSubtleCryptoCustom.cpp (208668 => 208669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSWebKitSubtleCryptoCustom.cpp        2016-11-13 10:05:43 UTC (rev 208668)
+++ trunk/Source/WebCore/bindings/js/JSWebKitSubtleCryptoCustom.cpp        2016-11-13 18:31:14 UTC (rev 208669)
</span><span class="lines">@@ -75,7 +75,7 @@
</span><span class="cx"> 
</span><span class="cx">     auto result = CryptoAlgorithmRegistry::singleton().create(algorithmIdentifier);
</span><span class="cx">     if (!result)
</span><del>-        setDOMException(&amp;state, NOT_SUPPORTED_ERR);
</del><ins>+        setDOMException(&amp;state, scope, NOT_SUPPORTED_ERR);
</ins><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -162,7 +162,7 @@
</span><span class="cx"> 
</span><span class="cx">     if (!key-&gt;allows(CryptoKeyUsageEncrypt)) {
</span><span class="cx">         wrapped().document()-&gt;addConsoleMessage(MessageSource::JS, MessageLevel::Error, ASCIILiteral(&quot;Key usages do not include 'encrypt'&quot;));
</span><del>-        setDOMException(&amp;state, NOT_SUPPORTED_ERR);
</del><ins>+        setDOMException(&amp;state, scope, NOT_SUPPORTED_ERR);
</ins><span class="cx">         return jsUndefined();
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -181,11 +181,10 @@
</span><span class="cx">         wrapper-&gt;reject(nullptr);
</span><span class="cx">     };
</span><span class="cx"> 
</span><del>-    ExceptionCode ec = 0;
-    algorithm-&gt;encrypt(*parameters, *key, data, WTFMove(successCallback), WTFMove(failureCallback), ec);
-    if (ec) {
-        setDOMException(&amp;state, ec);
-        return jsUndefined();
</del><ins>+    auto result = algorithm-&gt;encrypt(*parameters, *key, data, WTFMove(successCallback), WTFMove(failureCallback));
+    if (result.hasException()) {
+        propagateException(state, scope, result.releaseException());
+        return { };
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     return promise;
</span><span class="lines">@@ -234,11 +233,10 @@
</span><span class="cx">         wrapper-&gt;reject(nullptr);
</span><span class="cx">     };
</span><span class="cx"> 
</span><del>-    ExceptionCode ec = 0;
-    algorithm-&gt;decrypt(*parameters, *key, data, WTFMove(successCallback), WTFMove(failureCallback), ec);
-    if (ec) {
-        setDOMException(&amp;state, ec);
-        return jsUndefined();
</del><ins>+    auto result = algorithm-&gt;decrypt(*parameters, *key, data, WTFMove(successCallback), WTFMove(failureCallback));
+    if (result.hasException()) {
+        propagateException(state, scope, result.releaseException());
+        return { };
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     return promise;
</span><span class="lines">@@ -287,11 +285,10 @@
</span><span class="cx">         wrapper-&gt;reject(nullptr);
</span><span class="cx">     };
</span><span class="cx"> 
</span><del>-    ExceptionCode ec = 0;
-    algorithm-&gt;sign(*parameters, *key, data, WTFMove(successCallback), WTFMove(failureCallback), ec);
-    if (ec) {
-        setDOMException(&amp;state, ec);
-        return jsUndefined();
</del><ins>+    auto result = algorithm-&gt;sign(*parameters, *key, data, WTFMove(successCallback), WTFMove(failureCallback));
+    if (result.hasException()) {
+        propagateException(state, scope, result.releaseException());
+        return { };
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     return promise;
</span><span class="lines">@@ -346,11 +343,10 @@
</span><span class="cx">         wrapper-&gt;reject(nullptr);
</span><span class="cx">     };
</span><span class="cx"> 
</span><del>-    ExceptionCode ec = 0;
-    algorithm-&gt;verify(*parameters, *key, signature, data, WTFMove(successCallback), WTFMove(failureCallback), ec);
-    if (ec) {
-        setDOMException(&amp;state, ec);
-        return jsUndefined();
</del><ins>+    auto result = algorithm-&gt;verify(*parameters, *key, signature, data, WTFMove(successCallback), WTFMove(failureCallback));
+    if (result.hasException()) {
+        propagateException(state, scope, result.releaseException());
+        return { };
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     return promise;
</span><span class="lines">@@ -389,11 +385,10 @@
</span><span class="cx">         wrapper-&gt;reject(nullptr);
</span><span class="cx">     };
</span><span class="cx"> 
</span><del>-    ExceptionCode ec = 0;
-    algorithm-&gt;digest(*parameters, data, WTFMove(successCallback), WTFMove(failureCallback), ec);
-    if (ec) {
-        setDOMException(&amp;state, ec);
-        return jsUndefined();
</del><ins>+    auto result = algorithm-&gt;digest(*parameters, data, WTFMove(successCallback), WTFMove(failureCallback));
+    if (result.hasException()) {
+        propagateException(state, scope, result.releaseException());
+        return { };
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     return promise;
</span><span class="lines">@@ -445,11 +440,10 @@
</span><span class="cx">         wrapper-&gt;reject(nullptr);
</span><span class="cx">     };
</span><span class="cx"> 
</span><del>-    ExceptionCode ec = 0;
-    algorithm-&gt;generateKey(*parameters, extractable, keyUsages, WTFMove(successCallback), WTFMove(failureCallback), ec, scriptExecutionContextFromExecState(&amp;state));
-    if (ec) {
-        setDOMException(&amp;state, ec);
-        return jsUndefined();
</del><ins>+    auto result = algorithm-&gt;generateKey(*parameters, extractable, keyUsages, WTFMove(successCallback), WTFMove(failureCallback), *scriptExecutionContextFromExecState(&amp;state));
+    if (result.hasException()) {
+        propagateException(state, scope, result.releaseException());
+        return { };
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     return promise;
</span><span class="lines">@@ -507,10 +501,7 @@
</span><span class="cx">     auto keyData = keySerialization-&gt;keyData();
</span><span class="cx">     RETURN_IF_EXCEPTION(scope, void());
</span><span class="cx"> 
</span><del>-    ExceptionCode ec = 0;
-    algorithm-&gt;importKey(*parameters, *keyData, extractable, keyUsages, WTFMove(callback), WTFMove(failureCallback), ec);
-    if (ec)
-        setDOMException(&amp;state, ec);
</del><ins>+    propagateException(state, scope, algorithm-&gt;importKey(*parameters, *keyData, extractable, keyUsages, WTFMove(callback), WTFMove(failureCallback)));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> JSValue JSWebKitSubtleCrypto::importKey(ExecState&amp; state)
</span><span class="lines">@@ -691,9 +682,8 @@
</span><span class="cx">         auto encryptFailureCallback = [wrapper]() mutable {
</span><span class="cx">             wrapper-&gt;reject(nullptr);
</span><span class="cx">         };
</span><del>-        ExceptionCode ec = 0;
-        algorithm-&gt;encryptForWrapKey(*parameters, *wrappingKey, std::make_pair(exportedKeyData.data(), exportedKeyData.size()), WTFMove(encryptSuccessCallback), WTFMove(encryptFailureCallback), ec);
-        if (ec) {
</del><ins>+        auto result = algorithm-&gt;encryptForWrapKey(*parameters, *wrappingKey, std::make_pair(exportedKeyData.data(), exportedKeyData.size()), WTFMove(encryptSuccessCallback), WTFMove(encryptFailureCallback));
+        if (result.hasException()) {
</ins><span class="cx">             // FIXME: Report failure details to console, and possibly to calling script once there is a standardized way to pass errors to WebCrypto promise reject functions.
</span><span class="cx">             wrapper-&gt;reject(nullptr);
</span><span class="cx">         }
</span><span class="lines">@@ -703,12 +693,7 @@
</span><span class="cx">         wrapper-&gt;reject(nullptr);
</span><span class="cx">     };
</span><span class="cx"> 
</span><del>-    ExceptionCode ec = 0;
</del><span class="cx">     WebCore::exportKey(state, keyFormat, *key, WTFMove(exportSuccessCallback), WTFMove(exportFailureCallback));
</span><del>-    if (ec) {
-        setDOMException(&amp;state, ec);
-        return jsUndefined();
-    }
</del><span class="cx"> 
</span><span class="cx">     return promise;
</span><span class="cx"> }
</span><span class="lines">@@ -808,11 +793,10 @@
</span><span class="cx">         wrapper-&gt;reject(nullptr);
</span><span class="cx">     };
</span><span class="cx"> 
</span><del>-    ExceptionCode ec = 0;
-    unwrapAlgorithm-&gt;decryptForUnwrapKey(*unwrapAlgorithmParameters, *unwrappingKey, wrappedKeyData, WTFMove(decryptSuccessCallback), WTFMove(decryptFailureCallback), ec);
-    if (ec) {
-        setDOMException(&amp;state, ec);
-        return jsUndefined();
</del><ins>+    auto result = unwrapAlgorithm-&gt;decryptForUnwrapKey(*unwrapAlgorithmParameters, *unwrappingKey, wrappedKeyData, WTFMove(decryptSuccessCallback), WTFMove(decryptFailureCallback));
+    if (result.hasException()) {
+        propagateException(state, scope, result.releaseException());
+        return { };
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     return promise;
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoCryptoAlgorithmcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/CryptoAlgorithm.cpp (208668 => 208669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/CryptoAlgorithm.cpp        2016-11-13 10:05:43 UTC (rev 208668)
+++ trunk/Source/WebCore/crypto/CryptoAlgorithm.cpp        2016-11-13 18:31:14 UTC (rev 208669)
</span><span class="lines">@@ -32,16 +32,8 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-CryptoAlgorithm::CryptoAlgorithm()
</del><ins>+void CryptoAlgorithm::generateKey(const std::unique_ptr&lt;CryptoAlgorithmParameters&gt;&amp;&amp;, bool, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&amp;&amp;, ExceptionCallback&amp;&amp; exceptionCallback, ScriptExecutionContext&amp;)
</ins><span class="cx"> {
</span><del>-}
-
-CryptoAlgorithm::~CryptoAlgorithm()
-{
-}
-
-void CryptoAlgorithm::generateKey(const std::unique_ptr&lt;CryptoAlgorithmParameters&gt;&amp;&amp;, bool, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&amp;&amp;, ExceptionCallback&amp;&amp; exceptionCallback, ScriptExecutionContext*)
-{
</del><span class="cx">     exceptionCallback(NOT_SUPPORTED_ERR);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -50,59 +42,59 @@
</span><span class="cx">     exceptionCallback(NOT_SUPPORTED_ERR);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithm::encrypt(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp;, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithm::encrypt(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp;)
</ins><span class="cx"> {
</span><del>-    ec = NOT_SUPPORTED_ERR;
</del><ins>+    return Exception { NOT_SUPPORTED_ERR };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithm::decrypt(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp;, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithm::decrypt(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp;)
</ins><span class="cx"> {
</span><del>-    ec = NOT_SUPPORTED_ERR;
</del><ins>+    return Exception { NOT_SUPPORTED_ERR };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithm::sign(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp;, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithm::sign(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp;)
</ins><span class="cx"> {
</span><del>-    ec = NOT_SUPPORTED_ERR;
</del><ins>+    return Exception { NOT_SUPPORTED_ERR };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithm::verify(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp;, const CryptoOperationData&amp;, const CryptoOperationData&amp;, BoolCallback&amp;&amp;, VoidCallback&amp;&amp;, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithm::verify(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp;, const CryptoOperationData&amp;, const CryptoOperationData&amp;, BoolCallback&amp;&amp;, VoidCallback&amp;&amp;)
</ins><span class="cx"> {
</span><del>-    ec = NOT_SUPPORTED_ERR;
</del><ins>+    return Exception { NOT_SUPPORTED_ERR };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithm::digest(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp;, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithm::digest(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp;)
</ins><span class="cx"> {
</span><del>-    ec = NOT_SUPPORTED_ERR;
</del><ins>+    return Exception { NOT_SUPPORTED_ERR };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithm::generateKey(const CryptoAlgorithmParametersDeprecated&amp;, bool, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&amp;&amp;, VoidCallback&amp;&amp;, ExceptionCode&amp; ec, ScriptExecutionContext*)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithm::generateKey(const CryptoAlgorithmParametersDeprecated&amp;, bool, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&amp;&amp;, VoidCallback&amp;&amp;, ScriptExecutionContext&amp;)
</ins><span class="cx"> {
</span><del>-    ec = NOT_SUPPORTED_ERR;
</del><ins>+    return Exception { NOT_SUPPORTED_ERR };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithm::deriveKey(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp;, CryptoAlgorithm*, bool, CryptoKeyUsageBitmap, KeyCallback&amp;&amp;, VoidCallback&amp;&amp;, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithm::deriveKey(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp;, CryptoAlgorithm*, bool, CryptoKeyUsageBitmap, KeyCallback&amp;&amp;, VoidCallback&amp;&amp;)
</ins><span class="cx"> {
</span><del>-    ec = NOT_SUPPORTED_ERR;
</del><ins>+    return Exception { NOT_SUPPORTED_ERR };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithm::deriveBits(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp;, unsigned long, VectorCallback&amp;&amp;, VoidCallback&amp;&amp;, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithm::deriveBits(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp;, unsigned long, VectorCallback&amp;&amp;, VoidCallback&amp;&amp;)
</ins><span class="cx"> {
</span><del>-    ec = NOT_SUPPORTED_ERR;
</del><ins>+    return Exception { NOT_SUPPORTED_ERR };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithm::importKey(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKeyData&amp;, bool, CryptoKeyUsageBitmap, KeyCallback&amp;&amp;, VoidCallback&amp;&amp;, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithm::importKey(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKeyData&amp;, bool, CryptoKeyUsageBitmap, KeyCallback&amp;&amp;, VoidCallback&amp;&amp;)
</ins><span class="cx"> {
</span><del>-    ec = NOT_SUPPORTED_ERR;
</del><ins>+    return Exception { NOT_SUPPORTED_ERR };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithm::encryptForWrapKey(const CryptoAlgorithmParametersDeprecated&amp; parameters, const CryptoKey&amp; key, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithm::encryptForWrapKey(const CryptoAlgorithmParametersDeprecated&amp; parameters, const CryptoKey&amp; key, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback)
</ins><span class="cx"> {
</span><del>-    encrypt(parameters, key, data, WTFMove(callback), WTFMove(failureCallback), ec);
</del><ins>+    return encrypt(parameters, key, data, WTFMove(callback), WTFMove(failureCallback));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithm::decryptForUnwrapKey(const CryptoAlgorithmParametersDeprecated&amp; parameters, const CryptoKey&amp; key, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithm::decryptForUnwrapKey(const CryptoAlgorithmParametersDeprecated&amp; parameters, const CryptoKey&amp; key, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback)
</ins><span class="cx"> {
</span><del>-    decrypt(parameters, key, data, WTFMove(callback), WTFMove(failureCallback), ec);
</del><ins>+    return decrypt(parameters, key, data, WTFMove(callback), WTFMove(failureCallback));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoCryptoAlgorithmh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/CryptoAlgorithm.h (208668 => 208669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/CryptoAlgorithm.h        2016-11-13 10:05:43 UTC (rev 208668)
+++ trunk/Source/WebCore/crypto/CryptoAlgorithm.h        2016-11-13 18:31:14 UTC (rev 208669)
</span><span class="lines">@@ -27,12 +27,10 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;CryptoAlgorithmIdentifier.h&quot;
</span><span class="cx"> #include &quot;CryptoKeyUsage.h&quot;
</span><ins>+#include &quot;ExceptionOr.h&quot;
</ins><span class="cx"> #include &quot;JsonWebKey.h&quot;
</span><span class="cx"> #include &quot;SubtleCrypto.h&quot;
</span><span class="cx"> #include &lt;wtf/Function.h&gt;
</span><del>-#include &lt;wtf/Noncopyable.h&gt;
-#include &lt;wtf/RefCounted.h&gt;
-#include &lt;wtf/Variant.h&gt;
</del><span class="cx"> #include &lt;wtf/Vector.h&gt;
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(SUBTLE_CRYPTO)
</span><span class="lines">@@ -39,8 +37,6 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-typedef int ExceptionCode;
-
</del><span class="cx"> class CryptoAlgorithmParameters;
</span><span class="cx"> class CryptoAlgorithmParametersDeprecated;
</span><span class="cx"> class CryptoKey;
</span><span class="lines">@@ -49,13 +45,13 @@
</span><span class="cx"> class ScriptExecutionContext;
</span><span class="cx"> 
</span><span class="cx"> // Data is mutable, so async operations should copy it first.
</span><del>-typedef std::pair&lt;const uint8_t*, size_t&gt; CryptoOperationData;
</del><ins>+using CryptoOperationData = std::pair&lt;const uint8_t*, size_t&gt;;
</ins><span class="cx"> 
</span><span class="cx"> using KeyData = Variant&lt;Vector&lt;uint8_t&gt;, JsonWebKey&gt;;
</span><span class="cx"> 
</span><span class="cx"> class CryptoAlgorithm : public RefCounted&lt;CryptoAlgorithm&gt; {
</span><span class="cx"> public:
</span><del>-    virtual ~CryptoAlgorithm();
</del><ins>+    virtual ~CryptoAlgorithm() = default;
</ins><span class="cx"> 
</span><span class="cx">     virtual CryptoAlgorithmIdentifier identifier() const = 0;
</span><span class="cx"> 
</span><span class="lines">@@ -66,26 +62,23 @@
</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="cx"> 
</span><del>-    virtual void generateKey(const std::unique_ptr&lt;CryptoAlgorithmParameters&gt;&amp;&amp;, bool extractable, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&amp;&amp;, ExceptionCallback&amp;&amp;, ScriptExecutionContext*);
</del><ins>+    virtual void generateKey(const std::unique_ptr&lt;CryptoAlgorithmParameters&gt;&amp;&amp;, bool extractable, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&amp;&amp;, ExceptionCallback&amp;&amp;, ScriptExecutionContext&amp;);
</ins><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"> 
</span><span class="cx">     // The following will be deprecated.
</span><del>-    virtual void encrypt(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;);
-    virtual void decrypt(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;);
-    virtual void sign(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;);
-    virtual void verify(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp;, const CryptoOperationData&amp; signature, const CryptoOperationData&amp;, BoolCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;);
-    virtual void digest(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;);
-    virtual void generateKey(const CryptoAlgorithmParametersDeprecated&amp;, bool extractable, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;, ScriptExecutionContext*);
-    virtual void deriveKey(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp; baseKey, CryptoAlgorithm* derivedKeyType, bool extractable, CryptoKeyUsageBitmap, KeyCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;);
-    virtual void deriveBits(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp; baseKey, unsigned long length, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;);
-    virtual void importKey(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKeyData&amp;, bool extractable, CryptoKeyUsageBitmap, KeyCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;);
</del><ins>+    virtual ExceptionOr&lt;void&gt; encrypt(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback);
+    virtual ExceptionOr&lt;void&gt; decrypt(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback);
+    virtual ExceptionOr&lt;void&gt; sign(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback);
+    virtual ExceptionOr&lt;void&gt; verify(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp;, const CryptoOperationData&amp; signature, const CryptoOperationData&amp;, BoolCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback);
+    virtual ExceptionOr&lt;void&gt; digest(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback);
+    virtual ExceptionOr&lt;void&gt; generateKey(const CryptoAlgorithmParametersDeprecated&amp;, bool extractable, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ScriptExecutionContext&amp;);
+    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);
+    virtual ExceptionOr&lt;void&gt; deriveBits(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp; baseKey, unsigned long length, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback);
+    virtual ExceptionOr&lt;void&gt; importKey(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKeyData&amp;, bool extractable, CryptoKeyUsageBitmap, KeyCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback);
</ins><span class="cx"> 
</span><span class="cx">     // These are only different from encrypt/decrypt because some algorithms may not expose encrypt/decrypt.
</span><del>-    virtual void encryptForWrapKey(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;);
-    virtual void decryptForUnwrapKey(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;);
-
-protected:
-    CryptoAlgorithm();
</del><ins>+    virtual ExceptionOr&lt;void&gt; encryptForWrapKey(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback);
+    virtual ExceptionOr&lt;void&gt; decryptForUnwrapKey(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback);
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoCryptoAlgorithmRegistrycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/CryptoAlgorithmRegistry.cpp (208668 => 208669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/CryptoAlgorithmRegistry.cpp        2016-11-13 10:05:43 UTC (rev 208668)
+++ trunk/Source/WebCore/crypto/CryptoAlgorithmRegistry.cpp        2016-11-13 18:31:14 UTC (rev 208669)
</span><span class="lines">@@ -34,40 +34,43 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><ins>+static StaticLock registryMutex;
+
</ins><span class="cx"> CryptoAlgorithmRegistry&amp; CryptoAlgorithmRegistry::singleton()
</span><span class="cx"> {
</span><span class="cx">     static NeverDestroyed&lt;CryptoAlgorithmRegistry&gt; registry;
</span><del>-
</del><span class="cx">     return registry;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static StaticLock registryMutex;
-
</del><span class="cx"> CryptoAlgorithmRegistry::CryptoAlgorithmRegistry()
</span><span class="cx"> {
</span><span class="cx">     platformRegisterAlgorithms();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool CryptoAlgorithmRegistry::getIdentifierForName(const String&amp; name, CryptoAlgorithmIdentifier&amp; result)
</del><ins>+Optional&lt;CryptoAlgorithmIdentifier&gt; CryptoAlgorithmRegistry::identifier(const String&amp; name)
</ins><span class="cx"> {
</span><span class="cx">     if (name.isEmpty())
</span><del>-        return false;
</del><ins>+        return Nullopt;
</ins><span class="cx"> 
</span><span class="cx">     std::lock_guard&lt;StaticLock&gt; lock(registryMutex);
</span><span class="cx"> 
</span><del>-    auto iter = m_nameToIdentifierMap.find(name.isolatedCopy());
-    if (iter == m_nameToIdentifierMap.end())
-        return false;
</del><ins>+    // FIXME: How is it helpful to call isolatedCopy on the argument to find?
+    auto identifier = m_identifiers.find(name.isolatedCopy());
+    if (identifier == m_identifiers.end())
+        return Nullopt;
</ins><span class="cx"> 
</span><del>-    result = iter-&gt;value;
-    return true;
</del><ins>+    return identifier-&gt;value;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-String CryptoAlgorithmRegistry::nameForIdentifier(CryptoAlgorithmIdentifier identifier)
</del><ins>+String CryptoAlgorithmRegistry::name(CryptoAlgorithmIdentifier identifier)
</ins><span class="cx"> {
</span><span class="cx">     std::lock_guard&lt;StaticLock&gt; lock(registryMutex);
</span><span class="cx"> 
</span><del>-    return m_identifierToNameMap.get(static_cast&lt;unsigned&gt;(identifier)).isolatedCopy();
</del><ins>+    auto contructor = m_constructors.find(static_cast&lt;unsigned&gt;(identifier));
+    if (contructor == m_constructors.end())
+        return { };
+
+    return contructor-&gt;value.first.isolatedCopy();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> RefPtr&lt;CryptoAlgorithm&gt; CryptoAlgorithmRegistry::create(CryptoAlgorithmIdentifier identifier)
</span><span class="lines">@@ -74,11 +77,11 @@
</span><span class="cx"> {
</span><span class="cx">     std::lock_guard&lt;StaticLock&gt; lock(registryMutex);
</span><span class="cx"> 
</span><del>-    auto iter = m_identifierToConstructorMap.find(static_cast&lt;unsigned&gt;(identifier));
-    if (iter == m_identifierToConstructorMap.end())
</del><ins>+    auto contructor = m_constructors.find(static_cast&lt;unsigned&gt;(identifier));
+    if (contructor == m_constructors.end())
</ins><span class="cx">         return nullptr;
</span><span class="cx"> 
</span><del>-    return iter-&gt;value();
</del><ins>+    return contructor-&gt;value.second();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void CryptoAlgorithmRegistry::registerAlgorithm(const String&amp; name, CryptoAlgorithmIdentifier identifier, CryptoAlgorithmConstructor constructor)
</span><span class="lines">@@ -85,14 +88,11 @@
</span><span class="cx"> {
</span><span class="cx">     std::lock_guard&lt;StaticLock&gt; lock(registryMutex);
</span><span class="cx"> 
</span><del>-    bool added = m_nameToIdentifierMap.add(name, identifier).isNewEntry;
-    ASSERT_UNUSED(added, added);
</del><ins>+    ASSERT(!m_identifiers.contains(name));
+    ASSERT(!m_constructors.contains(static_cast&lt;unsigned&gt;(identifier)));
</ins><span class="cx"> 
</span><del>-    added = m_identifierToNameMap.add(static_cast&lt;unsigned&gt;(identifier), name).isNewEntry;
-    ASSERT_UNUSED(added, added);
-
-    added = m_identifierToConstructorMap.add(static_cast&lt;unsigned&gt;(identifier), constructor).isNewEntry;
-    ASSERT_UNUSED(added, added);
</del><ins>+    m_identifiers.add(name, identifier);
+    m_constructors.add(static_cast&lt;unsigned&gt;(identifier), std::make_pair(name, constructor));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoCryptoAlgorithmRegistryh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/CryptoAlgorithmRegistry.h (208668 => 208669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/CryptoAlgorithmRegistry.h        2016-11-13 10:05:43 UTC (rev 208668)
+++ trunk/Source/WebCore/crypto/CryptoAlgorithmRegistry.h        2016-11-13 18:31:14 UTC (rev 208669)
</span><span class="lines">@@ -35,8 +35,6 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-typedef int ExceptionCode;
-
</del><span class="cx"> class CryptoAlgorithm;
</span><span class="cx"> 
</span><span class="cx"> class CryptoAlgorithmRegistry {
</span><span class="lines">@@ -46,8 +44,8 @@
</span><span class="cx"> public:
</span><span class="cx">     static CryptoAlgorithmRegistry&amp; singleton();
</span><span class="cx"> 
</span><del>-    bool getIdentifierForName(const String&amp;, CryptoAlgorithmIdentifier&amp;);
-    String nameForIdentifier(CryptoAlgorithmIdentifier);
</del><ins>+    Optional&lt;CryptoAlgorithmIdentifier&gt; identifier(const String&amp;);
+    String name(CryptoAlgorithmIdentifier);
</ins><span class="cx"> 
</span><span class="cx">     RefPtr&lt;CryptoAlgorithm&gt; create(CryptoAlgorithmIdentifier);
</span><span class="cx"> 
</span><span class="lines">@@ -55,7 +53,7 @@
</span><span class="cx">     CryptoAlgorithmRegistry();
</span><span class="cx">     void platformRegisterAlgorithms();
</span><span class="cx"> 
</span><del>-    typedef Ref&lt;CryptoAlgorithm&gt; (*CryptoAlgorithmConstructor)();
</del><ins>+    using CryptoAlgorithmConstructor = Ref&lt;CryptoAlgorithm&gt; (*)();
</ins><span class="cx"> 
</span><span class="cx">     template&lt;typename AlgorithmClass&gt; void registerAlgorithm()
</span><span class="cx">     {
</span><span class="lines">@@ -64,9 +62,8 @@
</span><span class="cx"> 
</span><span class="cx">     void registerAlgorithm(const String&amp; name, CryptoAlgorithmIdentifier, CryptoAlgorithmConstructor);
</span><span class="cx"> 
</span><del>-    HashMap&lt;String, CryptoAlgorithmIdentifier, ASCIICaseInsensitiveHash&gt; m_nameToIdentifierMap;
-    HashMap&lt;unsigned, String&gt; m_identifierToNameMap;
-    HashMap&lt;unsigned, CryptoAlgorithmConstructor&gt; m_identifierToConstructorMap;
</del><ins>+    HashMap&lt;String, CryptoAlgorithmIdentifier, ASCIICaseInsensitiveHash&gt; m_identifiers;
+    HashMap&lt;unsigned, std::pair&lt;String, CryptoAlgorithmConstructor&gt;&gt; m_constructors;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmAES_CBCcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_CBC.cpp (208668 => 208669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_CBC.cpp        2016-11-13 10:05:43 UTC (rev 208668)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_CBC.cpp        2016-11-13 18:31:14 UTC (rev 208669)
</span><span class="lines">@@ -37,21 +37,11 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-const char* const CryptoAlgorithmAES_CBC::s_name = &quot;AES-CBC&quot;;
-
</del><span class="cx"> static inline bool usagesAreInvalidForCryptoAlgorithmAES_CBC(CryptoKeyUsageBitmap usages)
</span><span class="cx"> {
</span><span class="cx">     return usages &amp; (CryptoKeyUsageSign | CryptoKeyUsageVerify | CryptoKeyUsageDeriveKey | CryptoKeyUsageDeriveBits);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-CryptoAlgorithmAES_CBC::CryptoAlgorithmAES_CBC()
-{
-}
-
-CryptoAlgorithmAES_CBC::~CryptoAlgorithmAES_CBC()
-{
-}
-
</del><span class="cx"> Ref&lt;CryptoAlgorithm&gt; CryptoAlgorithmAES_CBC::create()
</span><span class="cx"> {
</span><span class="cx">     return adoptRef(*new CryptoAlgorithmAES_CBC);
</span><span class="lines">@@ -67,13 +57,12 @@
</span><span class="cx">     if (key.algorithmIdentifier() != s_identifier)
</span><span class="cx">         return false;
</span><span class="cx">     ASSERT(is&lt;CryptoKeyAES&gt;(key));
</span><del>-
</del><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmAES_CBC::generateKey(const std::unique_ptr&lt;CryptoAlgorithmParameters&gt;&amp;&amp; parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyOrKeyPairCallback&amp;&amp; callback, ExceptionCallback&amp;&amp; exceptionCallback, ScriptExecutionContext*)
</del><ins>+void CryptoAlgorithmAES_CBC::generateKey(const std::unique_ptr&lt;CryptoAlgorithmParameters&gt;&amp;&amp; parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyOrKeyPairCallback&amp;&amp; callback, ExceptionCallback&amp;&amp; exceptionCallback, ScriptExecutionContext&amp;)
</ins><span class="cx"> {
</span><del>-    const auto&amp; aesParameters = downcast&lt;CryptoAlgorithmAesKeyGenParams&gt;(*parameters);
</del><ins>+    auto&amp; aesParameters = downcast&lt;CryptoAlgorithmAesKeyGenParams&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">@@ -128,52 +117,43 @@
</span><span class="cx">     callback(*result);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmAES_CBC::encrypt(const CryptoAlgorithmParametersDeprecated&amp; parameters, const CryptoKey&amp; key, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp; ec)
</del><ins>+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)
</ins><span class="cx"> {
</span><del>-    const CryptoAlgorithmAesCbcParamsDeprecated&amp; aesCBCParameters = downcast&lt;CryptoAlgorithmAesCbcParamsDeprecated&gt;(parameters);
-
-    if (!keyAlgorithmMatches(aesCBCParameters, key)) {
-        ec = NOT_SUPPORTED_ERR;
-        return;
-    }
-
-    platformEncrypt(aesCBCParameters, downcast&lt;CryptoKeyAES&gt;(key), data, WTFMove(callback), WTFMove(failureCallback), ec);
</del><ins>+    auto&amp; aesCBCParameters = downcast&lt;CryptoAlgorithmAesCbcParamsDeprecated&gt;(parameters);
+    if (!keyAlgorithmMatches(aesCBCParameters, key))
+        return Exception { NOT_SUPPORTED_ERR };
+    return platformEncrypt(aesCBCParameters, downcast&lt;CryptoKeyAES&gt;(key), data, WTFMove(callback), WTFMove(failureCallback));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmAES_CBC::decrypt(const CryptoAlgorithmParametersDeprecated&amp; parameters, const CryptoKey&amp; key, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithmAES_CBC::decrypt(const CryptoAlgorithmParametersDeprecated&amp; parameters, const CryptoKey&amp; key, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback)
</ins><span class="cx"> {
</span><del>-    const CryptoAlgorithmAesCbcParamsDeprecated&amp; aesCBCParameters = downcast&lt;CryptoAlgorithmAesCbcParamsDeprecated&gt;(parameters);
-
-    if (!keyAlgorithmMatches(aesCBCParameters, key)) {
-        ec = NOT_SUPPORTED_ERR;
-        return;
-    }
-
-    platformDecrypt(aesCBCParameters, downcast&lt;CryptoKeyAES&gt;(key), data, WTFMove(callback), WTFMove(failureCallback), ec);
</del><ins>+    auto&amp; aesCBCParameters = downcast&lt;CryptoAlgorithmAesCbcParamsDeprecated&gt;(parameters);
+    if (!keyAlgorithmMatches(aesCBCParameters, key))
+        return Exception { NOT_SUPPORTED_ERR };
+    return platformDecrypt(aesCBCParameters, downcast&lt;CryptoKeyAES&gt;(key), data, WTFMove(callback), WTFMove(failureCallback));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmAES_CBC::generateKey(const CryptoAlgorithmParametersDeprecated&amp; parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyOrKeyPairCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;, ScriptExecutionContext*)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithmAES_CBC::generateKey(const CryptoAlgorithmParametersDeprecated&amp; parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyOrKeyPairCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ScriptExecutionContext&amp;)
</ins><span class="cx"> {
</span><del>-    const CryptoAlgorithmAesKeyGenParamsDeprecated&amp; aesParameters = downcast&lt;CryptoAlgorithmAesKeyGenParamsDeprecated&gt;(parameters);
</del><ins>+    auto&amp; aesParameters = downcast&lt;CryptoAlgorithmAesKeyGenParamsDeprecated&gt;(parameters);
</ins><span class="cx"> 
</span><del>-    RefPtr&lt;CryptoKeyAES&gt; result = CryptoKeyAES::generate(CryptoAlgorithmIdentifier::AES_CBC, aesParameters.length, extractable, usages);
</del><ins>+    auto result = CryptoKeyAES::generate(CryptoAlgorithmIdentifier::AES_CBC, aesParameters.length, extractable, usages);
</ins><span class="cx">     if (!result) {
</span><span class="cx">         failureCallback();
</span><del>-        return;
</del><ins>+        return { };
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     callback(result.get(), nullptr);
</span><ins>+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmAES_CBC::importKey(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKeyData&amp; keyData, bool extractable, CryptoKeyUsageBitmap usage, KeyCallback&amp;&amp; callback, VoidCallback&amp;&amp;, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithmAES_CBC::importKey(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKeyData&amp; keyData, bool extractable, CryptoKeyUsageBitmap usage, KeyCallback&amp;&amp; callback, VoidCallback&amp;&amp;)
</ins><span class="cx"> {
</span><del>-    if (!is&lt;CryptoKeyDataOctetSequence&gt;(keyData)) {
-        ec = NOT_SUPPORTED_ERR;
-        return;
-    }
-    const CryptoKeyDataOctetSequence&amp; keyDataOctetSequence = downcast&lt;CryptoKeyDataOctetSequence&gt;(keyData);
-    RefPtr&lt;CryptoKeyAES&gt; result = CryptoKeyAES::create(CryptoAlgorithmIdentifier::AES_CBC, keyDataOctetSequence.octetSequence(), extractable, usage);
-    callback(*result);
</del><ins>+    if (!is&lt;CryptoKeyDataOctetSequence&gt;(keyData))
+        return Exception { NOT_SUPPORTED_ERR };
+    auto&amp; keyDataOctetSequence = downcast&lt;CryptoKeyDataOctetSequence&gt;(keyData);
+    callback(CryptoKeyAES::create(CryptoAlgorithmIdentifier::AES_CBC, keyDataOctetSequence.octetSequence(), extractable, usage));
+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmAES_CBCh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_CBC.h (208668 => 208669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_CBC.h        2016-11-13 10:05:43 UTC (rev 208668)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_CBC.h        2016-11-13 18:31:14 UTC (rev 208669)
</span><span class="lines">@@ -36,29 +36,25 @@
</span><span class="cx"> 
</span><span class="cx"> class CryptoAlgorithmAES_CBC final : public CryptoAlgorithm {
</span><span class="cx"> public:
</span><del>-    static const char* const s_name;
-    static const CryptoAlgorithmIdentifier s_identifier = CryptoAlgorithmIdentifier::AES_CBC;
-
</del><ins>+    static constexpr const char* s_name = &quot;AES-CBC&quot;;
+    static constexpr CryptoAlgorithmIdentifier s_identifier = CryptoAlgorithmIdentifier::AES_CBC;
</ins><span class="cx">     static Ref&lt;CryptoAlgorithm&gt; create();
</span><span class="cx"> 
</span><del>-    CryptoAlgorithmIdentifier identifier() const override;
</del><ins>+private:
+    CryptoAlgorithmAES_CBC() = default;
+    CryptoAlgorithmIdentifier identifier() const final;
</ins><span class="cx"> 
</span><del>-    void generateKey(const std::unique_ptr&lt;CryptoAlgorithmParameters&gt;&amp;&amp;, bool extractable, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&amp;&amp;, ExceptionCallback&amp;&amp;, ScriptExecutionContext*) final;
</del><ins>+    void generateKey(const std::unique_ptr&lt;CryptoAlgorithmParameters&gt;&amp;&amp;, bool extractable, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&amp;&amp;, ExceptionCallback&amp;&amp;, ScriptExecutionContext&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"> 
</span><del>-    // The following will be deprecated.
-    void encrypt(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;) override;
-    void decrypt(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;) override;
-    void generateKey(const CryptoAlgorithmParametersDeprecated&amp;, bool extractable, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;, ScriptExecutionContext*) override;
-    void importKey(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKeyData&amp;, bool extractable, CryptoKeyUsageBitmap, KeyCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;) override;
</del><ins>+    ExceptionOr&lt;void&gt; encrypt(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback) final;
+    ExceptionOr&lt;void&gt; decrypt(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback) final;
+    ExceptionOr&lt;void&gt; generateKey(const CryptoAlgorithmParametersDeprecated&amp;, bool extractable, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ScriptExecutionContext&amp;) final;
+    ExceptionOr&lt;void&gt; importKey(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKeyData&amp;, bool extractable, CryptoKeyUsageBitmap, KeyCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback) final;
</ins><span class="cx"> 
</span><del>-private:
-    CryptoAlgorithmAES_CBC();
-    virtual ~CryptoAlgorithmAES_CBC();
-
</del><span class="cx">     bool keyAlgorithmMatches(const CryptoAlgorithmAesCbcParamsDeprecated&amp; algorithmParameters, const CryptoKey&amp;) const;
</span><del>-    void platformEncrypt(const CryptoAlgorithmAesCbcParamsDeprecated&amp;, const CryptoKeyAES&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;);
-    void platformDecrypt(const CryptoAlgorithmAesCbcParamsDeprecated&amp;, const CryptoKeyAES&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;);
</del><ins>+    ExceptionOr&lt;void&gt; platformEncrypt(const CryptoAlgorithmAesCbcParamsDeprecated&amp;, const CryptoKeyAES&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback);
+    ExceptionOr&lt;void&gt; platformDecrypt(const CryptoAlgorithmAesCbcParamsDeprecated&amp;, const CryptoKeyAES&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback);
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmAES_KWcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_KW.cpp (208668 => 208669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_KW.cpp        2016-11-13 10:05:43 UTC (rev 208668)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_KW.cpp        2016-11-13 18:31:14 UTC (rev 208669)
</span><span class="lines">@@ -36,21 +36,11 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-const char* const CryptoAlgorithmAES_KW::s_name = &quot;AES-KW&quot;;
-
</del><span class="cx"> static inline bool usagesAreInvalidForCryptoAlgorithmAES_KW(CryptoKeyUsageBitmap usages)
</span><span class="cx"> {
</span><span class="cx">     return usages &amp; (CryptoKeyUsageSign | CryptoKeyUsageVerify | CryptoKeyUsageDeriveKey | CryptoKeyUsageDeriveBits | CryptoKeyUsageEncrypt | CryptoKeyUsageDecrypt);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-CryptoAlgorithmAES_KW::CryptoAlgorithmAES_KW()
-{
-}
-
-CryptoAlgorithmAES_KW::~CryptoAlgorithmAES_KW()
-{
-}
-
</del><span class="cx"> Ref&lt;CryptoAlgorithm&gt; CryptoAlgorithmAES_KW::create()
</span><span class="cx"> {
</span><span class="cx">     return adoptRef(*new CryptoAlgorithmAES_KW);
</span><span class="lines">@@ -66,20 +56,17 @@
</span><span class="cx">     if (key.algorithmIdentifier() != s_identifier)
</span><span class="cx">         return false;
</span><span class="cx">     ASSERT(is&lt;CryptoKeyAES&gt;(key));
</span><del>-
</del><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmAES_KW::generateKey(const std::unique_ptr&lt;CryptoAlgorithmParameters&gt;&amp;&amp; parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyOrKeyPairCallback&amp;&amp; callback, ExceptionCallback&amp;&amp; exceptionCallback, ScriptExecutionContext*)
</del><ins>+void CryptoAlgorithmAES_KW::generateKey(const std::unique_ptr&lt;CryptoAlgorithmParameters&gt;&amp;&amp; parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyOrKeyPairCallback&amp;&amp; callback, ExceptionCallback&amp;&amp; exceptionCallback, ScriptExecutionContext&amp;)
</ins><span class="cx"> {
</span><del>-    const auto&amp; aesParameters = downcast&lt;CryptoAlgorithmAesKeyGenParams&gt;(*parameters);
-
</del><span class="cx">     if (usagesAreInvalidForCryptoAlgorithmAES_KW(usages)) {
</span><span class="cx">         exceptionCallback(SYNTAX_ERR);
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    auto result = CryptoKeyAES::generate(CryptoAlgorithmIdentifier::AES_KW, aesParameters.length, extractable, usages);
</del><ins>+    auto result = CryptoKeyAES::generate(CryptoAlgorithmIdentifier::AES_KW, downcast&lt;CryptoAlgorithmAesKeyGenParams&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">@@ -101,7 +88,7 @@
</span><span class="cx">         result = CryptoKeyAES::importRaw(parameters-&gt;identifier, WTFMove(WTF::get&lt;Vector&lt;uint8_t&gt;&gt;(data)), extractable, usages);
</span><span class="cx">         break;
</span><span class="cx">     case SubtleCrypto::KeyFormat::Jwk: {
</span><del>-        auto checkAlgCallback = [](size_t length, const Optional&lt;String&gt;&amp; alg) -&gt; bool {
</del><ins>+        result = CryptoKeyAES::importJwk(parameters-&gt;identifier, WTFMove(WTF::get&lt;JsonWebKey&gt;(data)), extractable, usages, [](size_t length, const Optional&lt;String&gt;&amp; alg) -&gt; bool {
</ins><span class="cx">             switch (length) {
</span><span class="cx">             case CryptoKeyAES::s_length128:
</span><span class="cx">                 return !alg || alg.value() == &quot;A128KW&quot;;
</span><span class="lines">@@ -111,8 +98,7 @@
</span><span class="cx">                 return !alg || alg.value() == &quot;A256KW&quot;;
</span><span class="cx">             }
</span><span class="cx">             return false;
</span><del>-        };
-        result = CryptoKeyAES::importJwk(parameters-&gt;identifier, WTFMove(WTF::get&lt;JsonWebKey&gt;(data)), extractable, usages, WTFMove(checkAlgCallback));
</del><ins>+        });
</ins><span class="cx">         break;
</span><span class="cx">     }
</span><span class="cx">     default:
</span><span class="lines">@@ -127,48 +113,37 @@
</span><span class="cx">     callback(*result);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmAES_KW::encryptForWrapKey(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp; key, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp; ec)
</del><ins>+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)
</ins><span class="cx"> {
</span><del>-    if (!keyAlgorithmMatches(key)) {
-        ec = NOT_SUPPORTED_ERR;
-        return;
-    }
-
-    platformEncrypt(downcast&lt;CryptoKeyAES&gt;(key), data, WTFMove(callback), WTFMove(failureCallback), ec);
</del><ins>+    if (!keyAlgorithmMatches(key))
+        return Exception { NOT_SUPPORTED_ERR };
+    return platformEncrypt(downcast&lt;CryptoKeyAES&gt;(key), data, WTFMove(callback), WTFMove(failureCallback));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmAES_KW::decryptForUnwrapKey(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp; key, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithmAES_KW::decryptForUnwrapKey(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp; key, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback)
</ins><span class="cx"> {
</span><del>-    if (!keyAlgorithmMatches(key)) {
-        ec = NOT_SUPPORTED_ERR;
-        return;
-    }
-
-    platformDecrypt(downcast&lt;CryptoKeyAES&gt;(key), data, WTFMove(callback), WTFMove(failureCallback), ec);
</del><ins>+    if (!keyAlgorithmMatches(key))
+        return Exception { NOT_SUPPORTED_ERR };
+    return platformDecrypt(downcast&lt;CryptoKeyAES&gt;(key), data, WTFMove(callback), WTFMove(failureCallback));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmAES_KW::generateKey(const CryptoAlgorithmParametersDeprecated&amp; parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyOrKeyPairCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;, ScriptExecutionContext*)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithmAES_KW::generateKey(const CryptoAlgorithmParametersDeprecated&amp; parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyOrKeyPairCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ScriptExecutionContext&amp;)
</ins><span class="cx"> {
</span><del>-    const CryptoAlgorithmAesKeyGenParamsDeprecated&amp; aesParameters = downcast&lt;CryptoAlgorithmAesKeyGenParamsDeprecated&gt;(parameters);
-
-    RefPtr&lt;CryptoKeyAES&gt; result = CryptoKeyAES::generate(CryptoAlgorithmIdentifier::AES_KW, aesParameters.length, extractable, usages);
</del><ins>+    auto result = CryptoKeyAES::generate(CryptoAlgorithmIdentifier::AES_KW, downcast&lt;CryptoAlgorithmAesKeyGenParamsDeprecated&gt;(parameters).length, extractable, usages);
</ins><span class="cx">     if (!result) {
</span><span class="cx">         failureCallback();
</span><del>-        return;
</del><ins>+        return { };
</ins><span class="cx">     }
</span><del>-
</del><span class="cx">     callback(result.get(), nullptr);
</span><ins>+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmAES_KW::importKey(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKeyData&amp; keyData, bool extractable, CryptoKeyUsageBitmap usage, KeyCallback&amp;&amp; callback, VoidCallback&amp;&amp;, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithmAES_KW::importKey(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKeyData&amp; keyData, bool extractable, CryptoKeyUsageBitmap usage, KeyCallback&amp;&amp; callback, VoidCallback&amp;&amp;)
</ins><span class="cx"> {
</span><del>-    if (!is&lt;CryptoKeyDataOctetSequence&gt;(keyData)) {
-        ec = NOT_SUPPORTED_ERR;
-        return;
-    }
-    const CryptoKeyDataOctetSequence&amp; keyDataOctetSequence = downcast&lt;CryptoKeyDataOctetSequence&gt;(keyData);
-    RefPtr&lt;CryptoKeyAES&gt; result = CryptoKeyAES::create(CryptoAlgorithmIdentifier::AES_KW, keyDataOctetSequence.octetSequence(), extractable, usage);
-    callback(*result);
</del><ins>+    if (!is&lt;CryptoKeyDataOctetSequence&gt;(keyData))
+        return Exception { NOT_SUPPORTED_ERR };
+    callback(CryptoKeyAES::create(CryptoAlgorithmIdentifier::AES_KW, downcast&lt;CryptoKeyDataOctetSequence&gt;(keyData).octetSequence(), extractable, usage));
+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmAES_KWh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_KW.h (208668 => 208669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_KW.h        2016-11-13 10:05:43 UTC (rev 208668)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_KW.h        2016-11-13 18:31:14 UTC (rev 208669)
</span><span class="lines">@@ -35,29 +35,25 @@
</span><span class="cx"> 
</span><span class="cx"> class CryptoAlgorithmAES_KW final : public CryptoAlgorithm {
</span><span class="cx"> public:
</span><del>-    static const char* const s_name;
-    static const CryptoAlgorithmIdentifier s_identifier = CryptoAlgorithmIdentifier::AES_KW;
-
</del><ins>+    static constexpr const char* s_name = &quot;AES-KW&quot;;
+    static constexpr CryptoAlgorithmIdentifier s_identifier = CryptoAlgorithmIdentifier::AES_KW;
</ins><span class="cx">     static Ref&lt;CryptoAlgorithm&gt; create();
</span><span class="cx"> 
</span><del>-    CryptoAlgorithmIdentifier identifier() const override;
</del><ins>+private:
+    CryptoAlgorithmAES_KW() = default;
+    CryptoAlgorithmIdentifier identifier() const final;
</ins><span class="cx"> 
</span><del>-    void generateKey(const std::unique_ptr&lt;CryptoAlgorithmParameters&gt;&amp;&amp;, bool extractable, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&amp;&amp;, ExceptionCallback&amp;&amp;, ScriptExecutionContext*) final;
</del><ins>+    void generateKey(const std::unique_ptr&lt;CryptoAlgorithmParameters&gt;&amp;&amp;, bool extractable, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&amp;&amp;, ExceptionCallback&amp;&amp;, ScriptExecutionContext&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"> 
</span><del>-    // The following will be deprecated.
-    void encryptForWrapKey(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;) override;
-    void decryptForUnwrapKey(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;) override;
-    void generateKey(const CryptoAlgorithmParametersDeprecated&amp;, bool extractable, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;, ScriptExecutionContext*) override;
-    void importKey(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKeyData&amp;, bool extractable, CryptoKeyUsageBitmap, KeyCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;) override;
</del><ins>+    ExceptionOr&lt;void&gt; encryptForWrapKey(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback) final;
+    ExceptionOr&lt;void&gt; decryptForUnwrapKey(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback) final;
+    ExceptionOr&lt;void&gt; generateKey(const CryptoAlgorithmParametersDeprecated&amp;, bool extractable, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ScriptExecutionContext&amp;) final;
+    ExceptionOr&lt;void&gt; importKey(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKeyData&amp;, bool extractable, CryptoKeyUsageBitmap, KeyCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback) final;
</ins><span class="cx"> 
</span><del>-private:
-    CryptoAlgorithmAES_KW();
-    virtual ~CryptoAlgorithmAES_KW();
-
</del><span class="cx">     bool keyAlgorithmMatches(const CryptoKey&amp;) const;
</span><del>-    void platformEncrypt(const CryptoKeyAES&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;);
-    void platformDecrypt(const CryptoKeyAES&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;);
</del><ins>+    ExceptionOr&lt;void&gt; platformEncrypt(const CryptoKeyAES&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback);
+    ExceptionOr&lt;void&gt; platformDecrypt(const CryptoKeyAES&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback);
</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 (208668 => 208669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmHMAC.cpp        2016-11-13 10:05:43 UTC (rev 208668)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmHMAC.cpp        2016-11-13 18:31:14 UTC (rev 208669)
</span><span class="lines">@@ -37,21 +37,11 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-const char* const CryptoAlgorithmHMAC::s_name = &quot;HMAC&quot;;
-
</del><span class="cx"> static inline bool usagesAreInvalidForCryptoAlgorithmHMAC(CryptoKeyUsageBitmap usages)
</span><span class="cx"> {
</span><span class="cx">     return usages &amp; (CryptoKeyUsageEncrypt | CryptoKeyUsageDecrypt | CryptoKeyUsageDeriveKey | CryptoKeyUsageDeriveBits | CryptoKeyUsageWrapKey | CryptoKeyUsageUnwrapKey);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-CryptoAlgorithmHMAC::CryptoAlgorithmHMAC()
-{
-}
-
-CryptoAlgorithmHMAC::~CryptoAlgorithmHMAC()
-{
-}
-
</del><span class="cx"> Ref&lt;CryptoAlgorithm&gt; CryptoAlgorithmHMAC::create()
</span><span class="cx"> {
</span><span class="cx">     return adoptRef(*new CryptoAlgorithmHMAC);
</span><span class="lines">@@ -73,7 +63,7 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmHMAC::generateKey(const std::unique_ptr&lt;CryptoAlgorithmParameters&gt;&amp;&amp; parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyOrKeyPairCallback&amp;&amp; callback, ExceptionCallback&amp;&amp; exceptionCallback, ScriptExecutionContext*)
</del><ins>+void CryptoAlgorithmHMAC::generateKey(const std::unique_ptr&lt;CryptoAlgorithmParameters&gt;&amp;&amp; parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyOrKeyPairCallback&amp;&amp; callback, ExceptionCallback&amp;&amp; exceptionCallback, ScriptExecutionContext&amp;)
</ins><span class="cx"> {
</span><span class="cx">     const auto&amp; hmacParameters = downcast&lt;CryptoAlgorithmHmacKeyParams&gt;(*parameters);
</span><span class="cx"> 
</span><span class="lines">@@ -143,55 +133,40 @@
</span><span class="cx">     callback(*result);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmHMAC::sign(const CryptoAlgorithmParametersDeprecated&amp; parameters, const CryptoKey&amp; key, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp; ec)
</del><ins>+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)
</ins><span class="cx"> {
</span><del>-    const CryptoAlgorithmHmacParamsDeprecated&amp; hmacParameters = downcast&lt;CryptoAlgorithmHmacParamsDeprecated&gt;(parameters);
-
-    if (!keyAlgorithmMatches(hmacParameters, key)) {
-        ec = NOT_SUPPORTED_ERR;
-        return;
-    }
-
-    platformSign(hmacParameters, downcast&lt;CryptoKeyHMAC&gt;(key), data, WTFMove(callback), WTFMove(failureCallback), ec);
</del><ins>+    auto&amp; hmacParameters = downcast&lt;CryptoAlgorithmHmacParamsDeprecated&gt;(parameters);
+    if (!keyAlgorithmMatches(hmacParameters, key))
+        return Exception { NOT_SUPPORTED_ERR };
+    return platformSign(hmacParameters, downcast&lt;CryptoKeyHMAC&gt;(key), data, WTFMove(callback), WTFMove(failureCallback));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmHMAC::verify(const CryptoAlgorithmParametersDeprecated&amp; parameters, const CryptoKey&amp; key, const CryptoOperationData&amp; expectedSignature, const CryptoOperationData&amp; data, BoolCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithmHMAC::verify(const CryptoAlgorithmParametersDeprecated&amp; parameters, const CryptoKey&amp; key, const CryptoOperationData&amp; expectedSignature, const CryptoOperationData&amp; data, BoolCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback)
</ins><span class="cx"> {
</span><del>-    const CryptoAlgorithmHmacParamsDeprecated&amp; hmacParameters = downcast&lt;CryptoAlgorithmHmacParamsDeprecated&gt;(parameters);
-
-    if (!keyAlgorithmMatches(hmacParameters, key)) {
-        ec = NOT_SUPPORTED_ERR;
-        return;
-    }
-
-    platformVerify(hmacParameters, downcast&lt;CryptoKeyHMAC&gt;(key), expectedSignature, data, WTFMove(callback), WTFMove(failureCallback), ec);
</del><ins>+    auto&amp; hmacParameters = downcast&lt;CryptoAlgorithmHmacParamsDeprecated&gt;(parameters);
+    if (!keyAlgorithmMatches(hmacParameters, key))
+        return Exception { NOT_SUPPORTED_ERR };
+    return platformVerify(hmacParameters, downcast&lt;CryptoKeyHMAC&gt;(key), expectedSignature, data, WTFMove(callback), WTFMove(failureCallback));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmHMAC::generateKey(const CryptoAlgorithmParametersDeprecated&amp; parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyOrKeyPairCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;, ScriptExecutionContext*)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithmHMAC::generateKey(const CryptoAlgorithmParametersDeprecated&amp; parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyOrKeyPairCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ScriptExecutionContext&amp;)
</ins><span class="cx"> {
</span><del>-    const CryptoAlgorithmHmacKeyParamsDeprecated&amp; hmacParameters = downcast&lt;CryptoAlgorithmHmacKeyParamsDeprecated&gt;(parameters);
-
-    RefPtr&lt;CryptoKeyHMAC&gt; result = CryptoKeyHMAC::generate(hmacParameters.hasLength ? hmacParameters.length : 0, hmacParameters.hash, extractable, usages);
</del><ins>+    auto&amp; hmacParameters = downcast&lt;CryptoAlgorithmHmacKeyParamsDeprecated&gt;(parameters);
+    auto result = CryptoKeyHMAC::generate(hmacParameters.hasLength ? hmacParameters.length : 0, hmacParameters.hash, extractable, usages);
</ins><span class="cx">     if (!result) {
</span><span class="cx">         failureCallback();
</span><del>-        return;
</del><ins>+        return { };
</ins><span class="cx">     }
</span><del>-
</del><span class="cx">     callback(result.get(), nullptr);
</span><ins>+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmHMAC::importKey(const CryptoAlgorithmParametersDeprecated&amp; parameters, const CryptoKeyData&amp; keyData, bool extractable, CryptoKeyUsageBitmap usage, KeyCallback&amp;&amp; callback, VoidCallback&amp;&amp;, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithmHMAC::importKey(const CryptoAlgorithmParametersDeprecated&amp; parameters, const CryptoKeyData&amp; keyData, bool extractable, CryptoKeyUsageBitmap usage, KeyCallback&amp;&amp; callback, VoidCallback&amp;&amp;)
</ins><span class="cx"> {
</span><del>-    if (!is&lt;CryptoKeyDataOctetSequence&gt;(keyData)) {
-        ec = NOT_SUPPORTED_ERR;
-        return;
-    }
-    const CryptoKeyDataOctetSequence&amp; keyDataOctetSequence = downcast&lt;CryptoKeyDataOctetSequence&gt;(keyData);
-
-    const CryptoAlgorithmHmacParamsDeprecated&amp; hmacParameters = downcast&lt;CryptoAlgorithmHmacParamsDeprecated&gt;(parameters);
-
-    RefPtr&lt;CryptoKeyHMAC&gt; result = CryptoKeyHMAC::create(keyDataOctetSequence.octetSequence(), hmacParameters.hash, extractable, usage);
-    callback(*result);
</del><ins>+    if (!is&lt;CryptoKeyDataOctetSequence&gt;(keyData))
+        return Exception { NOT_SUPPORTED_ERR };
+    callback(CryptoKeyHMAC::create(downcast&lt;CryptoKeyDataOctetSequence&gt;(keyData).octetSequence(), downcast&lt;CryptoAlgorithmHmacParamsDeprecated&gt;(parameters).hash, extractable, usage));
+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmHMACh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmHMAC.h (208668 => 208669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmHMAC.h        2016-11-13 10:05:43 UTC (rev 208668)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmHMAC.h        2016-11-13 18:31:14 UTC (rev 208669)
</span><span class="lines">@@ -36,29 +36,26 @@
</span><span class="cx"> 
</span><span class="cx"> class CryptoAlgorithmHMAC final : public CryptoAlgorithm {
</span><span class="cx"> public:
</span><del>-    static const char* const s_name;
-    static const CryptoAlgorithmIdentifier s_identifier = CryptoAlgorithmIdentifier::HMAC;
-
</del><ins>+    static constexpr const char* s_name = &quot;HMAC&quot;;
+    static constexpr CryptoAlgorithmIdentifier s_identifier = CryptoAlgorithmIdentifier::HMAC;
</ins><span class="cx">     static Ref&lt;CryptoAlgorithm&gt; create();
</span><span class="cx"> 
</span><del>-    CryptoAlgorithmIdentifier identifier() const override;
</del><ins>+private:
+    CryptoAlgorithmHMAC() = default;
+    CryptoAlgorithmIdentifier identifier() const final;
</ins><span class="cx"> 
</span><del>-    void generateKey(const std::unique_ptr&lt;CryptoAlgorithmParameters&gt;&amp;&amp;, bool extractable, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&amp;&amp;, ExceptionCallback&amp;&amp;, ScriptExecutionContext*) final;
</del><ins>+    void generateKey(const std::unique_ptr&lt;CryptoAlgorithmParameters&gt;&amp;&amp;, bool extractable, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&amp;&amp;, ExceptionCallback&amp;&amp;, ScriptExecutionContext&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"> 
</span><span class="cx">     // The following will be deprecated.
</span><del>-    void sign(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;) override;
-    void verify(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp;, const CryptoOperationData&amp; signature, const CryptoOperationData&amp;, BoolCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;) override;
-    void generateKey(const CryptoAlgorithmParametersDeprecated&amp;, bool extractable, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;, ScriptExecutionContext*) override;
-    void importKey(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKeyData&amp;, bool extractable, CryptoKeyUsageBitmap, KeyCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;) override;
</del><ins>+    ExceptionOr&lt;void&gt; sign(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback) final;
+    ExceptionOr&lt;void&gt; verify(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp;, const CryptoOperationData&amp; signature, const CryptoOperationData&amp;, BoolCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback) final;
+    ExceptionOr&lt;void&gt; generateKey(const CryptoAlgorithmParametersDeprecated&amp;, bool extractable, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ScriptExecutionContext&amp;) final;
+    ExceptionOr&lt;void&gt; importKey(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKeyData&amp;, bool extractable, CryptoKeyUsageBitmap, KeyCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback) final;
</ins><span class="cx"> 
</span><del>-private:
-    CryptoAlgorithmHMAC();
-    virtual ~CryptoAlgorithmHMAC();
-
</del><span class="cx">     bool keyAlgorithmMatches(const CryptoAlgorithmHmacParamsDeprecated&amp; algorithmParameters, const CryptoKey&amp;) const;
</span><del>-    void platformSign(const CryptoAlgorithmHmacParamsDeprecated&amp;, const CryptoKeyHMAC&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;);
-    void platformVerify(const CryptoAlgorithmHmacParamsDeprecated&amp;, const CryptoKeyHMAC&amp;, const CryptoOperationData&amp; signature, const CryptoOperationData&amp;, BoolCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;);
</del><ins>+    ExceptionOr&lt;void&gt; platformSign(const CryptoAlgorithmHmacParamsDeprecated&amp;, const CryptoKeyHMAC&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback);
+    ExceptionOr&lt;void&gt; platformVerify(const CryptoAlgorithmHmacParamsDeprecated&amp;, const CryptoKeyHMAC&amp;, const CryptoOperationData&amp; signature, const CryptoOperationData&amp;, BoolCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback);
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmRSAES_PKCS1_v1_5cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp (208668 => 208669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp        2016-11-13 10:05:43 UTC (rev 208668)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp        2016-11-13 18:31:14 UTC (rev 208669)
</span><span class="lines">@@ -38,16 +38,6 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-const char* const CryptoAlgorithmRSAES_PKCS1_v1_5::s_name = &quot;RSAES-PKCS1-v1_5&quot;;
-
-CryptoAlgorithmRSAES_PKCS1_v1_5::CryptoAlgorithmRSAES_PKCS1_v1_5()
-{
-}
-
-CryptoAlgorithmRSAES_PKCS1_v1_5::~CryptoAlgorithmRSAES_PKCS1_v1_5()
-{
-}
-
</del><span class="cx"> Ref&lt;CryptoAlgorithm&gt; CryptoAlgorithmRSAES_PKCS1_v1_5::create()
</span><span class="cx"> {
</span><span class="cx">     return adoptRef(*new CryptoAlgorithmRSAES_PKCS1_v1_5);
</span><span class="lines">@@ -67,7 +57,7 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmRSAES_PKCS1_v1_5::generateKey(const std::unique_ptr&lt;CryptoAlgorithmParameters&gt;&amp;&amp; parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyOrKeyPairCallback&amp;&amp; callback, ExceptionCallback&amp;&amp; exceptionCallback, ScriptExecutionContext* context)
</del><ins>+void CryptoAlgorithmRSAES_PKCS1_v1_5::generateKey(const std::unique_ptr&lt;CryptoAlgorithmParameters&gt;&amp;&amp; parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyOrKeyPairCallback&amp;&amp; callback, ExceptionCallback&amp;&amp; exceptionCallback, ScriptExecutionContext&amp; context)
</ins><span class="cx"> {
</span><span class="cx">     const auto&amp; rsaParameters = downcast&lt;CryptoAlgorithmRsaKeyGenParams&gt;(*parameters);
</span><span class="cx"> 
</span><span class="lines">@@ -85,7 +75,7 @@
</span><span class="cx">         capturedCallback(OperationError);
</span><span class="cx">     };
</span><span class="cx">     // Notice: CryptoAlgorithmIdentifier::SHA_1 is just a placeholder. It should not have any effect.
</span><del>-    CryptoKeyRSA::generatePair(CryptoAlgorithmIdentifier::RSAES_PKCS1_v1_5, CryptoAlgorithmIdentifier::SHA_1, false, rsaParameters.modulusLength, rsaParameters.publicExponentVector(), extractable, usages, WTFMove(keyPairCallback), WTFMove(failureCallback), context);
</del><ins>+    CryptoKeyRSA::generatePair(CryptoAlgorithmIdentifier::RSAES_PKCS1_v1_5, CryptoAlgorithmIdentifier::SHA_1, false, rsaParameters.modulusLength, rsaParameters.publicExponentVector(), extractable, usages, WTFMove(keyPairCallback), WTFMove(failureCallback), &amp;context);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void CryptoAlgorithmRSAES_PKCS1_v1_5::importKey(SubtleCrypto::KeyFormat format, KeyData&amp;&amp; data, const std::unique_ptr&lt;CryptoAlgorithmParameters&gt;&amp;&amp; parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyCallback&amp;&amp; callback, ExceptionCallback&amp;&amp; exceptionCallback)
</span><span class="lines">@@ -121,49 +111,41 @@
</span><span class="cx">     callback(*result);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmRSAES_PKCS1_v1_5::encrypt(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp; key, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithmRSAES_PKCS1_v1_5::encrypt(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp; key, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback)
</ins><span class="cx"> {
</span><del>-    if (!keyAlgorithmMatches(key)) {
-        ec = NOT_SUPPORTED_ERR;
-        return;
-    }
-
-    platformEncrypt(downcast&lt;CryptoKeyRSA&gt;(key), data, WTFMove(callback), WTFMove(failureCallback), ec);
</del><ins>+    if (!keyAlgorithmMatches(key))
+        return Exception { NOT_SUPPORTED_ERR };
+    return platformEncrypt(downcast&lt;CryptoKeyRSA&gt;(key), data, WTFMove(callback), WTFMove(failureCallback));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmRSAES_PKCS1_v1_5::decrypt(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp; key, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithmRSAES_PKCS1_v1_5::decrypt(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp; key, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback)
</ins><span class="cx"> {
</span><del>-    if (!keyAlgorithmMatches(key)) {
-        ec = NOT_SUPPORTED_ERR;
-        return;
-    }
-
-    platformDecrypt(downcast&lt;CryptoKeyRSA&gt;(key), data, WTFMove(callback), WTFMove(failureCallback), ec);
</del><ins>+    if (!keyAlgorithmMatches(key))
+        return Exception { NOT_SUPPORTED_ERR };
+    return platformDecrypt(downcast&lt;CryptoKeyRSA&gt;(key), data, WTFMove(callback), WTFMove(failureCallback));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmRSAES_PKCS1_v1_5::generateKey(const CryptoAlgorithmParametersDeprecated&amp; parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyOrKeyPairCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;, ScriptExecutionContext* context)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithmRSAES_PKCS1_v1_5::generateKey(const CryptoAlgorithmParametersDeprecated&amp; parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyOrKeyPairCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ScriptExecutionContext&amp; context)
</ins><span class="cx"> {
</span><del>-    const CryptoAlgorithmRsaKeyGenParamsDeprecated&amp; rsaParameters = downcast&lt;CryptoAlgorithmRsaKeyGenParamsDeprecated&gt;(parameters);
-
</del><ins>+    auto&amp; rsaParameters = downcast&lt;CryptoAlgorithmRsaKeyGenParamsDeprecated&gt;(parameters);
</ins><span class="cx">     auto keyPairCallback = [capturedCallback = WTFMove(callback)](CryptoKeyPair&amp; pair) {
</span><span class="cx">         capturedCallback(nullptr, &amp;pair);
</span><span class="cx">     };
</span><del>-
-    CryptoKeyRSA::generatePair(CryptoAlgorithmIdentifier::RSAES_PKCS1_v1_5, rsaParameters.hash, rsaParameters.hasHash, rsaParameters.modulusLength, rsaParameters.publicExponent, extractable, usages, WTFMove(keyPairCallback), WTFMove(failureCallback), context);
</del><ins>+    CryptoKeyRSA::generatePair(CryptoAlgorithmIdentifier::RSAES_PKCS1_v1_5, rsaParameters.hash, rsaParameters.hasHash, rsaParameters.modulusLength, rsaParameters.publicExponent, extractable, usages, WTFMove(keyPairCallback), WTFMove(failureCallback), &amp;context);
+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmRSAES_PKCS1_v1_5::importKey(const CryptoAlgorithmParametersDeprecated&amp; parameters, const CryptoKeyData&amp; keyData, bool extractable, CryptoKeyUsageBitmap usage, KeyCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithmRSAES_PKCS1_v1_5::importKey(const CryptoAlgorithmParametersDeprecated&amp; parameters, const CryptoKeyData&amp; keyData, bool extractable, CryptoKeyUsageBitmap usage, KeyCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback)
</ins><span class="cx"> {
</span><del>-    const CryptoAlgorithmRsaKeyParamsWithHashDeprecated&amp; rsaParameters = downcast&lt;CryptoAlgorithmRsaKeyParamsWithHashDeprecated&gt;(parameters);
-    const CryptoKeyDataRSAComponents&amp; rsaComponents = downcast&lt;CryptoKeyDataRSAComponents&gt;(keyData);
-
-    RefPtr&lt;CryptoKeyRSA&gt; result = CryptoKeyRSA::create(CryptoAlgorithmIdentifier::RSAES_PKCS1_v1_5, rsaParameters.hash, rsaParameters.hasHash, rsaComponents, extractable, usage);
</del><ins>+    auto&amp; rsaParameters = downcast&lt;CryptoAlgorithmRsaKeyParamsWithHashDeprecated&gt;(parameters);
+    auto&amp; rsaComponents = downcast&lt;CryptoKeyDataRSAComponents&gt;(keyData);
+    auto result = CryptoKeyRSA::create(CryptoAlgorithmIdentifier::RSAES_PKCS1_v1_5, rsaParameters.hash, rsaParameters.hasHash, rsaComponents, extractable, usage);
</ins><span class="cx">     if (!result) {
</span><span class="cx">         failureCallback();
</span><del>-        return;
</del><ins>+        return { };
</ins><span class="cx">     }
</span><del>-
</del><span class="cx">     callback(*result);
</span><ins>+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmRSAES_PKCS1_v1_5h"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h (208668 => 208669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h        2016-11-13 10:05:43 UTC (rev 208668)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h        2016-11-13 18:31:14 UTC (rev 208669)
</span><span class="lines">@@ -36,29 +36,26 @@
</span><span class="cx"> 
</span><span class="cx"> class CryptoAlgorithmRSAES_PKCS1_v1_5 final : public CryptoAlgorithm {
</span><span class="cx"> public:
</span><del>-    static const char* const s_name;
-    static const CryptoAlgorithmIdentifier s_identifier = CryptoAlgorithmIdentifier::RSAES_PKCS1_v1_5;
-
</del><ins>+    static constexpr const char* s_name = &quot;RSAES-PKCS1-v1_5&quot;;
+    static constexpr CryptoAlgorithmIdentifier s_identifier = CryptoAlgorithmIdentifier::RSAES_PKCS1_v1_5;
</ins><span class="cx">     static Ref&lt;CryptoAlgorithm&gt; create();
</span><span class="cx"> 
</span><del>-    CryptoAlgorithmIdentifier identifier() const override;
</del><ins>+private:
+    CryptoAlgorithmRSAES_PKCS1_v1_5() = default;
+    CryptoAlgorithmIdentifier identifier() const final;
</ins><span class="cx"> 
</span><del>-    void generateKey(const std::unique_ptr&lt;CryptoAlgorithmParameters&gt;&amp;&amp;, bool extractable, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&amp;&amp;, ExceptionCallback&amp;&amp;, ScriptExecutionContext*) final;
</del><ins>+    void generateKey(const std::unique_ptr&lt;CryptoAlgorithmParameters&gt;&amp;&amp;, bool extractable, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&amp;&amp;, ExceptionCallback&amp;&amp;, ScriptExecutionContext&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"> 
</span><span class="cx">     // The following will be deprecated.
</span><del>-    void encrypt(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;) override;
-    void decrypt(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;) override;
-    void generateKey(const CryptoAlgorithmParametersDeprecated&amp;, bool extractable, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;, ScriptExecutionContext*) override;
-    void importKey(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKeyData&amp;, bool extractable, CryptoKeyUsageBitmap, KeyCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;) override;
</del><ins>+    ExceptionOr&lt;void&gt; encrypt(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback) final;
+    ExceptionOr&lt;void&gt; decrypt(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback) final;
+    ExceptionOr&lt;void&gt; generateKey(const CryptoAlgorithmParametersDeprecated&amp;, bool extractable, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ScriptExecutionContext&amp;) final;
+    ExceptionOr&lt;void&gt; importKey(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKeyData&amp;, bool extractable, CryptoKeyUsageBitmap, KeyCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback) final;
</ins><span class="cx"> 
</span><del>-private:
-    CryptoAlgorithmRSAES_PKCS1_v1_5();
-    virtual ~CryptoAlgorithmRSAES_PKCS1_v1_5();
-
</del><span class="cx">     bool keyAlgorithmMatches(const CryptoKey&amp;) const;
</span><del>-    void platformEncrypt(const CryptoKeyRSA&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;);
-    void platformDecrypt(const CryptoKeyRSA&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;);
</del><ins>+    ExceptionOr&lt;void&gt; platformEncrypt(const CryptoKeyRSA&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback);
+    ExceptionOr&lt;void&gt; platformDecrypt(const CryptoKeyRSA&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback);
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmRSASSA_PKCS1_v1_5cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp (208668 => 208669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp        2016-11-13 10:05:43 UTC (rev 208668)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp        2016-11-13 18:31:14 UTC (rev 208669)
</span><span class="lines">@@ -40,16 +40,6 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-const char* const CryptoAlgorithmRSASSA_PKCS1_v1_5::s_name = &quot;RSASSA-PKCS1-v1_5&quot;;
-
-CryptoAlgorithmRSASSA_PKCS1_v1_5::CryptoAlgorithmRSASSA_PKCS1_v1_5()
-{
-}
-
-CryptoAlgorithmRSASSA_PKCS1_v1_5::~CryptoAlgorithmRSASSA_PKCS1_v1_5()
-{
-}
-
</del><span class="cx"> Ref&lt;CryptoAlgorithm&gt; CryptoAlgorithmRSASSA_PKCS1_v1_5::create()
</span><span class="cx"> {
</span><span class="cx">     return adoptRef(*new CryptoAlgorithmRSASSA_PKCS1_v1_5);
</span><span class="lines">@@ -72,7 +62,7 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmRSASSA_PKCS1_v1_5::generateKey(const std::unique_ptr&lt;CryptoAlgorithmParameters&gt;&amp;&amp; parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyOrKeyPairCallback&amp;&amp; callback, ExceptionCallback&amp;&amp; exceptionCallback, ScriptExecutionContext* context)
</del><ins>+void CryptoAlgorithmRSASSA_PKCS1_v1_5::generateKey(const std::unique_ptr&lt;CryptoAlgorithmParameters&gt;&amp;&amp; parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyOrKeyPairCallback&amp;&amp; callback, ExceptionCallback&amp;&amp; exceptionCallback, ScriptExecutionContext&amp; context)
</ins><span class="cx"> {
</span><span class="cx">     const auto&amp; rsaParameters = downcast&lt;CryptoAlgorithmRsaHashedKeyGenParams&gt;(*parameters);
</span><span class="cx"> 
</span><span class="lines">@@ -89,7 +79,7 @@
</span><span class="cx">     auto failureCallback = [capturedCallback = WTFMove(exceptionCallback)]() {
</span><span class="cx">         capturedCallback(OperationError);
</span><span class="cx">     };
</span><del>-    CryptoKeyRSA::generatePair(CryptoAlgorithmIdentifier::RSASSA_PKCS1_v1_5, rsaParameters.hashIdentifier, true, rsaParameters.modulusLength, rsaParameters.publicExponentVector(), extractable, usages, WTFMove(keyPairCallback), WTFMove(failureCallback), context);
</del><ins>+    CryptoKeyRSA::generatePair(CryptoAlgorithmIdentifier::RSASSA_PKCS1_v1_5, rsaParameters.hashIdentifier, true, rsaParameters.modulusLength, rsaParameters.publicExponentVector(), extractable, usages, WTFMove(keyPairCallback), WTFMove(failureCallback), &amp;context);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey(SubtleCrypto::KeyFormat format, KeyData&amp;&amp; data, const std::unique_ptr&lt;CryptoAlgorithmParameters&gt;&amp;&amp; parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyCallback&amp;&amp; callback, ExceptionCallback&amp;&amp; exceptionCallback)
</span><span class="lines">@@ -150,53 +140,43 @@
</span><span class="cx">     callback(*result);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmRSASSA_PKCS1_v1_5::sign(const CryptoAlgorithmParametersDeprecated&amp; parameters, const CryptoKey&amp; key, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithmRSASSA_PKCS1_v1_5::sign(const CryptoAlgorithmParametersDeprecated&amp; parameters, const CryptoKey&amp; key, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback)
</ins><span class="cx"> {
</span><del>-    const CryptoAlgorithmRsaSsaParamsDeprecated&amp; rsaSSAParameters = downcast&lt;CryptoAlgorithmRsaSsaParamsDeprecated&gt;(parameters);
-
-    if (!keyAlgorithmMatches(rsaSSAParameters, key)) {
-        ec = NOT_SUPPORTED_ERR;
-        return;
-    }
-
-    platformSign(rsaSSAParameters, downcast&lt;CryptoKeyRSA&gt;(key), data, WTFMove(callback), WTFMove(failureCallback), ec);
</del><ins>+    auto&amp; rsaSSAParameters = downcast&lt;CryptoAlgorithmRsaSsaParamsDeprecated&gt;(parameters);
+    if (!keyAlgorithmMatches(rsaSSAParameters, key))
+        return Exception { NOT_SUPPORTED_ERR };
+    return platformSign(rsaSSAParameters, downcast&lt;CryptoKeyRSA&gt;(key), data, WTFMove(callback), WTFMove(failureCallback));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmRSASSA_PKCS1_v1_5::verify(const CryptoAlgorithmParametersDeprecated&amp; parameters, const CryptoKey&amp; key, const CryptoOperationData&amp; signature, const CryptoOperationData&amp; data, BoolCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithmRSASSA_PKCS1_v1_5::verify(const CryptoAlgorithmParametersDeprecated&amp; parameters, const CryptoKey&amp; key, const CryptoOperationData&amp; signature, const CryptoOperationData&amp; data, BoolCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback)
</ins><span class="cx"> {
</span><del>-    const CryptoAlgorithmRsaSsaParamsDeprecated&amp; rsaSSAParameters = downcast&lt;CryptoAlgorithmRsaSsaParamsDeprecated&gt;(parameters);
-
-    if (!keyAlgorithmMatches(rsaSSAParameters, key)) {
-        ec = NOT_SUPPORTED_ERR;
-        return;
-    }
-
-    platformVerify(rsaSSAParameters,  downcast&lt;CryptoKeyRSA&gt;(key), signature, data, WTFMove(callback), WTFMove(failureCallback), ec);
</del><ins>+    auto&amp; rsaSSAParameters = downcast&lt;CryptoAlgorithmRsaSsaParamsDeprecated&gt;(parameters);
+    if (!keyAlgorithmMatches(rsaSSAParameters, key))
+        return Exception { NOT_SUPPORTED_ERR };
+    return platformVerify(rsaSSAParameters,  downcast&lt;CryptoKeyRSA&gt;(key), signature, data, WTFMove(callback), WTFMove(failureCallback));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmRSASSA_PKCS1_v1_5::generateKey(const CryptoAlgorithmParametersDeprecated&amp; parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyOrKeyPairCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;, ScriptExecutionContext* context)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithmRSASSA_PKCS1_v1_5::generateKey(const CryptoAlgorithmParametersDeprecated&amp; parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyOrKeyPairCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ScriptExecutionContext&amp; context)
</ins><span class="cx"> {
</span><del>-    const CryptoAlgorithmRsaKeyGenParamsDeprecated&amp; rsaParameters = downcast&lt;CryptoAlgorithmRsaKeyGenParamsDeprecated&gt;(parameters);
-
</del><ins>+    auto&amp; rsaParameters = downcast&lt;CryptoAlgorithmRsaKeyGenParamsDeprecated&gt;(parameters);
</ins><span class="cx">     auto keyPairCallback = [capturedCallback = WTFMove(callback)](CryptoKeyPair&amp; pair) {
</span><span class="cx">         capturedCallback(nullptr, &amp;pair);
</span><span class="cx">     };
</span><del>-
-    CryptoKeyRSA::generatePair(CryptoAlgorithmIdentifier::RSASSA_PKCS1_v1_5, rsaParameters.hash, rsaParameters.hasHash, rsaParameters.modulusLength, rsaParameters.publicExponent, extractable, usages, WTFMove(keyPairCallback), WTFMove(failureCallback), context);
</del><ins>+    CryptoKeyRSA::generatePair(CryptoAlgorithmIdentifier::RSASSA_PKCS1_v1_5, rsaParameters.hash, rsaParameters.hasHash, rsaParameters.modulusLength, rsaParameters.publicExponent, extractable, usages, WTFMove(keyPairCallback), WTFMove(failureCallback), &amp;context);
+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey(const CryptoAlgorithmParametersDeprecated&amp; parameters, const CryptoKeyData&amp; keyData, bool extractable, CryptoKeyUsageBitmap usage, KeyCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey(const CryptoAlgorithmParametersDeprecated&amp; parameters, const CryptoKeyData&amp; keyData, bool extractable, CryptoKeyUsageBitmap usage, KeyCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback)
</ins><span class="cx"> {
</span><del>-    const CryptoAlgorithmRsaKeyParamsWithHashDeprecated&amp; rsaKeyParameters = downcast&lt;CryptoAlgorithmRsaKeyParamsWithHashDeprecated&gt;(parameters);
-    const CryptoKeyDataRSAComponents&amp; rsaComponents = downcast&lt;CryptoKeyDataRSAComponents&gt;(keyData);
-
-    RefPtr&lt;CryptoKeyRSA&gt; result = CryptoKeyRSA::create(CryptoAlgorithmIdentifier::RSASSA_PKCS1_v1_5, rsaKeyParameters.hash, rsaKeyParameters.hasHash, rsaComponents, extractable, usage);
</del><ins>+    auto&amp; rsaKeyParameters = downcast&lt;CryptoAlgorithmRsaKeyParamsWithHashDeprecated&gt;(parameters);
+    auto&amp; rsaComponents = downcast&lt;CryptoKeyDataRSAComponents&gt;(keyData);
+    auto result = CryptoKeyRSA::create(CryptoAlgorithmIdentifier::RSASSA_PKCS1_v1_5, rsaKeyParameters.hash, rsaKeyParameters.hasHash, rsaComponents, extractable, usage);
</ins><span class="cx">     if (!result) {
</span><span class="cx">         failureCallback();
</span><del>-        return;
</del><ins>+        return { };
</ins><span class="cx">     }
</span><del>-
</del><span class="cx">     callback(*result);
</span><ins>+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmRSASSA_PKCS1_v1_5h"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h (208668 => 208669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h        2016-11-13 10:05:43 UTC (rev 208668)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h        2016-11-13 18:31:14 UTC (rev 208669)
</span><span class="lines">@@ -36,29 +36,25 @@
</span><span class="cx"> 
</span><span class="cx"> class CryptoAlgorithmRSASSA_PKCS1_v1_5 final : public CryptoAlgorithm {
</span><span class="cx"> public:
</span><del>-    static const char* const s_name;
-    static const CryptoAlgorithmIdentifier s_identifier = CryptoAlgorithmIdentifier::RSASSA_PKCS1_v1_5;
-
</del><ins>+    static constexpr const char* s_name = &quot;RSASSA-PKCS1-v1_5&quot;;
+    static constexpr CryptoAlgorithmIdentifier s_identifier = CryptoAlgorithmIdentifier::RSASSA_PKCS1_v1_5;
</ins><span class="cx">     static Ref&lt;CryptoAlgorithm&gt; create();
</span><span class="cx"> 
</span><del>-    CryptoAlgorithmIdentifier identifier() const override;
</del><ins>+private:
+    CryptoAlgorithmRSASSA_PKCS1_v1_5() = default;
+    CryptoAlgorithmIdentifier identifier() const final;
</ins><span class="cx"> 
</span><del>-    void generateKey(const std::unique_ptr&lt;CryptoAlgorithmParameters&gt;&amp;&amp;, bool extractable, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&amp;&amp;, ExceptionCallback&amp;&amp;, ScriptExecutionContext*) final;
</del><ins>+    void generateKey(const std::unique_ptr&lt;CryptoAlgorithmParameters&gt;&amp;&amp;, bool extractable, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&amp;&amp;, ExceptionCallback&amp;&amp;, ScriptExecutionContext&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"> 
</span><del>-    // The following will be deprecated.
-    void sign(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;) override;
-    void verify(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp;, const CryptoOperationData&amp; signature, const CryptoOperationData&amp;, BoolCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;) override;
-    void generateKey(const CryptoAlgorithmParametersDeprecated&amp;, bool extractable, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;, ScriptExecutionContext*) override;
-    void importKey(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKeyData&amp;, bool extractable, CryptoKeyUsageBitmap, KeyCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;) override;
</del><ins>+    ExceptionOr&lt;void&gt; sign(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback) final;
+    ExceptionOr&lt;void&gt; verify(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp;, const CryptoOperationData&amp; signature, const CryptoOperationData&amp;, BoolCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback) final;
+    ExceptionOr&lt;void&gt; generateKey(const CryptoAlgorithmParametersDeprecated&amp;, bool extractable, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ScriptExecutionContext&amp;) final;
+    ExceptionOr&lt;void&gt; importKey(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKeyData&amp;, bool extractable, CryptoKeyUsageBitmap, KeyCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback) final;
</ins><span class="cx"> 
</span><del>-private:
-    CryptoAlgorithmRSASSA_PKCS1_v1_5();
-    virtual ~CryptoAlgorithmRSASSA_PKCS1_v1_5();
-
</del><span class="cx">     bool keyAlgorithmMatches(const CryptoAlgorithmRsaSsaParamsDeprecated&amp; algorithmParameters, const CryptoKey&amp;) const;
</span><del>-    void platformSign(const CryptoAlgorithmRsaSsaParamsDeprecated&amp;, const CryptoKeyRSA&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;);
-    void platformVerify(const CryptoAlgorithmRsaSsaParamsDeprecated&amp;, const CryptoKeyRSA&amp;, const CryptoOperationData&amp; signature, const CryptoOperationData&amp;, BoolCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;);
</del><ins>+    ExceptionOr&lt;void&gt; platformSign(const CryptoAlgorithmRsaSsaParamsDeprecated&amp;, const CryptoKeyRSA&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback);
+    ExceptionOr&lt;void&gt; platformVerify(const CryptoAlgorithmRsaSsaParamsDeprecated&amp;, const CryptoKeyRSA&amp;, const CryptoOperationData&amp; signature, const CryptoOperationData&amp;, BoolCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback);
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmRSA_OAEPcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp (208668 => 208669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp        2016-11-13 10:05:43 UTC (rev 208668)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp        2016-11-13 18:31:14 UTC (rev 208669)
</span><span class="lines">@@ -40,16 +40,6 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-const char* const CryptoAlgorithmRSA_OAEP::s_name = &quot;RSA-OAEP&quot;;
-
-CryptoAlgorithmRSA_OAEP::CryptoAlgorithmRSA_OAEP()
-{
-}
-
-CryptoAlgorithmRSA_OAEP::~CryptoAlgorithmRSA_OAEP()
-{
-}
-
</del><span class="cx"> Ref&lt;CryptoAlgorithm&gt; CryptoAlgorithmRSA_OAEP::create()
</span><span class="cx"> {
</span><span class="cx">     return adoptRef(*new CryptoAlgorithmRSA_OAEP);
</span><span class="lines">@@ -72,7 +62,7 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmRSA_OAEP::generateKey(const std::unique_ptr&lt;CryptoAlgorithmParameters&gt;&amp;&amp; parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyOrKeyPairCallback&amp;&amp; callback, ExceptionCallback&amp;&amp; exceptionCallback, ScriptExecutionContext* context)
</del><ins>+void CryptoAlgorithmRSA_OAEP::generateKey(const std::unique_ptr&lt;CryptoAlgorithmParameters&gt;&amp;&amp; parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyOrKeyPairCallback&amp;&amp; callback, ExceptionCallback&amp;&amp; exceptionCallback, ScriptExecutionContext&amp; context)
</ins><span class="cx"> {
</span><span class="cx">     const auto&amp; rsaParameters = downcast&lt;CryptoAlgorithmRsaHashedKeyGenParams&gt;(*parameters);
</span><span class="cx"> 
</span><span class="lines">@@ -89,7 +79,7 @@
</span><span class="cx">     auto failureCallback = [capturedCallback = WTFMove(exceptionCallback)]() {
</span><span class="cx">         capturedCallback(OperationError);
</span><span class="cx">     };
</span><del>-    CryptoKeyRSA::generatePair(CryptoAlgorithmIdentifier::RSA_OAEP, rsaParameters.hashIdentifier, true, rsaParameters.modulusLength, rsaParameters.publicExponentVector(), extractable, usages, WTFMove(keyPairCallback), WTFMove(failureCallback), context);
</del><ins>+    CryptoKeyRSA::generatePair(CryptoAlgorithmIdentifier::RSA_OAEP, rsaParameters.hashIdentifier, true, rsaParameters.modulusLength, rsaParameters.publicExponentVector(), extractable, usages, WTFMove(keyPairCallback), WTFMove(failureCallback), &amp;context);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void CryptoAlgorithmRSA_OAEP::importKey(SubtleCrypto::KeyFormat format, KeyData&amp;&amp; data, const std::unique_ptr&lt;CryptoAlgorithmParameters&gt;&amp;&amp; parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyCallback&amp;&amp; callback, ExceptionCallback&amp;&amp; exceptionCallback)
</span><span class="lines">@@ -161,53 +151,43 @@
</span><span class="cx">     callback(*result);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmRSA_OAEP::encrypt(const CryptoAlgorithmParametersDeprecated&amp; parameters, const CryptoKey&amp; key, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithmRSA_OAEP::encrypt(const CryptoAlgorithmParametersDeprecated&amp; parameters, const CryptoKey&amp; key, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback)
</ins><span class="cx"> {
</span><del>-    const CryptoAlgorithmRsaOaepParamsDeprecated&amp; rsaOAEPParameters = downcast&lt;CryptoAlgorithmRsaOaepParamsDeprecated&gt;(parameters);
-
-    if (!keyAlgorithmMatches(rsaOAEPParameters, key)) {
-        ec = NOT_SUPPORTED_ERR;
-        return;
-    }
-
-    platformEncrypt(rsaOAEPParameters, downcast&lt;CryptoKeyRSA&gt;(key), data, WTFMove(callback), WTFMove(failureCallback), ec);
</del><ins>+    auto&amp; rsaOAEPParameters = downcast&lt;CryptoAlgorithmRsaOaepParamsDeprecated&gt;(parameters);
+    if (!keyAlgorithmMatches(rsaOAEPParameters, key))
+        return Exception { NOT_SUPPORTED_ERR };
+    return platformEncrypt(rsaOAEPParameters, downcast&lt;CryptoKeyRSA&gt;(key), data, WTFMove(callback), WTFMove(failureCallback));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmRSA_OAEP::decrypt(const CryptoAlgorithmParametersDeprecated&amp; parameters, const CryptoKey&amp; key, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithmRSA_OAEP::decrypt(const CryptoAlgorithmParametersDeprecated&amp; parameters, const CryptoKey&amp; key, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback)
</ins><span class="cx"> {
</span><del>-    const CryptoAlgorithmRsaOaepParamsDeprecated&amp; rsaOAEPParameters = downcast&lt;CryptoAlgorithmRsaOaepParamsDeprecated&gt;(parameters);
-
-    if (!keyAlgorithmMatches(rsaOAEPParameters, key)) {
-        ec = NOT_SUPPORTED_ERR;
-        return;
-    }
-
-    platformDecrypt(rsaOAEPParameters, downcast&lt;CryptoKeyRSA&gt;(key), data, WTFMove(callback), WTFMove(failureCallback), ec);
</del><ins>+    auto&amp; rsaOAEPParameters = downcast&lt;CryptoAlgorithmRsaOaepParamsDeprecated&gt;(parameters);
+    if (!keyAlgorithmMatches(rsaOAEPParameters, key))
+        return Exception { NOT_SUPPORTED_ERR };
+    return platformDecrypt(rsaOAEPParameters, downcast&lt;CryptoKeyRSA&gt;(key), data, WTFMove(callback), WTFMove(failureCallback));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmRSA_OAEP::generateKey(const CryptoAlgorithmParametersDeprecated&amp; parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyOrKeyPairCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;, ScriptExecutionContext* context)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithmRSA_OAEP::generateKey(const CryptoAlgorithmParametersDeprecated&amp; parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyOrKeyPairCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ScriptExecutionContext&amp; context)
</ins><span class="cx"> {
</span><del>-    const CryptoAlgorithmRsaKeyGenParamsDeprecated&amp; rsaParameters = downcast&lt;CryptoAlgorithmRsaKeyGenParamsDeprecated&gt;(parameters);
-
</del><ins>+    auto&amp; rsaParameters = downcast&lt;CryptoAlgorithmRsaKeyGenParamsDeprecated&gt;(parameters);
</ins><span class="cx">     auto keyPairCallback = [capturedCallback = WTFMove(callback)](CryptoKeyPair&amp; pair) {
</span><span class="cx">         capturedCallback(nullptr, &amp;pair);
</span><span class="cx">     };
</span><del>-
-    CryptoKeyRSA::generatePair(CryptoAlgorithmIdentifier::RSA_OAEP, rsaParameters.hash, rsaParameters.hasHash, rsaParameters.modulusLength, rsaParameters.publicExponent, extractable, usages, WTFMove(keyPairCallback), WTFMove(failureCallback), context);
</del><ins>+    CryptoKeyRSA::generatePair(CryptoAlgorithmIdentifier::RSA_OAEP, rsaParameters.hash, rsaParameters.hasHash, rsaParameters.modulusLength, rsaParameters.publicExponent, extractable, usages, WTFMove(keyPairCallback), WTFMove(failureCallback), &amp;context);
+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmRSA_OAEP::importKey(const CryptoAlgorithmParametersDeprecated&amp; parameters, const CryptoKeyData&amp; keyData, bool extractable, CryptoKeyUsageBitmap usage, KeyCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithmRSA_OAEP::importKey(const CryptoAlgorithmParametersDeprecated&amp; parameters, const CryptoKeyData&amp; keyData, bool extractable, CryptoKeyUsageBitmap usage, KeyCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback)
</ins><span class="cx"> {
</span><del>-    const CryptoAlgorithmRsaKeyParamsWithHashDeprecated&amp; rsaKeyParameters = downcast&lt;CryptoAlgorithmRsaKeyParamsWithHashDeprecated&gt;(parameters);
-    const CryptoKeyDataRSAComponents&amp; rsaComponents = downcast&lt;CryptoKeyDataRSAComponents&gt;(keyData);
-
-    RefPtr&lt;CryptoKeyRSA&gt; result = CryptoKeyRSA::create(CryptoAlgorithmIdentifier::RSA_OAEP, rsaKeyParameters.hash, rsaKeyParameters.hasHash, rsaComponents, extractable, usage);
</del><ins>+    auto&amp; rsaKeyParameters = downcast&lt;CryptoAlgorithmRsaKeyParamsWithHashDeprecated&gt;(parameters);
+    auto&amp; rsaComponents = downcast&lt;CryptoKeyDataRSAComponents&gt;(keyData);
+    auto result = CryptoKeyRSA::create(CryptoAlgorithmIdentifier::RSA_OAEP, rsaKeyParameters.hash, rsaKeyParameters.hasHash, rsaComponents, extractable, usage);
</ins><span class="cx">     if (!result) {
</span><span class="cx">         failureCallback();
</span><del>-        return;
</del><ins>+        return { };
</ins><span class="cx">     }
</span><del>-
</del><span class="cx">     callback(*result);
</span><ins>+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmRSA_OAEPh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSA_OAEP.h (208668 => 208669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSA_OAEP.h        2016-11-13 10:05:43 UTC (rev 208668)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSA_OAEP.h        2016-11-13 18:31:14 UTC (rev 208669)
</span><span class="lines">@@ -36,29 +36,25 @@
</span><span class="cx"> 
</span><span class="cx"> class CryptoAlgorithmRSA_OAEP final : public CryptoAlgorithm {
</span><span class="cx"> public:
</span><del>-    static const char* const s_name;
-    static const CryptoAlgorithmIdentifier s_identifier = CryptoAlgorithmIdentifier::RSA_OAEP;
-
</del><ins>+    static constexpr const char* s_name = &quot;RSA-OAEP&quot;;
+    static constexpr CryptoAlgorithmIdentifier s_identifier = CryptoAlgorithmIdentifier::RSA_OAEP;
</ins><span class="cx">     static Ref&lt;CryptoAlgorithm&gt; create();
</span><span class="cx"> 
</span><del>-    CryptoAlgorithmIdentifier identifier() const override;
</del><ins>+private:
+    CryptoAlgorithmRSA_OAEP() = default;
+    CryptoAlgorithmIdentifier identifier() const final;
</ins><span class="cx"> 
</span><del>-    void generateKey(const std::unique_ptr&lt;CryptoAlgorithmParameters&gt;&amp;&amp;, bool extractable, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&amp;&amp;, ExceptionCallback&amp;&amp;, ScriptExecutionContext*) final;
</del><ins>+    void generateKey(const std::unique_ptr&lt;CryptoAlgorithmParameters&gt;&amp;&amp;, bool extractable, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&amp;&amp;, ExceptionCallback&amp;&amp;, ScriptExecutionContext&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"> 
</span><del>-    // The following will be deprecated.
-    void encrypt(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;) override;
-    void decrypt(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;) override;
-    void generateKey(const CryptoAlgorithmParametersDeprecated&amp;, bool extractable, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;, ScriptExecutionContext*) override;
-    void importKey(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKeyData&amp;, bool extractable, CryptoKeyUsageBitmap, KeyCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;) override;
</del><ins>+    ExceptionOr&lt;void&gt; encrypt(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback) final;
+    ExceptionOr&lt;void&gt; decrypt(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKey&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback) final;
+    ExceptionOr&lt;void&gt; generateKey(const CryptoAlgorithmParametersDeprecated&amp;, bool extractable, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ScriptExecutionContext&amp;) final;
+    ExceptionOr&lt;void&gt; importKey(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoKeyData&amp;, bool extractable, CryptoKeyUsageBitmap, KeyCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback) final;
</ins><span class="cx"> 
</span><del>-private:
-    CryptoAlgorithmRSA_OAEP();
-    virtual ~CryptoAlgorithmRSA_OAEP();
-
</del><span class="cx">     bool keyAlgorithmMatches(const CryptoAlgorithmRsaOaepParamsDeprecated&amp; algorithmParameters, const CryptoKey&amp;) const;
</span><del>-    void platformEncrypt(const CryptoAlgorithmRsaOaepParamsDeprecated&amp;, const CryptoKeyRSA&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;);
-    void platformDecrypt(const CryptoAlgorithmRsaOaepParamsDeprecated&amp;, const CryptoKeyRSA&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;);
</del><ins>+    ExceptionOr&lt;void&gt; platformEncrypt(const CryptoAlgorithmRsaOaepParamsDeprecated&amp;, const CryptoKeyRSA&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback);
+    ExceptionOr&lt;void&gt; platformDecrypt(const CryptoAlgorithmRsaOaepParamsDeprecated&amp;, const CryptoKeyRSA&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback);
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmSHA1cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA1.cpp (208668 => 208669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA1.cpp        2016-11-13 10:05:43 UTC (rev 208668)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA1.cpp        2016-11-13 18:31:14 UTC (rev 208669)
</span><span class="lines">@@ -32,16 +32,6 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-const char* const CryptoAlgorithmSHA1::s_name = &quot;SHA-1&quot;;
-
-CryptoAlgorithmSHA1::CryptoAlgorithmSHA1()
-{
-}
-
-CryptoAlgorithmSHA1::~CryptoAlgorithmSHA1()
-{
-}
-
</del><span class="cx"> Ref&lt;CryptoAlgorithm&gt; CryptoAlgorithmSHA1::create()
</span><span class="cx"> {
</span><span class="cx">     return adoptRef(*new CryptoAlgorithmSHA1);
</span><span class="lines">@@ -52,17 +42,16 @@
</span><span class="cx">     return s_identifier;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmSHA1::digest(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithmSHA1::digest(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback)
</ins><span class="cx"> {
</span><del>-    std::unique_ptr&lt;CryptoDigest&gt; digest = CryptoDigest::create(CryptoDigest::Algorithm::SHA_1);
</del><ins>+    auto digest = CryptoDigest::create(CryptoDigest::Algorithm::SHA_1);
</ins><span class="cx">     if (!digest) {
</span><span class="cx">         failureCallback();
</span><del>-        return;
</del><ins>+        return { };
</ins><span class="cx">     }
</span><del>-
</del><span class="cx">     digest-&gt;addBytes(data.first, data.second);
</span><del>-
</del><span class="cx">     callback(digest-&gt;computeHash());
</span><ins>+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmSHA1h"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA1.h (208668 => 208669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA1.h        2016-11-13 10:05:43 UTC (rev 208668)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA1.h        2016-11-13 18:31:14 UTC (rev 208669)
</span><span class="lines">@@ -33,18 +33,14 @@
</span><span class="cx"> 
</span><span class="cx"> class CryptoAlgorithmSHA1 final : public CryptoAlgorithm {
</span><span class="cx"> public:
</span><del>-    static const char* const s_name;
-    static const CryptoAlgorithmIdentifier s_identifier = CryptoAlgorithmIdentifier::SHA_1;
-
</del><ins>+    static constexpr const char* s_name = &quot;SHA-1&quot;;
+    static constexpr CryptoAlgorithmIdentifier s_identifier = CryptoAlgorithmIdentifier::SHA_1;
</ins><span class="cx">     static Ref&lt;CryptoAlgorithm&gt; create();
</span><span class="cx"> 
</span><del>-    CryptoAlgorithmIdentifier identifier() const override;
-
-    void digest(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;) override;
-
</del><span class="cx"> private:
</span><del>-    CryptoAlgorithmSHA1();
-    virtual ~CryptoAlgorithmSHA1();
</del><ins>+    CryptoAlgorithmSHA1() = default;
+    CryptoAlgorithmIdentifier identifier() const final;
+    ExceptionOr&lt;void&gt; digest(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback) final;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmSHA224cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA224.cpp (208668 => 208669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA224.cpp        2016-11-13 10:05:43 UTC (rev 208668)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA224.cpp        2016-11-13 18:31:14 UTC (rev 208669)
</span><span class="lines">@@ -32,16 +32,6 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-const char* const CryptoAlgorithmSHA224::s_name = &quot;SHA-224&quot;;
-
-CryptoAlgorithmSHA224::CryptoAlgorithmSHA224()
-{
-}
-
-CryptoAlgorithmSHA224::~CryptoAlgorithmSHA224()
-{
-}
-
</del><span class="cx"> Ref&lt;CryptoAlgorithm&gt; CryptoAlgorithmSHA224::create()
</span><span class="cx"> {
</span><span class="cx">     return adoptRef(*new CryptoAlgorithmSHA224);
</span><span class="lines">@@ -52,17 +42,16 @@
</span><span class="cx">     return s_identifier;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmSHA224::digest(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithmSHA224::digest(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback)
</ins><span class="cx"> {
</span><del>-    std::unique_ptr&lt;CryptoDigest&gt; digest = CryptoDigest::create(CryptoDigest::Algorithm::SHA_224);
</del><ins>+    auto digest = CryptoDigest::create(CryptoDigest::Algorithm::SHA_224);
</ins><span class="cx">     if (!digest) {
</span><span class="cx">         failureCallback();
</span><del>-        return;
</del><ins>+        return { };
</ins><span class="cx">     }
</span><del>-
</del><span class="cx">     digest-&gt;addBytes(data.first, data.second);
</span><del>-
</del><span class="cx">     callback(digest-&gt;computeHash());
</span><ins>+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmSHA224h"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA224.h (208668 => 208669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA224.h        2016-11-13 10:05:43 UTC (rev 208668)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA224.h        2016-11-13 18:31:14 UTC (rev 208669)
</span><span class="lines">@@ -33,18 +33,14 @@
</span><span class="cx"> 
</span><span class="cx"> class CryptoAlgorithmSHA224 final : public CryptoAlgorithm {
</span><span class="cx"> public:
</span><del>-    static const char* const s_name;
-    static const CryptoAlgorithmIdentifier s_identifier = CryptoAlgorithmIdentifier::SHA_224;
-
</del><ins>+    static constexpr const char* s_name = &quot;SHA-224&quot;;
+    static constexpr CryptoAlgorithmIdentifier s_identifier = CryptoAlgorithmIdentifier::SHA_224;
</ins><span class="cx">     static Ref&lt;CryptoAlgorithm&gt; create();
</span><span class="cx"> 
</span><del>-    CryptoAlgorithmIdentifier identifier() const override;
-
-    void digest(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;) override;
-
</del><span class="cx"> private:
</span><del>-    CryptoAlgorithmSHA224();
-    virtual ~CryptoAlgorithmSHA224();
</del><ins>+    CryptoAlgorithmSHA224() = default;
+    CryptoAlgorithmIdentifier identifier() const final;
+    ExceptionOr&lt;void&gt; digest(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback) final;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmSHA256cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA256.cpp (208668 => 208669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA256.cpp        2016-11-13 10:05:43 UTC (rev 208668)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA256.cpp        2016-11-13 18:31:14 UTC (rev 208669)
</span><span class="lines">@@ -32,16 +32,6 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-const char* const CryptoAlgorithmSHA256::s_name = &quot;SHA-256&quot;;
-
-CryptoAlgorithmSHA256::CryptoAlgorithmSHA256()
-{
-}
-
-CryptoAlgorithmSHA256::~CryptoAlgorithmSHA256()
-{
-}
-
</del><span class="cx"> Ref&lt;CryptoAlgorithm&gt; CryptoAlgorithmSHA256::create()
</span><span class="cx"> {
</span><span class="cx">     return adoptRef(*new CryptoAlgorithmSHA256);
</span><span class="lines">@@ -52,17 +42,16 @@
</span><span class="cx">     return s_identifier;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmSHA256::digest(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithmSHA256::digest(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback)
</ins><span class="cx"> {
</span><del>-    std::unique_ptr&lt;CryptoDigest&gt; digest = CryptoDigest::create(CryptoDigest::Algorithm::SHA_256);
</del><ins>+    auto digest = CryptoDigest::create(CryptoDigest::Algorithm::SHA_256);
</ins><span class="cx">     if (!digest) {
</span><span class="cx">         failureCallback();
</span><del>-        return;
</del><ins>+        return { };
</ins><span class="cx">     }
</span><del>-
</del><span class="cx">     digest-&gt;addBytes(data.first, data.second);
</span><del>-
</del><span class="cx">     callback(digest-&gt;computeHash());
</span><ins>+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmSHA256h"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA256.h (208668 => 208669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA256.h        2016-11-13 10:05:43 UTC (rev 208668)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA256.h        2016-11-13 18:31:14 UTC (rev 208669)
</span><span class="lines">@@ -33,18 +33,14 @@
</span><span class="cx"> 
</span><span class="cx"> class CryptoAlgorithmSHA256 final : public CryptoAlgorithm {
</span><span class="cx"> public:
</span><del>-    static const char* const s_name;
</del><ins>+    static constexpr const char* s_name = &quot;SHA-256&quot;;
</ins><span class="cx">     static const CryptoAlgorithmIdentifier s_identifier = CryptoAlgorithmIdentifier::SHA_256;
</span><del>-
</del><span class="cx">     static Ref&lt;CryptoAlgorithm&gt; create();
</span><span class="cx"> 
</span><del>-    CryptoAlgorithmIdentifier identifier() const override;
-
-    void digest(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;) override;
-
</del><span class="cx"> private:
</span><del>-    CryptoAlgorithmSHA256();
-    virtual ~CryptoAlgorithmSHA256();
</del><ins>+    CryptoAlgorithmSHA256() = default;
+    CryptoAlgorithmIdentifier identifier() const final;
+    ExceptionOr&lt;void&gt; digest(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback) final;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmSHA384cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA384.cpp (208668 => 208669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA384.cpp        2016-11-13 10:05:43 UTC (rev 208668)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA384.cpp        2016-11-13 18:31:14 UTC (rev 208669)
</span><span class="lines">@@ -32,16 +32,6 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-const char* const CryptoAlgorithmSHA384::s_name = &quot;SHA-384&quot;;
-
-CryptoAlgorithmSHA384::CryptoAlgorithmSHA384()
-{
-}
-
-CryptoAlgorithmSHA384::~CryptoAlgorithmSHA384()
-{
-}
-
</del><span class="cx"> Ref&lt;CryptoAlgorithm&gt; CryptoAlgorithmSHA384::create()
</span><span class="cx"> {
</span><span class="cx">     return adoptRef(*new CryptoAlgorithmSHA384);
</span><span class="lines">@@ -52,17 +42,16 @@
</span><span class="cx">     return s_identifier;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmSHA384::digest(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithmSHA384::digest(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback)
</ins><span class="cx"> {
</span><del>-    std::unique_ptr&lt;CryptoDigest&gt; digest = CryptoDigest::create(CryptoDigest::Algorithm::SHA_384);
</del><ins>+    auto digest = CryptoDigest::create(CryptoDigest::Algorithm::SHA_384);
</ins><span class="cx">     if (!digest) {
</span><span class="cx">         failureCallback();
</span><del>-        return;
</del><ins>+        return { };
</ins><span class="cx">     }
</span><del>-
</del><span class="cx">     digest-&gt;addBytes(data.first, data.second);
</span><del>-
</del><span class="cx">     callback(digest-&gt;computeHash());
</span><ins>+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmSHA384h"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA384.h (208668 => 208669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA384.h        2016-11-13 10:05:43 UTC (rev 208668)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA384.h        2016-11-13 18:31:14 UTC (rev 208669)
</span><span class="lines">@@ -33,18 +33,14 @@
</span><span class="cx"> 
</span><span class="cx"> class CryptoAlgorithmSHA384 final : public CryptoAlgorithm {
</span><span class="cx"> public:
</span><del>-    static const char* const s_name;
-    static const CryptoAlgorithmIdentifier s_identifier = CryptoAlgorithmIdentifier::SHA_384;
-
</del><ins>+    static constexpr const char* s_name = &quot;SHA-384&quot;;
+    static constexpr CryptoAlgorithmIdentifier s_identifier = CryptoAlgorithmIdentifier::SHA_384;
</ins><span class="cx">     static Ref&lt;CryptoAlgorithm&gt; create();
</span><span class="cx"> 
</span><del>-    CryptoAlgorithmIdentifier identifier() const override;
-
-    void digest(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;) override;
-
</del><span class="cx"> private:
</span><del>-    CryptoAlgorithmSHA384();
-    virtual ~CryptoAlgorithmSHA384();
</del><ins>+    CryptoAlgorithmSHA384() = default;
+    CryptoAlgorithmIdentifier identifier() const final;
+    ExceptionOr&lt;void&gt; digest(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback) final;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmSHA512cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA512.cpp (208668 => 208669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA512.cpp        2016-11-13 10:05:43 UTC (rev 208668)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA512.cpp        2016-11-13 18:31:14 UTC (rev 208669)
</span><span class="lines">@@ -32,16 +32,6 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-const char* const CryptoAlgorithmSHA512::s_name = &quot;SHA-512&quot;;
-
-CryptoAlgorithmSHA512::CryptoAlgorithmSHA512()
-{
-}
-
-CryptoAlgorithmSHA512::~CryptoAlgorithmSHA512()
-{
-}
-
</del><span class="cx"> Ref&lt;CryptoAlgorithm&gt; CryptoAlgorithmSHA512::create()
</span><span class="cx"> {
</span><span class="cx">     return adoptRef(*new CryptoAlgorithmSHA512);
</span><span class="lines">@@ -52,17 +42,16 @@
</span><span class="cx">     return s_identifier;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmSHA512::digest(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithmSHA512::digest(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback)
</ins><span class="cx"> {
</span><del>-    std::unique_ptr&lt;CryptoDigest&gt; digest = CryptoDigest::create(CryptoDigest::Algorithm::SHA_512);
</del><ins>+    auto digest = CryptoDigest::create(CryptoDigest::Algorithm::SHA_512);
</ins><span class="cx">     if (!digest) {
</span><span class="cx">         failureCallback();
</span><del>-        return;
</del><ins>+        return { };
</ins><span class="cx">     }
</span><del>-
</del><span class="cx">     digest-&gt;addBytes(data.first, data.second);
</span><del>-
</del><span class="cx">     callback(digest-&gt;computeHash());
</span><ins>+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmSHA512h"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA512.h (208668 => 208669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA512.h        2016-11-13 10:05:43 UTC (rev 208668)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA512.h        2016-11-13 18:31:14 UTC (rev 208669)
</span><span class="lines">@@ -33,18 +33,14 @@
</span><span class="cx"> 
</span><span class="cx"> class CryptoAlgorithmSHA512 final : public CryptoAlgorithm {
</span><span class="cx"> public:
</span><del>-    static const char* const s_name;
-    static const CryptoAlgorithmIdentifier s_identifier = CryptoAlgorithmIdentifier::SHA_512;
-
</del><ins>+    static constexpr const char* s_name = &quot;SHA-512&quot;;
+    static constexpr CryptoAlgorithmIdentifier s_identifier = CryptoAlgorithmIdentifier::SHA_512;
</ins><span class="cx">     static Ref&lt;CryptoAlgorithm&gt; create();
</span><span class="cx"> 
</span><del>-    CryptoAlgorithmIdentifier identifier() const override;
-
-    void digest(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;) override;
-
</del><span class="cx"> private:
</span><del>-    CryptoAlgorithmSHA512();
-    virtual ~CryptoAlgorithmSHA512();
</del><ins>+    CryptoAlgorithmSHA512() = default;
+    CryptoAlgorithmIdentifier identifier() const final;
+    ExceptionOr&lt;void&gt; digest(const CryptoAlgorithmParametersDeprecated&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp; failureCallback) final;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorecryptogcryptCryptoAlgorithmHMACGCryptcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/gcrypt/CryptoAlgorithmHMACGCrypt.cpp (208668 => 208669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/gcrypt/CryptoAlgorithmHMACGCrypt.cpp        2016-11-13 10:05:43 UTC (rev 208668)
+++ trunk/Source/WebCore/crypto/gcrypt/CryptoAlgorithmHMACGCrypt.cpp        2016-11-13 18:31:14 UTC (rev 208669)
</span><span class="lines">@@ -55,12 +55,14 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool calculateSignature(int algorithm, const Vector&lt;uint8_t&gt;&amp; key, const CryptoOperationData&amp; data, Vector&lt;uint8_t&gt;&amp; signature)
</del><ins>+static Optional&lt;Vector&lt;uint8_t&gt;&gt; calculateSignature(int algorithm, const Vector&lt;uint8_t&gt;&amp; key, const CryptoOperationData&amp; data)
</ins><span class="cx"> {
</span><span class="cx">     size_t digestLength = gcry_mac_get_algo_maclen(algorithm);
</span><span class="cx">     const void* keyData = key.data() ? key.data() : reinterpret_cast&lt;const uint8_t*&gt;(&quot;&quot;);
</span><span class="cx"> 
</span><span class="cx">     bool result = false;
</span><ins>+    Vector&lt;uint8_t&gt; signature;
+
</ins><span class="cx">     gcry_mac_hd_t hd;
</span><span class="cx">     gcry_error_t err;
</span><span class="cx"> 
</span><span class="lines">@@ -88,44 +90,43 @@
</span><span class="cx">     if (hd)
</span><span class="cx">         gcry_mac_close(hd);
</span><span class="cx"> 
</span><del>-    return result;
</del><ins>+    if (!result)
+        return Nullopt;
+
+    return WTFMove(signature);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmHMAC::platformSign(const CryptoAlgorithmHmacParamsDeprecated&amp; parameters, const CryptoKeyHMAC&amp; key, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithmHMAC::platformSign(const CryptoAlgorithmHmacParamsDeprecated&amp; parameters, const CryptoKeyHMAC&amp; key, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback)
</ins><span class="cx"> {
</span><del>-    UNUSED_PARAM(failureCallback);
</del><span class="cx">     int algorithm = getGCryptDigestAlgorithm(parameters.hash);
</span><del>-    if (algorithm == GCRY_MAC_NONE) {
-        ec = NOT_SUPPORTED_ERR;
-        return;
-    }
</del><ins>+    if (algorithm == GCRY_MAC_NONE)
+        return Exception { NOT_SUPPORTED_ERR };
</ins><span class="cx"> 
</span><del>-    Vector&lt;uint8_t&gt; signature;
-    if (calculateSignature(algorithm, key.key(), data, signature))
-        callback(signature);
</del><ins>+    auto signature = calculateSignature(algorithm, key.key(), data);
+    if (signature)
+        callback(*signature);
</ins><span class="cx">     else
</span><span class="cx">         failureCallback();
</span><ins>+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmHMAC::platformVerify(const CryptoAlgorithmHmacParamsDeprecated&amp; parameters, const CryptoKeyHMAC&amp; key, const CryptoOperationData&amp; expectedSignature, const CryptoOperationData&amp; data, BoolCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithmHMAC::platformVerify(const CryptoAlgorithmHmacParamsDeprecated&amp; parameters, const CryptoKeyHMAC&amp; key, const CryptoOperationData&amp; expectedSignature, const CryptoOperationData&amp; data, BoolCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback)
</ins><span class="cx"> {
</span><del>-    UNUSED_PARAM(failureCallback);
</del><span class="cx">     int algorithm = getGCryptDigestAlgorithm(parameters.hash);
</span><del>-    if (algorithm == GCRY_MAC_NONE) {
-        ec = NOT_SUPPORTED_ERR;
-        return;
-    }
</del><ins>+    if (algorithm == GCRY_MAC_NONE)
+        return Exception { NOT_SUPPORTED_ERR };
</ins><span class="cx"> 
</span><del>-    Vector&lt;uint8_t&gt; signature;
-    if (!calculateSignature(algorithm, key.key(), data, signature)) {
</del><ins>+    auto signature = calculateSignature(algorithm, key.key(), data);
+    if (!signature) {
</ins><span class="cx">         failureCallback();
</span><del>-        return;
</del><ins>+        return { };
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // Using a constant time comparison to prevent timing attacks.
</span><del>-    bool result = signature.size() == expectedSignature.second &amp;&amp; !constantTimeMemcmp(signature.data(), expectedSignature.first, signature.size());
</del><ins>+    bool result = signature.value().size() == expectedSignature.second &amp;&amp; !constantTimeMemcmp(signature.value().data(), expectedSignature.first, signature.value().size());
</ins><span class="cx"> 
</span><span class="cx">     callback(result);
</span><ins>+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorecryptognutlsCryptoAlgorithmAES_CBCGnuTLScpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/gnutls/CryptoAlgorithmAES_CBCGnuTLS.cpp (208668 => 208669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/gnutls/CryptoAlgorithmAES_CBCGnuTLS.cpp        2016-11-13 10:05:43 UTC (rev 208668)
+++ trunk/Source/WebCore/crypto/gnutls/CryptoAlgorithmAES_CBCGnuTLS.cpp        2016-11-13 18:31:14 UTC (rev 208669)
</span><span class="lines">@@ -28,35 +28,21 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(SUBTLE_CRYPTO)
</span><span class="cx"> 
</span><del>-#include &quot;CryptoAlgorithmAesCbcParamsDeprecated.h&quot;
-#include &quot;CryptoKeyAES.h&quot;
</del><span class="cx"> #include &quot;ExceptionCode.h&quot;
</span><span class="cx"> #include &quot;NotImplemented.h&quot;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmAES_CBC::platformEncrypt(const CryptoAlgorithmAesCbcParamsDeprecated&amp; parameters, const CryptoKeyAES&amp; key, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithmAES_CBC::platformEncrypt(const CryptoAlgorithmAesCbcParamsDeprecated&amp;, const CryptoKeyAES&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp;)
</ins><span class="cx"> {
</span><span class="cx">     notImplemented();
</span><del>-    ec = NOT_SUPPORTED_ERR;
-
-    UNUSED_PARAM(parameters);
-    UNUSED_PARAM(key);
-    UNUSED_PARAM(data);
-    UNUSED_PARAM(callback);
-    UNUSED_PARAM(failureCallback);
</del><ins>+    return Exception { NOT_SUPPORTED_ERR };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmAES_CBC::platformDecrypt(const CryptoAlgorithmAesCbcParamsDeprecated&amp; parameters, const CryptoKeyAES&amp; key, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithmAES_CBC::platformDecrypt(const CryptoAlgorithmAesCbcParamsDeprecated&amp;, const CryptoKeyAES&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp;)
</ins><span class="cx"> {
</span><span class="cx">     notImplemented();
</span><del>-    ec = NOT_SUPPORTED_ERR;
-
-    UNUSED_PARAM(parameters);
-    UNUSED_PARAM(key);
-    UNUSED_PARAM(data);
-    UNUSED_PARAM(callback);
-    UNUSED_PARAM(failureCallback);
</del><ins>+    return Exception { NOT_SUPPORTED_ERR };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorecryptognutlsCryptoAlgorithmAES_KWGnuTLScpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/gnutls/CryptoAlgorithmAES_KWGnuTLS.cpp (208668 => 208669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/gnutls/CryptoAlgorithmAES_KWGnuTLS.cpp        2016-11-13 10:05:43 UTC (rev 208668)
+++ trunk/Source/WebCore/crypto/gnutls/CryptoAlgorithmAES_KWGnuTLS.cpp        2016-11-13 18:31:14 UTC (rev 208669)
</span><span class="lines">@@ -28,32 +28,21 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(SUBTLE_CRYPTO)
</span><span class="cx"> 
</span><del>-#include &quot;CryptoKeyAES.h&quot;
</del><span class="cx"> #include &quot;ExceptionCode.h&quot;
</span><span class="cx"> #include &quot;NotImplemented.h&quot;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmAES_KW::platformEncrypt(const CryptoKeyAES&amp; key, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithmAES_KW::platformEncrypt(const CryptoKeyAES&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp;)
</ins><span class="cx"> {
</span><span class="cx">     notImplemented();
</span><del>-    ec = NOT_SUPPORTED_ERR;
-
-    UNUSED_PARAM(key);
-    UNUSED_PARAM(data);
-    UNUSED_PARAM(callback);
-    UNUSED_PARAM(failureCallback);
</del><ins>+    return Exception { NOT_SUPPORTED_ERR };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmAES_KW::platformDecrypt(const CryptoKeyAES&amp; key, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithmAES_KW::platformDecrypt(const CryptoKeyAES&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp;)
</ins><span class="cx"> {
</span><span class="cx">     notImplemented();
</span><del>-    ec = NOT_SUPPORTED_ERR;
-
-    UNUSED_PARAM(key);
-    UNUSED_PARAM(data);
-    UNUSED_PARAM(callback);
-    UNUSED_PARAM(failureCallback);
</del><ins>+    return Exception { NOT_SUPPORTED_ERR };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorecryptognutlsCryptoAlgorithmHMACGnuTLScpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/gnutls/CryptoAlgorithmHMACGnuTLS.cpp (208668 => 208669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/gnutls/CryptoAlgorithmHMACGnuTLS.cpp        2016-11-13 10:05:43 UTC (rev 208668)
+++ trunk/Source/WebCore/crypto/gnutls/CryptoAlgorithmHMACGnuTLS.cpp        2016-11-13 18:31:14 UTC (rev 208669)
</span><span class="lines">@@ -68,28 +68,20 @@
</span><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmHMAC::platformSign(const CryptoAlgorithmHmacParamsDeprecated&amp; parameters, const CryptoKeyHMAC&amp; key, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithmHMAC::platformSign(const CryptoAlgorithmHmacParamsDeprecated&amp; parameters, const CryptoKeyHMAC&amp; key, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp;)
</ins><span class="cx"> {
</span><del>-    UNUSED_PARAM(failureCallback);
</del><span class="cx">     gnutls_mac_algorithm_t algorithm = getGnutlsDigestAlgorithm(parameters.hash);
</span><del>-    if (algorithm == GNUTLS_MAC_UNKNOWN) {
-        ec = NOT_SUPPORTED_ERR;
-        return;
-    }
-
-    Vector&lt;uint8_t&gt; signature = calculateSignature(algorithm, key.key(), data);
-
-    callback(signature);
</del><ins>+    if (algorithm == GNUTLS_MAC_UNKNOWN)
+        return Exception { NOT_SUPPORTED_ERR };
+    callback(calculateSignature(algorithm, key.key(), data));
+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmHMAC::platformVerify(const CryptoAlgorithmHmacParamsDeprecated&amp; parameters, const CryptoKeyHMAC&amp; key, const CryptoOperationData&amp; expectedSignature, const CryptoOperationData&amp; data, BoolCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithmHMAC::platformVerify(const CryptoAlgorithmHmacParamsDeprecated&amp; parameters, const CryptoKeyHMAC&amp; key, const CryptoOperationData&amp; expectedSignature, const CryptoOperationData&amp; data, BoolCallback&amp;&amp; callback, VoidCallback&amp;&amp;)
</ins><span class="cx"> {
</span><del>-    UNUSED_PARAM(failureCallback);
</del><span class="cx">     gnutls_mac_algorithm_t algorithm = getGnutlsDigestAlgorithm(parameters.hash);
</span><del>-    if (algorithm == GNUTLS_MAC_UNKNOWN) {
-        ec = NOT_SUPPORTED_ERR;
-        return;
-    }
</del><ins>+    if (algorithm == GNUTLS_MAC_UNKNOWN)
+        return Exception { NOT_SUPPORTED_ERR };
</ins><span class="cx"> 
</span><span class="cx">     Vector&lt;uint8_t&gt; signature = calculateSignature(algorithm, key.key(), data);
</span><span class="cx"> 
</span><span class="lines">@@ -97,6 +89,8 @@
</span><span class="cx">     bool result = signature.size() == expectedSignature.second &amp;&amp; !constantTimeMemcmp(signature.data(), expectedSignature.first, signature.size());
</span><span class="cx"> 
</span><span class="cx">     callback(result);
</span><ins>+
+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorecryptognutlsCryptoAlgorithmRSAES_PKCS1_v1_5GnuTLScpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/gnutls/CryptoAlgorithmRSAES_PKCS1_v1_5GnuTLS.cpp (208668 => 208669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/gnutls/CryptoAlgorithmRSAES_PKCS1_v1_5GnuTLS.cpp        2016-11-13 10:05:43 UTC (rev 208668)
+++ trunk/Source/WebCore/crypto/gnutls/CryptoAlgorithmRSAES_PKCS1_v1_5GnuTLS.cpp        2016-11-13 18:31:14 UTC (rev 208669)
</span><span class="lines">@@ -34,26 +34,16 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmRSAES_PKCS1_v1_5::platformEncrypt(const CryptoKeyRSA&amp; key, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithmRSAES_PKCS1_v1_5::platformEncrypt(const CryptoKeyRSA&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp;)
</ins><span class="cx"> {
</span><span class="cx">     notImplemented();
</span><del>-    ec = NOT_SUPPORTED_ERR;
-
-    UNUSED_PARAM(key);
-    UNUSED_PARAM(data);
-    UNUSED_PARAM(callback);
-    UNUSED_PARAM(failureCallback);
</del><ins>+    return Exception { NOT_SUPPORTED_ERR };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmRSAES_PKCS1_v1_5::platformDecrypt(const CryptoKeyRSA&amp; key, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithmRSAES_PKCS1_v1_5::platformDecrypt(const CryptoKeyRSA&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp;)
</ins><span class="cx"> {
</span><span class="cx">     notImplemented();
</span><del>-    ec = NOT_SUPPORTED_ERR;
-
-    UNUSED_PARAM(key);
-    UNUSED_PARAM(data);
-    UNUSED_PARAM(callback);
-    UNUSED_PARAM(failureCallback);
</del><ins>+    return Exception { NOT_SUPPORTED_ERR };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorecryptognutlsCryptoAlgorithmRSASSA_PKCS1_v1_5GnuTLScpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/gnutls/CryptoAlgorithmRSASSA_PKCS1_v1_5GnuTLS.cpp (208668 => 208669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/gnutls/CryptoAlgorithmRSASSA_PKCS1_v1_5GnuTLS.cpp        2016-11-13 10:05:43 UTC (rev 208668)
+++ trunk/Source/WebCore/crypto/gnutls/CryptoAlgorithmRSASSA_PKCS1_v1_5GnuTLS.cpp        2016-11-13 18:31:14 UTC (rev 208669)
</span><span class="lines">@@ -35,29 +35,16 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign(const CryptoAlgorithmRsaSsaParamsDeprecated&amp; parameters, const CryptoKeyRSA&amp; key, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign(const CryptoAlgorithmRsaSsaParamsDeprecated&amp;, const CryptoKeyRSA&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp;)
</ins><span class="cx"> {
</span><span class="cx">     notImplemented();
</span><del>-    ec = NOT_SUPPORTED_ERR;
-
-    UNUSED_PARAM(parameters);
-    UNUSED_PARAM(key);
-    UNUSED_PARAM(data);
-    UNUSED_PARAM(callback);
-    UNUSED_PARAM(failureCallback);
</del><ins>+    return Exception { NOT_SUPPORTED_ERR };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmRSASSA_PKCS1_v1_5::platformVerify(const CryptoAlgorithmRsaSsaParamsDeprecated&amp; parameters, const CryptoKeyRSA&amp; key, const CryptoOperationData&amp; signature, const CryptoOperationData&amp; data, BoolCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithmRSASSA_PKCS1_v1_5::platformVerify(const CryptoAlgorithmRsaSsaParamsDeprecated&amp;, const CryptoKeyRSA&amp;, const CryptoOperationData&amp;, const CryptoOperationData&amp;, BoolCallback&amp;&amp;, VoidCallback&amp;&amp;)
</ins><span class="cx"> {
</span><span class="cx">     notImplemented();
</span><del>-    ec = NOT_SUPPORTED_ERR;
-
-    UNUSED_PARAM(parameters);
-    UNUSED_PARAM(key);
-    UNUSED_PARAM(signature);
-    UNUSED_PARAM(data);
-    UNUSED_PARAM(callback);
-    UNUSED_PARAM(failureCallback);
</del><ins>+    return Exception { NOT_SUPPORTED_ERR };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorecryptognutlsCryptoAlgorithmRSA_OAEPGnuTLScpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/gnutls/CryptoAlgorithmRSA_OAEPGnuTLS.cpp (208668 => 208669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/gnutls/CryptoAlgorithmRSA_OAEPGnuTLS.cpp        2016-11-13 10:05:43 UTC (rev 208668)
+++ trunk/Source/WebCore/crypto/gnutls/CryptoAlgorithmRSA_OAEPGnuTLS.cpp        2016-11-13 18:31:14 UTC (rev 208669)
</span><span class="lines">@@ -28,35 +28,21 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(SUBTLE_CRYPTO)
</span><span class="cx"> 
</span><del>-#include &quot;CryptoAlgorithmRsaOaepParamsDeprecated.h&quot;
-#include &quot;CryptoKeyRSA.h&quot;
</del><span class="cx"> #include &quot;ExceptionCode.h&quot;
</span><span class="cx"> #include &quot;NotImplemented.h&quot;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmRSA_OAEP::platformEncrypt(const CryptoAlgorithmRsaOaepParamsDeprecated&amp; parameters, const CryptoKeyRSA&amp; key, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithmRSA_OAEP::platformEncrypt(const CryptoAlgorithmRsaOaepParamsDeprecated&amp;, const CryptoKeyRSA&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp;)
</ins><span class="cx"> {
</span><span class="cx">     notImplemented();
</span><del>-    ec = NOT_SUPPORTED_ERR;
-
-    UNUSED_PARAM(parameters);
-    UNUSED_PARAM(key);
-    UNUSED_PARAM(data);
-    UNUSED_PARAM(callback);
-    UNUSED_PARAM(failureCallback);
</del><ins>+    return Exception { NOT_SUPPORTED_ERR };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmRSA_OAEP::platformDecrypt(const CryptoAlgorithmRsaOaepParamsDeprecated&amp; parameters, const CryptoKeyRSA&amp; key, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithmRSA_OAEP::platformDecrypt(const CryptoAlgorithmRsaOaepParamsDeprecated&amp;, const CryptoKeyRSA&amp;, const CryptoOperationData&amp;, VectorCallback&amp;&amp;, VoidCallback&amp;&amp;)
</ins><span class="cx"> {
</span><span class="cx">     notImplemented();
</span><del>-    ec = NOT_SUPPORTED_ERR;
-
-    UNUSED_PARAM(parameters);
-    UNUSED_PARAM(key);
-    UNUSED_PARAM(data);
-    UNUSED_PARAM(callback);
-    UNUSED_PARAM(failureCallback);
</del><ins>+    return Exception { NOT_SUPPORTED_ERR };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorecryptokeysCryptoKeyAEScpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/keys/CryptoKeyAES.cpp (208668 => 208669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/keys/CryptoKeyAES.cpp        2016-11-13 10:05:43 UTC (rev 208668)
+++ trunk/Source/WebCore/crypto/keys/CryptoKeyAES.cpp        2016-11-13 18:31:14 UTC (rev 208669)
</span><span class="lines">@@ -106,7 +106,7 @@
</span><span class="cx"> 
</span><span class="cx"> std::unique_ptr&lt;KeyAlgorithm&gt; CryptoKeyAES::buildAlgorithm() const
</span><span class="cx"> {
</span><del>-    return std::make_unique&lt;AesKeyAlgorithm&gt;(CryptoAlgorithmRegistry::singleton().nameForIdentifier(algorithmIdentifier()), m_key.size() * 8);
</del><ins>+    return std::make_unique&lt;AesKeyAlgorithm&gt;(CryptoAlgorithmRegistry::singleton().name(algorithmIdentifier()), m_key.size() * 8);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> std::unique_ptr&lt;CryptoKeyData&gt; CryptoKeyAES::exportData() const
</span></span></pre></div>
<a id="trunkSourceWebCorecryptokeysCryptoKeyHMACcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/keys/CryptoKeyHMAC.cpp (208668 => 208669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/keys/CryptoKeyHMAC.cpp        2016-11-13 10:05:43 UTC (rev 208668)
+++ trunk/Source/WebCore/crypto/keys/CryptoKeyHMAC.cpp        2016-11-13 18:31:14 UTC (rev 208669)
</span><span class="lines">@@ -116,8 +116,8 @@
</span><span class="cx"> 
</span><span class="cx"> std::unique_ptr&lt;KeyAlgorithm&gt; CryptoKeyHMAC::buildAlgorithm() const
</span><span class="cx"> {
</span><del>-    return std::make_unique&lt;HmacKeyAlgorithm&gt;(CryptoAlgorithmRegistry::singleton().nameForIdentifier(algorithmIdentifier()),
-        CryptoAlgorithmRegistry::singleton().nameForIdentifier(m_hash), m_key.size() * 8);
</del><ins>+    return std::make_unique&lt;HmacKeyAlgorithm&gt;(CryptoAlgorithmRegistry::singleton().name(algorithmIdentifier()),
+        CryptoAlgorithmRegistry::singleton().name(m_hash), m_key.size() * 8);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> std::unique_ptr&lt;CryptoKeyData&gt; CryptoKeyHMAC::exportData() const
</span></span></pre></div>
<a id="trunkSourceWebCorecryptomacCryptoAlgorithmAES_CBCMaccpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/mac/CryptoAlgorithmAES_CBCMac.cpp (208668 => 208669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/mac/CryptoAlgorithmAES_CBCMac.cpp        2016-11-13 10:05:43 UTC (rev 208668)
+++ trunk/Source/WebCore/crypto/mac/CryptoAlgorithmAES_CBCMac.cpp        2016-11-13 18:31:14 UTC (rev 208669)
</span><span class="lines">@@ -30,7 +30,6 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;CryptoAlgorithmAesCbcParamsDeprecated.h&quot;
</span><span class="cx"> #include &quot;CryptoKeyAES.h&quot;
</span><del>-#include &quot;ExceptionCode.h&quot;
</del><span class="cx"> #include &lt;CommonCrypto/CommonCrypto.h&gt;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -82,14 +81,16 @@
</span><span class="cx">     callback(result);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmAES_CBC::platformEncrypt(const CryptoAlgorithmAesCbcParamsDeprecated&amp; parameters, const CryptoKeyAES&amp; key, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithmAES_CBC::platformEncrypt(const CryptoAlgorithmAesCbcParamsDeprecated&amp; parameters, const CryptoKeyAES&amp; key, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback)
</ins><span class="cx"> {
</span><span class="cx">     transformAES_CBC(kCCEncrypt, parameters, key, data, WTFMove(callback), WTFMove(failureCallback));
</span><ins>+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmAES_CBC::platformDecrypt(const CryptoAlgorithmAesCbcParamsDeprecated&amp; parameters, const CryptoKeyAES&amp; key, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithmAES_CBC::platformDecrypt(const CryptoAlgorithmAesCbcParamsDeprecated&amp; parameters, const CryptoKeyAES&amp; key, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback)
</ins><span class="cx"> {
</span><span class="cx">     transformAES_CBC(kCCDecrypt, parameters, key, data, WTFMove(callback), WTFMove(failureCallback));
</span><ins>+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorecryptomacCryptoAlgorithmAES_KWMaccpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/mac/CryptoAlgorithmAES_KWMac.cpp (208668 => 208669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/mac/CryptoAlgorithmAES_KWMac.cpp        2016-11-13 10:05:43 UTC (rev 208668)
+++ trunk/Source/WebCore/crypto/mac/CryptoAlgorithmAES_KWMac.cpp        2016-11-13 18:31:14 UTC (rev 208669)
</span><span class="lines">@@ -34,13 +34,13 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmAES_KW::platformEncrypt(const CryptoKeyAES&amp; key, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithmAES_KW::platformEncrypt(const CryptoKeyAES&amp; key, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback)
</ins><span class="cx"> {
</span><span class="cx">     if (data.second % 8) {
</span><span class="cx">         // RFC 3394 uses 64-bit blocks as input.
</span><span class="cx">         // &lt;rdar://problem/15949992&gt; CommonCrypto doesn't detect incorrect data length, silently producing a bad cyphertext.
</span><span class="cx">         failureCallback();
</span><del>-        return;
</del><ins>+        return { };
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     Vector&lt;uint8_t&gt; result(CCSymmetricWrappedSize(kCCWRAPAES, data.second));
</span><span class="lines">@@ -48,13 +48,14 @@
</span><span class="cx">     int status = CCSymmetricKeyWrap(kCCWRAPAES, CCrfc3394_iv, CCrfc3394_ivLen, key.key().data(), key.key().size(), data.first, data.second, result.data(), &amp;resultSize);
</span><span class="cx">     if (status) {
</span><span class="cx">         failureCallback();
</span><del>-        return;
</del><ins>+        return { };
</ins><span class="cx">     }
</span><span class="cx">     result.shrink(resultSize);
</span><span class="cx">     callback(result);
</span><ins>+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmAES_KW::platformDecrypt(const CryptoKeyAES&amp; key, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithmAES_KW::platformDecrypt(const CryptoKeyAES&amp; key, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback)
</ins><span class="cx"> {
</span><span class="cx">     Vector&lt;uint8_t&gt; result(CCSymmetricUnwrappedSize(kCCWRAPAES, data.second));
</span><span class="cx">     size_t resultSize = result.size();
</span><span class="lines">@@ -61,16 +62,17 @@
</span><span class="cx"> 
</span><span class="cx">     if (resultSize % 8) {
</span><span class="cx">         failureCallback();
</span><del>-        return;
</del><ins>+        return { };
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     int status = CCSymmetricKeyUnwrap(kCCWRAPAES, CCrfc3394_iv, CCrfc3394_ivLen, key.key().data(), key.key().size(), data.first, data.second, result.data(), &amp;resultSize);
</span><span class="cx">     if (status) {
</span><span class="cx">         failureCallback();
</span><del>-        return;
</del><ins>+        return { };
</ins><span class="cx">     }
</span><span class="cx">     result.shrink(resultSize);
</span><span class="cx">     callback(result);
</span><ins>+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorecryptomacCryptoAlgorithmHMACMaccpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/mac/CryptoAlgorithmHMACMac.cpp (208668 => 208669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/mac/CryptoAlgorithmHMACMac.cpp        2016-11-13 10:05:43 UTC (rev 208668)
+++ trunk/Source/WebCore/crypto/mac/CryptoAlgorithmHMACMac.cpp        2016-11-13 18:31:14 UTC (rev 208669)
</span><span class="lines">@@ -36,26 +36,21 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-static bool getCommonCryptoHMACAlgorithm(CryptoAlgorithmIdentifier hashFunction, CCHmacAlgorithm&amp; algorithm)
</del><ins>+static Optional&lt;CCHmacAlgorithm&gt; commonCryptoHMACAlgorithm(CryptoAlgorithmIdentifier hashFunction)
</ins><span class="cx"> {
</span><span class="cx">     switch (hashFunction) {
</span><span class="cx">     case CryptoAlgorithmIdentifier::SHA_1:
</span><del>-        algorithm = kCCHmacAlgSHA1;
-        return true;
</del><ins>+        return kCCHmacAlgSHA1;
</ins><span class="cx">     case CryptoAlgorithmIdentifier::SHA_224:
</span><del>-        algorithm = kCCHmacAlgSHA224;
-        return true;
</del><ins>+        return kCCHmacAlgSHA224;
</ins><span class="cx">     case CryptoAlgorithmIdentifier::SHA_256:
</span><del>-        algorithm = kCCHmacAlgSHA256;
-        return true;
</del><ins>+        return kCCHmacAlgSHA256;
</ins><span class="cx">     case CryptoAlgorithmIdentifier::SHA_384:
</span><del>-        algorithm = kCCHmacAlgSHA384;
-        return true;
</del><ins>+        return kCCHmacAlgSHA384;
</ins><span class="cx">     case CryptoAlgorithmIdentifier::SHA_512:
</span><del>-        algorithm = kCCHmacAlgSHA512;
-        return true;
</del><ins>+        return kCCHmacAlgSHA512;
</ins><span class="cx">     default:
</span><del>-        return false;
</del><ins>+        return Nullopt;
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -89,33 +84,29 @@
</span><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmHMAC::platformSign(const CryptoAlgorithmHmacParamsDeprecated&amp; parameters, const CryptoKeyHMAC&amp; key, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp;, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithmHMAC::platformSign(const CryptoAlgorithmHmacParamsDeprecated&amp; parameters, const CryptoKeyHMAC&amp; key, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp;)
</ins><span class="cx"> {
</span><del>-    CCHmacAlgorithm algorithm;
-    if (!getCommonCryptoHMACAlgorithm(parameters.hash, algorithm)) {
-        ec = NOT_SUPPORTED_ERR;
-        return;
-    }
-
-    Vector&lt;uint8_t&gt; signature = calculateSignature(algorithm, key.key(), data);
-
-    callback(signature);
</del><ins>+    auto algorithm = commonCryptoHMACAlgorithm(parameters.hash);
+    if (!algorithm)
+        return Exception { NOT_SUPPORTED_ERR };
+    callback(calculateSignature(*algorithm, key.key(), data));
+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmHMAC::platformVerify(const CryptoAlgorithmHmacParamsDeprecated&amp; parameters, const CryptoKeyHMAC&amp; key, const CryptoOperationData&amp; expectedSignature, const CryptoOperationData&amp; data, BoolCallback&amp;&amp; callback, VoidCallback&amp;&amp;, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithmHMAC::platformVerify(const CryptoAlgorithmHmacParamsDeprecated&amp; parameters, const CryptoKeyHMAC&amp; key, const CryptoOperationData&amp; expectedSignature, const CryptoOperationData&amp; data, BoolCallback&amp;&amp; callback, VoidCallback&amp;&amp;)
</ins><span class="cx"> {
</span><del>-    CCHmacAlgorithm algorithm;
-    if (!getCommonCryptoHMACAlgorithm(parameters.hash, algorithm)) {
-        ec = NOT_SUPPORTED_ERR;
-        return;
-    }
</del><ins>+    auto algorithm = commonCryptoHMACAlgorithm(parameters.hash);
+    if (!algorithm)
+        return Exception { NOT_SUPPORTED_ERR };
</ins><span class="cx"> 
</span><del>-    Vector&lt;uint8_t&gt; signature = calculateSignature(algorithm, key.key(), data);
</del><ins>+    auto signature = calculateSignature(*algorithm, key.key(), data);
</ins><span class="cx"> 
</span><span class="cx">     // Using a constant time comparison to prevent timing attacks.
</span><span class="cx">     bool result = signature.size() == expectedSignature.second &amp;&amp; !constantTimeMemcmp(signature.data(), expectedSignature.first, signature.size());
</span><span class="cx"> 
</span><span class="cx">     callback(result);
</span><ins>+
+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorecryptomacCryptoAlgorithmRSAES_PKCS1_v1_5Maccpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/mac/CryptoAlgorithmRSAES_PKCS1_v1_5Mac.cpp (208668 => 208669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/mac/CryptoAlgorithmRSAES_PKCS1_v1_5Mac.cpp        2016-11-13 10:05:43 UTC (rev 208668)
+++ trunk/Source/WebCore/crypto/mac/CryptoAlgorithmRSAES_PKCS1_v1_5Mac.cpp        2016-11-13 18:31:14 UTC (rev 208669)
</span><span class="lines">@@ -33,7 +33,7 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmRSAES_PKCS1_v1_5::platformEncrypt(const CryptoKeyRSA&amp; key, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithmRSAES_PKCS1_v1_5::platformEncrypt(const CryptoKeyRSA&amp; key, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback)
</ins><span class="cx"> {
</span><span class="cx">     Vector&lt;uint8_t&gt; cipherText(1024);
</span><span class="cx">     size_t cipherTextLength = cipherText.size();
</span><span class="lines">@@ -40,14 +40,15 @@
</span><span class="cx">     CCCryptorStatus status = CCRSACryptorEncrypt(key.platformKey(), ccPKCS1Padding, data.first, data.second, cipherText.data(), &amp;cipherTextLength, 0, 0, kCCDigestNone);
</span><span class="cx">     if (status) {
</span><span class="cx">         failureCallback();
</span><del>-        return;
</del><ins>+        return { };
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     cipherText.resize(cipherTextLength);
</span><span class="cx">     callback(cipherText);
</span><ins>+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmRSAES_PKCS1_v1_5::platformDecrypt(const CryptoKeyRSA&amp; key, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp;)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithmRSAES_PKCS1_v1_5::platformDecrypt(const CryptoKeyRSA&amp; key, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback)
</ins><span class="cx"> {
</span><span class="cx">     Vector&lt;uint8_t&gt; plainText(1024);
</span><span class="cx">     size_t plainTextLength = plainText.size();
</span><span class="lines">@@ -54,11 +55,12 @@
</span><span class="cx">     CCCryptorStatus status = CCRSACryptorDecrypt(key.platformKey(), ccPKCS1Padding, data.first, data.second, plainText.data(), &amp;plainTextLength, 0, 0, kCCDigestNone);
</span><span class="cx">     if (status) {
</span><span class="cx">         failureCallback();
</span><del>-        return;
</del><ins>+        return { };
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     plainText.resize(plainTextLength);
</span><span class="cx">     callback(plainText);
</span><ins>+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorecryptomacCryptoAlgorithmRSASSA_PKCS1_v1_5Maccpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp (208668 => 208669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp        2016-11-13 10:05:43 UTC (rev 208668)
+++ trunk/Source/WebCore/crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp        2016-11-13 18:31:14 UTC (rev 208669)
</span><span class="lines">@@ -36,52 +36,41 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-inline bool getCryptoDigestAlgorithm(CryptoAlgorithmIdentifier hashFunction, CryptoDigest::Algorithm&amp; algorithm)
</del><ins>+inline Optional&lt;CryptoDigest::Algorithm&gt; cryptoDigestAlgorithm(CryptoAlgorithmIdentifier hashFunction)
</ins><span class="cx"> {
</span><span class="cx">     switch (hashFunction) {
</span><span class="cx">     case CryptoAlgorithmIdentifier::SHA_1:
</span><del>-        algorithm = CryptoDigest::Algorithm::SHA_1;
-        return true;
</del><ins>+        return CryptoDigest::Algorithm::SHA_1;
</ins><span class="cx">     case CryptoAlgorithmIdentifier::SHA_224:
</span><del>-        algorithm = CryptoDigest::Algorithm::SHA_224;
-        return true;
</del><ins>+        return CryptoDigest::Algorithm::SHA_224;
</ins><span class="cx">     case CryptoAlgorithmIdentifier::SHA_256:
</span><del>-        algorithm = CryptoDigest::Algorithm::SHA_256;
-        return true;
</del><ins>+        return CryptoDigest::Algorithm::SHA_256;
</ins><span class="cx">     case CryptoAlgorithmIdentifier::SHA_384:
</span><del>-        algorithm = CryptoDigest::Algorithm::SHA_384;
-        return true;
</del><ins>+        return CryptoDigest::Algorithm::SHA_384;
</ins><span class="cx">     case CryptoAlgorithmIdentifier::SHA_512:
</span><del>-        algorithm = CryptoDigest::Algorithm::SHA_512;
-        return true;
</del><ins>+        return CryptoDigest::Algorithm::SHA_512;
</ins><span class="cx">     default:
</span><del>-        return false;
</del><ins>+        return Nullopt;
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign(const CryptoAlgorithmRsaSsaParamsDeprecated&amp; parameters, const CryptoKeyRSA&amp; key, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign(const CryptoAlgorithmRsaSsaParamsDeprecated&amp; parameters, const CryptoKeyRSA&amp; key, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback)
</ins><span class="cx"> {
</span><span class="cx">     CCDigestAlgorithm digestAlgorithm;
</span><del>-    if (!getCommonCryptoDigestAlgorithm(parameters.hash, digestAlgorithm)) {
-        ec = NOT_SUPPORTED_ERR;
-        return;
-    }
</del><ins>+    if (!getCommonCryptoDigestAlgorithm(parameters.hash, digestAlgorithm))
+        return Exception { NOT_SUPPORTED_ERR };
</ins><span class="cx"> 
</span><del>-    CryptoDigest::Algorithm cryptoDigestAlgorithm;
-    if (!getCryptoDigestAlgorithm(parameters.hash, cryptoDigestAlgorithm)) {
-        ec = NOT_SUPPORTED_ERR;
-        return;
-    }
</del><ins>+    auto cryptoDigestAlgorithm = WebCore::cryptoDigestAlgorithm(parameters.hash);
+    if (!cryptoDigestAlgorithm)
+        return Exception { NOT_SUPPORTED_ERR };
</ins><span class="cx"> 
</span><del>-    std::unique_ptr&lt;CryptoDigest&gt; digest = CryptoDigest::create(cryptoDigestAlgorithm);
-    if (!digest) {
-        ec = NOT_SUPPORTED_ERR;
-        return;
-    }
</del><ins>+    auto digest = CryptoDigest::create(*cryptoDigestAlgorithm);
+    if (!digest)
+        return Exception { NOT_SUPPORTED_ERR };
</ins><span class="cx"> 
</span><span class="cx">     digest-&gt;addBytes(data.first, data.second);
</span><span class="cx"> 
</span><del>-    Vector&lt;uint8_t&gt; digestData = digest-&gt;computeHash();
</del><ins>+    auto digestData = digest-&gt;computeHash();
</ins><span class="cx"> 
</span><span class="cx">     Vector&lt;uint8_t&gt; signature(512);
</span><span class="cx">     size_t signatureSize = signature.size();
</span><span class="lines">@@ -89,38 +78,33 @@
</span><span class="cx">     CCCryptorStatus status = CCRSACryptorSign(key.platformKey(), ccPKCS1Padding, digestData.data(), digestData.size(), digestAlgorithm, 0, signature.data(), &amp;signatureSize);
</span><span class="cx">     if (status) {
</span><span class="cx">         failureCallback();
</span><del>-        return;
</del><ins>+        return { };
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     signature.resize(signatureSize);
</span><span class="cx">     callback(signature);
</span><ins>+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmRSASSA_PKCS1_v1_5::platformVerify(const CryptoAlgorithmRsaSsaParamsDeprecated&amp; parameters, const CryptoKeyRSA&amp; key, const CryptoOperationData&amp; signature, const CryptoOperationData&amp; data, BoolCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithmRSASSA_PKCS1_v1_5::platformVerify(const CryptoAlgorithmRsaSsaParamsDeprecated&amp; parameters, const CryptoKeyRSA&amp; key, const CryptoOperationData&amp; signature, const CryptoOperationData&amp; data, BoolCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback)
</ins><span class="cx"> {
</span><span class="cx">     CCDigestAlgorithm digestAlgorithm;
</span><del>-    if (!getCommonCryptoDigestAlgorithm(parameters.hash, digestAlgorithm)) {
-        ec = NOT_SUPPORTED_ERR;
-        return;
-    }
</del><ins>+    if (!getCommonCryptoDigestAlgorithm(parameters.hash, digestAlgorithm))
+        return Exception { NOT_SUPPORTED_ERR };
</ins><span class="cx"> 
</span><del>-    CryptoDigest::Algorithm cryptoDigestAlgorithm;
-    if (!getCryptoDigestAlgorithm(parameters.hash, cryptoDigestAlgorithm)) {
-        ec = NOT_SUPPORTED_ERR;
-        return;
-    }
</del><ins>+    auto cryptoDigestAlgorithm = WebCore::cryptoDigestAlgorithm(parameters.hash);
+    if (!cryptoDigestAlgorithm)
+        return Exception { NOT_SUPPORTED_ERR };
</ins><span class="cx"> 
</span><del>-    std::unique_ptr&lt;CryptoDigest&gt; digest = CryptoDigest::create(cryptoDigestAlgorithm);
-    if (!digest) {
-        ec = NOT_SUPPORTED_ERR;
-        return;
-    }
</del><ins>+    auto digest = CryptoDigest::create(*cryptoDigestAlgorithm);
+    if (!digest)
+        return Exception { NOT_SUPPORTED_ERR };
</ins><span class="cx"> 
</span><span class="cx">     digest-&gt;addBytes(data.first, data.second);
</span><span class="cx"> 
</span><del>-    Vector&lt;uint8_t&gt; digestData = digest-&gt;computeHash();
</del><ins>+    auto digestData = digest-&gt;computeHash();
</ins><span class="cx"> 
</span><del>-    CCCryptorStatus status = CCRSACryptorVerify(key.platformKey(), ccPKCS1Padding, digestData.data(), digestData.size(), digestAlgorithm, 0, signature.first, signature.second);
</del><ins>+    auto status = CCRSACryptorVerify(key.platformKey(), ccPKCS1Padding, digestData.data(), digestData.size(), digestAlgorithm, 0, signature.first, signature.second);
</ins><span class="cx">     if (!status)
</span><span class="cx">         callback(true);
</span><span class="cx">     else if (status == kCCNotVerified || status == kCCDecodeError) // &lt;rdar://problem/15464982&gt; CCRSACryptorVerify returns kCCDecodeError instead of kCCNotVerified sometimes
</span><span class="lines">@@ -127,6 +111,7 @@
</span><span class="cx">         callback(false);
</span><span class="cx">     else
</span><span class="cx">         failureCallback();
</span><ins>+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorecryptomacCryptoAlgorithmRSA_OAEPMaccpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp (208668 => 208669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp        2016-11-13 10:05:43 UTC (rev 208668)
+++ trunk/Source/WebCore/crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp        2016-11-13 18:31:14 UTC (rev 208669)
</span><span class="lines">@@ -35,13 +35,11 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmRSA_OAEP::platformEncrypt(const CryptoAlgorithmRsaOaepParamsDeprecated&amp; parameters, const CryptoKeyRSA&amp; key, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithmRSA_OAEP::platformEncrypt(const CryptoAlgorithmRsaOaepParamsDeprecated&amp; parameters, const CryptoKeyRSA&amp; key, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback)
</ins><span class="cx"> {
</span><span class="cx">     CCDigestAlgorithm digestAlgorithm;
</span><del>-    if (!getCommonCryptoDigestAlgorithm(parameters.hash, digestAlgorithm)) {
-        ec = NOT_SUPPORTED_ERR;
-        return;
-    }
</del><ins>+    if (!getCommonCryptoDigestAlgorithm(parameters.hash, digestAlgorithm))
+        return Exception { NOT_SUPPORTED_ERR };
</ins><span class="cx"> 
</span><span class="cx">     Vector&lt;uint8_t&gt; cipherText(1024);
</span><span class="cx">     size_t cipherTextLength = cipherText.size();
</span><span class="lines">@@ -49,20 +47,19 @@
</span><span class="cx">     CCCryptorStatus status = CCRSACryptorEncrypt(key.platformKey(), ccOAEPPadding, data.first, data.second, cipherText.data(), &amp;cipherTextLength, parameters.label.data(), parameters.label.size(), digestAlgorithm);
</span><span class="cx">     if (status) {
</span><span class="cx">         failureCallback();
</span><del>-        return;
</del><ins>+        return { };
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     cipherText.resize(cipherTextLength);
</span><span class="cx">     callback(cipherText);
</span><ins>+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CryptoAlgorithmRSA_OAEP::platformDecrypt(const CryptoAlgorithmRsaOaepParamsDeprecated&amp; parameters, const CryptoKeyRSA&amp; key, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; CryptoAlgorithmRSA_OAEP::platformDecrypt(const CryptoAlgorithmRsaOaepParamsDeprecated&amp; parameters, const CryptoKeyRSA&amp; key, const CryptoOperationData&amp; data, VectorCallback&amp;&amp; callback, VoidCallback&amp;&amp; failureCallback)
</ins><span class="cx"> {
</span><span class="cx">     CCDigestAlgorithm digestAlgorithm;
</span><del>-    if (!getCommonCryptoDigestAlgorithm(parameters.hash, digestAlgorithm)) {
-        ec = NOT_SUPPORTED_ERR;
-        return;
-    }
</del><ins>+    if (!getCommonCryptoDigestAlgorithm(parameters.hash, digestAlgorithm))
+        return Exception { NOT_SUPPORTED_ERR };
</ins><span class="cx"> 
</span><span class="cx">     Vector&lt;uint8_t&gt; plainText(1024);
</span><span class="cx">     size_t plainTextLength = plainText.size();
</span><span class="lines">@@ -69,11 +66,12 @@
</span><span class="cx">     CCCryptorStatus status = CCRSACryptorDecrypt(key.platformKey(), ccOAEPPadding, data.first, data.second, plainText.data(), &amp;plainTextLength, parameters.label.data(), parameters.label.size(), digestAlgorithm);
</span><span class="cx">     if (status) {
</span><span class="cx">         failureCallback();
</span><del>-        return;
</del><ins>+        return { };
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     plainText.resize(plainTextLength);
</span><span class="cx">     callback(plainText);
</span><ins>+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorecryptomacCryptoKeyRSAMaccpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/mac/CryptoKeyRSAMac.cpp (208668 => 208669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/mac/CryptoKeyRSAMac.cpp        2016-11-13 10:05:43 UTC (rev 208668)
+++ trunk/Source/WebCore/crypto/mac/CryptoKeyRSAMac.cpp        2016-11-13 18:31:14 UTC (rev 208669)
</span><span class="lines">@@ -162,7 +162,7 @@
</span><span class="cx"> 
</span><span class="cx"> std::unique_ptr&lt;KeyAlgorithm&gt; CryptoKeyRSA::buildAlgorithm() const
</span><span class="cx"> {
</span><del>-    String name = CryptoAlgorithmRegistry::singleton().nameForIdentifier(algorithmIdentifier());
</del><ins>+    String name = CryptoAlgorithmRegistry::singleton().name(algorithmIdentifier());
</ins><span class="cx">     Vector&lt;uint8_t&gt; modulus;
</span><span class="cx">     Vector&lt;uint8_t&gt; publicExponent;
</span><span class="cx">     CCCryptorStatus status = getPublicKeyComponents(m_platformKey, modulus, publicExponent);
</span><span class="lines">@@ -174,7 +174,7 @@
</span><span class="cx"> 
</span><span class="cx">     size_t modulusLength = modulus.size() * 8;
</span><span class="cx">     if (m_restrictedToSpecificHash)
</span><del>-        return std::make_unique&lt;RsaHashedKeyAlgorithm&gt;(name, modulusLength, WTFMove(publicExponent), CryptoAlgorithmRegistry::singleton().nameForIdentifier(m_hash));
</del><ins>+        return std::make_unique&lt;RsaHashedKeyAlgorithm&gt;(name, modulusLength, WTFMove(publicExponent), CryptoAlgorithmRegistry::singleton().name(m_hash));
</ins><span class="cx">     return std::make_unique&lt;RsaKeyAlgorithm&gt;(name, modulusLength, WTFMove(publicExponent));
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>