Unreviewed, rolling out r233867.
authordavid_fenton@apple.com <david_fenton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 16 Jul 2018 23:11:49 +0000 (23:11 +0000)
committerdavid_fenton@apple.com <david_fenton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 16 Jul 2018 23:11:49 +0000 (23:11 +0000)
caused build failures on High Sierra, Sierra and iOS

Reverted changeset:

"[WebCrypto] Crypto operations should copy their parameters
before hoping to another thread"
https://bugs.webkit.org/show_bug.cgi?id=187501
https://trac.webkit.org/changeset/233867

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233868 268f45cc-cd09-0410-ab3c-d52691b4dbfc

119 files changed:
LayoutTests/ChangeLog
LayoutTests/TestExpectations
LayoutTests/crypto/subtle/aes-gcm-import-key-unwrap-ec-raw-key-expected.txt [deleted file]
LayoutTests/crypto/subtle/aes-gcm-import-key-unwrap-ec-raw-key.html [deleted file]
LayoutTests/http/wpt/crypto/aes-cbc-crash.any-expected.txt [deleted file]
LayoutTests/http/wpt/crypto/aes-cbc-crash.any.html [deleted file]
LayoutTests/http/wpt/crypto/aes-cbc-crash.any.js [deleted file]
LayoutTests/http/wpt/crypto/aes-cbc-crash.any.worker-expected.txt [deleted file]
LayoutTests/http/wpt/crypto/aes-cbc-crash.any.worker.html [deleted file]
LayoutTests/http/wpt/crypto/aes-ctr-crash.any-expected.txt [deleted file]
LayoutTests/http/wpt/crypto/aes-ctr-crash.any.html [deleted file]
LayoutTests/http/wpt/crypto/aes-ctr-crash.any.js [deleted file]
LayoutTests/http/wpt/crypto/aes-ctr-crash.any.worker-expected.txt [deleted file]
LayoutTests/http/wpt/crypto/aes-ctr-crash.any.worker.html [deleted file]
LayoutTests/http/wpt/crypto/aes-gcm-crash.any-expected.txt [deleted file]
LayoutTests/http/wpt/crypto/aes-gcm-crash.any.html [deleted file]
LayoutTests/http/wpt/crypto/aes-gcm-crash.any.js [deleted file]
LayoutTests/http/wpt/crypto/aes-gcm-crash.any.worker-expected.txt [deleted file]
LayoutTests/http/wpt/crypto/aes-gcm-crash.any.worker.html [deleted file]
LayoutTests/http/wpt/crypto/derive-hmac-key-crash.any-expected.txt [deleted file]
LayoutTests/http/wpt/crypto/derive-hmac-key-crash.any.html [deleted file]
LayoutTests/http/wpt/crypto/derive-hmac-key-crash.any.js [deleted file]
LayoutTests/http/wpt/crypto/derive-hmac-key-crash.any.worker-expected.txt [deleted file]
LayoutTests/http/wpt/crypto/derive-hmac-key-crash.any.worker.html [deleted file]
LayoutTests/http/wpt/crypto/ecdsa-crash.any-expected.txt [deleted file]
LayoutTests/http/wpt/crypto/ecdsa-crash.any.html [deleted file]
LayoutTests/http/wpt/crypto/ecdsa-crash.any.js [deleted file]
LayoutTests/http/wpt/crypto/ecdsa-crash.any.worker-expected.txt [deleted file]
LayoutTests/http/wpt/crypto/ecdsa-crash.any.worker.html [deleted file]
LayoutTests/http/wpt/crypto/hkdf-crash.any-expected.txt [deleted file]
LayoutTests/http/wpt/crypto/hkdf-crash.any.html [deleted file]
LayoutTests/http/wpt/crypto/hkdf-crash.any.js [deleted file]
LayoutTests/http/wpt/crypto/hkdf-crash.any.worker-expected.txt [deleted file]
LayoutTests/http/wpt/crypto/hkdf-crash.any.worker.html [deleted file]
LayoutTests/http/wpt/crypto/pbkdf2-crash.any-expected.txt [deleted file]
LayoutTests/http/wpt/crypto/pbkdf2-crash.any.html [deleted file]
LayoutTests/http/wpt/crypto/pbkdf2-crash.any.js [deleted file]
LayoutTests/http/wpt/crypto/pbkdf2-crash.any.worker-expected.txt [deleted file]
LayoutTests/http/wpt/crypto/pbkdf2-crash.any.worker.html [deleted file]
LayoutTests/http/wpt/crypto/resources/common.js [deleted file]
LayoutTests/http/wpt/crypto/rsa-oaep-crash.any-expected.txt [deleted file]
LayoutTests/http/wpt/crypto/rsa-oaep-crash.any.html [deleted file]
LayoutTests/http/wpt/crypto/rsa-oaep-crash.any.js [deleted file]
LayoutTests/http/wpt/crypto/rsa-oaep-crash.any.worker-expected.txt [deleted file]
LayoutTests/http/wpt/crypto/rsa-oaep-crash.any.worker.html [deleted file]
LayoutTests/http/wpt/crypto/rsa-pss-crash.any-expected.txt [deleted file]
LayoutTests/http/wpt/crypto/rsa-pss-crash.any.html [deleted file]
LayoutTests/http/wpt/crypto/rsa-pss-crash.any.js [deleted file]
LayoutTests/http/wpt/crypto/rsa-pss-crash.any.worker-expected.txt [deleted file]
LayoutTests/http/wpt/crypto/rsa-pss-crash.any.worker.html [deleted file]
LayoutTests/http/wpt/crypto/unwrap-ec-key-crash.any-expected.txt [deleted file]
LayoutTests/http/wpt/crypto/unwrap-ec-key-crash.any.html [deleted file]
LayoutTests/http/wpt/crypto/unwrap-ec-key-crash.any.js [deleted file]
LayoutTests/http/wpt/crypto/unwrap-ec-key-crash.any.worker-expected.txt [deleted file]
LayoutTests/http/wpt/crypto/unwrap-ec-key-crash.any.worker.html [deleted file]
LayoutTests/http/wpt/crypto/unwrap-rsa-key-crash.any-expected.txt [deleted file]
LayoutTests/http/wpt/crypto/unwrap-rsa-key-crash.any.html [deleted file]
LayoutTests/http/wpt/crypto/unwrap-rsa-key-crash.any.js [deleted file]
LayoutTests/http/wpt/crypto/unwrap-rsa-key-crash.any.worker-expected.txt [deleted file]
LayoutTests/http/wpt/crypto/unwrap-rsa-key-crash.any.worker.html [deleted file]
Source/WebCore/ChangeLog
Source/WebCore/crypto/CryptoAlgorithm.cpp
Source/WebCore/crypto/CryptoAlgorithm.h
Source/WebCore/crypto/SubtleCrypto.cpp
Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_CBC.cpp
Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_CBC.h
Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_CFB.cpp
Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_CFB.h
Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_CTR.cpp
Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_CTR.h
Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_GCM.cpp
Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_GCM.h
Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_KW.cpp
Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_KW.h
Source/WebCore/crypto/algorithms/CryptoAlgorithmECDH.cpp
Source/WebCore/crypto/algorithms/CryptoAlgorithmECDH.h
Source/WebCore/crypto/algorithms/CryptoAlgorithmECDSA.cpp
Source/WebCore/crypto/algorithms/CryptoAlgorithmECDSA.h
Source/WebCore/crypto/algorithms/CryptoAlgorithmHKDF.cpp
Source/WebCore/crypto/algorithms/CryptoAlgorithmHKDF.h
Source/WebCore/crypto/algorithms/CryptoAlgorithmHMAC.cpp
Source/WebCore/crypto/algorithms/CryptoAlgorithmHMAC.h
Source/WebCore/crypto/algorithms/CryptoAlgorithmPBKDF2.cpp
Source/WebCore/crypto/algorithms/CryptoAlgorithmPBKDF2.h
Source/WebCore/crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp
Source/WebCore/crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h
Source/WebCore/crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp
Source/WebCore/crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h
Source/WebCore/crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp
Source/WebCore/crypto/algorithms/CryptoAlgorithmRSA_OAEP.h
Source/WebCore/crypto/algorithms/CryptoAlgorithmRSA_PSS.cpp
Source/WebCore/crypto/algorithms/CryptoAlgorithmRSA_PSS.h
Source/WebCore/crypto/gcrypt/CryptoAlgorithmAES_CBCGCrypt.cpp
Source/WebCore/crypto/gcrypt/CryptoAlgorithmAES_CFBGCrypt.cpp
Source/WebCore/crypto/gcrypt/CryptoAlgorithmAES_CTRGCrypt.cpp
Source/WebCore/crypto/gcrypt/CryptoAlgorithmAES_GCMGCrypt.cpp
Source/WebCore/crypto/gcrypt/CryptoAlgorithmHKDFGCrypt.cpp
Source/WebCore/crypto/gcrypt/CryptoAlgorithmPBKDF2GCrypt.cpp
Source/WebCore/crypto/gcrypt/CryptoAlgorithmRSA_OAEPGCrypt.cpp
Source/WebCore/crypto/gcrypt/CryptoAlgorithmRSA_PSSGCrypt.cpp
Source/WebCore/crypto/mac/CryptoAlgorithmAES_CBCMac.cpp
Source/WebCore/crypto/mac/CryptoAlgorithmAES_CFBMac.cpp
Source/WebCore/crypto/mac/CryptoAlgorithmAES_CTRMac.cpp
Source/WebCore/crypto/mac/CryptoAlgorithmAES_GCMMac.cpp
Source/WebCore/crypto/mac/CryptoAlgorithmHKDFMac.cpp
Source/WebCore/crypto/mac/CryptoAlgorithmPBKDF2Mac.cpp
Source/WebCore/crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp
Source/WebCore/crypto/mac/CryptoAlgorithmRSA_PSSMac.cpp
Source/WebCore/crypto/parameters/CryptoAlgorithmAesCbcCfbParams.h
Source/WebCore/crypto/parameters/CryptoAlgorithmAesCtrParams.h
Source/WebCore/crypto/parameters/CryptoAlgorithmAesGcmParams.h
Source/WebCore/crypto/parameters/CryptoAlgorithmEcKeyParams.h
Source/WebCore/crypto/parameters/CryptoAlgorithmEcdsaParams.h
Source/WebCore/crypto/parameters/CryptoAlgorithmHkdfParams.h
Source/WebCore/crypto/parameters/CryptoAlgorithmHmacKeyParams.h
Source/WebCore/crypto/parameters/CryptoAlgorithmPbkdf2Params.h
Source/WebCore/crypto/parameters/CryptoAlgorithmRsaHashedImportParams.h
Source/WebCore/crypto/parameters/CryptoAlgorithmRsaOaepParams.h
Source/WebCore/crypto/parameters/CryptoAlgorithmRsaPssParams.h

index a243ae5..3844f16 100644 (file)
@@ -1,3 +1,16 @@
+2018-07-16  David Fenton  <david_fenton@apple.com>
+
+        Unreviewed, rolling out r233867.
+
+        caused build failures on High Sierra, Sierra and iOS
+
+        Reverted changeset:
+
+        "[WebCrypto] Crypto operations should copy their parameters
+        before hoping to another thread"
+        https://bugs.webkit.org/show_bug.cgi?id=187501
+        https://trac.webkit.org/changeset/233867
+
 2018-07-15  Jiewen Tan  <jiewen_tan@apple.com>
 
         [WebCrypto] Crypto operations should copy their parameters before hoping to another thread
index b8984bf..6e00a84 100644 (file)
@@ -1480,9 +1480,14 @@ workers/wasm-long-compile.html [ Slow ]
 
 # Flaky WebCrypto API tests
 imported/w3c/web-platform-tests/WebCryptoAPI/wrapKey_unwrapKey/test_wrapKey_unwrapKey.https.html [ Pass Failure ]
+imported/w3c/web-platform-tests/WebCryptoAPI/derive_bits_keys/pbkdf2.https.worker.html [ Pass Failure Slow ]
+webkit.org/b/186940 imported/w3c/web-platform-tests/WebCryptoAPI/generateKey/successes_RSASSA-PKCS1-v1_5.https.any.html [ Pass Failure Slow ]
+webkit.org/b/186940 imported/w3c/web-platform-tests/WebCryptoAPI/generateKey/successes_RSA-PSS.https.any.html [ Pass Failure Slow ]
+webkit.org/b/187025 imported/w3c/web-platform-tests/WebCryptoAPI/generateKey/successes_RSASSA-PKCS1-v1_5.https.any.worker.html  [ Pass Failure Slow ]
 
 # WebCryptoAPI tests that take too long to complete
-imported/w3c/web-platform-tests/WebCryptoAPI/ [ Slow ]
+imported/w3c/web-platform-tests/WebCryptoAPI/import_export/rsa_importKey.https.worker.html [ Slow ]
+imported/w3c/web-platform-tests/WebCryptoAPI/import_export/test_rsa_importKey.https.html [ Slow ]
 
 # Imported Beacon test that is flaky because its last check is very slow.
 webkit.org/b/175202 imported/w3c/web-platform-tests/beacon/beacon-basic-string.html [ Pass Failure ]
diff --git a/LayoutTests/crypto/subtle/aes-gcm-import-key-unwrap-ec-raw-key-expected.txt b/LayoutTests/crypto/subtle/aes-gcm-import-key-unwrap-ec-raw-key-expected.txt
deleted file mode 100644 (file)
index 4b29490..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-Test unwrapping an EC raw key with AES-GCM using an imported key
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS bytesToHexString(unwrappedKey) is expectedRawKey
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
diff --git a/LayoutTests/crypto/subtle/aes-gcm-import-key-unwrap-ec-raw-key.html b/LayoutTests/crypto/subtle/aes-gcm-import-key-unwrap-ec-raw-key.html
deleted file mode 100644 (file)
index a306dc2..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-    <script src="../../resources/js-test-pre.js"></script>
-    <script src="../resources/common.js"></script>
-</head>
-<body>
-<p id="description"></p>
-<div id="console"></div>
-
-<script>
-    description("Test unwrapping an EC raw key with AES-GCM using an imported key");
-
-    jsTestIsAsync = true;
-
-    var extractable = true;
-    var expectedRawKey = "04d454955a2793be2905906d4d3b286450268c6dd421c701fa682bb8133fac46d0f6398d4cba8ce1c8c185d0271dc348f58415dcef0b166a3e11d65693c9ed01a2";
-    var rawKey = asciiToUint8Array("jnOw99oOZFLIEPMr");
-    var aesGcmParams = {
-        name: "aes-gcm",
-        iv: asciiToUint8Array("jnOw99oOZFLIEPMr"),
-    };
-    var wrappedKey = hexStringToUint8Array("b50b299894672c25341db938ad7dc3f87f05e29a36e062b08f7022f9bb7ee41a6d503bfa460e63333c2d1b6fe5b62169276f511ed928cdf0ad9af40807b8a5674af07016e5af5476f6aec5266321e300eb");
-
-
-    crypto.subtle.importKey("raw", rawKey, "aes-gcm", extractable, ["unwrapKey"]).then(function(unwrappingKey) {
-        return crypto.subtle.unwrapKey("raw", wrappedKey, unwrappingKey, aesGcmParams, { name: "ECDH", namedCurve: "P-256" }, extractable, []);
-    }).then(function(cryptoKey) {
-        return crypto.subtle.exportKey("raw", cryptoKey);
-    }).then(function(result) {
-        unwrappedKey = result;
-
-        shouldBe("bytesToHexString(unwrappedKey)", "expectedRawKey");
-
-        finishJSTest();
-    });
-
-</script>
-
-<script src="../../resources/js-test-post.js"></script>
-</body>
-</html>
diff --git a/LayoutTests/http/wpt/crypto/aes-cbc-crash.any-expected.txt b/LayoutTests/http/wpt/crypto/aes-cbc-crash.any-expected.txt
deleted file mode 100644 (file)
index f1aa120..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-
-PASS Test passed if no crashes. 
-
diff --git a/LayoutTests/http/wpt/crypto/aes-cbc-crash.any.html b/LayoutTests/http/wpt/crypto/aes-cbc-crash.any.html
deleted file mode 100644 (file)
index 2382913..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file
diff --git a/LayoutTests/http/wpt/crypto/aes-cbc-crash.any.js b/LayoutTests/http/wpt/crypto/aes-cbc-crash.any.js
deleted file mode 100644 (file)
index 7147840..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-// META: script=./resources/common.js
-
-test(() => {
-    const max = 10000;
-    const plainText = asciiToUint8Array("Hello, World!");
-    const aesCbcParams = {
-        name: "aes-cbc",
-        iv: asciiToUint8Array("jnOw99oOZFLIEPMr")
-    };
-    const rawKey = asciiToUint8Array("jnOw99oOZFLIEPMr");
-    crypto.subtle.importKey('raw', rawKey, "aes-cbc", false, ["encrypt"]).then(key => {
-        for (let i = 0; i < max; i++)
-            crypto.subtle.encrypt(aesCbcParams, key, plainText);
-    });
-}, "Test passed if no crashes.");
diff --git a/LayoutTests/http/wpt/crypto/aes-cbc-crash.any.worker-expected.txt b/LayoutTests/http/wpt/crypto/aes-cbc-crash.any.worker-expected.txt
deleted file mode 100644 (file)
index f1aa120..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-
-PASS Test passed if no crashes. 
-
diff --git a/LayoutTests/http/wpt/crypto/aes-cbc-crash.any.worker.html b/LayoutTests/http/wpt/crypto/aes-cbc-crash.any.worker.html
deleted file mode 100644 (file)
index 2382913..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file
diff --git a/LayoutTests/http/wpt/crypto/aes-ctr-crash.any-expected.txt b/LayoutTests/http/wpt/crypto/aes-ctr-crash.any-expected.txt
deleted file mode 100644 (file)
index f1aa120..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-
-PASS Test passed if no crashes. 
-
diff --git a/LayoutTests/http/wpt/crypto/aes-ctr-crash.any.html b/LayoutTests/http/wpt/crypto/aes-ctr-crash.any.html
deleted file mode 100644 (file)
index 2382913..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file
diff --git a/LayoutTests/http/wpt/crypto/aes-ctr-crash.any.js b/LayoutTests/http/wpt/crypto/aes-ctr-crash.any.js
deleted file mode 100644 (file)
index 508b9aa..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-// META: script=./resources/common.js
-
-test(() => {
-    const max = 10000;
-    const plainText = asciiToUint8Array("Hello, World!");
-    const aesCtrParams = {
-        name: "aes-ctr",
-        counter: asciiToUint8Array("jnOw99oOZFLIEPMr"),
-        length: 8,
-    };
-    const rawKey = asciiToUint8Array("jnOw99oOZFLIEPMr");
-    crypto.subtle.importKey('raw', rawKey, "aes-ctr", false, ["encrypt"]).then(key => {
-        for (let i = 0; i < max; i++)
-            crypto.subtle.encrypt(aesCtrParams, key, plainText);
-    });
-}, "Test passed if no crashes.");
diff --git a/LayoutTests/http/wpt/crypto/aes-ctr-crash.any.worker-expected.txt b/LayoutTests/http/wpt/crypto/aes-ctr-crash.any.worker-expected.txt
deleted file mode 100644 (file)
index f1aa120..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-
-PASS Test passed if no crashes. 
-
diff --git a/LayoutTests/http/wpt/crypto/aes-ctr-crash.any.worker.html b/LayoutTests/http/wpt/crypto/aes-ctr-crash.any.worker.html
deleted file mode 100644 (file)
index 2382913..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file
diff --git a/LayoutTests/http/wpt/crypto/aes-gcm-crash.any-expected.txt b/LayoutTests/http/wpt/crypto/aes-gcm-crash.any-expected.txt
deleted file mode 100644 (file)
index f1aa120..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-
-PASS Test passed if no crashes. 
-
diff --git a/LayoutTests/http/wpt/crypto/aes-gcm-crash.any.html b/LayoutTests/http/wpt/crypto/aes-gcm-crash.any.html
deleted file mode 100644 (file)
index 2382913..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file
diff --git a/LayoutTests/http/wpt/crypto/aes-gcm-crash.any.js b/LayoutTests/http/wpt/crypto/aes-gcm-crash.any.js
deleted file mode 100644 (file)
index ff7b86e..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-// META: script=./resources/common.js
-
-test(() => {
-    const max = 10000;
-    const plainText = asciiToUint8Array("Hello, World!");
-    const aesGcmParams = {
-        name: "aes-gcm",
-        iv: asciiToUint8Array("jnOw99oOZFLIEPMr"),
-    };
-    const rawKey = asciiToUint8Array("jnOw99oOZFLIEPMr");
-    crypto.subtle.importKey('raw', rawKey, "aes-gcm", false, ["encrypt"]).then(key => {
-        for (let i = 0; i < max; i++)
-            crypto.subtle.encrypt(aesGcmParams, key, plainText);
-    });
-}, "Test passed if no crashes.");
diff --git a/LayoutTests/http/wpt/crypto/aes-gcm-crash.any.worker-expected.txt b/LayoutTests/http/wpt/crypto/aes-gcm-crash.any.worker-expected.txt
deleted file mode 100644 (file)
index f1aa120..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-
-PASS Test passed if no crashes. 
-
diff --git a/LayoutTests/http/wpt/crypto/aes-gcm-crash.any.worker.html b/LayoutTests/http/wpt/crypto/aes-gcm-crash.any.worker.html
deleted file mode 100644 (file)
index 2382913..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file
diff --git a/LayoutTests/http/wpt/crypto/derive-hmac-key-crash.any-expected.txt b/LayoutTests/http/wpt/crypto/derive-hmac-key-crash.any-expected.txt
deleted file mode 100644 (file)
index f1aa120..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-
-PASS Test passed if no crashes. 
-
diff --git a/LayoutTests/http/wpt/crypto/derive-hmac-key-crash.any.html b/LayoutTests/http/wpt/crypto/derive-hmac-key-crash.any.html
deleted file mode 100644 (file)
index 2382913..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file
diff --git a/LayoutTests/http/wpt/crypto/derive-hmac-key-crash.any.js b/LayoutTests/http/wpt/crypto/derive-hmac-key-crash.any.js
deleted file mode 100644 (file)
index 05fe73d..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-// META: script=./resources/common.js
-
-test(() => {
-    const max = 10000;
-    const rawKey = asciiToUint8Array("jnOw99oOZFLIEPMr");
-    const salt = asciiToUint8Array("jnOw99oO");
-    const info = asciiToUint8Array("jnOw99oO");
-    crypto.subtle.importKey("raw", rawKey, "HKDF", false, ["deriveKey"]).then(key => {
-        for (let i = 0; i < max; i++)
-            crypto.subtle.deriveKey({name: "HKDF", salt: salt, info: info, hash: "sha-1"}, key, {name: "hmac", hash: "sha-1"}, false, ['sign', 'verify']);
-    });
-}, "Test passed if no crashes.");
diff --git a/LayoutTests/http/wpt/crypto/derive-hmac-key-crash.any.worker-expected.txt b/LayoutTests/http/wpt/crypto/derive-hmac-key-crash.any.worker-expected.txt
deleted file mode 100644 (file)
index f1aa120..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-
-PASS Test passed if no crashes. 
-
diff --git a/LayoutTests/http/wpt/crypto/derive-hmac-key-crash.any.worker.html b/LayoutTests/http/wpt/crypto/derive-hmac-key-crash.any.worker.html
deleted file mode 100644 (file)
index 2382913..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file
diff --git a/LayoutTests/http/wpt/crypto/ecdsa-crash.any-expected.txt b/LayoutTests/http/wpt/crypto/ecdsa-crash.any-expected.txt
deleted file mode 100644 (file)
index f1aa120..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-
-PASS Test passed if no crashes. 
-
diff --git a/LayoutTests/http/wpt/crypto/ecdsa-crash.any.html b/LayoutTests/http/wpt/crypto/ecdsa-crash.any.html
deleted file mode 100644 (file)
index 2382913..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file
diff --git a/LayoutTests/http/wpt/crypto/ecdsa-crash.any.js b/LayoutTests/http/wpt/crypto/ecdsa-crash.any.js
deleted file mode 100644 (file)
index 306d98f..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-// META: script=./resources/common.js
-
-test(() => {
-    const max = 10000;
-    const jwkPrivateKey = {
-        kty: "EC",
-        crv: "P-256",
-        x: "1FSVWieTvikFkG1NOyhkUCaMbdQhxwH6aCu4Ez-sRtA",
-        y: "9jmNTLqM4cjBhdAnHcNI9YQV3O8LFmo-EdZWk8ntAaI",
-        d: "ppxBSov3N8_AUcisAuvmLV4yE8e_L_BLE8bZb9Z1Xjg",
-    };
-    const ecdsaParams = {
-        name: "ECDSA",
-        hash: "SHA-256",
-    };
-    const data = asciiToUint8Array("Hello, World!");
-
-    crypto.subtle.importKey("jwk", jwkPrivateKey, { name: "ECDSA", namedCurve: "P-256" }, false, ["sign"]).then(key => {
-        for (let i = 0; i < max; i++)
-            crypto.subtle.sign(ecdsaParams, key, data);
-    });
-}, "Test passed if no crashes.");
diff --git a/LayoutTests/http/wpt/crypto/ecdsa-crash.any.worker-expected.txt b/LayoutTests/http/wpt/crypto/ecdsa-crash.any.worker-expected.txt
deleted file mode 100644 (file)
index f1aa120..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-
-PASS Test passed if no crashes. 
-
diff --git a/LayoutTests/http/wpt/crypto/ecdsa-crash.any.worker.html b/LayoutTests/http/wpt/crypto/ecdsa-crash.any.worker.html
deleted file mode 100644 (file)
index 2382913..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file
diff --git a/LayoutTests/http/wpt/crypto/hkdf-crash.any-expected.txt b/LayoutTests/http/wpt/crypto/hkdf-crash.any-expected.txt
deleted file mode 100644 (file)
index f1aa120..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-
-PASS Test passed if no crashes. 
-
diff --git a/LayoutTests/http/wpt/crypto/hkdf-crash.any.html b/LayoutTests/http/wpt/crypto/hkdf-crash.any.html
deleted file mode 100644 (file)
index 2382913..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file
diff --git a/LayoutTests/http/wpt/crypto/hkdf-crash.any.js b/LayoutTests/http/wpt/crypto/hkdf-crash.any.js
deleted file mode 100644 (file)
index 244c4cd..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-// META: script=./resources/common.js
-
-test(() => {
-    const max = 10000;
-    const rawKey = hexStringToUint8Array("0b0b0b0b0b0b0b0b0b0b0b");
-    const info = hexStringToUint8Array("f0f1f2f3f4f5f6f7f8f9");
-    const salt = hexStringToUint8Array("000102030405060708090a0b0c");
-    crypto.subtle.importKey("raw", rawKey, "HKDF", false, ["deriveBits"]).then(key => {
-        for (let i = 0; i < max; i++)
-            crypto.subtle.deriveBits({name: "HKDF", salt: salt, info: info, hash: "sha-1"}, key, 336);
-    });
-}, "Test passed if no crashes.");
diff --git a/LayoutTests/http/wpt/crypto/hkdf-crash.any.worker-expected.txt b/LayoutTests/http/wpt/crypto/hkdf-crash.any.worker-expected.txt
deleted file mode 100644 (file)
index f1aa120..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-
-PASS Test passed if no crashes. 
-
diff --git a/LayoutTests/http/wpt/crypto/hkdf-crash.any.worker.html b/LayoutTests/http/wpt/crypto/hkdf-crash.any.worker.html
deleted file mode 100644 (file)
index 2382913..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file
diff --git a/LayoutTests/http/wpt/crypto/pbkdf2-crash.any-expected.txt b/LayoutTests/http/wpt/crypto/pbkdf2-crash.any-expected.txt
deleted file mode 100644 (file)
index f1aa120..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-
-PASS Test passed if no crashes. 
-
diff --git a/LayoutTests/http/wpt/crypto/pbkdf2-crash.any.html b/LayoutTests/http/wpt/crypto/pbkdf2-crash.any.html
deleted file mode 100644 (file)
index 2382913..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file
diff --git a/LayoutTests/http/wpt/crypto/pbkdf2-crash.any.js b/LayoutTests/http/wpt/crypto/pbkdf2-crash.any.js
deleted file mode 100644 (file)
index e9d3988..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-// META: script=./resources/common.js
-
-test(() => {
-    const max = 10000;
-    crypto.subtle.importKey('raw', new Uint8Array(32), {name: 'PBKDF2', hash: {name: 'SHA-256'}}, false, ['deriveBits']).then(key => {
-        for (let i = 0; i < max; i++)
-            crypto.subtle.deriveBits({name: 'PBKDF2', hash: {name: 'SHA-256'}, salt: new Uint8Array(32), iterations: 1000}, key, 256);
-    });
-}, "Test passed if no crashes.");
diff --git a/LayoutTests/http/wpt/crypto/pbkdf2-crash.any.worker-expected.txt b/LayoutTests/http/wpt/crypto/pbkdf2-crash.any.worker-expected.txt
deleted file mode 100644 (file)
index f1aa120..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-
-PASS Test passed if no crashes. 
-
diff --git a/LayoutTests/http/wpt/crypto/pbkdf2-crash.any.worker.html b/LayoutTests/http/wpt/crypto/pbkdf2-crash.any.worker.html
deleted file mode 100644 (file)
index 2382913..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file
diff --git a/LayoutTests/http/wpt/crypto/resources/common.js b/LayoutTests/http/wpt/crypto/resources/common.js
deleted file mode 100644 (file)
index 5f5c15a..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-function hexStringToUint8Array(hexString)
-{
-    if (hexString.length % 2 != 0)
-        throw "Invalid hexString";
-    var arrayBuffer = new Uint8Array(hexString.length / 2);
-
-    for (var i = 0; i < hexString.length; i += 2) {
-        var byteValue = parseInt(hexString.substr(i, 2), 16);
-        if (byteValue == NaN)
-            throw "Invalid hexString";
-        arrayBuffer[i/2] = byteValue;
-    }
-
-    return arrayBuffer;
-}
-
-function asciiToUint8Array(str)
-{
-    var chars = [];
-    for (var i = 0; i < str.length; ++i)
-        chars.push(str.charCodeAt(i));
-    return new Uint8Array(chars);
-}
diff --git a/LayoutTests/http/wpt/crypto/rsa-oaep-crash.any-expected.txt b/LayoutTests/http/wpt/crypto/rsa-oaep-crash.any-expected.txt
deleted file mode 100644 (file)
index f1aa120..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-
-PASS Test passed if no crashes. 
-
diff --git a/LayoutTests/http/wpt/crypto/rsa-oaep-crash.any.html b/LayoutTests/http/wpt/crypto/rsa-oaep-crash.any.html
deleted file mode 100644 (file)
index 2382913..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file
diff --git a/LayoutTests/http/wpt/crypto/rsa-oaep-crash.any.js b/LayoutTests/http/wpt/crypto/rsa-oaep-crash.any.js
deleted file mode 100644 (file)
index 698d288..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-// META: script=./resources/common.js
-
-test(() => {
-    const max = 10000;
-    const plainText = asciiToUint8Array("Hello, World!");
-    const jwkKey = {
-        kty: "RSA",
-        alg: "RSA-OAEP",
-        use: "enc",
-        key_ops: ["encrypt", "wrapKey"],
-        ext: true,
-        n: "rcCUCv7Oc1HVam1DIhCzqknThWawOp8QLk8Ziy2p10ByjQFCajoFiyuAWl-R1WXZaf4xitLRracT9agpzIzc-MbLSHIGgWQGO21lGiImy5ftZ-D8bHAqRz2y15pzD4c4CEou7XSSLDoRnR0QG5MsDhD6s2gV9mwHkrtkCxtMWdBi-77as8wGmlNRldcOSgZDLK8UnCSgA1OguZ989bFyc8tOOEIb0xUSfPSz3LPSCnyYz68aDjmKVeNH-ig857OScyWbGyEy3Biw64qun3juUlNWsJ3zngkOdteYWytx5Qr4XKNs6R-Myyq72KUp02mJDZiiyiglxML_i3-_CeecCw",
-        e: "AQAB"
-    };
-    const rsaOaepParams = {
-        name: "rsa-oaep"
-    };
-    crypto.subtle.importKey('jwk', jwkKey, {name: "RSA-OAEP", hash: "SHA-1"}, false, ["encrypt"]).then(key => {
-        for (let i = 0; i < max; i++)
-            crypto.subtle.encrypt(rsaOaepParams, key, plainText);
-    });
-}, "Test passed if no crashes.");
diff --git a/LayoutTests/http/wpt/crypto/rsa-oaep-crash.any.worker-expected.txt b/LayoutTests/http/wpt/crypto/rsa-oaep-crash.any.worker-expected.txt
deleted file mode 100644 (file)
index f1aa120..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-
-PASS Test passed if no crashes. 
-
diff --git a/LayoutTests/http/wpt/crypto/rsa-oaep-crash.any.worker.html b/LayoutTests/http/wpt/crypto/rsa-oaep-crash.any.worker.html
deleted file mode 100644 (file)
index 2382913..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file
diff --git a/LayoutTests/http/wpt/crypto/rsa-pss-crash.any-expected.txt b/LayoutTests/http/wpt/crypto/rsa-pss-crash.any-expected.txt
deleted file mode 100644 (file)
index f1aa120..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-
-PASS Test passed if no crashes. 
-
diff --git a/LayoutTests/http/wpt/crypto/rsa-pss-crash.any.html b/LayoutTests/http/wpt/crypto/rsa-pss-crash.any.html
deleted file mode 100644 (file)
index 2382913..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file
diff --git a/LayoutTests/http/wpt/crypto/rsa-pss-crash.any.js b/LayoutTests/http/wpt/crypto/rsa-pss-crash.any.js
deleted file mode 100644 (file)
index ec8cb27..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-// META: script=./resources/common.js
-
-test(() => {
-    const max = 10000;
-    const jwkKey = {
-        kty: "RSA",
-        alg: "PS1",
-        use: "sig",
-        key_ops: ["sign"],
-        ext: true,
-        n: "rcCUCv7Oc1HVam1DIhCzqknThWawOp8QLk8Ziy2p10ByjQFCajoFiyuAWl-R1WXZaf4xitLRracT9agpzIzc-MbLSHIGgWQGO21lGiImy5ftZ-D8bHAqRz2y15pzD4c4CEou7XSSLDoRnR0QG5MsDhD6s2gV9mwHkrtkCxtMWdBi-77as8wGmlNRldcOSgZDLK8UnCSgA1OguZ989bFyc8tOOEIb0xUSfPSz3LPSCnyYz68aDjmKVeNH-ig857OScyWbGyEy3Biw64qun3juUlNWsJ3zngkOdteYWytx5Qr4XKNs6R-Myyq72KUp02mJDZiiyiglxML_i3-_CeecCw",
-        e: "AQAB",
-        d: "eNLS37aCz7RXSNPD_DtLBJ6j5T8cSxdzRBCjPaI6WcGqJp16lq3UTwuoDLAqlA9oGYm238dsIWpuucP_lQtbWe-7SpxoI6_vmYGf7YVUHv1-DF9qiOmSrMmdxMnVOzYXY8RaT6thPjn_J5cfLV2xI_LwsrMtmpdSyNlgX0zTUhwtuahgAKMEChYjH2EnjHdHw6sY2-wApdcQI7ULE0oo5RzbQZpmuhcN9hiBc0L3hhF0qo50mbl02_65_GQ7DpVkXBxNgRBLzlPabmzzG2oAhfefLgYmSC1opaCkXE6vRWQNWNL45RZNZFYM3uoJghOMqGeocM0BpjdChHrPOlFvSQ",
-        p: "4miTuAjKMeH5uJ5KB397QUwhbkYEgSbcA2mifmSkvE2018gb55qkBHK1eVryf1_m43LNlc6O_ak6gfzdZIZvS5NCGjPl0q09plUpu8qFOSspBwA67qGH76lFlZLn_d4yglS7wfLru4_5Ys8qLLs-DqVLviwposOnyyWqwM5AXp0",
-        q: "xHYrzkivtmnz_sGchnWGc0q-pDOkKicptRpv2pMFIIXxnFX5aMeEXIZjVujXtwUy1UlFIN2GZJSvy5KJ79mu_XyNnFHMzedH-A3ee3u8h1UUrZF-vUu1_e4U_x67NN1dedzUSKynN7pFl3OkuShMBWGV-cwzOPdcVAfVuZlxUMc",
-        dp: "fBzDzYDUBmBQGop7Hn0dvf_T27V6RqpctWo074CQZcFbP2atFVtKSj3viWT3xid2VHzcgiDHdfpM3nEVlEO1wwIonGCSvdjGEOZiiFVOjrZAOVxA8guOjyyFvqbXke06VwPIIVvfKeSU2zuhbP__1tt6F_fxow4Kb2xonGT0GGk",
-        dq: "jmE2DiIPdhwDgLXAQpIaBqQ81bO3XfVT_LRULAwwwwlPuQV148H04zlh9TJ6Y2GZHYokV1U0eOBpJxfkb7dLYtpJpuiBjRf4yIUEoGlkkI_QlJnFSFr-YjGRdfNHqWBkxlSMZL770R9mIATndGkH7z5x-r9KwBZFC4FCG2hg_zE",
-        qi: "YCX_pLwbMBA1ThVH0WcwmnytqNcrMCEwTm7ByA2eU6nWbQrULvf7m9_kzfLUcjsnpAVlBQG5JMXMy0Sq4ptwbywsa5-G8KAOOOR2L3v4hC-Eys9ftgFM_3i0o40eeQH4b3haPbntrIeMg8IzlOuVYKf9-2QuKDoWeRdd7NsdxTk",
-    };
-    const rsaPssParams = {
-        name: "RSA-PSS",
-        saltLength: 16
-    };
-    const data = asciiToUint8Array("Hello, World!");
-
-    crypto.subtle.importKey("jwk", jwkKey, { name: "RSA-PSS", hash: "SHA-1" }, false, ["sign"]).then(key => {
-        for (let i = 0; i < max; i++)
-            crypto.subtle.sign(rsaPssParams, key, data);
-    });
-}, "Test passed if no crashes.");
diff --git a/LayoutTests/http/wpt/crypto/rsa-pss-crash.any.worker-expected.txt b/LayoutTests/http/wpt/crypto/rsa-pss-crash.any.worker-expected.txt
deleted file mode 100644 (file)
index f1aa120..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-
-PASS Test passed if no crashes. 
-
diff --git a/LayoutTests/http/wpt/crypto/rsa-pss-crash.any.worker.html b/LayoutTests/http/wpt/crypto/rsa-pss-crash.any.worker.html
deleted file mode 100644 (file)
index 2382913..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file
diff --git a/LayoutTests/http/wpt/crypto/unwrap-ec-key-crash.any-expected.txt b/LayoutTests/http/wpt/crypto/unwrap-ec-key-crash.any-expected.txt
deleted file mode 100644 (file)
index f1aa120..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-
-PASS Test passed if no crashes. 
-
diff --git a/LayoutTests/http/wpt/crypto/unwrap-ec-key-crash.any.html b/LayoutTests/http/wpt/crypto/unwrap-ec-key-crash.any.html
deleted file mode 100644 (file)
index 2382913..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file
diff --git a/LayoutTests/http/wpt/crypto/unwrap-ec-key-crash.any.js b/LayoutTests/http/wpt/crypto/unwrap-ec-key-crash.any.js
deleted file mode 100644 (file)
index 8da71ba..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-// META: script=./resources/common.js
-
-test(() => {
-    const max = 10000;
-    const wrappedKey = hexStringToUint8Array( "b50b299894672c25341db938ad7dc3f87f05e29a36e062b08f7022f9bb7ee41a6d503bfa460e63333c2d1b6fe5b62169276f511ed928cdf0ad9af40807b8a5674af07016e5af5476f6aec5266321e300eb");
-    const rawKey = asciiToUint8Array("jnOw99oOZFLIEPMr");
-    const aesGcmParams = {
-        name: "aes-gcm",
-        iv: asciiToUint8Array("jnOw99oOZFLIEPMr"),
-    };
-    crypto.subtle.importKey('raw', rawKey, "aes-gcm", false, ["unwrapKey"]).then(key => {
-        for (let i = 0; i < max; i++)
-            crypto.subtle.unwrapKey("raw", wrappedKey, key, aesGcmParams, { name: "ECDH", namedCurve: "P-256" }, false, [ ]);
-    });
-}, "Test passed if no crashes.");
diff --git a/LayoutTests/http/wpt/crypto/unwrap-ec-key-crash.any.worker-expected.txt b/LayoutTests/http/wpt/crypto/unwrap-ec-key-crash.any.worker-expected.txt
deleted file mode 100644 (file)
index f1aa120..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-
-PASS Test passed if no crashes. 
-
diff --git a/LayoutTests/http/wpt/crypto/unwrap-ec-key-crash.any.worker.html b/LayoutTests/http/wpt/crypto/unwrap-ec-key-crash.any.worker.html
deleted file mode 100644 (file)
index 2382913..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file
diff --git a/LayoutTests/http/wpt/crypto/unwrap-rsa-key-crash.any-expected.txt b/LayoutTests/http/wpt/crypto/unwrap-rsa-key-crash.any-expected.txt
deleted file mode 100644 (file)
index f1aa120..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-
-PASS Test passed if no crashes. 
-
diff --git a/LayoutTests/http/wpt/crypto/unwrap-rsa-key-crash.any.html b/LayoutTests/http/wpt/crypto/unwrap-rsa-key-crash.any.html
deleted file mode 100644 (file)
index 2382913..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file
diff --git a/LayoutTests/http/wpt/crypto/unwrap-rsa-key-crash.any.js b/LayoutTests/http/wpt/crypto/unwrap-rsa-key-crash.any.js
deleted file mode 100644 (file)
index a3b5d0e..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-// META: script=./resources/common.js
-
-test(() => {
-    const max = 10000;
-    const wrappedKey = hexStringToUint8Array( "7aedac7ca0885c4c8340e7414b45b160a872c38eb56f25fa17eeb885abcbd72ce35fb0d8dcfa023dcb0bf94b0fe2a98a693b30e8a993207d646f2b14f673eddddc53815cb3b63cadf3b275bd0c387276e792fbdfd0bab94951ce109ff42ad4c739e5bd6e3f21140d0de7fbd3b60b8a05b29e1aae6385ced993546140a143db854d5b54e2a5d0be425d2aa8a4eee00b779a7b905c3e7fc4a91c37582871eb0b6daddba5d9497271e82e71589a31058fe0c38a7506f72acbc70f88139654cb1a26580f9c20b228c8f22865233d6a705eb68249a906f7d022ef28c84a5dccba26455391f4ce3572e9cfa50b7b4cefcdadf1eec50afc1df31a43f9dda40cd14524aa075b8f081a8b708ce1214b8ec0bd1c9a9af21596d7520b032a7588edaff8116e8710b47f8cda2caace8386cf176507c664f2757d3d728f6ea3be81abe58f36f751a32833d8689b7008a66b72d325ae729bb1064e88ace17c767c376d5c88eff8e8f1cf377639e66390614af43b4aa171fe144ad69c5a0d4d5d4129461da5250fb389b0eb0d53e65263a4b6265ad3fc0d375d42426f3ca1373c044aa47ec9973c77c46ae34f07ba6cc7d43c56438a9d678bf961f7bd7a4155f7cf813dd7a6fe434f04f052d86f5fc79813e85c0817f952e13e99ddea5d21d92e517a8f269a8da660c1d1432ad2d476bd2d13c1f3207b0a5c3f0f250fc195f406e89c1c107d5733cbaaacefc411ea7377880caa09847560b4dfe86f1ce8a0aac3d142eb9aa315a7e36383b5aa4f027f6ee6603053dd877e57755ae13a0b01453b3806610f98ed85ea574a2c040d0df9e861091f72a285fb563da4ac9d6098a2e4cf232455d8529e80ec8b9334690bca941caa8d8c6c2ebb29c73176c736b2e1cd897aaecdb7d51fbf2eeb5716bb441c0a2646643530f1618a5923b7fe3c6d8fcd55ec18ddbc5053d09af3f3ca058b3471d3cc327cdcdaa8a0dcada0dd3e52365d5ad2d36643769e8f274ef2020ce47975dceefb1fa3a4ff092927ebd2dc9017b4e36ab0591358a65c98d981f1e687e9cde16b3953b0f4b5a8f0b305fdfbbc60d11046d633a8c96e705290300a145a58f61983a3b95dc57615863faa2c217f3656a627b6a3e438ff55cd87c6462699a3db064213f30831e8be8d058ea6313af2d468904dfa544b4caf0598fcb2e59d5a1b4ee022f32e86b4ef0fd2e55ecb38edc114758d97718bc3c43f300614554a19320b7c7687d3d2218bb7fef7a01950c028c14f0bdede849924c0cab8161a7d0600d46f9e37bdbb7f7b2d3ca72e75eb6da10e015c5c2bed171ac50ff94a3291a6fc5b5a093d4c9cfbc269fc4f295c881676706f1fadda515c6f9441f5f05af0a8255706b18f8b76bf4b5f729cddea05b099470f02f71df46a3b0b53ec5429bdfd29c9c50f72c0359bdf4ee7435dcbc415fa5b2633ebdc5d6213fe5eefcfdeda6a14b9f4d9ba837afae59549a31428a9ead0c3e32c66cf93e42d5b0266e0ad7d6ed5027923c6d0eb8191f55d987a2ebf4c87f4d49c1b75c3e938c8c54d502877e54ef1fbae0851e6b55c3fbc443fe6ae1ef97aa4d4c4a0dd7a74191fa72bf1f127b63001f36c9b3d1bb8d9d1fe609cf24423b84cc96afed8e38508efb9bf01638ca75abcc46fc371aac26c493ee9b0a71c95e310eeb30460ef6baf622cbc74c89b01558d0913e4394369a782d3536c8ca0b90aaf087004a7d18836c0b9d45a48fd235a12e687d80c6e");
-    const rawKey = asciiToUint8Array("jnOw99oOZFLIEPMr");
-    const aesCbcParams = {
-        name: "aes-cbc",
-        iv: asciiToUint8Array("jnOw99oOZFLIEPMr"),
-    };
-    crypto.subtle.importKey('raw', rawKey, "aes-cbc", false, ["unwrapKey"]).then(key => {
-        for (let i = 0; i < max; i++)
-            crypto.subtle.unwrapKey("pkcs8", wrappedKey, key, aesCbcParams, {name: "rsa-oaep", hash: "sha-1"}, false, ["decrypt"]);
-    });
-}, "Test passed if no crashes.");
diff --git a/LayoutTests/http/wpt/crypto/unwrap-rsa-key-crash.any.worker-expected.txt b/LayoutTests/http/wpt/crypto/unwrap-rsa-key-crash.any.worker-expected.txt
deleted file mode 100644 (file)
index f1aa120..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-
-PASS Test passed if no crashes. 
-
diff --git a/LayoutTests/http/wpt/crypto/unwrap-rsa-key-crash.any.worker.html b/LayoutTests/http/wpt/crypto/unwrap-rsa-key-crash.any.worker.html
deleted file mode 100644 (file)
index 2382913..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file
index 6d86475..bc7dedd 100644 (file)
@@ -1,3 +1,16 @@
+2018-07-16  David Fenton  <david_fenton@apple.com>
+
+        Unreviewed, rolling out r233867.
+
+        caused build failures on High Sierra, Sierra and iOS
+
+        Reverted changeset:
+
+        "[WebCrypto] Crypto operations should copy their parameters
+        before hoping to another thread"
+        https://bugs.webkit.org/show_bug.cgi?id=187501
+        https://trac.webkit.org/changeset/233867
+
 2018-07-15  Jiewen Tan  <jiewen_tan@apple.com>
 
         [WebCrypto] Crypto operations should copy their parameters before hoping to another thread
index c4111a3..4bfbd7d 100644 (file)
 
 namespace WebCore {
 
-void CryptoAlgorithm::encrypt(const CryptoAlgorithmParameters&, Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&& exceptionCallback, ScriptExecutionContext&, WorkQueue&)
+void CryptoAlgorithm::encrypt(std::unique_ptr<CryptoAlgorithmParameters>&&, Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&& exceptionCallback, ScriptExecutionContext&, WorkQueue&)
 {
     exceptionCallback(NotSupportedError);
 }
 
-void CryptoAlgorithm::decrypt(const CryptoAlgorithmParameters&, Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&& exceptionCallback, ScriptExecutionContext&, WorkQueue&)
+void CryptoAlgorithm::decrypt(std::unique_ptr<CryptoAlgorithmParameters>&&, Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&& exceptionCallback, ScriptExecutionContext&, WorkQueue&)
 {
     exceptionCallback(NotSupportedError);
 }
 
-void CryptoAlgorithm::sign(const CryptoAlgorithmParameters&, Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&& exceptionCallback, ScriptExecutionContext&, WorkQueue&)
+void CryptoAlgorithm::sign(std::unique_ptr<CryptoAlgorithmParameters>&&, Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&& exceptionCallback, ScriptExecutionContext&, WorkQueue&)
 {
     exceptionCallback(NotSupportedError);
 }
 
-void CryptoAlgorithm::verify(const CryptoAlgorithmParameters&, Ref<CryptoKey>&&, Vector<uint8_t>&&, Vector<uint8_t>&&, BoolCallback&&, ExceptionCallback&& exceptionCallback, ScriptExecutionContext&, WorkQueue&)
+void CryptoAlgorithm::verify(std::unique_ptr<CryptoAlgorithmParameters>&&, Ref<CryptoKey>&&, Vector<uint8_t>&&, Vector<uint8_t>&&, BoolCallback&&, ExceptionCallback&& exceptionCallback, ScriptExecutionContext&, WorkQueue&)
 {
     exceptionCallback(NotSupportedError);
 }
@@ -62,12 +62,12 @@ void CryptoAlgorithm::generateKey(const CryptoAlgorithmParameters&, bool, Crypto
     exceptionCallback(NotSupportedError);
 }
 
-void CryptoAlgorithm::deriveBits(const CryptoAlgorithmParameters&, Ref<CryptoKey>&&, size_t, VectorCallback&&, ExceptionCallback&& exceptionCallback, ScriptExecutionContext&, WorkQueue&)
+void CryptoAlgorithm::deriveBits(std::unique_ptr<CryptoAlgorithmParameters>&&, Ref<CryptoKey>&&, size_t, VectorCallback&&, ExceptionCallback&& exceptionCallback, ScriptExecutionContext&, WorkQueue&)
 {
     exceptionCallback(NotSupportedError);
 }
 
-void CryptoAlgorithm::importKey(CryptoKeyFormat, KeyData&&, const CryptoAlgorithmParameters&, bool, CryptoKeyUsageBitmap, KeyCallback&&, ExceptionCallback&& exceptionCallback)
+void CryptoAlgorithm::importKey(CryptoKeyFormat, KeyData&&, const std::unique_ptr<CryptoAlgorithmParameters>&&, bool, CryptoKeyUsageBitmap, KeyCallback&&, ExceptionCallback&& exceptionCallback)
 {
     exceptionCallback(NotSupportedError);
 }
@@ -95,6 +95,7 @@ ExceptionOr<size_t> CryptoAlgorithm::getKeyLength(const CryptoAlgorithmParameter
 template<typename ResultCallbackType, typename OperationType>
 static void dispatchAlgorithmOperation(WorkQueue& workQueue, ScriptExecutionContext& context, ResultCallbackType&& callback, CryptoAlgorithm::ExceptionCallback&& exceptionCallback, OperationType&& operation)
 {
+    // There is no guarantee that callback and exceptionCallback will be destroyed in the thread in which they were created.
     workQueue.dispatch(
         [operation = WTFMove(operation), callback = WTFMove(callback), exceptionCallback = WTFMove(exceptionCallback), contextIdentifier = context.contextIdentifier()]() mutable {
             auto result = operation();
@@ -108,12 +109,12 @@ static void dispatchAlgorithmOperation(WorkQueue& workQueue, ScriptExecutionCont
         });
 }
 
-void CryptoAlgorithm::dispatchOperationInWorkQueue(WorkQueue& workQueue, ScriptExecutionContext& context, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, WTF::Function<ExceptionOr<Vector<uint8_t>>()>&& operation)
+void CryptoAlgorithm::dispatchOperation(WorkQueue& workQueue, ScriptExecutionContext& context, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, WTF::Function<ExceptionOr<Vector<uint8_t>>()>&& operation)
 {
     dispatchAlgorithmOperation(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback), WTFMove(operation));
 }
 
-void CryptoAlgorithm::dispatchOperationInWorkQueue(WorkQueue& workQueue, ScriptExecutionContext& context, BoolCallback&& callback, ExceptionCallback&& exceptionCallback, WTF::Function<ExceptionOr<bool>()>&& operation)
+void CryptoAlgorithm::dispatchOperation(WorkQueue& workQueue, ScriptExecutionContext& context, BoolCallback&& callback, ExceptionCallback&& exceptionCallback, WTF::Function<ExceptionOr<bool>()>&& operation)
 {
     dispatchAlgorithmOperation(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback), WTFMove(operation));
 }
index 1ed8aa3..e708213 100644 (file)
@@ -33,7 +33,6 @@
 #include "JsonWebKey.h"
 #include "SubtleCrypto.h"
 #include <wtf/Function.h>
-#include <wtf/ThreadSafeRefCounted.h>
 #include <wtf/Variant.h>
 #include <wtf/Vector.h>
 #include <wtf/WorkQueue.h>
@@ -49,7 +48,7 @@ class ScriptExecutionContext;
 using KeyData = Variant<Vector<uint8_t>, JsonWebKey>;
 using KeyOrKeyPair = Variant<RefPtr<CryptoKey>, CryptoKeyPair>;
 
-class CryptoAlgorithm : public ThreadSafeRefCounted<CryptoAlgorithm> {
+class CryptoAlgorithm : public RefCounted<CryptoAlgorithm> {
 public:
     virtual ~CryptoAlgorithm() = default;
 
@@ -64,22 +63,22 @@ public:
     using ExceptionCallback = WTF::Function<void(ExceptionCode)>;
     using KeyDataCallback = WTF::Function<void(CryptoKeyFormat, KeyData&&)>;
 
-    virtual void encrypt(const CryptoAlgorithmParameters&, Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&);
-    virtual void decrypt(const CryptoAlgorithmParameters&, Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&);
-    virtual void sign(const CryptoAlgorithmParameters&, Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&);
-    virtual void verify(const CryptoAlgorithmParameters&, Ref<CryptoKey>&&, Vector<uint8_t>&& signature, Vector<uint8_t>&&, BoolCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&);
+    virtual void encrypt(std::unique_ptr<CryptoAlgorithmParameters>&&, Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&);
+    virtual void decrypt(std::unique_ptr<CryptoAlgorithmParameters>&&, Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&);
+    virtual void sign(std::unique_ptr<CryptoAlgorithmParameters>&&, Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&);
+    virtual void verify(std::unique_ptr<CryptoAlgorithmParameters>&&, Ref<CryptoKey>&&, Vector<uint8_t>&& signature, Vector<uint8_t>&&, BoolCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&);
     virtual void digest(Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&);
     virtual void generateKey(const CryptoAlgorithmParameters&, bool extractable, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&&, ExceptionCallback&&, ScriptExecutionContext&);
-    virtual void deriveBits(const CryptoAlgorithmParameters&, Ref<CryptoKey>&&, size_t length, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&);
+    virtual void deriveBits(std::unique_ptr<CryptoAlgorithmParameters>&&, Ref<CryptoKey>&&, size_t length, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&);
     // FIXME: https://bugs.webkit.org/show_bug.cgi?id=169262
-    virtual void importKey(CryptoKeyFormat, KeyData&&, const CryptoAlgorithmParameters&, bool extractable, CryptoKeyUsageBitmap, KeyCallback&&, ExceptionCallback&&);
+    virtual void importKey(CryptoKeyFormat, KeyData&&, const std::unique_ptr<CryptoAlgorithmParameters>&&, bool extractable, CryptoKeyUsageBitmap, KeyCallback&&, ExceptionCallback&&);
     virtual void exportKey(CryptoKeyFormat, Ref<CryptoKey>&&, KeyDataCallback&&, ExceptionCallback&&);
     virtual void wrapKey(Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&);
     virtual void unwrapKey(Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&);
     virtual ExceptionOr<size_t> getKeyLength(const CryptoAlgorithmParameters&);
 
-    static void dispatchOperationInWorkQueue(WorkQueue&, ScriptExecutionContext&, VectorCallback&&, ExceptionCallback&&, WTF::Function<ExceptionOr<Vector<uint8_t>>()>&&);
-    static void dispatchOperationInWorkQueue(WorkQueue&, ScriptExecutionContext&, BoolCallback&&, ExceptionCallback&&, WTF::Function<ExceptionOr<bool>()>&&);
+    static void dispatchOperation(WorkQueue&, ScriptExecutionContext&, VectorCallback&&, ExceptionCallback&&, WTF::Function<ExceptionOr<Vector<uint8_t>>()>&&);
+    static void dispatchOperation(WorkQueue&, ScriptExecutionContext&, BoolCallback&&, ExceptionCallback&&, WTF::Function<ExceptionOr<bool>()>&&);
 };
 
 } // namespace WebCore
index bf7ef46..8673642 100644 (file)
@@ -516,26 +516,6 @@ RefPtr<DeferredPromise> getPromise(DeferredPromise* index, WeakPtr<SubtleCrypto>
     return nullptr;
 }
 
-static std::unique_ptr<CryptoAlgorithmParameters> crossThreadCopyImportParams(const CryptoAlgorithmParameters& importParams)
-{
-    switch (importParams.parametersClass()) {
-    case CryptoAlgorithmParameters::Class::None: {
-        auto result = std::make_unique<CryptoAlgorithmRsaHashedImportParams>();
-        result->identifier = importParams.identifier;
-        return result;
-    }
-    case CryptoAlgorithmParameters::Class::EcKeyParams:
-        return std::make_unique<CryptoAlgorithmEcKeyParams>(crossThreadCopy(downcast<CryptoAlgorithmEcKeyParams>(importParams)));
-    case CryptoAlgorithmParameters::Class::HmacKeyParams:
-        return std::make_unique<CryptoAlgorithmHmacKeyParams>(crossThreadCopy(downcast<CryptoAlgorithmHmacKeyParams>(importParams)));
-    case CryptoAlgorithmParameters::Class::RsaHashedImportParams:
-        return std::make_unique<CryptoAlgorithmRsaHashedImportParams>(crossThreadCopy(downcast<CryptoAlgorithmRsaHashedImportParams>(importParams)));
-    default:
-        ASSERT_NOT_REACHED();
-        return nullptr;
-    }
-}
-
 // MARK: - Exposed functions.
 
 void SubtleCrypto::encrypt(JSC::ExecState& state, AlgorithmIdentifier&& algorithmIdentifier, CryptoKey& key, BufferSource&& dataBufferSource, Ref<DeferredPromise>&& promise)
@@ -573,7 +553,7 @@ void SubtleCrypto::encrypt(JSC::ExecState& state, AlgorithmIdentifier&& algorith
             rejectWithException(promise.releaseNonNull(), ec);
     };
 
-    algorithm->encrypt(*params, key, WTFMove(data), WTFMove(callback), WTFMove(exceptionCallback), *scriptExecutionContext(), m_workQueue);
+    algorithm->encrypt(WTFMove(params), key, WTFMove(data), WTFMove(callback), WTFMove(exceptionCallback), *scriptExecutionContext(), m_workQueue);
 }
 
 void SubtleCrypto::decrypt(JSC::ExecState& state, AlgorithmIdentifier&& algorithmIdentifier, CryptoKey& key, BufferSource&& dataBufferSource, Ref<DeferredPromise>&& promise)
@@ -611,7 +591,7 @@ void SubtleCrypto::decrypt(JSC::ExecState& state, AlgorithmIdentifier&& algorith
             rejectWithException(promise.releaseNonNull(), ec);
     };
 
-    algorithm->decrypt(*params, key, WTFMove(data), WTFMove(callback), WTFMove(exceptionCallback), *scriptExecutionContext(), m_workQueue);
+    algorithm->decrypt(WTFMove(params), key, WTFMove(data), WTFMove(callback), WTFMove(exceptionCallback), *scriptExecutionContext(), m_workQueue);
 }
 
 void SubtleCrypto::sign(JSC::ExecState& state, AlgorithmIdentifier&& algorithmIdentifier, CryptoKey& key, BufferSource&& dataBufferSource, Ref<DeferredPromise>&& promise)
@@ -649,7 +629,7 @@ void SubtleCrypto::sign(JSC::ExecState& state, AlgorithmIdentifier&& algorithmId
             rejectWithException(promise.releaseNonNull(), ec);
     };
 
-    algorithm->sign(*params, key, WTFMove(data), WTFMove(callback), WTFMove(exceptionCallback), *scriptExecutionContext(), m_workQueue);
+    algorithm->sign(WTFMove(params), key, WTFMove(data), WTFMove(callback), WTFMove(exceptionCallback), *scriptExecutionContext(), m_workQueue);
 }
 
 void SubtleCrypto::verify(JSC::ExecState& state, AlgorithmIdentifier&& algorithmIdentifier, CryptoKey& key, BufferSource&& signatureBufferSource, BufferSource&& dataBufferSource, Ref<DeferredPromise>&& promise)
@@ -688,7 +668,7 @@ void SubtleCrypto::verify(JSC::ExecState& state, AlgorithmIdentifier&& algorithm
             rejectWithException(promise.releaseNonNull(), ec);
     };
 
-    algorithm->verify(*params, key, WTFMove(signature), WTFMove(data), WTFMove(callback), WTFMove(exceptionCallback), *scriptExecutionContext(), m_workQueue);
+    algorithm->verify(WTFMove(params), key, WTFMove(signature), WTFMove(data), WTFMove(callback), WTFMove(exceptionCallback), *scriptExecutionContext(), m_workQueue);
 }
 
 void SubtleCrypto::digest(JSC::ExecState& state, AlgorithmIdentifier&& algorithmIdentifier, BufferSource&& dataBufferSource, Ref<DeferredPromise>&& promise)
@@ -816,7 +796,7 @@ void SubtleCrypto::deriveKey(JSC::ExecState& state, AlgorithmIdentifier&& algori
     auto index = promise.ptr();
     m_pendingPromises.add(index, WTFMove(promise));
     auto subtleCryptoWeakPointer = makeWeakPtr(*this);
-    auto callback = [index, subtleCryptoWeakPointer, importAlgorithm = WTFMove(importAlgorithm), importParams = crossThreadCopyImportParams(*importParams), extractable, keyUsagesBitmap](const Vector<uint8_t>& derivedKey) mutable {
+    auto callback = [index, subtleCryptoWeakPointer, importAlgorithm, importParams = WTFMove(importParams), extractable, keyUsagesBitmap](const Vector<uint8_t>& derivedKey) mutable {
         // FIXME: https://bugs.webkit.org/show_bug.cgi?id=169395
         KeyData data = derivedKey;
         auto callback = [index, subtleCryptoWeakPointer](CryptoKey& key) mutable {
@@ -833,14 +813,14 @@ void SubtleCrypto::deriveKey(JSC::ExecState& state, AlgorithmIdentifier&& algori
                 rejectWithException(promise.releaseNonNull(), ec);
         };
 
-        importAlgorithm->importKey(SubtleCrypto::KeyFormat::Raw, WTFMove(data), *importParams, extractable, keyUsagesBitmap, WTFMove(callback), WTFMove(exceptionCallback));
+        importAlgorithm->importKey(SubtleCrypto::KeyFormat::Raw, WTFMove(data), WTFMove(importParams), extractable, keyUsagesBitmap, WTFMove(callback), WTFMove(exceptionCallback));
     };
     auto exceptionCallback = [index, subtleCryptoWeakPointer](ExceptionCode ec) mutable {
         if (auto promise = getPromise(index, subtleCryptoWeakPointer))
             rejectWithException(promise.releaseNonNull(), ec);
     };
 
-    algorithm->deriveBits(*params, baseKey, length, WTFMove(callback), WTFMove(exceptionCallback), *scriptExecutionContext(), m_workQueue);
+    algorithm->deriveBits(WTFMove(params), baseKey, length, WTFMove(callback), WTFMove(exceptionCallback), *scriptExecutionContext(), m_workQueue);
 }
 
 void SubtleCrypto::deriveBits(JSC::ExecState& state, AlgorithmIdentifier&& algorithmIdentifier, CryptoKey& baseKey, unsigned length, Ref<DeferredPromise>&& promise)
@@ -876,7 +856,7 @@ void SubtleCrypto::deriveBits(JSC::ExecState& state, AlgorithmIdentifier&& algor
             rejectWithException(promise.releaseNonNull(), ec);
     };
 
-    algorithm->deriveBits(*params, baseKey, length, WTFMove(callback), WTFMove(exceptionCallback), *scriptExecutionContext(), m_workQueue);
+    algorithm->deriveBits(WTFMove(params), baseKey, length, WTFMove(callback), WTFMove(exceptionCallback), *scriptExecutionContext(), m_workQueue);
 }
 
 void SubtleCrypto::importKey(JSC::ExecState& state, KeyFormat format, KeyDataVariant&& keyDataVariant, AlgorithmIdentifier&& algorithmIdentifier, bool extractable, Vector<CryptoKeyUsage>&& keyUsages, Ref<DeferredPromise>&& promise)
@@ -919,7 +899,7 @@ void SubtleCrypto::importKey(JSC::ExecState& state, KeyFormat format, KeyDataVar
     // The 11 December 2014 version of the specification suggests we should perform the following task asynchronously:
     // https://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-importKey
     // It is not beneficial for less time consuming operations. Therefore, we perform it synchronously.
-    algorithm->importKey(format, WTFMove(keyData), *params, extractable, keyUsagesBitmap, WTFMove(callback), WTFMove(exceptionCallback));
+    algorithm->importKey(format, WTFMove(keyData), WTFMove(params), extractable, keyUsagesBitmap, WTFMove(callback), WTFMove(exceptionCallback));
 }
 
 void SubtleCrypto::exportKey(KeyFormat format, CryptoKey& key, Ref<DeferredPromise>&& promise)
@@ -1049,7 +1029,7 @@ void SubtleCrypto::wrapKey(JSC::ExecState& state, KeyFormat format, CryptoKey& k
                     return;
                 }
                 // The following operation should be performed asynchronously.
-                wrapAlgorithm->encrypt(*wrapParams, WTFMove(wrappingKey), WTFMove(bytes), WTFMove(callback), WTFMove(exceptionCallback), *context, workQueue);
+                wrapAlgorithm->encrypt(WTFMove(wrapParams), WTFMove(wrappingKey), WTFMove(bytes), WTFMove(callback), WTFMove(exceptionCallback), *context, workQueue);
             }
         }
     };
@@ -1116,7 +1096,7 @@ void SubtleCrypto::unwrapKey(JSC::ExecState& state, KeyFormat format, BufferSour
     auto index = promise.ptr();
     m_pendingPromises.add(index, WTFMove(promise));
     auto subtleCryptoWeakPointer = makeWeakPtr(*this);
-    auto callback = [index, subtleCryptoWeakPointer, format, importAlgorithm, unwrappedKeyAlgorithm = crossThreadCopyImportParams(*unwrappedKeyAlgorithm), extractable, keyUsagesBitmap](const Vector<uint8_t>& bytes) mutable {
+    auto callback = [index, subtleCryptoWeakPointer, format, importAlgorithm, unwrappedKeyAlgorithm = WTFMove(unwrappedKeyAlgorithm), extractable, keyUsagesBitmap](const Vector<uint8_t>& bytes) mutable {
         if (subtleCryptoWeakPointer) {
             if (auto promise = subtleCryptoWeakPointer->m_pendingPromises.get(index)) {
                 KeyData keyData;
@@ -1162,7 +1142,7 @@ void SubtleCrypto::unwrapKey(JSC::ExecState& state, KeyFormat format, BufferSour
                 };
 
                 // The following operation should be performed synchronously.
-                importAlgorithm->importKey(format, WTFMove(keyData), *unwrappedKeyAlgorithm, extractable, keyUsagesBitmap, WTFMove(callback), WTFMove(exceptionCallback));
+                importAlgorithm->importKey(format, WTFMove(keyData), WTFMove(unwrappedKeyAlgorithm), extractable, keyUsagesBitmap, WTFMove(callback), WTFMove(exceptionCallback));
             }
         }
     };
@@ -1179,7 +1159,7 @@ void SubtleCrypto::unwrapKey(JSC::ExecState& state, KeyFormat format, BufferSour
         return;
     }
 
-    unwrapAlgorithm->decrypt(*unwrapParams, unwrappingKey, WTFMove(wrappedKey), WTFMove(callback), WTFMove(exceptionCallback), *scriptExecutionContext(), m_workQueue);
+    unwrapAlgorithm->decrypt(WTFMove(unwrapParams), unwrappingKey, WTFMove(wrappedKey), WTFMove(callback), WTFMove(exceptionCallback), *scriptExecutionContext(), m_workQueue);
 }
 
 }
index 5a87b77..c2f7558 100644 (file)
@@ -31,7 +31,6 @@
 #include "CryptoAlgorithmAesCbcCfbParams.h"
 #include "CryptoAlgorithmAesKeyParams.h"
 #include "CryptoKeyAES.h"
-#include <wtf/CrossThreadCopier.h>
 
 namespace WebCore {
 
@@ -57,35 +56,35 @@ CryptoAlgorithmIdentifier CryptoAlgorithmAES_CBC::identifier() const
     return s_identifier;
 }
 
-void CryptoAlgorithmAES_CBC::encrypt(const CryptoAlgorithmParameters& parameters, Ref<CryptoKey>&& key, Vector<uint8_t>&& plainText, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
+void CryptoAlgorithmAES_CBC::encrypt(std::unique_ptr<CryptoAlgorithmParameters>&& parameters, Ref<CryptoKey>&& key, Vector<uint8_t>&& plainText, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
 {
     using namespace CryptoAlgorithmAES_CBCInternal;
-
-    auto& aesParameters = downcast<CryptoAlgorithmAesCbcCfbParams>(parameters);
+    ASSERT(parameters);
+    auto& aesParameters = downcast<CryptoAlgorithmAesCbcCfbParams>(*parameters);
     if (aesParameters.ivVector().size() != IVSIZE) {
         exceptionCallback(OperationError);
         return;
     }
 
-    dispatchOperationInWorkQueue(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback),
-        [parameters = crossThreadCopy(aesParameters), key = WTFMove(key), plainText = WTFMove(plainText)] {
-            return platformEncrypt(parameters, downcast<CryptoKeyAES>(key.get()), plainText);
+    dispatchOperation(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback),
+        [parameters = WTFMove(parameters), key = WTFMove(key), plainText = WTFMove(plainText)] {
+            return platformEncrypt(downcast<CryptoAlgorithmAesCbcCfbParams>(*parameters), downcast<CryptoKeyAES>(key.get()), plainText);
         });
 }
 
-void CryptoAlgorithmAES_CBC::decrypt(const CryptoAlgorithmParameters& parameters, Ref<CryptoKey>&& key, Vector<uint8_t>&& cipherText, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
+void CryptoAlgorithmAES_CBC::decrypt(std::unique_ptr<CryptoAlgorithmParameters>&& parameters, Ref<CryptoKey>&& key, Vector<uint8_t>&& cipherText, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
 {
     using namespace CryptoAlgorithmAES_CBCInternal;
-
-    auto& aesParameters = downcast<CryptoAlgorithmAesCbcCfbParams>(parameters);
+    ASSERT(parameters);
+    auto& aesParameters = downcast<CryptoAlgorithmAesCbcCfbParams>(*parameters);
     if (aesParameters.ivVector().size() != IVSIZE) {
         exceptionCallback(OperationError);
         return;
     }
 
-    dispatchOperationInWorkQueue(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback),
-        [parameters = crossThreadCopy(aesParameters), key = WTFMove(key), cipherText = WTFMove(cipherText)] {
-            return platformDecrypt(parameters, downcast<CryptoKeyAES>(key.get()), cipherText);
+    dispatchOperation(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback),
+        [parameters = WTFMove(parameters), key = WTFMove(key), cipherText = WTFMove(cipherText)] {
+            return platformDecrypt(downcast<CryptoAlgorithmAesCbcCfbParams>(*parameters), downcast<CryptoKeyAES>(key.get()), cipherText);
         });
 }
 
@@ -107,10 +106,10 @@ void CryptoAlgorithmAES_CBC::generateKey(const CryptoAlgorithmParameters& parame
     callback(WTFMove(result));
 }
 
-void CryptoAlgorithmAES_CBC::importKey(CryptoKeyFormat format, KeyData&& data, const CryptoAlgorithmParameters& parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyCallback&& callback, ExceptionCallback&& exceptionCallback)
+void CryptoAlgorithmAES_CBC::importKey(CryptoKeyFormat format, KeyData&& data, const std::unique_ptr<CryptoAlgorithmParameters>&& parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyCallback&& callback, ExceptionCallback&& exceptionCallback)
 {
     using namespace CryptoAlgorithmAES_CBCInternal;
-
+    ASSERT(parameters);
     if (usagesAreInvalidForCryptoAlgorithmAES_CBC(usages)) {
         exceptionCallback(SyntaxError);
         return;
@@ -119,7 +118,7 @@ void CryptoAlgorithmAES_CBC::importKey(CryptoKeyFormat format, KeyData&& data, c
     RefPtr<CryptoKeyAES> result;
     switch (format) {
     case CryptoKeyFormat::Raw:
-        result = CryptoKeyAES::importRaw(parameters.identifier, WTFMove(WTF::get<Vector<uint8_t>>(data)), extractable, usages);
+        result = CryptoKeyAES::importRaw(parameters->identifier, WTFMove(WTF::get<Vector<uint8_t>>(data)), extractable, usages);
         break;
     case CryptoKeyFormat::Jwk: {
         auto checkAlgCallback = [](size_t length, const String& alg) -> bool {
@@ -133,7 +132,7 @@ void CryptoAlgorithmAES_CBC::importKey(CryptoKeyFormat format, KeyData&& data, c
             }
             return false;
         };
-        result = CryptoKeyAES::importJwk(parameters.identifier, WTFMove(WTF::get<JsonWebKey>(data)), extractable, usages, WTFMove(checkAlgCallback));
+        result = CryptoKeyAES::importJwk(parameters->identifier, WTFMove(WTF::get<JsonWebKey>(data)), extractable, usages, WTFMove(checkAlgCallback));
         break;
     }
     default:
index 1fd8f50..ab25bc2 100644 (file)
@@ -44,15 +44,15 @@ private:
     CryptoAlgorithmAES_CBC() = default;
     CryptoAlgorithmIdentifier identifier() const final;
 
-    void encrypt(const CryptoAlgorithmParameters&, Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&) final;
-    void decrypt(const CryptoAlgorithmParameters&, Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&) final;
+    void encrypt(std::unique_ptr<CryptoAlgorithmParameters>&&, Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&) final;
+    void decrypt(std::unique_ptr<CryptoAlgorithmParameters>&&, Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&) final;
     void generateKey(const CryptoAlgorithmParameters&, bool extractable, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&&, ExceptionCallback&&, ScriptExecutionContext&) final;
-    void importKey(CryptoKeyFormat, KeyData&&, const CryptoAlgorithmParameters&, bool extractable, CryptoKeyUsageBitmap, KeyCallback&&, ExceptionCallback&&) final;
+    void importKey(CryptoKeyFormat, KeyData&&, const std::unique_ptr<CryptoAlgorithmParameters>&&, bool extractable, CryptoKeyUsageBitmap, KeyCallback&&, ExceptionCallback&&) final;
     void exportKey(CryptoKeyFormat, Ref<CryptoKey>&&, KeyDataCallback&&, ExceptionCallback&&) final;
     ExceptionOr<size_t> getKeyLength(const CryptoAlgorithmParameters&) final;
 
-    static ExceptionOr<Vector<uint8_t>> platformEncrypt(const CryptoAlgorithmAesCbcCfbParams&, const CryptoKeyAES&, const Vector<uint8_t>&);
-    static ExceptionOr<Vector<uint8_t>> platformDecrypt(const CryptoAlgorithmAesCbcCfbParams&, const CryptoKeyAES&, const Vector<uint8_t>&);
+    static ExceptionOr<Vector<uint8_t>> platformEncrypt(CryptoAlgorithmAesCbcCfbParams&, const CryptoKeyAES&, const Vector<uint8_t>&);
+    static ExceptionOr<Vector<uint8_t>> platformDecrypt(CryptoAlgorithmAesCbcCfbParams&, const CryptoKeyAES&, const Vector<uint8_t>&);
 };
 
 } // namespace WebCore
index 51c333a..3a11311 100644 (file)
@@ -31,7 +31,6 @@
 #include "CryptoAlgorithmAesCbcCfbParams.h"
 #include "CryptoAlgorithmAesKeyParams.h"
 #include "CryptoKeyAES.h"
-#include <wtf/CrossThreadCopier.h>
 
 namespace WebCore {
 
@@ -57,35 +56,35 @@ CryptoAlgorithmIdentifier CryptoAlgorithmAES_CFB::identifier() const
     return s_identifier;
 }
 
-void CryptoAlgorithmAES_CFB::encrypt(const CryptoAlgorithmParameters& parameters, Ref<CryptoKey>&& key, Vector<uint8_t>&& plainText, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
+void CryptoAlgorithmAES_CFB::encrypt(std::unique_ptr<CryptoAlgorithmParameters>&& parameters, Ref<CryptoKey>&& key, Vector<uint8_t>&& plainText, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
 {
     using namespace CryptoAlgorithmAES_CFBInternal;
-
-    auto& aesParameters = downcast<CryptoAlgorithmAesCbcCfbParams>(parameters);
+    ASSERT(parameters);
+    auto& aesParameters = downcast<CryptoAlgorithmAesCbcCfbParams>(*parameters);
     if (aesParameters.ivVector().size() != IVSIZE) {
         exceptionCallback(OperationError);
         return;
     }
 
-    dispatchOperationInWorkQueue(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback),
-        [parameters = crossThreadCopy(aesParameters), key = WTFMove(key), plainText = WTFMove(plainText)] {
-            return platformEncrypt(parameters, downcast<CryptoKeyAES>(key.get()), plainText);
+    dispatchOperation(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback),
+        [parameters = WTFMove(parameters), key = WTFMove(key), plainText = WTFMove(plainText)] {
+            return platformEncrypt(downcast<CryptoAlgorithmAesCbcCfbParams>(*parameters), downcast<CryptoKeyAES>(key.get()), plainText);
         });
 }
 
-void CryptoAlgorithmAES_CFB::decrypt(const CryptoAlgorithmParameters& parameters, Ref<CryptoKey>&& key, Vector<uint8_t>&& cipherText, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
+void CryptoAlgorithmAES_CFB::decrypt(std::unique_ptr<CryptoAlgorithmParameters>&& parameters, Ref<CryptoKey>&& key, Vector<uint8_t>&& cipherText, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
 {
     using namespace CryptoAlgorithmAES_CFBInternal;
-
-    auto& aesParameters = downcast<CryptoAlgorithmAesCbcCfbParams>(parameters);
+    ASSERT(parameters);
+    auto& aesParameters = downcast<CryptoAlgorithmAesCbcCfbParams>(*parameters);
     if (aesParameters.ivVector().size() != IVSIZE) {
         exceptionCallback(OperationError);
         return;
     }
 
-    dispatchOperationInWorkQueue(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback),
-        [parameters = crossThreadCopy(aesParameters), key = WTFMove(key), cipherText = WTFMove(cipherText)] {
-            return platformDecrypt(parameters, downcast<CryptoKeyAES>(key.get()), cipherText);
+    dispatchOperation(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback),
+        [parameters = WTFMove(parameters), key = WTFMove(key), cipherText = WTFMove(cipherText)] {
+            return platformDecrypt(downcast<CryptoAlgorithmAesCbcCfbParams>(*parameters), downcast<CryptoKeyAES>(key.get()), cipherText);
         });
 }
 
@@ -107,10 +106,10 @@ void CryptoAlgorithmAES_CFB::generateKey(const CryptoAlgorithmParameters& parame
     callback(WTFMove(result));
 }
 
-void CryptoAlgorithmAES_CFB::importKey(CryptoKeyFormat format, KeyData&& data, const CryptoAlgorithmParameters& parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyCallback&& callback, ExceptionCallback&& exceptionCallback)
+void CryptoAlgorithmAES_CFB::importKey(CryptoKeyFormat format, KeyData&& data, const std::unique_ptr<CryptoAlgorithmParameters>&& parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyCallback&& callback, ExceptionCallback&& exceptionCallback)
 {
     using namespace CryptoAlgorithmAES_CFBInternal;
-    
+    ASSERT(parameters);
     if (usagesAreInvalidForCryptoAlgorithmAES_CFB(usages)) {
         exceptionCallback(SyntaxError);
         return;
@@ -119,7 +118,7 @@ void CryptoAlgorithmAES_CFB::importKey(CryptoKeyFormat format, KeyData&& data, c
     RefPtr<CryptoKeyAES> result;
     switch (format) {
     case CryptoKeyFormat::Raw:
-        result = CryptoKeyAES::importRaw(parameters.identifier, WTFMove(WTF::get<Vector<uint8_t>>(data)), extractable, usages);
+        result = CryptoKeyAES::importRaw(parameters->identifier, WTFMove(WTF::get<Vector<uint8_t>>(data)), extractable, usages);
         break;
     case CryptoKeyFormat::Jwk: {
         auto checkAlgCallback = [](size_t length, const String& alg) -> bool {
@@ -133,7 +132,7 @@ void CryptoAlgorithmAES_CFB::importKey(CryptoKeyFormat format, KeyData&& data, c
             }
             return false;
         };
-        result = CryptoKeyAES::importJwk(parameters.identifier, WTFMove(WTF::get<JsonWebKey>(data)), extractable, usages, WTFMove(checkAlgCallback));
+        result = CryptoKeyAES::importJwk(parameters->identifier, WTFMove(WTF::get<JsonWebKey>(data)), extractable, usages, WTFMove(checkAlgCallback));
         break;
     }
     default:
index 34ece4a..03ab05a 100644 (file)
@@ -44,15 +44,15 @@ private:
     CryptoAlgorithmAES_CFB() = default;
     CryptoAlgorithmIdentifier identifier() const final;
 
-    void encrypt(const CryptoAlgorithmParameters&, Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&) final;
-    void decrypt(const CryptoAlgorithmParameters&, Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&) final;
+    void encrypt(std::unique_ptr<CryptoAlgorithmParameters>&&, Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&) final;
+    void decrypt(std::unique_ptr<CryptoAlgorithmParameters>&&, Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&) final;
     void generateKey(const CryptoAlgorithmParameters&, bool extractable, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&&, ExceptionCallback&&, ScriptExecutionContext&) final;
-    void importKey(CryptoKeyFormat, KeyData&&, const CryptoAlgorithmParameters&, bool extractable, CryptoKeyUsageBitmap, KeyCallback&&, ExceptionCallback&&) final;
+    void importKey(CryptoKeyFormat, KeyData&&, const std::unique_ptr<CryptoAlgorithmParameters>&&, bool extractable, CryptoKeyUsageBitmap, KeyCallback&&, ExceptionCallback&&) final;
     void exportKey(CryptoKeyFormat, Ref<CryptoKey>&&, KeyDataCallback&&, ExceptionCallback&&) final;
     ExceptionOr<size_t> getKeyLength(const CryptoAlgorithmParameters&) final;
 
-    static ExceptionOr<Vector<uint8_t>> platformEncrypt(const CryptoAlgorithmAesCbcCfbParams&, const CryptoKeyAES&, const Vector<uint8_t>&);
-    static ExceptionOr<Vector<uint8_t>> platformDecrypt(const CryptoAlgorithmAesCbcCfbParams&, const CryptoKeyAES&, const Vector<uint8_t>&);
+    static ExceptionOr<Vector<uint8_t>> platformEncrypt(CryptoAlgorithmAesCbcCfbParams&, const CryptoKeyAES&, const Vector<uint8_t>&);
+    static ExceptionOr<Vector<uint8_t>> platformDecrypt(CryptoAlgorithmAesCbcCfbParams&, const CryptoKeyAES&, const Vector<uint8_t>&);
 };
 
 } // namespace WebCore
index ad5bb4b..abea471 100644 (file)
@@ -31,7 +31,6 @@
 #include "CryptoAlgorithmAesCtrParams.h"
 #include "CryptoAlgorithmAesKeyParams.h"
 #include "CryptoKeyAES.h"
-#include <wtf/CrossThreadCopier.h>
 
 namespace WebCore {
 
@@ -47,7 +46,7 @@ static inline bool usagesAreInvalidForCryptoAlgorithmAES_CTR(CryptoKeyUsageBitma
     return usages & (CryptoKeyUsageSign | CryptoKeyUsageVerify | CryptoKeyUsageDeriveKey | CryptoKeyUsageDeriveBits);
 }
 
-static bool parametersAreValid(const CryptoAlgorithmAesCtrParams& parameters)
+static bool parametersAreValid(CryptoAlgorithmAesCtrParams& parameters)
 {
     using namespace CryptoAlgorithmAES_CTRInternal;
     if (parameters.counterVector().size() != CounterSize)
@@ -67,31 +66,33 @@ CryptoAlgorithmIdentifier CryptoAlgorithmAES_CTR::identifier() const
     return s_identifier;
 }
 
-void CryptoAlgorithmAES_CTR::encrypt(const CryptoAlgorithmParameters& parameters, Ref<CryptoKey>&& key, Vector<uint8_t>&& plainText, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
+void CryptoAlgorithmAES_CTR::encrypt(std::unique_ptr<CryptoAlgorithmParameters>&& parameters, Ref<CryptoKey>&& key, Vector<uint8_t>&& plainText, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
 {
-    auto& aesParameters = downcast<CryptoAlgorithmAesCtrParams>(parameters);
+    ASSERT(parameters);
+    auto& aesParameters = downcast<CryptoAlgorithmAesCtrParams>(*parameters);
     if (!parametersAreValid(aesParameters)) {
         exceptionCallback(OperationError);
         return;
     }
 
-    dispatchOperationInWorkQueue(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback),
-        [parameters = crossThreadCopy(aesParameters), key = WTFMove(key), plainText = WTFMove(plainText)] {
-            return platformEncrypt(parameters, downcast<CryptoKeyAES>(key.get()), plainText);
+    dispatchOperation(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback),
+        [parameters = WTFMove(parameters), key = WTFMove(key), plainText = WTFMove(plainText)] {
+            return platformEncrypt(downcast<CryptoAlgorithmAesCtrParams>(*parameters), downcast<CryptoKeyAES>(key.get()), plainText);
         });
 }
 
-void CryptoAlgorithmAES_CTR::decrypt(const CryptoAlgorithmParameters& parameters, Ref<CryptoKey>&& key, Vector<uint8_t>&& cipherText, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
+void CryptoAlgorithmAES_CTR::decrypt(std::unique_ptr<CryptoAlgorithmParameters>&& parameters, Ref<CryptoKey>&& key, Vector<uint8_t>&& cipherText, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
 {
-    auto& aesParameters = downcast<CryptoAlgorithmAesCtrParams>(parameters);
+    ASSERT(parameters);
+    auto& aesParameters = downcast<CryptoAlgorithmAesCtrParams>(*parameters);
     if (!parametersAreValid(aesParameters)) {
         exceptionCallback(OperationError);
         return;
     }
 
-    dispatchOperationInWorkQueue(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback),
-        [parameters = crossThreadCopy(aesParameters), key = WTFMove(key), cipherText = WTFMove(cipherText)] {
-            return platformDecrypt(parameters, downcast<CryptoKeyAES>(key.get()), cipherText);
+    dispatchOperation(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback),
+        [parameters = WTFMove(parameters), key = WTFMove(key), cipherText = WTFMove(cipherText)] {
+            return platformDecrypt(downcast<CryptoAlgorithmAesCtrParams>(*parameters), downcast<CryptoKeyAES>(key.get()), cipherText);
         });
 }
 
@@ -113,10 +114,10 @@ void CryptoAlgorithmAES_CTR::generateKey(const CryptoAlgorithmParameters& parame
     callback(WTFMove(result));
 }
 
-void CryptoAlgorithmAES_CTR::importKey(CryptoKeyFormat format, KeyData&& data, const CryptoAlgorithmParameters& parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyCallback&& callback, ExceptionCallback&& exceptionCallback)
+void CryptoAlgorithmAES_CTR::importKey(CryptoKeyFormat format, KeyData&& data, const std::unique_ptr<CryptoAlgorithmParameters>&& parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyCallback&& callback, ExceptionCallback&& exceptionCallback)
 {
     using namespace CryptoAlgorithmAES_CTRInternal;
-
+    ASSERT(parameters);
     if (usagesAreInvalidForCryptoAlgorithmAES_CTR(usages)) {
         exceptionCallback(SyntaxError);
         return;
@@ -125,7 +126,7 @@ void CryptoAlgorithmAES_CTR::importKey(CryptoKeyFormat format, KeyData&& data, c
     RefPtr<CryptoKeyAES> result;
     switch (format) {
     case CryptoKeyFormat::Raw:
-        result = CryptoKeyAES::importRaw(parameters.identifier, WTFMove(WTF::get<Vector<uint8_t>>(data)), extractable, usages);
+        result = CryptoKeyAES::importRaw(parameters->identifier, WTFMove(WTF::get<Vector<uint8_t>>(data)), extractable, usages);
         break;
     case CryptoKeyFormat::Jwk: {
         auto checkAlgCallback = [](size_t length, const String& alg) -> bool {
@@ -139,7 +140,7 @@ void CryptoAlgorithmAES_CTR::importKey(CryptoKeyFormat format, KeyData&& data, c
             }
             return false;
         };
-        result = CryptoKeyAES::importJwk(parameters.identifier, WTFMove(WTF::get<JsonWebKey>(data)), extractable, usages, WTFMove(checkAlgCallback));
+        result = CryptoKeyAES::importJwk(parameters->identifier, WTFMove(WTF::get<JsonWebKey>(data)), extractable, usages, WTFMove(checkAlgCallback));
         break;
     }
     default:
index 5d32ed7..9e8bf05 100644 (file)
@@ -44,15 +44,15 @@ private:
     CryptoAlgorithmAES_CTR() = default;
     CryptoAlgorithmIdentifier identifier() const final;
 
-    void encrypt(const CryptoAlgorithmParameters&, Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&) final;
-    void decrypt(const CryptoAlgorithmParameters&, Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&) final;
+    void encrypt(std::unique_ptr<CryptoAlgorithmParameters>&&, Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&) final;
+    void decrypt(std::unique_ptr<CryptoAlgorithmParameters>&&, Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&) final;
     void generateKey(const CryptoAlgorithmParameters&, bool extractable, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&&, ExceptionCallback&&, ScriptExecutionContext&) final;
-    void importKey(CryptoKeyFormat, KeyData&&, const CryptoAlgorithmParameters&, bool extractable, CryptoKeyUsageBitmap, KeyCallback&&, ExceptionCallback&&) final;
+    void importKey(CryptoKeyFormat, KeyData&&, const std::unique_ptr<CryptoAlgorithmParameters>&&, bool extractable, CryptoKeyUsageBitmap, KeyCallback&&, ExceptionCallback&&) final;
     void exportKey(CryptoKeyFormat, Ref<CryptoKey>&&, KeyDataCallback&&, ExceptionCallback&&) final;
     ExceptionOr<size_t> getKeyLength(const CryptoAlgorithmParameters&) final;
 
-    static ExceptionOr<Vector<uint8_t>> platformEncrypt(const CryptoAlgorithmAesCtrParams&, const CryptoKeyAES&, const Vector<uint8_t>&);
-    static ExceptionOr<Vector<uint8_t>> platformDecrypt(const CryptoAlgorithmAesCtrParams&, const CryptoKeyAES&, const Vector<uint8_t>&);
+    static ExceptionOr<Vector<uint8_t>> platformEncrypt(CryptoAlgorithmAesCtrParams&, const CryptoKeyAES&, const Vector<uint8_t>&);
+    static ExceptionOr<Vector<uint8_t>> platformDecrypt(CryptoAlgorithmAesCtrParams&, const CryptoKeyAES&, const Vector<uint8_t>&);
 };
 
 } // namespace WebCore
index 305f7e5..4fc1315 100644 (file)
@@ -31,7 +31,6 @@
 #include "CryptoAlgorithmAesGcmParams.h"
 #include "CryptoAlgorithmAesKeyParams.h"
 #include "CryptoKeyAES.h"
-#include <wtf/CrossThreadCopier.h>
 
 namespace WebCore {
 
@@ -71,11 +70,11 @@ CryptoAlgorithmIdentifier CryptoAlgorithmAES_GCM::identifier() const
     return s_identifier;
 }
 
-void CryptoAlgorithmAES_GCM::encrypt(const CryptoAlgorithmParameters& parameters, Ref<CryptoKey>&& key, Vector<uint8_t>&& plainText, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
+void CryptoAlgorithmAES_GCM::encrypt(std::unique_ptr<CryptoAlgorithmParameters>&& parameters, Ref<CryptoKey>&& key, Vector<uint8_t>&& plainText, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
 {
     using namespace CryptoAlgorithmAES_GCMInternal;
-
-    auto& aesParameters = downcast<CryptoAlgorithmAesGcmParams>(parameters);
+    ASSERT(parameters);
+    auto& aesParameters = downcast<CryptoAlgorithmAesGcmParams>(*parameters);
 
 #if __WORDSIZE >= 64
     if (plainText.size() > PlainTextMaxLength) {
@@ -98,17 +97,17 @@ void CryptoAlgorithmAES_GCM::encrypt(const CryptoAlgorithmParameters& parameters
         return;
     }
 
-    dispatchOperationInWorkQueue(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback),
-        [parameters = crossThreadCopy(aesParameters), key = WTFMove(key), plainText = WTFMove(plainText)] {
-            return platformEncrypt(parameters, downcast<CryptoKeyAES>(key.get()), plainText);
+    dispatchOperation(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback),
+        [parameters = WTFMove(parameters), key = WTFMove(key), plainText = WTFMove(plainText)] {
+            return platformEncrypt(downcast<CryptoAlgorithmAesGcmParams>(*parameters), downcast<CryptoKeyAES>(key.get()), plainText);
         });
 }
 
-void CryptoAlgorithmAES_GCM::decrypt(const CryptoAlgorithmParameters& parameters, Ref<CryptoKey>&& key, Vector<uint8_t>&& cipherText, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
+void CryptoAlgorithmAES_GCM::decrypt(std::unique_ptr<CryptoAlgorithmParameters>&& parameters, Ref<CryptoKey>&& key, Vector<uint8_t>&& cipherText, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
 {
     using namespace CryptoAlgorithmAES_GCMInternal;
-
-    auto& aesParameters = downcast<CryptoAlgorithmAesGcmParams>(parameters);
+    ASSERT(parameters);
+    auto& aesParameters = downcast<CryptoAlgorithmAesGcmParams>(*parameters);
 
     aesParameters.tagLength = aesParameters.tagLength ? aesParameters.tagLength : DefaultTagLength;
     if (!tagLengthIsValid(*(aesParameters.tagLength))) {
@@ -131,9 +130,9 @@ void CryptoAlgorithmAES_GCM::decrypt(const CryptoAlgorithmParameters& parameters
     }
 #endif
 
-    dispatchOperationInWorkQueue(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback),
-        [parameters = crossThreadCopy(aesParameters), key = WTFMove(key), cipherText = WTFMove(cipherText)] {
-            return platformDecrypt(parameters, downcast<CryptoKeyAES>(key.get()), cipherText);
+    dispatchOperation(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback),
+        [parameters = WTFMove(parameters), key = WTFMove(key), cipherText = WTFMove(cipherText)] {
+            return platformDecrypt(downcast<CryptoAlgorithmAesGcmParams>(*parameters), downcast<CryptoKeyAES>(key.get()), cipherText);
         });
 }
 
@@ -155,10 +154,10 @@ void CryptoAlgorithmAES_GCM::generateKey(const CryptoAlgorithmParameters& parame
     callback(WTFMove(result));
 }
 
-void CryptoAlgorithmAES_GCM::importKey(CryptoKeyFormat format, KeyData&& data, const CryptoAlgorithmParameters& parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyCallback&& callback, ExceptionCallback&& exceptionCallback)
+void CryptoAlgorithmAES_GCM::importKey(CryptoKeyFormat format, KeyData&& data, const std::unique_ptr<CryptoAlgorithmParameters>&& parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyCallback&& callback, ExceptionCallback&& exceptionCallback)
 {
     using namespace CryptoAlgorithmAES_GCMInternal;
-
+    ASSERT(parameters);
     if (usagesAreInvalidForCryptoAlgorithmAES_GCM(usages)) {
         exceptionCallback(SyntaxError);
         return;
@@ -167,7 +166,7 @@ void CryptoAlgorithmAES_GCM::importKey(CryptoKeyFormat format, KeyData&& data, c
     RefPtr<CryptoKeyAES> result;
     switch (format) {
     case CryptoKeyFormat::Raw:
-        result = CryptoKeyAES::importRaw(parameters.identifier, WTFMove(WTF::get<Vector<uint8_t>>(data)), extractable, usages);
+        result = CryptoKeyAES::importRaw(parameters->identifier, WTFMove(WTF::get<Vector<uint8_t>>(data)), extractable, usages);
         break;
     case CryptoKeyFormat::Jwk: {
         auto checkAlgCallback = [](size_t length, const String& alg) -> bool {
@@ -181,7 +180,7 @@ void CryptoAlgorithmAES_GCM::importKey(CryptoKeyFormat format, KeyData&& data, c
             }
             return false;
         };
-        result = CryptoKeyAES::importJwk(parameters.identifier, WTFMove(WTF::get<JsonWebKey>(data)), extractable, usages, WTFMove(checkAlgCallback));
+        result = CryptoKeyAES::importJwk(parameters->identifier, WTFMove(WTF::get<JsonWebKey>(data)), extractable, usages, WTFMove(checkAlgCallback));
         break;
     }
     default:
index 3c42858..a520fd6 100644 (file)
@@ -44,15 +44,15 @@ private:
     CryptoAlgorithmAES_GCM() = default;
     CryptoAlgorithmIdentifier identifier() const final;
 
-    void encrypt(const CryptoAlgorithmParameters&, Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&) final;
-    void decrypt(const CryptoAlgorithmParameters&, Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&) final;
+    void encrypt(std::unique_ptr<CryptoAlgorithmParameters>&&, Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&) final;
+    void decrypt(std::unique_ptr<CryptoAlgorithmParameters>&&, Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&) final;
     void generateKey(const CryptoAlgorithmParameters&, bool extractable, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&&, ExceptionCallback&&, ScriptExecutionContext&) final;
-    void importKey(CryptoKeyFormat, KeyData&&, const CryptoAlgorithmParameters&, bool extractable, CryptoKeyUsageBitmap, KeyCallback&&, ExceptionCallback&&) final;
+    void importKey(CryptoKeyFormat, KeyData&&, const std::unique_ptr<CryptoAlgorithmParameters>&&, bool extractable, CryptoKeyUsageBitmap, KeyCallback&&, ExceptionCallback&&) final;
     void exportKey(CryptoKeyFormat, Ref<CryptoKey>&&, KeyDataCallback&&, ExceptionCallback&&) final;
     ExceptionOr<size_t> getKeyLength(const CryptoAlgorithmParameters&) final;
 
-    static ExceptionOr<Vector<uint8_t>> platformEncrypt(const CryptoAlgorithmAesGcmParams&, const CryptoKeyAES&, const Vector<uint8_t>&);
-    static ExceptionOr<Vector<uint8_t>> platformDecrypt(const CryptoAlgorithmAesGcmParams&, const CryptoKeyAES&, const Vector<uint8_t>&);
+    static ExceptionOr<Vector<uint8_t>> platformEncrypt(CryptoAlgorithmAesGcmParams&, const CryptoKeyAES&, const Vector<uint8_t>&);
+    static ExceptionOr<Vector<uint8_t>> platformDecrypt(CryptoAlgorithmAesGcmParams&, const CryptoKeyAES&, const Vector<uint8_t>&);
 };
 
 } // namespace WebCore
index 1782c96..804dff0 100644 (file)
@@ -71,10 +71,10 @@ void CryptoAlgorithmAES_KW::generateKey(const CryptoAlgorithmParameters& paramet
     callback(WTFMove(result));
 }
 
-void CryptoAlgorithmAES_KW::importKey(CryptoKeyFormat format, KeyData&& data, const CryptoAlgorithmParameters& parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyCallback&& callback, ExceptionCallback&& exceptionCallback)
+void CryptoAlgorithmAES_KW::importKey(CryptoKeyFormat format, KeyData&& data, const std::unique_ptr<CryptoAlgorithmParameters>&& parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyCallback&& callback, ExceptionCallback&& exceptionCallback)
 {
     using namespace CryptoAlgorithmAES_KWInternal;
-
+    ASSERT(parameters);
     if (usagesAreInvalidForCryptoAlgorithmAES_KW(usages)) {
         exceptionCallback(SyntaxError);
         return;
@@ -83,10 +83,10 @@ void CryptoAlgorithmAES_KW::importKey(CryptoKeyFormat format, KeyData&& data, co
     RefPtr<CryptoKeyAES> result;
     switch (format) {
     case CryptoKeyFormat::Raw:
-        result = CryptoKeyAES::importRaw(parameters.identifier, WTFMove(WTF::get<Vector<uint8_t>>(data)), extractable, usages);
+        result = CryptoKeyAES::importRaw(parameters->identifier, WTFMove(WTF::get<Vector<uint8_t>>(data)), extractable, usages);
         break;
     case CryptoKeyFormat::Jwk: {
-        result = CryptoKeyAES::importJwk(parameters.identifier, WTFMove(WTF::get<JsonWebKey>(data)), extractable, usages, [](size_t length, const String& alg) -> bool {
+        result = CryptoKeyAES::importJwk(parameters->identifier, WTFMove(WTF::get<JsonWebKey>(data)), extractable, usages, [](size_t length, const String& alg) -> bool {
             switch (length) {
             case CryptoKeyAES::s_length128:
                 return alg.isNull() || alg == ALG128;
index ed657be..e0a557f 100644 (file)
@@ -44,7 +44,7 @@ private:
     CryptoAlgorithmIdentifier identifier() const final;
 
     void generateKey(const CryptoAlgorithmParameters&, bool extractable, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&&, ExceptionCallback&&, ScriptExecutionContext&) final;
-    void importKey(CryptoKeyFormat, KeyData&&, const CryptoAlgorithmParameters&, bool extractable, CryptoKeyUsageBitmap, KeyCallback&&, ExceptionCallback&&) final;
+    void importKey(CryptoKeyFormat, KeyData&&, const std::unique_ptr<CryptoAlgorithmParameters>&&, bool extractable, CryptoKeyUsageBitmap, KeyCallback&&, ExceptionCallback&&) final;
     void exportKey(CryptoKeyFormat, Ref<CryptoKey>&&, KeyDataCallback&&, ExceptionCallback&&) final;
     void wrapKey(Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&) final;
     void unwrapKey(Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&) final;
index a6d309d..163bd9c 100644 (file)
@@ -66,7 +66,7 @@ void CryptoAlgorithmECDH::generateKey(const CryptoAlgorithmParameters& parameter
     callback(WTFMove(pair));
 }
 
-void CryptoAlgorithmECDH::deriveBits(const CryptoAlgorithmParameters& parameters, Ref<CryptoKey>&& baseKey, size_t length, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
+void CryptoAlgorithmECDH::deriveBits(std::unique_ptr<CryptoAlgorithmParameters>&& parameters, Ref<CryptoKey>&& baseKey, size_t length, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
 {
     // We only accept length that is a multiple of 8.
     if (length % 8) {
@@ -74,7 +74,8 @@ void CryptoAlgorithmECDH::deriveBits(const CryptoAlgorithmParameters& parameters
         return;
     }
 
-    auto& ecParameters = downcast<CryptoAlgorithmEcdhKeyDeriveParams>(parameters);
+    ASSERT(parameters);
+    auto& ecParameters = downcast<CryptoAlgorithmEcdhKeyDeriveParams>(*parameters);
 
     if (baseKey->type() != CryptoKey::Type::Private) {
         exceptionCallback(InvalidAccessError);
@@ -116,17 +117,18 @@ void CryptoAlgorithmECDH::deriveBits(const CryptoAlgorithmParameters& parameters
     // This is a special case that can't use dispatchOperation() because it bundles
     // the result validation and callback dispatch into unifiedCallback.
     workQueue.dispatch(
-        [baseKey = WTFMove(baseKey), publicKey = ecParameters.publicKey, length, unifiedCallback = WTFMove(unifiedCallback), contextIdentifier = context.contextIdentifier()]() mutable {
-            auto derivedKey = platformDeriveBits(downcast<CryptoKeyEC>(baseKey.get()), downcast<CryptoKeyEC>(*publicKey));
+        [baseKey = WTFMove(baseKey), publicKey = ecParameters.publicKey.releaseNonNull(), length, unifiedCallback = WTFMove(unifiedCallback), contextIdentifier = context.contextIdentifier()]() mutable {
+            auto derivedKey = platformDeriveBits(downcast<CryptoKeyEC>(baseKey.get()), downcast<CryptoKeyEC>(publicKey.get()));
             ScriptExecutionContext::postTaskTo(contextIdentifier, [derivedKey = WTFMove(derivedKey), length, unifiedCallback = WTFMove(unifiedCallback)](auto&) mutable {
                 unifiedCallback(WTFMove(derivedKey), length);
             });
         });
 }
 
-void CryptoAlgorithmECDH::importKey(CryptoKeyFormat format, KeyData&& data, const CryptoAlgorithmParameters& parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyCallback&& callback, ExceptionCallback&& exceptionCallback)
+void CryptoAlgorithmECDH::importKey(CryptoKeyFormat format, KeyData&& data, const std::unique_ptr<CryptoAlgorithmParameters>&& parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyCallback&& callback, ExceptionCallback&& exceptionCallback)
 {
-    const auto& ecParameters = downcast<CryptoAlgorithmEcKeyParams>(parameters);
+    ASSERT(parameters);
+    const auto& ecParameters = downcast<CryptoAlgorithmEcKeyParams>(*parameters);
 
     RefPtr<CryptoKeyEC> result;
     switch (format) {
index 9796fb9..123ee69 100644 (file)
@@ -44,8 +44,8 @@ private:
     CryptoAlgorithmIdentifier identifier() const final;
 
     void generateKey(const CryptoAlgorithmParameters&, bool extractable, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&&, ExceptionCallback&&, ScriptExecutionContext&) final;
-    void deriveBits(const CryptoAlgorithmParameters&, Ref<CryptoKey>&&, size_t length, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&) final;
-    void importKey(CryptoKeyFormat, KeyData&&, const CryptoAlgorithmParameters&, bool extractable, CryptoKeyUsageBitmap, KeyCallback&&, ExceptionCallback&&) final;
+    void deriveBits(std::unique_ptr<CryptoAlgorithmParameters>&&, Ref<CryptoKey>&&, size_t length, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&) final;
+    void importKey(CryptoKeyFormat, KeyData&&, const std::unique_ptr<CryptoAlgorithmParameters>&&, bool extractable, CryptoKeyUsageBitmap, KeyCallback&&, ExceptionCallback&&) final;
     void exportKey(CryptoKeyFormat, Ref<CryptoKey>&&, KeyDataCallback&&, ExceptionCallback&&) final;
 
     static std::optional<Vector<uint8_t>> platformDeriveBits(const CryptoKeyEC&, const CryptoKeyEC&);
index 4f06bcf..131ddce 100644 (file)
@@ -31,7 +31,6 @@
 #include "CryptoAlgorithmEcKeyParams.h"
 #include "CryptoAlgorithmEcdsaParams.h"
 #include "CryptoKeyEC.h"
-#include <wtf/CrossThreadCopier.h>
 
 namespace WebCore {
 
@@ -52,29 +51,29 @@ CryptoAlgorithmIdentifier CryptoAlgorithmECDSA::identifier() const
     return s_identifier;
 }
 
-void CryptoAlgorithmECDSA::sign(const CryptoAlgorithmParameters& parameters, Ref<CryptoKey>&& key, Vector<uint8_t>&& data, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
+void CryptoAlgorithmECDSA::sign(std::unique_ptr<CryptoAlgorithmParameters>&& parameters, Ref<CryptoKey>&& key, Vector<uint8_t>&& data, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
 {
     if (key->type() != CryptoKeyType::Private) {
         exceptionCallback(InvalidAccessError);
         return;
     }
 
-    dispatchOperationInWorkQueue(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback),
-        [parameters = crossThreadCopy(downcast<CryptoAlgorithmEcdsaParams>(parameters)), key = WTFMove(key), data = WTFMove(data)] {
-            return platformSign(parameters, downcast<CryptoKeyEC>(key.get()), data);
+    dispatchOperation(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback),
+        [parameters = WTFMove(parameters), key = WTFMove(key), data = WTFMove(data)] {
+            return platformSign(downcast<CryptoAlgorithmEcdsaParams>(*parameters), downcast<CryptoKeyEC>(key.get()), data);
         });
 }
 
-void CryptoAlgorithmECDSA::verify(const CryptoAlgorithmParameters& parameters, Ref<CryptoKey>&& key, Vector<uint8_t>&& signature, Vector<uint8_t>&& data, BoolCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
+void CryptoAlgorithmECDSA::verify(std::unique_ptr<CryptoAlgorithmParameters>&& parameters, Ref<CryptoKey>&& key, Vector<uint8_t>&& signature, Vector<uint8_t>&& data, BoolCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
 {
     if (key->type() != CryptoKeyType::Public) {
         exceptionCallback(InvalidAccessError);
         return;
     }
 
-    dispatchOperationInWorkQueue(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback),
-        [parameters = crossThreadCopy(downcast<CryptoAlgorithmEcdsaParams>(parameters)), key = WTFMove(key), signature = WTFMove(signature), data = WTFMove(data)] {
-            return platformVerify(parameters, downcast<CryptoKeyEC>(key.get()), signature, data);
+    dispatchOperation(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback),
+        [parameters = WTFMove(parameters), key = WTFMove(key), signature = WTFMove(signature), data = WTFMove(data)] {
+            return platformVerify(downcast<CryptoAlgorithmEcdsaParams>(*parameters), downcast<CryptoKeyEC>(key.get()), signature, data);
         });
 }
 
@@ -99,9 +98,10 @@ void CryptoAlgorithmECDSA::generateKey(const CryptoAlgorithmParameters& paramete
     callback(WTFMove(pair));
 }
 
-void CryptoAlgorithmECDSA::importKey(CryptoKeyFormat format, KeyData&& data, const CryptoAlgorithmParameters& parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyCallback&& callback, ExceptionCallback&& exceptionCallback)
+void CryptoAlgorithmECDSA::importKey(CryptoKeyFormat format, KeyData&& data, const std::unique_ptr<CryptoAlgorithmParameters>&& parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyCallback&& callback, ExceptionCallback&& exceptionCallback)
 {
-    const auto& ecParameters = downcast<CryptoAlgorithmEcKeyParams>(parameters);
+    ASSERT(parameters);
+    const auto& ecParameters = downcast<CryptoAlgorithmEcKeyParams>(*parameters);
 
     RefPtr<CryptoKeyEC> result;
     switch (format) {
index 059c911..738fa60 100644 (file)
@@ -44,10 +44,10 @@ private:
     CryptoAlgorithmECDSA() = default;
     CryptoAlgorithmIdentifier identifier() const final;
 
-    void sign(const CryptoAlgorithmParameters&, Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&) final;
-    void verify(const CryptoAlgorithmParameters&, Ref<CryptoKey>&&, Vector<uint8_t>&& signature, Vector<uint8_t>&&, BoolCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&) final;
+    void sign(std::unique_ptr<CryptoAlgorithmParameters>&&, Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&) final;
+    void verify(std::unique_ptr<CryptoAlgorithmParameters>&&, Ref<CryptoKey>&&, Vector<uint8_t>&& signature, Vector<uint8_t>&&, BoolCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&) final;
     void generateKey(const CryptoAlgorithmParameters&, bool extractable, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&&, ExceptionCallback&&, ScriptExecutionContext&) final;
-    void importKey(CryptoKeyFormat, KeyData&&, const CryptoAlgorithmParameters&, bool extractable, CryptoKeyUsageBitmap, KeyCallback&&, ExceptionCallback&&) final;
+    void importKey(CryptoKeyFormat, KeyData&&, const std::unique_ptr<CryptoAlgorithmParameters>&&, bool extractable, CryptoKeyUsageBitmap, KeyCallback&&, ExceptionCallback&&) final;
     void exportKey(CryptoKeyFormat, Ref<CryptoKey>&&, KeyDataCallback&&, ExceptionCallback&&) final;
 
     static ExceptionOr<Vector<uint8_t>> platformSign(const CryptoAlgorithmEcdsaParams&, const CryptoKeyEC&, const Vector<uint8_t>&);
index 81ff019..879f1ff 100644 (file)
@@ -30,7 +30,6 @@
 
 #include "CryptoAlgorithmHkdfParams.h"
 #include "CryptoKeyRaw.h"
-#include <wtf/CrossThreadCopier.h>
 
 namespace WebCore {
 
@@ -44,20 +43,20 @@ CryptoAlgorithmIdentifier CryptoAlgorithmHKDF::identifier() const
     return s_identifier;
 }
 
-void CryptoAlgorithmHKDF::deriveBits(const CryptoAlgorithmParameters& parameters, Ref<CryptoKey>&& baseKey, size_t length, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
+void CryptoAlgorithmHKDF::deriveBits(std::unique_ptr<CryptoAlgorithmParameters>&& parameters, Ref<CryptoKey>&& baseKey, size_t length, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
 {
     if (!length || length % 8) {
         exceptionCallback(OperationError);
         return;
     }
 
-    dispatchOperationInWorkQueue(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback),
-        [parameters = crossThreadCopy(downcast<CryptoAlgorithmHkdfParams>(parameters)), baseKey = WTFMove(baseKey), length] {
-            return platformDeriveBits(parameters, downcast<CryptoKeyRaw>(baseKey.get()), length);
+    dispatchOperation(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback),
+        [parameters = WTFMove(parameters), baseKey = WTFMove(baseKey), length] {
+            return platformDeriveBits(downcast<CryptoAlgorithmHkdfParams>(*parameters), downcast<CryptoKeyRaw>(baseKey.get()), length);
         });
 }
 
-void CryptoAlgorithmHKDF::importKey(CryptoKeyFormat format, KeyData&& data, const CryptoAlgorithmParameters& parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyCallback&& callback, ExceptionCallback&& exceptionCallback)
+void CryptoAlgorithmHKDF::importKey(CryptoKeyFormat format, KeyData&& data, const std::unique_ptr<CryptoAlgorithmParameters>&& parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyCallback&& callback, ExceptionCallback&& exceptionCallback)
 {
     if (format != CryptoKeyFormat::Raw) {
         exceptionCallback(NotSupportedError);
@@ -72,7 +71,7 @@ void CryptoAlgorithmHKDF::importKey(CryptoKeyFormat format, KeyData&& data, cons
         return;
     }
 
-    callback(CryptoKeyRaw::create(parameters.identifier, WTFMove(WTF::get<Vector<uint8_t>>(data)), usages));
+    callback(CryptoKeyRaw::create(parameters->identifier, WTFMove(WTF::get<Vector<uint8_t>>(data)), usages));
 }
 
 ExceptionOr<size_t> CryptoAlgorithmHKDF::getKeyLength(const CryptoAlgorithmParameters&)
index f23f996..edf67db 100644 (file)
@@ -44,11 +44,11 @@ private:
     CryptoAlgorithmHKDF() = default;
     CryptoAlgorithmIdentifier identifier() const final;
 
-    void deriveBits(const CryptoAlgorithmParameters&, Ref<CryptoKey>&&, size_t length, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&) final;
-    void importKey(CryptoKeyFormat, KeyData&&, const CryptoAlgorithmParameters&, bool extractable, CryptoKeyUsageBitmap, KeyCallback&&, ExceptionCallback&&) final;
+    void deriveBits(std::unique_ptr<CryptoAlgorithmParameters>&&, Ref<CryptoKey>&&, size_t length, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&) final;
+    void importKey(CryptoKeyFormat, KeyData&&, const std::unique_ptr<CryptoAlgorithmParameters>&&, bool extractable, CryptoKeyUsageBitmap, KeyCallback&&, ExceptionCallback&&) final;
     ExceptionOr<size_t> getKeyLength(const CryptoAlgorithmParameters&) final;
 
-    static ExceptionOr<Vector<uint8_t>> platformDeriveBits(const CryptoAlgorithmHkdfParams&, const CryptoKeyRaw&, size_t);
+    static ExceptionOr<Vector<uint8_t>> platformDeriveBits(CryptoAlgorithmHkdfParams&, const CryptoKeyRaw&, size_t);
 };
 
 } // namespace WebCore
index 8a08738..e04c5b9 100644 (file)
@@ -57,17 +57,17 @@ CryptoAlgorithmIdentifier CryptoAlgorithmHMAC::identifier() const
     return s_identifier;
 }
 
-void CryptoAlgorithmHMAC::sign(const CryptoAlgorithmParameters&, Ref<CryptoKey>&& key, Vector<uint8_t>&& data, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
+void CryptoAlgorithmHMAC::sign(std::unique_ptr<CryptoAlgorithmParameters>&&, Ref<CryptoKey>&& key, Vector<uint8_t>&& data, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
 {
-    dispatchOperationInWorkQueue(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback),
+    dispatchOperation(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback),
         [key = WTFMove(key), data = WTFMove(data)] {
             return platformSign(downcast<CryptoKeyHMAC>(key.get()), data);
         });
 }
 
-void CryptoAlgorithmHMAC::verify(const CryptoAlgorithmParameters&, Ref<CryptoKey>&& key, Vector<uint8_t>&& signature, Vector<uint8_t>&& data, BoolCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
+void CryptoAlgorithmHMAC::verify(std::unique_ptr<CryptoAlgorithmParameters>&&, Ref<CryptoKey>&& key, Vector<uint8_t>&& signature, Vector<uint8_t>&& data, BoolCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
 {
-    dispatchOperationInWorkQueue(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback),
+    dispatchOperation(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback),
         [key = WTFMove(key), signature = WTFMove(signature), data = WTFMove(data)] {
             return platformVerify(downcast<CryptoKeyHMAC>(key.get()), signature, data);
         });
@@ -96,11 +96,11 @@ void CryptoAlgorithmHMAC::generateKey(const CryptoAlgorithmParameters& parameter
     callback(WTFMove(result));
 }
 
-void CryptoAlgorithmHMAC::importKey(CryptoKeyFormat format, KeyData&& data, const CryptoAlgorithmParameters& parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyCallback&& callback, ExceptionCallback&& exceptionCallback)
+void CryptoAlgorithmHMAC::importKey(CryptoKeyFormat format, KeyData&& data, const std::unique_ptr<CryptoAlgorithmParameters>&& parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyCallback&& callback, ExceptionCallback&& exceptionCallback)
 {
     using namespace CryptoAlgorithmHMACInternal;
-
-    const auto& hmacParameters = downcast<CryptoAlgorithmHmacKeyParams>(parameters);
+    ASSERT(parameters);
+    const auto& hmacParameters = downcast<CryptoAlgorithmHmacKeyParams>(*parameters);
 
     if (usagesAreInvalidForCryptoAlgorithmHMAC(usages)) {
         exceptionCallback(SyntaxError);
index d394cb7..7d8f7b4 100644 (file)
@@ -43,10 +43,10 @@ private:
     CryptoAlgorithmHMAC() = default;
     CryptoAlgorithmIdentifier identifier() const final;
 
-    void sign(const CryptoAlgorithmParameters&, Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&) final;
-    void verify(const CryptoAlgorithmParameters&, Ref<CryptoKey>&&, Vector<uint8_t>&& signature, Vector<uint8_t>&&, BoolCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&) final;
+    void sign(std::unique_ptr<CryptoAlgorithmParameters>&&, Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&) final;
+    void verify(std::unique_ptr<CryptoAlgorithmParameters>&&, Ref<CryptoKey>&&, Vector<uint8_t>&& signature, Vector<uint8_t>&&, BoolCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&) final;
     void generateKey(const CryptoAlgorithmParameters&, bool extractable, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&&, ExceptionCallback&&, ScriptExecutionContext&) final;
-    void importKey(CryptoKeyFormat, KeyData&&, const CryptoAlgorithmParameters&, bool extractable, CryptoKeyUsageBitmap, KeyCallback&&, ExceptionCallback&&) final;
+    void importKey(CryptoKeyFormat, KeyData&&, const std::unique_ptr<CryptoAlgorithmParameters>&&, bool extractable, CryptoKeyUsageBitmap, KeyCallback&&, ExceptionCallback&&) final;
     void exportKey(CryptoKeyFormat, Ref<CryptoKey>&&, KeyDataCallback&&, ExceptionCallback&&) final;
     ExceptionOr<size_t> getKeyLength(const CryptoAlgorithmParameters&) final;
 
index 4156fd0..0562e5b 100644 (file)
@@ -30,7 +30,6 @@
 
 #include "CryptoAlgorithmPbkdf2Params.h"
 #include "CryptoKeyRaw.h"
-#include <wtf/CrossThreadCopier.h>
 
 namespace WebCore {
 
@@ -44,20 +43,20 @@ CryptoAlgorithmIdentifier CryptoAlgorithmPBKDF2::identifier() const
     return s_identifier;
 }
 
-void CryptoAlgorithmPBKDF2::deriveBits(const CryptoAlgorithmParameters& parameters, Ref<CryptoKey>&& baseKey, size_t length, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
+void CryptoAlgorithmPBKDF2::deriveBits(std::unique_ptr<CryptoAlgorithmParameters>&& parameters, Ref<CryptoKey>&& baseKey, size_t length, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
 {
     if (!length || length % 8) {
         exceptionCallback(OperationError);
         return;
     }
 
-    dispatchOperationInWorkQueue(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback),
-        [parameters = crossThreadCopy(downcast<CryptoAlgorithmPbkdf2Params>(parameters)), baseKey = WTFMove(baseKey), length] {
-            return platformDeriveBits(parameters, downcast<CryptoKeyRaw>(baseKey.get()), length);
+    dispatchOperation(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback),
+        [parameters = WTFMove(parameters), baseKey = WTFMove(baseKey), length] {
+            return platformDeriveBits(downcast<CryptoAlgorithmPbkdf2Params>(*parameters), downcast<CryptoKeyRaw>(baseKey.get()), length);
         });
 }
 
-void CryptoAlgorithmPBKDF2::importKey(CryptoKeyFormat format, KeyData&& data, const CryptoAlgorithmParameters& parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyCallback&& callback, ExceptionCallback&& exceptionCallback)
+void CryptoAlgorithmPBKDF2::importKey(CryptoKeyFormat format, KeyData&& data, const std::unique_ptr<CryptoAlgorithmParameters>&& parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyCallback&& callback, ExceptionCallback&& exceptionCallback)
 {
     if (format != CryptoKeyFormat::Raw) {
         exceptionCallback(NotSupportedError);
@@ -72,7 +71,7 @@ void CryptoAlgorithmPBKDF2::importKey(CryptoKeyFormat format, KeyData&& data, co
         return;
     }
 
-    callback(CryptoKeyRaw::create(parameters.identifier, WTFMove(WTF::get<Vector<uint8_t>>(data)), usages));
+    callback(CryptoKeyRaw::create(parameters->identifier, WTFMove(WTF::get<Vector<uint8_t>>(data)), usages));
 }
 
 ExceptionOr<size_t> CryptoAlgorithmPBKDF2::getKeyLength(const CryptoAlgorithmParameters&)
index 7832130..e21e186 100644 (file)
@@ -44,11 +44,11 @@ private:
     CryptoAlgorithmPBKDF2() = default;
     CryptoAlgorithmIdentifier identifier() const final;
 
-    void deriveBits(const CryptoAlgorithmParameters&, Ref<CryptoKey>&&, size_t length, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&) final;
-    void importKey(CryptoKeyFormat, KeyData&&, const CryptoAlgorithmParameters&, bool extractable, CryptoKeyUsageBitmap, KeyCallback&&, ExceptionCallback&&) final;
+    void deriveBits(std::unique_ptr<CryptoAlgorithmParameters>&&, Ref<CryptoKey>&&, size_t length, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&) final;
+    void importKey(CryptoKeyFormat, KeyData&&, const std::unique_ptr<CryptoAlgorithmParameters>&&, bool extractable, CryptoKeyUsageBitmap, KeyCallback&&, ExceptionCallback&&) final;
     ExceptionOr<size_t> getKeyLength(const CryptoAlgorithmParameters&) final;
 
-    static ExceptionOr<Vector<uint8_t>> platformDeriveBits(const CryptoAlgorithmPbkdf2Params&, const CryptoKeyRaw&, size_t);
+    static ExceptionOr<Vector<uint8_t>> platformDeriveBits(CryptoAlgorithmPbkdf2Params&, const CryptoKeyRaw&, size_t);
 };
 
 } // namespace WebCore
index 3794475..76eeeb5 100644 (file)
@@ -47,27 +47,27 @@ CryptoAlgorithmIdentifier CryptoAlgorithmRSAES_PKCS1_v1_5::identifier() const
     return s_identifier;
 }
 
-void CryptoAlgorithmRSAES_PKCS1_v1_5::encrypt(const CryptoAlgorithmParameters&, Ref<CryptoKey>&& key, Vector<uint8_t>&& plainText, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
+void CryptoAlgorithmRSAES_PKCS1_v1_5::encrypt(std::unique_ptr<CryptoAlgorithmParameters>&&, Ref<CryptoKey>&& key, Vector<uint8_t>&& plainText, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
 {
     if (key->type() != CryptoKeyType::Public) {
         exceptionCallback(InvalidAccessError);
         return;
     }
 
-    dispatchOperationInWorkQueue(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback),
+    dispatchOperation(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback),
         [key = WTFMove(key), plainText = WTFMove(plainText)] {
             return platformEncrypt(downcast<CryptoKeyRSA>(key.get()), plainText);
         });
 }
 
-void CryptoAlgorithmRSAES_PKCS1_v1_5::decrypt(const CryptoAlgorithmParameters&, Ref<CryptoKey>&& key, Vector<uint8_t>&& cipherText, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
+void CryptoAlgorithmRSAES_PKCS1_v1_5::decrypt(std::unique_ptr<CryptoAlgorithmParameters>&&, Ref<CryptoKey>&& key, Vector<uint8_t>&& cipherText, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
 {
     if (key->type() != CryptoKeyType::Private) {
         exceptionCallback(InvalidAccessError);
         return;
     }
 
-    dispatchOperationInWorkQueue(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback),
+    dispatchOperation(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback),
         [key = WTFMove(key), cipherText = WTFMove(cipherText)] {
             return platformDecrypt(downcast<CryptoKeyRSA>(key.get()), cipherText);
         });
@@ -94,8 +94,9 @@ void CryptoAlgorithmRSAES_PKCS1_v1_5::generateKey(const CryptoAlgorithmParameter
     CryptoKeyRSA::generatePair(CryptoAlgorithmIdentifier::RSAES_PKCS1_v1_5, CryptoAlgorithmIdentifier::SHA_1, false, rsaParameters.modulusLength, rsaParameters.publicExponentVector(), extractable, usages, WTFMove(keyPairCallback), WTFMove(failureCallback), &context);
 }
 
-void CryptoAlgorithmRSAES_PKCS1_v1_5::importKey(CryptoKeyFormat format, KeyData&& data, const CryptoAlgorithmParameters& parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyCallback&& callback, ExceptionCallback&& exceptionCallback)
+void CryptoAlgorithmRSAES_PKCS1_v1_5::importKey(CryptoKeyFormat format, KeyData&& data, const std::unique_ptr<CryptoAlgorithmParameters>&& parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyCallback&& callback, ExceptionCallback&& exceptionCallback)
 {
+    ASSERT(parameters);
     RefPtr<CryptoKeyRSA> result;
     switch (format) {
     case CryptoKeyFormat::Jwk: {
@@ -112,7 +113,7 @@ void CryptoAlgorithmRSAES_PKCS1_v1_5::importKey(CryptoKeyFormat format, KeyData&
             exceptionCallback(DataError);
             return;
         }
-        result = CryptoKeyRSA::importJwk(parameters.identifier, std::nullopt, WTFMove(key), extractable, usages);
+        result = CryptoKeyRSA::importJwk(parameters->identifier, std::nullopt, WTFMove(key), extractable, usages);
         break;
     }
     case CryptoKeyFormat::Spki: {
@@ -120,7 +121,7 @@ void CryptoAlgorithmRSAES_PKCS1_v1_5::importKey(CryptoKeyFormat format, KeyData&
             exceptionCallback(SyntaxError);
             return;
         }
-        result = CryptoKeyRSA::importSpki(parameters.identifier, std::nullopt, WTFMove(WTF::get<Vector<uint8_t>>(data)), extractable, usages);
+        result = CryptoKeyRSA::importSpki(parameters->identifier, std::nullopt, WTFMove(WTF::get<Vector<uint8_t>>(data)), extractable, usages);
         break;
     }
     case CryptoKeyFormat::Pkcs8: {
@@ -128,7 +129,7 @@ void CryptoAlgorithmRSAES_PKCS1_v1_5::importKey(CryptoKeyFormat format, KeyData&
             exceptionCallback(SyntaxError);
             return;
         }
-        result = CryptoKeyRSA::importPkcs8(parameters.identifier, std::nullopt, WTFMove(WTF::get<Vector<uint8_t>>(data)), extractable, usages);
+        result = CryptoKeyRSA::importPkcs8(parameters->identifier, std::nullopt, WTFMove(WTF::get<Vector<uint8_t>>(data)), extractable, usages);
         break;
     }
     default:
index 6b21041..31f69a6 100644 (file)
@@ -43,10 +43,10 @@ private:
     CryptoAlgorithmRSAES_PKCS1_v1_5() = default;
     CryptoAlgorithmIdentifier identifier() const final;
 
-    void encrypt(const CryptoAlgorithmParameters&, Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&) final;
-    void decrypt(const CryptoAlgorithmParameters&, Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&) final;
+    void encrypt(std::unique_ptr<CryptoAlgorithmParameters>&&, Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&) final;
+    void decrypt(std::unique_ptr<CryptoAlgorithmParameters>&&, Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&) final;
     void generateKey(const CryptoAlgorithmParameters&, bool extractable, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&&, ExceptionCallback&&, ScriptExecutionContext&) final;
-    void importKey(CryptoKeyFormat, KeyData&&, const CryptoAlgorithmParameters&, bool extractable, CryptoKeyUsageBitmap, KeyCallback&&, ExceptionCallback&&) final;
+    void importKey(CryptoKeyFormat, KeyData&&, const std::unique_ptr<CryptoAlgorithmParameters>&&, bool extractable, CryptoKeyUsageBitmap, KeyCallback&&, ExceptionCallback&&) final;
     void exportKey(CryptoKeyFormat, Ref<CryptoKey>&&, KeyDataCallback&&, ExceptionCallback&&) final;
 
     static ExceptionOr<Vector<uint8_t>> platformEncrypt(const CryptoKeyRSA&, const Vector<uint8_t>&);
index 5fb55ca..e15276d 100644 (file)
@@ -54,27 +54,27 @@ CryptoAlgorithmIdentifier CryptoAlgorithmRSASSA_PKCS1_v1_5::identifier() const
     return s_identifier;
 }
 
-void CryptoAlgorithmRSASSA_PKCS1_v1_5::sign(const CryptoAlgorithmParameters&, Ref<CryptoKey>&& key, Vector<uint8_t>&& data, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
+void CryptoAlgorithmRSASSA_PKCS1_v1_5::sign(std::unique_ptr<CryptoAlgorithmParameters>&&, Ref<CryptoKey>&& key, Vector<uint8_t>&& data, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
 {
     if (key->type() != CryptoKeyType::Private) {
         exceptionCallback(InvalidAccessError);
         return;
     }
 
-    dispatchOperationInWorkQueue(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback),
+    dispatchOperation(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback),
         [key = WTFMove(key), data = WTFMove(data)] {
             return platformSign(downcast<CryptoKeyRSA>(key.get()), data);
         });
 }
 
-void CryptoAlgorithmRSASSA_PKCS1_v1_5::verify(const CryptoAlgorithmParameters&, Ref<CryptoKey>&& key, Vector<uint8_t>&& signature, Vector<uint8_t>&& data, BoolCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
+void CryptoAlgorithmRSASSA_PKCS1_v1_5::verify(std::unique_ptr<CryptoAlgorithmParameters>&&, Ref<CryptoKey>&& key, Vector<uint8_t>&& signature, Vector<uint8_t>&& data, BoolCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
 {
     if (key->type() != CryptoKeyType::Public) {
         exceptionCallback(InvalidAccessError);
         return;
     }
 
-    dispatchOperationInWorkQueue(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback),
+    dispatchOperation(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback),
         [key = WTFMove(key), signature = WTFMove(signature), data = WTFMove(data)] {
             return platformVerify(downcast<CryptoKeyRSA>(key.get()), signature, data);
         });
@@ -100,11 +100,11 @@ void CryptoAlgorithmRSASSA_PKCS1_v1_5::generateKey(const CryptoAlgorithmParamete
     CryptoKeyRSA::generatePair(CryptoAlgorithmIdentifier::RSASSA_PKCS1_v1_5, rsaParameters.hashIdentifier, true, rsaParameters.modulusLength, rsaParameters.publicExponentVector(), extractable, usages, WTFMove(keyPairCallback), WTFMove(failureCallback), &context);
 }
 
-void CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey(CryptoKeyFormat format, KeyData&& data, const CryptoAlgorithmParameters& parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyCallback&& callback, ExceptionCallback&& exceptionCallback)
+void CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey(CryptoKeyFormat format, KeyData&& data, const std::unique_ptr<CryptoAlgorithmParameters>&& parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyCallback&& callback, ExceptionCallback&& exceptionCallback)
 {
     using namespace CryptoAlgorithmRSASSA_PKCS1_v1_5Internal;
-
-    const auto& rsaParameters = downcast<CryptoAlgorithmRsaHashedImportParams>(parameters);
+    ASSERT(parameters);
+    const auto& rsaParameters = downcast<CryptoAlgorithmRsaHashedImportParams>(*parameters);
 
     RefPtr<CryptoKeyRSA> result;
     switch (format) {
@@ -163,7 +163,7 @@ void CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey(CryptoKeyFormat format, KeyData
             return;
         }
         // FIXME: <webkit.org/b/165436>
-        result = CryptoKeyRSA::importPkcs8(parameters.identifier, rsaParameters.hashIdentifier, WTFMove(WTF::get<Vector<uint8_t>>(data)), extractable, usages);
+        result = CryptoKeyRSA::importPkcs8(parameters->identifier, rsaParameters.hashIdentifier, WTFMove(WTF::get<Vector<uint8_t>>(data)), extractable, usages);
         break;
     }
     default:
index 1d668cb..d47b182 100644 (file)
@@ -43,10 +43,10 @@ private:
     CryptoAlgorithmRSASSA_PKCS1_v1_5() = default;
     CryptoAlgorithmIdentifier identifier() const final;
 
-    void sign(const CryptoAlgorithmParameters&, Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&) final;
-    void verify(const CryptoAlgorithmParameters&, Ref<CryptoKey>&&, Vector<uint8_t>&& signature, Vector<uint8_t>&&, BoolCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&) final;
+    void sign(std::unique_ptr<CryptoAlgorithmParameters>&&, Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&) final;
+    void verify(std::unique_ptr<CryptoAlgorithmParameters>&&, Ref<CryptoKey>&&, Vector<uint8_t>&& signature, Vector<uint8_t>&&, BoolCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&) final;
     void generateKey(const CryptoAlgorithmParameters&, bool extractable, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&&, ExceptionCallback&&, ScriptExecutionContext&) final;
-    void importKey(CryptoKeyFormat, KeyData&&, const CryptoAlgorithmParameters&, bool extractable, CryptoKeyUsageBitmap, KeyCallback&&, ExceptionCallback&&) final;
+    void importKey(CryptoKeyFormat, KeyData&&, const std::unique_ptr<CryptoAlgorithmParameters>&&, bool extractable, CryptoKeyUsageBitmap, KeyCallback&&, ExceptionCallback&&) final;
     void exportKey(CryptoKeyFormat, Ref<CryptoKey>&&, KeyDataCallback&&, ExceptionCallback&&) final;
 
     static ExceptionOr<Vector<uint8_t>> platformSign(const CryptoKeyRSA&, const Vector<uint8_t>&);
index 210aec8..3ae1f0a 100644 (file)
@@ -33,7 +33,6 @@
 #include "CryptoAlgorithmRsaOaepParams.h"
 #include "CryptoKeyPair.h"
 #include "CryptoKeyRSA.h"
-#include <wtf/CrossThreadCopier.h>
 #include <wtf/Variant.h>
 
 namespace WebCore {
@@ -56,29 +55,31 @@ CryptoAlgorithmIdentifier CryptoAlgorithmRSA_OAEP::identifier() const
     return s_identifier;
 }
 
-void CryptoAlgorithmRSA_OAEP::encrypt(const CryptoAlgorithmParameters& parameters, Ref<CryptoKey>&& key, Vector<uint8_t>&& plainText, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
+void CryptoAlgorithmRSA_OAEP::encrypt(std::unique_ptr<CryptoAlgorithmParameters>&& parameters, Ref<CryptoKey>&& key, Vector<uint8_t>&& plainText, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
 {
+    ASSERT(parameters);
     if (key->type() != CryptoKeyType::Public) {
         exceptionCallback(InvalidAccessError);
         return;
     }
 
-    dispatchOperationInWorkQueue(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback),
-        [parameters = crossThreadCopy(downcast<CryptoAlgorithmRsaOaepParams>(parameters)), key = WTFMove(key), plainText = WTFMove(plainText)] {
-            return platformEncrypt(parameters, downcast<CryptoKeyRSA>(key.get()), plainText);
+    dispatchOperation(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback),
+        [parameters = WTFMove(parameters), key = WTFMove(key), plainText = WTFMove(plainText)] {
+            return platformEncrypt(downcast<CryptoAlgorithmRsaOaepParams>(*parameters), downcast<CryptoKeyRSA>(key.get()), plainText);
         });
 }
 
-void CryptoAlgorithmRSA_OAEP::decrypt(const CryptoAlgorithmParameters& parameters, Ref<CryptoKey>&& key, Vector<uint8_t>&& cipherText, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
+void CryptoAlgorithmRSA_OAEP::decrypt(std::unique_ptr<CryptoAlgorithmParameters>&& parameters, Ref<CryptoKey>&& key, Vector<uint8_t>&& cipherText, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
 {
+    ASSERT(parameters);
     if (key->type() != CryptoKeyType::Private) {
         exceptionCallback(InvalidAccessError);
         return;
     }
 
-    dispatchOperationInWorkQueue(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback),
-        [parameters = crossThreadCopy(downcast<CryptoAlgorithmRsaOaepParams>(parameters)), key = WTFMove(key), cipherText = WTFMove(cipherText)] {
-            return platformDecrypt(parameters, downcast<CryptoKeyRSA>(key.get()), cipherText);
+    dispatchOperation(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback),
+        [parameters = WTFMove(parameters), key = WTFMove(key), cipherText = WTFMove(cipherText)] {
+            return platformDecrypt(downcast<CryptoAlgorithmRsaOaepParams>(*parameters), downcast<CryptoKeyRSA>(key.get()), cipherText);
         });
 }
 
@@ -102,11 +103,11 @@ void CryptoAlgorithmRSA_OAEP::generateKey(const CryptoAlgorithmParameters& param
     CryptoKeyRSA::generatePair(CryptoAlgorithmIdentifier::RSA_OAEP, rsaParameters.hashIdentifier, true, rsaParameters.modulusLength, rsaParameters.publicExponentVector(), extractable, usages, WTFMove(keyPairCallback), WTFMove(failureCallback), &context);
 }
 
-void CryptoAlgorithmRSA_OAEP::importKey(CryptoKeyFormat format, KeyData&& data, const CryptoAlgorithmParameters& parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyCallback&& callback, ExceptionCallback&& exceptionCallback)
+void CryptoAlgorithmRSA_OAEP::importKey(CryptoKeyFormat format, KeyData&& data, const std::unique_ptr<CryptoAlgorithmParameters>&& parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyCallback&& callback, ExceptionCallback&& exceptionCallback)
 {
     using namespace CryptoAlgorithmRSA_OAEPInternal;
-
-    const auto& rsaParameters = downcast<CryptoAlgorithmRsaHashedImportParams>(parameters);
+    ASSERT(parameters);
+    const auto& rsaParameters = downcast<CryptoAlgorithmRsaHashedImportParams>(*parameters);
 
     RefPtr<CryptoKeyRSA> result;
     switch (format) {
@@ -177,7 +178,7 @@ void CryptoAlgorithmRSA_OAEP::importKey(CryptoKeyFormat format, KeyData&& data,
             return;
         }
         // FIXME: <webkit.org/b/165436>
-        result = CryptoKeyRSA::importPkcs8(parameters.identifier, rsaParameters.hashIdentifier, WTFMove(WTF::get<Vector<uint8_t>>(data)), extractable, usages);
+        result = CryptoKeyRSA::importPkcs8(parameters->identifier, rsaParameters.hashIdentifier, WTFMove(WTF::get<Vector<uint8_t>>(data)), extractable, usages);
         break;
     }
     default:
index a8a7e19..0028bef 100644 (file)
@@ -44,14 +44,14 @@ private:
     CryptoAlgorithmRSA_OAEP() = default;
     CryptoAlgorithmIdentifier identifier() const final;
 
-    void encrypt(const CryptoAlgorithmParameters&, Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&) final;
-    void decrypt(const CryptoAlgorithmParameters&, Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&) final;
+    void encrypt(std::unique_ptr<CryptoAlgorithmParameters>&&, Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&) final;
+    void decrypt(std::unique_ptr<CryptoAlgorithmParameters>&&, Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&) final;
     void generateKey(const CryptoAlgorithmParameters&, bool extractable, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&&, ExceptionCallback&&, ScriptExecutionContext&) final;
-    void importKey(CryptoKeyFormat, KeyData&&, const CryptoAlgorithmParameters&, bool extractable, CryptoKeyUsageBitmap, KeyCallback&&, ExceptionCallback&&) final;
+    void importKey(CryptoKeyFormat, KeyData&&, const std::unique_ptr<CryptoAlgorithmParameters>&&, bool extractable, CryptoKeyUsageBitmap, KeyCallback&&, ExceptionCallback&&) final;
     void exportKey(CryptoKeyFormat, Ref<CryptoKey>&&, KeyDataCallback&&, ExceptionCallback&&) final;
 
-    static ExceptionOr<Vector<uint8_t>> platformEncrypt(const CryptoAlgorithmRsaOaepParams&, const CryptoKeyRSA&, const Vector<uint8_t>&);
-    static ExceptionOr<Vector<uint8_t>> platformDecrypt(const CryptoAlgorithmRsaOaepParams&, const CryptoKeyRSA&, const Vector<uint8_t>&);
+    static ExceptionOr<Vector<uint8_t>> platformEncrypt(CryptoAlgorithmRsaOaepParams&, const CryptoKeyRSA&, const Vector<uint8_t>&);
+    static ExceptionOr<Vector<uint8_t>> platformDecrypt(CryptoAlgorithmRsaOaepParams&, const CryptoKeyRSA&, const Vector<uint8_t>&);
 };
 
 } // namespace WebCore
index 0500d8a..124d64e 100644 (file)
@@ -33,7 +33,6 @@
 #include "CryptoAlgorithmRsaPssParams.h"
 #include "CryptoKeyPair.h"
 #include "CryptoKeyRSA.h"
-#include <wtf/CrossThreadCopier.h>
 #include <wtf/Variant.h>
 
 namespace WebCore {
@@ -56,29 +55,29 @@ CryptoAlgorithmIdentifier CryptoAlgorithmRSA_PSS::identifier() const
     return s_identifier;
 }
 
-void CryptoAlgorithmRSA_PSS::sign(const CryptoAlgorithmParameters& parameters, Ref<CryptoKey>&& key, Vector<uint8_t>&& data, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
+void CryptoAlgorithmRSA_PSS::sign(std::unique_ptr<CryptoAlgorithmParameters>&& parameters, Ref<CryptoKey>&& key, Vector<uint8_t>&& data, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
 {
     if (key->type() != CryptoKeyType::Private) {
         exceptionCallback(InvalidAccessError);
         return;
     }
 
-    dispatchOperationInWorkQueue(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback),
-        [parameters = crossThreadCopy(downcast<CryptoAlgorithmRsaPssParams>(parameters)), key = WTFMove(key), data = WTFMove(data)] {
-            return platformSign(parameters, downcast<CryptoKeyRSA>(key.get()), data);
+    dispatchOperation(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback),
+        [parameters = WTFMove(parameters), key = WTFMove(key), data = WTFMove(data)] {
+            return platformSign(downcast<CryptoAlgorithmRsaPssParams>(*parameters), downcast<CryptoKeyRSA>(key.get()), data);
         });
 }
 
-void CryptoAlgorithmRSA_PSS::verify(const CryptoAlgorithmParameters& parameters, Ref<CryptoKey>&& key, Vector<uint8_t>&& signature, Vector<uint8_t>&& data, BoolCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
+void CryptoAlgorithmRSA_PSS::verify(std::unique_ptr<CryptoAlgorithmParameters>&& parameters, Ref<CryptoKey>&& key, Vector<uint8_t>&& signature, Vector<uint8_t>&& data, BoolCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
 {
     if (key->type() != CryptoKeyType::Public) {
         exceptionCallback(InvalidAccessError);
         return;
     }
 
-    dispatchOperationInWorkQueue(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback),
-        [parameters = crossThreadCopy(downcast<CryptoAlgorithmRsaPssParams>(parameters)), key = WTFMove(key), signature = WTFMove(signature), data = WTFMove(data)] {
-            return platformVerify(parameters, downcast<CryptoKeyRSA>(key.get()), signature, data);
+    dispatchOperation(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback),
+        [parameters = WTFMove(parameters), key = WTFMove(key), signature = WTFMove(signature), data = WTFMove(data)] {
+            return platformVerify(downcast<CryptoAlgorithmRsaPssParams>(*parameters), downcast<CryptoKeyRSA>(key.get()), signature, data);
         });
 }
 
@@ -102,11 +101,11 @@ void CryptoAlgorithmRSA_PSS::generateKey(const CryptoAlgorithmParameters& parame
     CryptoKeyRSA::generatePair(CryptoAlgorithmIdentifier::RSA_PSS, rsaParameters.hashIdentifier, true, rsaParameters.modulusLength, rsaParameters.publicExponentVector(), extractable, usages, WTFMove(keyPairCallback), WTFMove(failureCallback), &context);
 }
 
-void CryptoAlgorithmRSA_PSS::importKey(CryptoKeyFormat format, KeyData&& data, const CryptoAlgorithmParameters& parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyCallback&& callback, ExceptionCallback&& exceptionCallback)
+void CryptoAlgorithmRSA_PSS::importKey(CryptoKeyFormat format, KeyData&& data, const std::unique_ptr<CryptoAlgorithmParameters>&& parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyCallback&& callback, ExceptionCallback&& exceptionCallback)
 {
     using namespace CryptoAlgorithmRSA_PSSInternal;
-
-    const auto& rsaParameters = downcast<CryptoAlgorithmRsaHashedImportParams>(parameters);
+    ASSERT(parameters);
+    const auto& rsaParameters = downcast<CryptoAlgorithmRsaHashedImportParams>(*parameters);
 
     RefPtr<CryptoKeyRSA> result;
     switch (format) {
@@ -165,7 +164,7 @@ void CryptoAlgorithmRSA_PSS::importKey(CryptoKeyFormat format, KeyData&& data, c
             return;
         }
         // FIXME: <webkit.org/b/165436>
-        result = CryptoKeyRSA::importPkcs8(parameters.identifier, rsaParameters.hashIdentifier, WTFMove(WTF::get<Vector<uint8_t>>(data)), extractable, usages);
+        result = CryptoKeyRSA::importPkcs8(parameters->identifier, rsaParameters.hashIdentifier, WTFMove(WTF::get<Vector<uint8_t>>(data)), extractable, usages);
         break;
     }
     default:
index 6efc428..af572f4 100644 (file)
@@ -44,14 +44,14 @@ private:
     CryptoAlgorithmRSA_PSS() = default;
     CryptoAlgorithmIdentifier identifier() const final;
 
-    void sign(const CryptoAlgorithmParameters&, Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&) final;
-    void verify(const CryptoAlgorithmParameters&, Ref<CryptoKey>&&, Vector<uint8_t>&& signature, Vector<uint8_t>&&, BoolCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&) final;
+    void sign(std::unique_ptr<CryptoAlgorithmParameters>&&, Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&) final;
+    void verify(std::unique_ptr<CryptoAlgorithmParameters>&&, Ref<CryptoKey>&&, Vector<uint8_t>&& signature, Vector<uint8_t>&&, BoolCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&) final;
     void generateKey(const CryptoAlgorithmParameters&, bool extractable, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&&, ExceptionCallback&&, ScriptExecutionContext&) final;
-    void importKey(CryptoKeyFormat, KeyData&&, const CryptoAlgorithmParameters&, bool extractable, CryptoKeyUsageBitmap, KeyCallback&&, ExceptionCallback&&) final;
+    void importKey(CryptoKeyFormat, KeyData&&, const std::unique_ptr<CryptoAlgorithmParameters>&&, bool extractable, CryptoKeyUsageBitmap, KeyCallback&&, ExceptionCallback&&) final;
     void exportKey(CryptoKeyFormat, Ref<CryptoKey>&&, KeyDataCallback&&, ExceptionCallback&&) final;
 
-    static ExceptionOr<Vector<uint8_t>> platformSign(const CryptoAlgorithmRsaPssParams&, const CryptoKeyRSA&, const Vector<uint8_t>&);
-    static ExceptionOr<bool> platformVerify(const CryptoAlgorithmRsaPssParams&, const CryptoKeyRSA&, const Vector<uint8_t>&, const Vector<uint8_t>&);
+    static ExceptionOr<Vector<uint8_t>> platformSign(CryptoAlgorithmRsaPssParams&, const CryptoKeyRSA&, const Vector<uint8_t>&);
+    static ExceptionOr<bool> platformVerify(CryptoAlgorithmRsaPssParams&, const CryptoKeyRSA&, const Vector<uint8_t>&, const Vector<uint8_t>&);
 };
 
 } // namespace WebCore
index de581dc..13c80cc 100644 (file)
@@ -166,7 +166,7 @@ static std::optional<Vector<uint8_t>> gcryptDecrypt(const Vector<uint8_t>& key,
     return output;
 }
 
-ExceptionOr<Vector<uint8_t>> CryptoAlgorithmAES_CBC::platformEncrypt(const CryptoAlgorithmAesCbcCfbParams& parameters, const CryptoKeyAES& key, const Vector<uint8_t>& plainText)
+ExceptionOr<Vector<uint8_t>> CryptoAlgorithmAES_CBC::platformEncrypt(CryptoAlgorithmAesCbcCfbParams& parameters, const CryptoKeyAES& key, const Vector<uint8_t>& plainText)
 {
     auto output = gcryptEncrypt(key.key(), parameters.ivVector(), Vector<uint8_t>(plainText));
     if (!output)
@@ -174,7 +174,7 @@ ExceptionOr<Vector<uint8_t>> CryptoAlgorithmAES_CBC::platformEncrypt(const Crypt
     return WTFMove(*output);
 }
 
-ExceptionOr<Vector<uint8_t>> CryptoAlgorithmAES_CBC::platformDecrypt(const CryptoAlgorithmAesCbcCfbParams& parameters, const CryptoKeyAES& key, const Vector<uint8_t>& cipherText)
+ExceptionOr<Vector<uint8_t>> CryptoAlgorithmAES_CBC::platformDecrypt(CryptoAlgorithmAesCbcCfbParams& parameters, const CryptoKeyAES& key, const Vector<uint8_t>& cipherText)
 {
     auto output = gcryptDecrypt(key.key(), parameters.ivVector(), cipherText);
     if (!output)
index a21b5f2..06908ef 100644 (file)
 
 namespace WebCore {
 
-ExceptionOr<Vector<uint8_t>> CryptoAlgorithmAES_CFB::platformEncrypt(const CryptoAlgorithmAesCbcCfbParams&, const CryptoKeyAES&, const Vector<uint8_t>&)
+ExceptionOr<Vector<uint8_t>> CryptoAlgorithmAES_CFB::platformEncrypt(CryptoAlgorithmAesCbcCfbParams&, const CryptoKeyAES&, const Vector<uint8_t>&)
 {
     return Exception { NotSupportedError };
 }
 
-ExceptionOr<Vector<uint8_t>> CryptoAlgorithmAES_CFB::platformDecrypt(const CryptoAlgorithmAesCbcCfbParams&, const CryptoKeyAES&, const Vector<uint8_t>&)
+ExceptionOr<Vector<uint8_t>> CryptoAlgorithmAES_CFB::platformDecrypt(CryptoAlgorithmAesCbcCfbParams&, const CryptoKeyAES&, const Vector<uint8_t>&)
 {
     return Exception { NotSupportedError };
 }
index aa22f4e..6792249 100644 (file)
@@ -195,7 +195,7 @@ static std::optional<Vector<uint8_t>> gcryptAES_CTR(PAL::GCrypt::CipherOperation
     return output;
 }
 
-ExceptionOr<Vector<uint8_t>> CryptoAlgorithmAES_CTR::platformEncrypt(const CryptoAlgorithmAesCtrParams& parameters, const CryptoKeyAES& key, const Vector<uint8_t>& plainText)
+ExceptionOr<Vector<uint8_t>> CryptoAlgorithmAES_CTR::platformEncrypt(CryptoAlgorithmAesCtrParams& parameters, const CryptoKeyAES& key, const Vector<uint8_t>& plainText)
 {
     auto output = gcryptAES_CTR(gcry_cipher_encrypt, key.key(), parameters.counterVector(), parameters.length, plainText);
     if (!output)
@@ -203,7 +203,7 @@ ExceptionOr<Vector<uint8_t>> CryptoAlgorithmAES_CTR::platformEncrypt(const Crypt
     return WTFMove(*output);
 }
 
-ExceptionOr<Vector<uint8_t>> CryptoAlgorithmAES_CTR::platformDecrypt(const CryptoAlgorithmAesCtrParams& parameters, const CryptoKeyAES& key, const Vector<uint8_t>& cipherText)
+ExceptionOr<Vector<uint8_t>> CryptoAlgorithmAES_CTR::platformDecrypt(CryptoAlgorithmAesCtrParams& parameters, const CryptoKeyAES& key, const Vector<uint8_t>& cipherText)
 {
     auto output = gcryptAES_CTR(gcry_cipher_decrypt, key.key(), parameters.counterVector(), parameters.length, cipherText);
     if (!output)
index 47d26e8..8d3cd9e 100644 (file)
@@ -179,7 +179,7 @@ static std::optional<Vector<uint8_t>> gcryptDecrypt(const Vector<uint8_t>& key,
     return output;
 }
 
-ExceptionOr<Vector<uint8_t>> CryptoAlgorithmAES_GCM::platformEncrypt(const CryptoAlgorithmAesGcmParams& parameters, const CryptoKeyAES& key, const Vector<uint8_t>& plainText)
+ExceptionOr<Vector<uint8_t>> CryptoAlgorithmAES_GCM::platformEncrypt(CryptoAlgorithmAesGcmParams& parameters, const CryptoKeyAES& key, const Vector<uint8_t>& plainText)
 {
     auto output = gcryptEncrypt(key.key(), parameters.ivVector(), plainText, parameters.additionalDataVector(), parameters.tagLength.value_or(0) / 8);
     if (!output)
@@ -187,7 +187,7 @@ ExceptionOr<Vector<uint8_t>> CryptoAlgorithmAES_GCM::platformEncrypt(const Crypt
     return WTFMove(*output);
 }
 
-ExceptionOr<Vector<uint8_t>> CryptoAlgorithmAES_GCM::platformDecrypt(const CryptoAlgorithmAesGcmParams& parameters, const CryptoKeyAES& key, const Vector<uint8_t>& cipherText)
+ExceptionOr<Vector<uint8_t>> CryptoAlgorithmAES_GCM::platformDecrypt(CryptoAlgorithmAesGcmParams& parameters, const CryptoKeyAES& key, const Vector<uint8_t>& cipherText)
 {
     auto output = gcryptDecrypt(key.key(), parameters.ivVector(), cipherText, parameters.additionalDataVector(), parameters.tagLength.value_or(0) / 8);
     if (!output)
index 7f97d28..7926d35 100644 (file)
@@ -152,7 +152,7 @@ static std::optional<Vector<uint8_t>> gcryptDeriveBits(const Vector<uint8_t>& ke
     return output;
 }
 
-ExceptionOr<Vector<uint8_t>> CryptoAlgorithmHKDF::platformDeriveBits(const CryptoAlgorithmHkdfParams& parameters, const CryptoKeyRaw& key, size_t length)
+ExceptionOr<Vector<uint8_t>> CryptoAlgorithmHKDF::platformDeriveBits(CryptoAlgorithmHkdfParams& parameters, const CryptoKeyRaw& key, size_t length)
 {
     auto output = gcryptDeriveBits(key.key(), parameters.saltVector(), parameters.infoVector(), length / 8, parameters.hashIdentifier);
     if (!output)
index 9924e0a..6a6f8a4 100644 (file)
@@ -57,7 +57,7 @@ static std::optional<Vector<uint8_t>> gcryptDeriveBits(const Vector<uint8_t>& ke
     return result;
 }
 
-ExceptionOr<Vector<uint8_t>> CryptoAlgorithmPBKDF2::platformDeriveBits(const CryptoAlgorithmPbkdf2Params& parameters, const CryptoKeyRaw& key, size_t length)
+ExceptionOr<Vector<uint8_t>> CryptoAlgorithmPBKDF2::platformDeriveBits(CryptoAlgorithmPbkdf2Params& parameters, const CryptoKeyRaw& key, size_t length)
 {
     auto output = gcryptDeriveBits(key.key(), parameters.saltVector(), parameters.hashIdentifier, parameters.iterations, length);
     if (!output)
index 6ca60b6..1a668f2 100644 (file)
@@ -110,7 +110,7 @@ static std::optional<Vector<uint8_t>> gcryptDecrypt(CryptoAlgorithmIdentifier ha
     return mpiData(valueSexp);
 }
 
-ExceptionOr<Vector<uint8_t>> CryptoAlgorithmRSA_OAEP::platformEncrypt(const CryptoAlgorithmRsaOaepParams& parameters, const CryptoKeyRSA& key, const Vector<uint8_t>& plainText)
+ExceptionOr<Vector<uint8_t>> CryptoAlgorithmRSA_OAEP::platformEncrypt(CryptoAlgorithmRsaOaepParams& parameters, const CryptoKeyRSA& key, const Vector<uint8_t>& plainText)
 {
     RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(!(key.keySizeInBits() % 8));
     auto output = gcryptEncrypt(key.hashAlgorithmIdentifier(), key.platformKey(), parameters.labelVector(), plainText, key.keySizeInBits() / 8);
@@ -119,7 +119,7 @@ ExceptionOr<Vector<uint8_t>> CryptoAlgorithmRSA_OAEP::platformEncrypt(const Cryp
     return WTFMove(*output);
 }
 
-ExceptionOr<Vector<uint8_t>> CryptoAlgorithmRSA_OAEP::platformDecrypt(const CryptoAlgorithmRsaOaepParams& parameters, const CryptoKeyRSA& key, const Vector<uint8_t>& cipherText)
+ExceptionOr<Vector<uint8_t>> CryptoAlgorithmRSA_OAEP::platformDecrypt(CryptoAlgorithmRsaOaepParams& parameters, const CryptoKeyRSA& key, const Vector<uint8_t>& cipherText)
 {
     auto output = gcryptDecrypt(key.hashAlgorithmIdentifier(), key.platformKey(), parameters.labelVector(), cipherText);
     if (!output)
index 15c3cba..922cc9b 100644 (file)
@@ -135,7 +135,7 @@ static std::optional<bool> gcryptVerify(gcry_sexp_t keySexp, const Vector<uint8_
     return { error == GPG_ERR_NO_ERROR };
 }
 
-ExceptionOr<Vector<uint8_t>> CryptoAlgorithmRSA_PSS::platformSign(const CryptoAlgorithmRsaPssParams& parameters, const CryptoKeyRSA& key, const Vector<uint8_t>& data)
+ExceptionOr<Vector<uint8_t>> CryptoAlgorithmRSA_PSS::platformSign(CryptoAlgorithmRsaPssParams& parameters, const CryptoKeyRSA& key, const Vector<uint8_t>& data)
 {
     RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(!(key.keySizeInBits() % 8));
     auto output = gcryptSign(key.platformKey(), data, key.hashAlgorithmIdentifier(), parameters.saltLength, key.keySizeInBits() / 8);
@@ -144,7 +144,7 @@ ExceptionOr<Vector<uint8_t>> CryptoAlgorithmRSA_PSS::platformSign(const CryptoAl
     return WTFMove(*output);
 }
 
-ExceptionOr<bool> CryptoAlgorithmRSA_PSS::platformVerify(const CryptoAlgorithmRsaPssParams& parameters, const CryptoKeyRSA& key, const Vector<uint8_t>& signature, const Vector<uint8_t>& data)
+ExceptionOr<bool> CryptoAlgorithmRSA_PSS::platformVerify(CryptoAlgorithmRsaPssParams& parameters, const CryptoKeyRSA& key, const Vector<uint8_t>& signature, const Vector<uint8_t>& data)
 {
     auto output = gcryptVerify(key.platformKey(), signature, data, key.hashAlgorithmIdentifier(), parameters.saltLength);
     if (!output)
index 479e620..d3c7556 100644 (file)
@@ -62,13 +62,13 @@ static ExceptionOr<Vector<uint8_t>> transformAES_CBC(CCOperation operation, cons
     return WTFMove(result);
 }
 
-ExceptionOr<Vector<uint8_t>> CryptoAlgorithmAES_CBC::platformEncrypt(const CryptoAlgorithmAesCbcCfbParams& parameters, const CryptoKeyAES& key, const Vector<uint8_t>& plainText)
+ExceptionOr<Vector<uint8_t>> CryptoAlgorithmAES_CBC::platformEncrypt(CryptoAlgorithmAesCbcCfbParams& parameters, const CryptoKeyAES& key, const Vector<uint8_t>& plainText)
 {
     ASSERT(parameters.ivVector().size() == kCCBlockSizeAES128);
     return transformAES_CBC(kCCEncrypt, parameters.ivVector(), key.key(), plainText);
 }
 
-ExceptionOr<Vector<uint8_t>> CryptoAlgorithmAES_CBC::platformDecrypt(const CryptoAlgorithmAesCbcCfbParams& parameters, const CryptoKeyAES& key, const Vector<uint8_t>& cipherText)
+ExceptionOr<Vector<uint8_t>> CryptoAlgorithmAES_CBC::platformDecrypt(CryptoAlgorithmAesCbcCfbParams& parameters, const CryptoKeyAES& key, const Vector<uint8_t>& cipherText)
 {
     ASSERT(parameters.ivVector().size() == kCCBlockSizeAES128);
     return transformAES_CBC(kCCDecrypt, parameters.ivVector(), key.key(), cipherText);
index 3594562..001c0d6 100644 (file)
@@ -62,13 +62,13 @@ static ExceptionOr<Vector<uint8_t>> transformAES_CFB(CCOperation operation, cons
     return WTFMove(result);
 }
 
-ExceptionOr<Vector<uint8_t>> CryptoAlgorithmAES_CFB::platformEncrypt(const CryptoAlgorithmAesCbcCfbParams& parameters, const CryptoKeyAES& key, const Vector<uint8_t>& plainText)
+ExceptionOr<Vector<uint8_t>> CryptoAlgorithmAES_CFB::platformEncrypt(CryptoAlgorithmAesCbcCfbParams& parameters, const CryptoKeyAES& key, const Vector<uint8_t>& plainText)
 {
     ASSERT(parameters.ivVector().size() == kCCBlockSizeAES128);
     return transformAES_CFB(kCCEncrypt, parameters.ivVector(), key.key(), plainText);
 }
 
-ExceptionOr<Vector<uint8_t>> CryptoAlgorithmAES_CFB::platformDecrypt(const CryptoAlgorithmAesCbcCfbParams& parameters, const CryptoKeyAES& key, const Vector<uint8_t>& cipherText)
+ExceptionOr<Vector<uint8_t>> CryptoAlgorithmAES_CFB::platformDecrypt(CryptoAlgorithmAesCbcCfbParams& parameters, const CryptoKeyAES& key, const Vector<uint8_t>& cipherText)
 {
     ASSERT(parameters.ivVector().size() == kCCBlockSizeAES128);
     return transformAES_CFB(kCCDecrypt, parameters.ivVector(), key.key(), cipherText);
index 6c0b5e9..4fc147c 100644 (file)
@@ -138,13 +138,13 @@ static ExceptionOr<Vector<uint8_t>> transformAES_CTR(CCOperation operation, cons
     return WTFMove(head);
 }
 
-ExceptionOr<Vector<uint8_t>> CryptoAlgorithmAES_CTR::platformEncrypt(const CryptoAlgorithmAesCtrParams& parameters, const CryptoKeyAES& key, const Vector<uint8_t>& plainText)
+ExceptionOr<Vector<uint8_t>> CryptoAlgorithmAES_CTR::platformEncrypt(CryptoAlgorithmAesCtrParams& parameters, const CryptoKeyAES& key, const Vector<uint8_t>& plainText)
 {
     ASSERT(parameters.counterVector().size() == kCCBlockSizeAES128);
     return transformAES_CTR(kCCEncrypt, parameters.counterVector(), parameters.length, key.key(), plainText);
 }
 
-ExceptionOr<Vector<uint8_t>> CryptoAlgorithmAES_CTR::platformDecrypt(const CryptoAlgorithmAesCtrParams& parameters, const CryptoKeyAES& key, const Vector<uint8_t>& cipherText)
+ExceptionOr<Vector<uint8_t>> CryptoAlgorithmAES_CTR::platformDecrypt(CryptoAlgorithmAesCtrParams& parameters, const CryptoKeyAES& key, const Vector<uint8_t>& cipherText)
 {
       ASSERT(parameters.counterVector().size() == kCCBlockSizeAES128);
     return transformAES_CTR(kCCDecrypt, parameters.counterVector(), parameters.length, key.key(), cipherText);
index b2bc248..37d022e 100644 (file)
@@ -72,12 +72,12 @@ static ExceptionOr<Vector<uint8_t>> decyptAES_GCM(const Vector<uint8_t>& iv, con
     return WTFMove(plainText);
 }
 
-ExceptionOr<Vector<uint8_t>> CryptoAlgorithmAES_GCM::platformEncrypt(const CryptoAlgorithmAesGcmParams& parameters, const CryptoKeyAES& key, const Vector<uint8_t>& plainText)
+ExceptionOr<Vector<uint8_t>> CryptoAlgorithmAES_GCM::platformEncrypt(CryptoAlgorithmAesGcmParams& parameters, const CryptoKeyAES& key, const Vector<uint8_t>& plainText)
 {
     return encryptAES_GCM(parameters.ivVector(), key.key(), plainText, parameters.additionalDataVector(), parameters.tagLength.value_or(0) / 8);
 }
 
-ExceptionOr<Vector<uint8_t>> CryptoAlgorithmAES_GCM::platformDecrypt(const CryptoAlgorithmAesGcmParams& parameters, const CryptoKeyAES& key, const Vector<uint8_t>& cipherText)
+ExceptionOr<Vector<uint8_t>> CryptoAlgorithmAES_GCM::platformDecrypt(CryptoAlgorithmAesGcmParams& parameters, const CryptoKeyAES& key, const Vector<uint8_t>& cipherText)
 {
     return decyptAES_GCM(parameters.ivVector(), key.key(), cipherText, parameters.additionalDataVector(), parameters.tagLength.value_or(0) / 8);
 }
index 45af500..63c7db7 100644 (file)
@@ -34,7 +34,7 @@
 
 namespace WebCore {
 
-ExceptionOr<Vector<uint8_t>> CryptoAlgorithmHKDF::platformDeriveBits(const CryptoAlgorithmHkdfParams& parameters, const CryptoKeyRaw& key, size_t length)
+ExceptionOr<Vector<uint8_t>> CryptoAlgorithmHKDF::platformDeriveBits(CryptoAlgorithmHkdfParams& parameters, const CryptoKeyRaw& key, size_t length)
 {
     Vector<uint8_t> result(length / 8);
     CCDigestAlgorithm digestAlgorithm;
index 45ca8ba..b671f22 100644 (file)
@@ -55,7 +55,7 @@ static CCPseudoRandomAlgorithm commonCryptoHMACAlgorithm(CryptoAlgorithmIdentifi
 }
 }
 
-ExceptionOr<Vector<uint8_t>> CryptoAlgorithmPBKDF2::platformDeriveBits(const CryptoAlgorithmPbkdf2Params& parameters, const CryptoKeyRaw& key, size_t length)
+ExceptionOr<Vector<uint8_t>> CryptoAlgorithmPBKDF2::platformDeriveBits(CryptoAlgorithmPbkdf2Params& parameters, const CryptoKeyRaw& key, size_t length)
 {
     Vector<uint8_t> result(length / 8);
     // <rdar://problem/32439955> Currently, CCKeyDerivationPBKDF bails out when an empty password/salt is provided.
index 9e7b10b..86a966f 100644 (file)
@@ -63,12 +63,12 @@ static ExceptionOr<Vector<uint8_t>> decryptRSA_OAEP(CryptoAlgorithmIdentifier ha
     return WTFMove(plainText);
 }
 
-ExceptionOr<Vector<uint8_t>> CryptoAlgorithmRSA_OAEP::platformEncrypt(const CryptoAlgorithmRsaOaepParams& parameters, const CryptoKeyRSA& key, const Vector<uint8_t>& plainText)
+ExceptionOr<Vector<uint8_t>> CryptoAlgorithmRSA_OAEP::platformEncrypt(CryptoAlgorithmRsaOaepParams& parameters, const CryptoKeyRSA& key, const Vector<uint8_t>& plainText)
 {
     return encryptRSA_OAEP(key.hashAlgorithmIdentifier(), parameters.labelVector(), key.platformKey(), key.keySizeInBits(), plainText);
 }
 
-ExceptionOr<Vector<uint8_t>> CryptoAlgorithmRSA_OAEP::platformDecrypt(const CryptoAlgorithmRsaOaepParams& parameters, const CryptoKeyRSA& key, const Vector<uint8_t>& cipherText)
+ExceptionOr<Vector<uint8_t>> CryptoAlgorithmRSA_OAEP::platformDecrypt(CryptoAlgorithmRsaOaepParams& parameters, const CryptoKeyRSA& key, const Vector<uint8_t>& cipherText)
 {
     return decryptRSA_OAEP(key.hashAlgorithmIdentifier(), parameters.labelVector(), key.platformKey(), key.keySizeInBits(), cipherText);
 }
index ca3f22b..1306b36 100644 (file)
@@ -81,12 +81,12 @@ static ExceptionOr<bool> verifyRSA_PSS(CryptoAlgorithmIdentifier hash, const Pla
     return false;
 }
 
-ExceptionOr<Vector<uint8_t>> CryptoAlgorithmRSA_PSS::platformSign(const CryptoAlgorithmRsaPssParams& parameters, const CryptoKeyRSA& key, const Vector<uint8_t>& data)
+ExceptionOr<Vector<uint8_t>> CryptoAlgorithmRSA_PSS::platformSign(CryptoAlgorithmRsaPssParams& parameters, const CryptoKeyRSA& key, const Vector<uint8_t>& data)
 {
     return signRSA_PSS(key.hashAlgorithmIdentifier(), key.platformKey(), key.keySizeInBits(), data, parameters.saltLength);
 }
 
-ExceptionOr<bool> CryptoAlgorithmRSA_PSS::platformVerify(const CryptoAlgorithmRsaPssParams& parameters, const CryptoKeyRSA& key, const Vector<uint8_t>& signature, const Vector<uint8_t>& data)
+ExceptionOr<bool> CryptoAlgorithmRSA_PSS::platformVerify(CryptoAlgorithmRsaPssParams& parameters, const CryptoKeyRSA& key, const Vector<uint8_t>& signature, const Vector<uint8_t>& data)
 {
     return verifyRSA_PSS(key.hashAlgorithmIdentifier(), key.platformKey(), signature, data, parameters.saltLength);
 }
index d4117ae..ed2a979 100644 (file)
@@ -39,7 +39,7 @@ public:
 
     Class parametersClass() const final { return Class::AesCbcCfbParams; }
 
-    const Vector<uint8_t>& ivVector() const
+    const Vector<uint8_t>& ivVector()
     {
         if (!m_ivVector.isEmpty() || !iv.length())
             return m_ivVector;
@@ -48,17 +48,8 @@ public:
         return m_ivVector;
     }
 
-    CryptoAlgorithmAesCbcCfbParams isolatedCopy() const
-    {
-        CryptoAlgorithmAesCbcCfbParams result;
-        result.identifier = identifier;
-        result.m_ivVector = ivVector();
-
-        return result;
-    }
-
 private:
-    mutable Vector<uint8_t> m_ivVector;
+    Vector<uint8_t> m_ivVector;
 };
 
 } // namespace WebCore
index 4e05e01..0db1726 100644 (file)
@@ -40,7 +40,7 @@ public:
 
     Class parametersClass() const final { return Class::AesCtrParams; }
 
-    const Vector<uint8_t>& counterVector() const
+    const Vector<uint8_t>& counterVector()
     {
         if (!m_counterVector.isEmpty() || !counter.length())
             return m_counterVector;
@@ -49,18 +49,8 @@ public:
         return m_counterVector;
     }
 
-    CryptoAlgorithmAesCtrParams isolatedCopy() const
-    {
-        CryptoAlgorithmAesCtrParams result;
-        result.identifier = identifier;
-        result.m_counterVector = counterVector();
-        result.length = length;
-
-        return result;
-    }
-
 private:
-    mutable Vector<uint8_t> m_counterVector;
+    Vector<uint8_t> m_counterVector;
 };
 
 } // namespace WebCore
index d1f8e65..129c6bb 100644 (file)
@@ -37,12 +37,12 @@ class CryptoAlgorithmAesGcmParams final : public CryptoAlgorithmParameters {
 public:
     BufferSource iv;
     // Use additionalDataVector() instead of additionalData. The label will be gone once additionalDataVector() is called.
-    mutable std::optional<BufferSource::VariantType> additionalData;
-    mutable std::optional<uint8_t> tagLength;
+    std::optional<BufferSource::VariantType> additionalData;
+    std::optional<uint8_t> tagLength;
 
     Class parametersClass() const final { return Class::AesGcmParams; }
 
-    const Vector<uint8_t>& ivVector() const
+    const Vector<uint8_t>& ivVector()
     {
         if (!m_ivVector.isEmpty() || !iv.length())
             return m_ivVector;
@@ -51,34 +51,24 @@ public:
         return m_ivVector;
     }
 
-    const Vector<uint8_t>& additionalDataVector() const
+    const Vector<uint8_t>& additionalDataVector()
     {
         if (!m_additionalDataVector.isEmpty() || !additionalData)
             return m_additionalDataVector;
 
-        BufferSource additionalDataBuffer = WTFMove(*additionalData);
+        m_additionalDataBuffer = WTFMove(*additionalData);
         additionalData = std::nullopt;
-        if (!additionalDataBuffer.length())
+        if (!m_additionalDataBuffer.length())
             return m_additionalDataVector;
 
-        m_additionalDataVector.append(additionalDataBuffer.data(), additionalDataBuffer.length());
+        m_additionalDataVector.append(m_additionalDataBuffer.data(), m_additionalDataBuffer.length());
         return m_additionalDataVector;
     }
-
-    CryptoAlgorithmAesGcmParams isolatedCopy() const
-    {
-        CryptoAlgorithmAesGcmParams result;
-        result.identifier = identifier;
-        result.m_ivVector = ivVector();
-        result.m_additionalDataVector = additionalDataVector();
-        result.tagLength = tagLength;
-
-        return result;
-    }
-
+    
 private:
-    mutable Vector<uint8_t> m_ivVector;
-    mutable Vector<uint8_t> m_additionalDataVector;
+    Vector<uint8_t> m_ivVector;
+    Vector<uint8_t> m_additionalDataVector;
+    BufferSource m_additionalDataBuffer;
 };
 
 } // namespace WebCore
index b66aac7..c4b580f 100644 (file)
@@ -36,15 +36,6 @@ public:
     String namedCurve;
 
     Class parametersClass() const final { return Class::EcKeyParams; }
-
-    CryptoAlgorithmEcKeyParams isolatedCopy() const
-    {
-        CryptoAlgorithmEcKeyParams result;
-        result.identifier = identifier;
-        result.namedCurve = namedCurve.isolatedCopy();
-
-        return result;
-    }
 };
 
 } // namespace WebCore
index 700af83..2223c38 100644 (file)
@@ -41,15 +41,6 @@ public:
     CryptoAlgorithmIdentifier hashIdentifier;
 
     Class parametersClass() const final { return Class::EcdsaParams; }
-
-    CryptoAlgorithmEcdsaParams isolatedCopy() const
-    {
-        CryptoAlgorithmEcdsaParams result;
-        result.identifier = identifier;
-        result.hashIdentifier = hashIdentifier;
-
-        return result;
-    }
 };
 
 } // namespace WebCore
index 85bbc13..648b548 100644 (file)
@@ -43,7 +43,7 @@ public:
     BufferSource salt;
     BufferSource info;
 
-    const Vector<uint8_t>& saltVector() const
+    const Vector<uint8_t>& saltVector()
     {
         if (!m_saltVector.isEmpty() || !salt.length())
             return m_saltVector;
@@ -52,7 +52,7 @@ public:
         return m_saltVector;
     }
 
-    const Vector<uint8_t>& infoVector() const
+    const Vector<uint8_t>& infoVector()
     {
         if (!m_infoVector.isEmpty() || !info.length())
             return m_infoVector;
@@ -63,20 +63,9 @@ public:
 
     Class parametersClass() const final { return Class::HkdfParams; }
 
-    CryptoAlgorithmHkdfParams isolatedCopy() const
-    {
-        CryptoAlgorithmHkdfParams result;
-        result.identifier = identifier;
-        result.m_saltVector = saltVector();
-        result.m_infoVector = infoVector();
-        result.hashIdentifier = hashIdentifier;
-
-        return result;
-    }
-
 private:
-    mutable Vector<uint8_t> m_saltVector;
-    mutable Vector<uint8_t> m_infoVector;
+    Vector<uint8_t> m_saltVector;
+    Vector<uint8_t> m_infoVector;
 };
 
 } // namespace WebCore
index 9b8c5f2..c9f11b8 100644 (file)
@@ -42,16 +42,6 @@ public:
     std::optional<size_t> length;
 
     Class parametersClass() const final { return Class::HmacKeyParams; }
-
-    CryptoAlgorithmHmacKeyParams isolatedCopy() const
-    {
-        CryptoAlgorithmHmacKeyParams result;
-        result.identifier = identifier;
-        result.hashIdentifier = hashIdentifier;
-        result.length = length;
-
-        return result;
-    }
 };
 
 } // namespace WebCore
index e4eedec..b1ad498 100644 (file)
@@ -43,7 +43,7 @@ public:
     Variant<JSC::Strong<JSC::JSObject>, String> hash;
     CryptoAlgorithmIdentifier hashIdentifier;
 
-    const Vector<uint8_t>& saltVector() const
+    const Vector<uint8_t>& saltVector()
     {
         if (!m_saltVector.isEmpty() || !salt.length())
             return m_saltVector;
@@ -54,19 +54,8 @@ public:
 
     Class parametersClass() const final { return Class::Pbkdf2Params; }
 
-    CryptoAlgorithmPbkdf2Params isolatedCopy() const
-    {
-        CryptoAlgorithmPbkdf2Params result;
-        result.identifier = identifier;
-        result.m_saltVector = saltVector();
-        result.iterations = iterations;
-        result.hashIdentifier = hashIdentifier;
-
-        return result;
-    }
-
 private:
-    mutable Vector<uint8_t> m_saltVector;
+    Vector<uint8_t> m_saltVector;
 };
 
 } // namespace WebCore
index 12019ef..49dd3a2 100644 (file)
@@ -41,15 +41,6 @@ public:
     CryptoAlgorithmIdentifier hashIdentifier;
 
     Class parametersClass() const final { return Class::RsaHashedImportParams; }
-
-    CryptoAlgorithmRsaHashedImportParams isolatedCopy() const
-    {
-        CryptoAlgorithmRsaHashedImportParams result;
-        result.identifier = identifier;
-        result.hashIdentifier = hashIdentifier;
-
-        return result;
-    }
 };
 
 } // namespace WebCore
index 300d8e4..c56e653 100644 (file)
@@ -36,35 +36,27 @@ namespace WebCore {
 class CryptoAlgorithmRsaOaepParams final : public CryptoAlgorithmParameters {
 public:
     // Use labelVector() instead of label. The label will be gone once labelVector() is called.
-    mutable std::optional<BufferSource::VariantType> label;
+    std::optional<BufferSource::VariantType> label;
 
     Class parametersClass() const final { return Class::RsaOaepParams; }
 
-    const Vector<uint8_t>& labelVector() const
+    const Vector<uint8_t>& labelVector()
     {
         if (!m_labelVector.isEmpty() || !label)
             return m_labelVector;
 
-        BufferSource labelBuffer = WTFMove(*label);
+        m_labelBuffer = WTFMove(*label);
         label = std::nullopt;
-        if (!labelBuffer.length())
+        if (!m_labelBuffer.length())
             return m_labelVector;
 
-        m_labelVector.append(labelBuffer.data(), labelBuffer.length());
+        m_labelVector.append(m_labelBuffer.data(), m_labelBuffer.length());
         return m_labelVector;
     }
 
-    CryptoAlgorithmRsaOaepParams isolatedCopy() const
-    {
-        CryptoAlgorithmRsaOaepParams result;
-        result.identifier = identifier;
-        result.m_labelVector = labelVector();
-
-        return result;
-    }
-
 private:
-    mutable Vector<uint8_t> m_labelVector;
+    Vector<uint8_t> m_labelVector;
+    BufferSource m_labelBuffer;
 };
 
 } // namespace WebCore
index 78f5a1b..61f3a26 100644 (file)
@@ -36,15 +36,6 @@ public:
     size_t saltLength;
 
     Class parametersClass() const final { return Class::RsaPssParams; }
-
-    CryptoAlgorithmRsaPssParams isolatedCopy() const
-    {
-        CryptoAlgorithmRsaPssParams result;
-        result.identifier = identifier;
-        result.saltLength = saltLength;
-
-        return result;
-    }
 };
 
 } // namespace WebCore