[OpenSSL] Add stubs and build for Web Crypto
authordon.olmstead@sony.com <don.olmstead@sony.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 23 Jan 2020 02:45:17 +0000 (02:45 +0000)
committerdon.olmstead@sony.com <don.olmstead@sony.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 23 Jan 2020 02:45:17 +0000 (02:45 +0000)
https://bugs.webkit.org/show_bug.cgi?id=206449

Reviewed by Jiewen Tan.

.:

Enable Web Crypto as an experiment for WinCairo and PlayStation. Add the USE_OPENSSL
definition to platforms using OpenSSL.

* Source/cmake/OptionsFTW.cmake:
* Source/cmake/OptionsPlayStation.cmake:
* Source/cmake/OptionsWin.cmake:
* Source/cmake/OptionsWinCairo.cmake:

Source/WebCore:

Add stubs for an OpenSSL implementation of Web Crypto. Add the associated CMake
files for OpenSSL platforms and reference them on the platforms using OpenSSL.

Tests will be enabled as functionality lands.

* PlatformFTW.cmake:
* PlatformPlayStation.cmake:
* PlatformWinCairo.cmake:
* crypto/keys/CryptoKeyEC.h:
* crypto/keys/CryptoKeyRSA.h:
* crypto/openssl/CryptoAlgorithmAES_CBCOpenSSL.cpp: Added.
(WebCore::CryptoAlgorithmAES_CBC::platformEncrypt):
(WebCore::CryptoAlgorithmAES_CBC::platformDecrypt):
* crypto/openssl/CryptoAlgorithmAES_CFBOpenSSL.cpp: Added.
(WebCore::CryptoAlgorithmAES_CFB::platformEncrypt):
(WebCore::CryptoAlgorithmAES_CFB::platformDecrypt):
* crypto/openssl/CryptoAlgorithmAES_CTROpenSSL.cpp: Added.
(WebCore::CryptoAlgorithmAES_CTR::platformEncrypt):
(WebCore::CryptoAlgorithmAES_CTR::platformDecrypt):
* crypto/openssl/CryptoAlgorithmAES_GCMOpenSSL.cpp: Added.
(WebCore::CryptoAlgorithmAES_GCM::platformEncrypt):
(WebCore::CryptoAlgorithmAES_GCM::platformDecrypt):
* crypto/openssl/CryptoAlgorithmAES_KWOpenSSL.cpp: Added.
(WebCore::CryptoAlgorithmAES_KW::platformWrapKey):
(WebCore::CryptoAlgorithmAES_KW::platformUnwrapKey):
* crypto/openssl/CryptoAlgorithmECDHOpenSSL.cpp: Added.
(WebCore::CryptoAlgorithmECDH::platformDeriveBits):
* crypto/openssl/CryptoAlgorithmECDSAOpenSSL.cpp: Added.
(WebCore::CryptoAlgorithmECDSA::platformSign):
(WebCore::CryptoAlgorithmECDSA::platformVerify):
* crypto/openssl/CryptoAlgorithmHKDFOpenSSL.cpp: Added.
(WebCore::CryptoAlgorithmHKDF::platformDeriveBits):
* crypto/openssl/CryptoAlgorithmHMACOpenSSL.cpp: Added.
(WebCore::CryptoAlgorithmHMAC::platformSign):
(WebCore::CryptoAlgorithmHMAC::platformVerify):
* crypto/openssl/CryptoAlgorithmPBKDF2OpenSSL.cpp: Added.
(WebCore::CryptoAlgorithmPBKDF2::platformDeriveBits):
* crypto/openssl/CryptoAlgorithmRSAES_PKCS1_v1_5OpenSSL.cpp: Added.
(WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformEncrypt):
(WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformDecrypt):
* crypto/openssl/CryptoAlgorithmRSASSA_PKCS1_v1_5OpenSSL.cpp: Added.
(WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign):
(WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformVerify):
* crypto/openssl/CryptoAlgorithmRSA_OAEPOpenSSL.cpp: Added.
(WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt):
(WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt):
* crypto/openssl/CryptoAlgorithmRSA_PSSOpenSSL.cpp: Added.
(WebCore::CryptoAlgorithmRSA_PSS::platformSign):
(WebCore::CryptoAlgorithmRSA_PSS::platformVerify):
* crypto/openssl/CryptoAlgorithmRegistryOpenSSL.cpp: Added.
(WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms):
* crypto/openssl/CryptoKeyECOpenSSL.cpp: Added.
(WebCore::CryptoKeyEC::keySizeInBits const):
(WebCore::CryptoKeyEC::platformSupportedCurve):
(WebCore::CryptoKeyEC::platformGeneratePair):
(WebCore::CryptoKeyEC::platformImportRaw):
(WebCore::CryptoKeyEC::platformImportJWKPublic):
(WebCore::CryptoKeyEC::platformImportJWKPrivate):
(WebCore::CryptoKeyEC::platformImportSpki):
(WebCore::CryptoKeyEC::platformImportPkcs8):
(WebCore::CryptoKeyEC::platformExportRaw const):
(WebCore::CryptoKeyEC::platformAddFieldElements const):
(WebCore::CryptoKeyEC::platformExportSpki const):
(WebCore::CryptoKeyEC::platformExportPkcs8 const):
* crypto/openssl/CryptoKeyRSAOpenSSL.cpp: Added.
(WebCore::CryptoKeyRSA::create):
(WebCore::CryptoKeyRSA::isRestrictedToHash const):
(WebCore::CryptoKeyRSA::keySizeInBits const):
(WebCore::CryptoKeyRSA::generatePair):
(WebCore::CryptoKeyRSA::importSpki):
(WebCore::CryptoKeyRSA::importPkcs8):
(WebCore::CryptoKeyRSA::exportSpki const):
(WebCore::CryptoKeyRSA::exportPkcs8 const):
(WebCore::CryptoKeyRSA::exportData const):
* crypto/openssl/SerializedCryptoKeyWrapOpenSSL.cpp: Added.
(WebCore::getDefaultWebCryptoMasterKey):
(WebCore::wrapSerializedCryptoKey):
(WebCore::unwrapSerializedCryptoKey):
* platform/OpenSSL.cmake: Added.

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

30 files changed:
ChangeLog
Source/WebCore/ChangeLog
Source/WebCore/PlatformFTW.cmake
Source/WebCore/PlatformPlayStation.cmake
Source/WebCore/PlatformWinCairo.cmake
Source/WebCore/crypto/keys/CryptoKeyEC.h
Source/WebCore/crypto/keys/CryptoKeyRSA.h
Source/WebCore/crypto/openssl/CryptoAlgorithmAES_CBCOpenSSL.cpp [new file with mode: 0644]
Source/WebCore/crypto/openssl/CryptoAlgorithmAES_CFBOpenSSL.cpp [new file with mode: 0644]
Source/WebCore/crypto/openssl/CryptoAlgorithmAES_CTROpenSSL.cpp [new file with mode: 0644]
Source/WebCore/crypto/openssl/CryptoAlgorithmAES_GCMOpenSSL.cpp [new file with mode: 0644]
Source/WebCore/crypto/openssl/CryptoAlgorithmAES_KWOpenSSL.cpp [new file with mode: 0644]
Source/WebCore/crypto/openssl/CryptoAlgorithmECDHOpenSSL.cpp [new file with mode: 0644]
Source/WebCore/crypto/openssl/CryptoAlgorithmECDSAOpenSSL.cpp [new file with mode: 0644]
Source/WebCore/crypto/openssl/CryptoAlgorithmHKDFOpenSSL.cpp [new file with mode: 0644]
Source/WebCore/crypto/openssl/CryptoAlgorithmHMACOpenSSL.cpp [new file with mode: 0644]
Source/WebCore/crypto/openssl/CryptoAlgorithmPBKDF2OpenSSL.cpp [new file with mode: 0644]
Source/WebCore/crypto/openssl/CryptoAlgorithmRSAES_PKCS1_v1_5OpenSSL.cpp [new file with mode: 0644]
Source/WebCore/crypto/openssl/CryptoAlgorithmRSASSA_PKCS1_v1_5OpenSSL.cpp [new file with mode: 0644]
Source/WebCore/crypto/openssl/CryptoAlgorithmRSA_OAEPOpenSSL.cpp [new file with mode: 0644]
Source/WebCore/crypto/openssl/CryptoAlgorithmRSA_PSSOpenSSL.cpp [new file with mode: 0644]
Source/WebCore/crypto/openssl/CryptoAlgorithmRegistryOpenSSL.cpp [new file with mode: 0644]
Source/WebCore/crypto/openssl/CryptoKeyECOpenSSL.cpp [new file with mode: 0644]
Source/WebCore/crypto/openssl/CryptoKeyRSAOpenSSL.cpp [new file with mode: 0644]
Source/WebCore/crypto/openssl/SerializedCryptoKeyWrapOpenSSL.cpp [new file with mode: 0644]
Source/WebCore/platform/OpenSSL.cmake [new file with mode: 0644]
Source/cmake/OptionsFTW.cmake
Source/cmake/OptionsPlayStation.cmake
Source/cmake/OptionsWin.cmake
Source/cmake/OptionsWinCairo.cmake

index 369bfd9..165748f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2020-01-22  Don Olmstead  <don.olmstead@sony.com>
+
+        [OpenSSL] Add stubs and build for Web Crypto
+        https://bugs.webkit.org/show_bug.cgi?id=206449
+
+        Reviewed by Jiewen Tan.
+
+        Enable Web Crypto as an experiment for WinCairo and PlayStation. Add the USE_OPENSSL
+        definition to platforms using OpenSSL.
+
+        * Source/cmake/OptionsFTW.cmake:
+        * Source/cmake/OptionsPlayStation.cmake:
+        * Source/cmake/OptionsWin.cmake:
+        * Source/cmake/OptionsWinCairo.cmake:
+
 2020-01-21  Rob Buis  <rbuis@igalia.com>
 
         Add build flag for stale-while-revalidate
index ea42c74..d347b96 100644 (file)
@@ -1,3 +1,90 @@
+2020-01-22  Don Olmstead  <don.olmstead@sony.com>
+
+        [OpenSSL] Add stubs and build for Web Crypto
+        https://bugs.webkit.org/show_bug.cgi?id=206449
+
+        Reviewed by Jiewen Tan.
+
+        Add stubs for an OpenSSL implementation of Web Crypto. Add the associated CMake
+        files for OpenSSL platforms and reference them on the platforms using OpenSSL.
+
+        Tests will be enabled as functionality lands.
+
+        * PlatformFTW.cmake:
+        * PlatformPlayStation.cmake:
+        * PlatformWinCairo.cmake:
+        * crypto/keys/CryptoKeyEC.h:
+        * crypto/keys/CryptoKeyRSA.h:
+        * crypto/openssl/CryptoAlgorithmAES_CBCOpenSSL.cpp: Added.
+        (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt):
+        (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt):
+        * crypto/openssl/CryptoAlgorithmAES_CFBOpenSSL.cpp: Added.
+        (WebCore::CryptoAlgorithmAES_CFB::platformEncrypt):
+        (WebCore::CryptoAlgorithmAES_CFB::platformDecrypt):
+        * crypto/openssl/CryptoAlgorithmAES_CTROpenSSL.cpp: Added.
+        (WebCore::CryptoAlgorithmAES_CTR::platformEncrypt):
+        (WebCore::CryptoAlgorithmAES_CTR::platformDecrypt):
+        * crypto/openssl/CryptoAlgorithmAES_GCMOpenSSL.cpp: Added.
+        (WebCore::CryptoAlgorithmAES_GCM::platformEncrypt):
+        (WebCore::CryptoAlgorithmAES_GCM::platformDecrypt):
+        * crypto/openssl/CryptoAlgorithmAES_KWOpenSSL.cpp: Added.
+        (WebCore::CryptoAlgorithmAES_KW::platformWrapKey):
+        (WebCore::CryptoAlgorithmAES_KW::platformUnwrapKey):
+        * crypto/openssl/CryptoAlgorithmECDHOpenSSL.cpp: Added.
+        (WebCore::CryptoAlgorithmECDH::platformDeriveBits):
+        * crypto/openssl/CryptoAlgorithmECDSAOpenSSL.cpp: Added.
+        (WebCore::CryptoAlgorithmECDSA::platformSign):
+        (WebCore::CryptoAlgorithmECDSA::platformVerify):
+        * crypto/openssl/CryptoAlgorithmHKDFOpenSSL.cpp: Added.
+        (WebCore::CryptoAlgorithmHKDF::platformDeriveBits):
+        * crypto/openssl/CryptoAlgorithmHMACOpenSSL.cpp: Added.
+        (WebCore::CryptoAlgorithmHMAC::platformSign):
+        (WebCore::CryptoAlgorithmHMAC::platformVerify):
+        * crypto/openssl/CryptoAlgorithmPBKDF2OpenSSL.cpp: Added.
+        (WebCore::CryptoAlgorithmPBKDF2::platformDeriveBits):
+        * crypto/openssl/CryptoAlgorithmRSAES_PKCS1_v1_5OpenSSL.cpp: Added.
+        (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformEncrypt):
+        (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformDecrypt):
+        * crypto/openssl/CryptoAlgorithmRSASSA_PKCS1_v1_5OpenSSL.cpp: Added.
+        (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign):
+        (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformVerify):
+        * crypto/openssl/CryptoAlgorithmRSA_OAEPOpenSSL.cpp: Added.
+        (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt):
+        (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt):
+        * crypto/openssl/CryptoAlgorithmRSA_PSSOpenSSL.cpp: Added.
+        (WebCore::CryptoAlgorithmRSA_PSS::platformSign):
+        (WebCore::CryptoAlgorithmRSA_PSS::platformVerify):
+        * crypto/openssl/CryptoAlgorithmRegistryOpenSSL.cpp: Added.
+        (WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms):
+        * crypto/openssl/CryptoKeyECOpenSSL.cpp: Added.
+        (WebCore::CryptoKeyEC::keySizeInBits const):
+        (WebCore::CryptoKeyEC::platformSupportedCurve):
+        (WebCore::CryptoKeyEC::platformGeneratePair):
+        (WebCore::CryptoKeyEC::platformImportRaw):
+        (WebCore::CryptoKeyEC::platformImportJWKPublic):
+        (WebCore::CryptoKeyEC::platformImportJWKPrivate):
+        (WebCore::CryptoKeyEC::platformImportSpki):
+        (WebCore::CryptoKeyEC::platformImportPkcs8):
+        (WebCore::CryptoKeyEC::platformExportRaw const):
+        (WebCore::CryptoKeyEC::platformAddFieldElements const):
+        (WebCore::CryptoKeyEC::platformExportSpki const):
+        (WebCore::CryptoKeyEC::platformExportPkcs8 const):
+        * crypto/openssl/CryptoKeyRSAOpenSSL.cpp: Added.
+        (WebCore::CryptoKeyRSA::create):
+        (WebCore::CryptoKeyRSA::isRestrictedToHash const):
+        (WebCore::CryptoKeyRSA::keySizeInBits const):
+        (WebCore::CryptoKeyRSA::generatePair):
+        (WebCore::CryptoKeyRSA::importSpki):
+        (WebCore::CryptoKeyRSA::importPkcs8):
+        (WebCore::CryptoKeyRSA::exportSpki const):
+        (WebCore::CryptoKeyRSA::exportPkcs8 const):
+        (WebCore::CryptoKeyRSA::exportData const):
+        * crypto/openssl/SerializedCryptoKeyWrapOpenSSL.cpp: Added.
+        (WebCore::getDefaultWebCryptoMasterKey):
+        (WebCore::wrapSerializedCryptoKey):
+        (WebCore::unwrapSerializedCryptoKey):
+        * platform/OpenSSL.cmake: Added.
+
 2020-01-22  Fujii Hironori  <Hironori.Fujii@sony.com>
 
         preprocess-idls.pl: CygwinPathIfNeeded should use Cygwin::win_to_posix_path instead of invoking cygpath
index ae91a76..9ab4687 100644 (file)
@@ -2,6 +2,7 @@ include(platform/Curl.cmake)
 if (NOT APPLE_BUILD)
     include(platform/ImageDecoders.cmake)
 endif ()
+include(platform/OpenSSL.cmake)
 include(platform/TextureMapper.cmake)
 
 list(APPEND WebCore_PRIVATE_INCLUDE_DIRECTORIES
index cb1a8b9..f9a71cc 100644 (file)
@@ -2,6 +2,7 @@ include(platform/Cairo.cmake)
 include(platform/Curl.cmake)
 include(platform/FreeType.cmake)
 include(platform/ImageDecoders.cmake)
+include(platform/OpenSSL.cmake)
 include(platform/TextureMapper.cmake)
 
 list(APPEND WebCore_PRIVATE_INCLUDE_DIRECTORIES
index e3e478a..8e67a45 100644 (file)
@@ -1,6 +1,7 @@
 include(platform/Cairo.cmake)
 include(platform/Curl.cmake)
 include(platform/ImageDecoders.cmake)
+include(platform/OpenSSL.cmake)
 include(platform/TextureMapper.cmake)
 
 list(APPEND WebCore_PRIVATE_INCLUDE_DIRECTORIES
index cac748a..777dfd3 100644 (file)
@@ -50,6 +50,10 @@ typedef gcry_sexp_t PlatformECKey;
 typedef std::unique_ptr<typename std::remove_pointer<gcry_sexp_t>::type, PAL::GCrypt::HandleDeleter<gcry_sexp_t>> PlatformECKeyContainer;
 #endif
 
+#if USE(OPENSSL)
+typedef void* PlatformECKey;
+typedef std::unique_ptr<PlatformECKey> PlatformECKeyContainer;
+#endif
 
 namespace WebCore {
 
index 78f0266..c49fe68 100644 (file)
@@ -50,6 +50,11 @@ typedef gcry_sexp_t PlatformRSAKey;
 typedef std::unique_ptr<typename std::remove_pointer<gcry_sexp_t>::type, PAL::GCrypt::HandleDeleter<gcry_sexp_t>> PlatformRSAKeyContainer;
 #endif
 
+#if USE(OPENSSL)
+typedef void* PlatformRSAKey;
+typedef std::unique_ptr<PlatformRSAKey> PlatformRSAKeyContainer;
+#endif
+
 namespace WebCore {
 
 class CryptoKeyRSAComponents;
diff --git a/Source/WebCore/crypto/openssl/CryptoAlgorithmAES_CBCOpenSSL.cpp b/Source/WebCore/crypto/openssl/CryptoAlgorithmAES_CBCOpenSSL.cpp
new file mode 100644 (file)
index 0000000..67202e1
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2020 Sony Interactive Entertainment Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "CryptoAlgorithmAES_CBC.h"
+
+#if ENABLE(WEB_CRYPTO)
+
+#include "CryptoAlgorithmAesCbcCfbParams.h"
+#include "CryptoKeyAES.h"
+#include "NotImplemented.h"
+
+namespace WebCore {
+
+ExceptionOr<Vector<uint8_t>> CryptoAlgorithmAES_CBC::platformEncrypt(const CryptoAlgorithmAesCbcCfbParams&, const CryptoKeyAES&, const Vector<uint8_t>&, Padding)
+{
+    notImplemented();
+    return Exception { NotSupportedError };
+}
+
+ExceptionOr<Vector<uint8_t>> CryptoAlgorithmAES_CBC::platformDecrypt(const CryptoAlgorithmAesCbcCfbParams&, const CryptoKeyAES&, const Vector<uint8_t>&, Padding)
+{
+    notImplemented();
+    return Exception { NotSupportedError };
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(WEB_CRYPTO)
diff --git a/Source/WebCore/crypto/openssl/CryptoAlgorithmAES_CFBOpenSSL.cpp b/Source/WebCore/crypto/openssl/CryptoAlgorithmAES_CFBOpenSSL.cpp
new file mode 100644 (file)
index 0000000..629ce8e
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2020 Sony Interactive Entertainment Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "CryptoAlgorithmAES_CFB.h"
+
+#if ENABLE(WEB_CRYPTO)
+
+#include "CryptoAlgorithmAesCbcCfbParams.h"
+#include "CryptoKeyAES.h"
+#include "NotImplemented.h"
+
+namespace WebCore {
+
+ExceptionOr<Vector<uint8_t>> CryptoAlgorithmAES_CFB::platformEncrypt(const CryptoAlgorithmAesCbcCfbParams&, const CryptoKeyAES&, const Vector<uint8_t>&)
+{
+    notImplemented();
+    return Exception { NotSupportedError };
+}
+
+ExceptionOr<Vector<uint8_t>> CryptoAlgorithmAES_CFB::platformDecrypt(const CryptoAlgorithmAesCbcCfbParams&, const CryptoKeyAES&, const Vector<uint8_t>&)
+{
+    notImplemented();
+    return Exception { NotSupportedError };
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(WEB_CRYPTO)
diff --git a/Source/WebCore/crypto/openssl/CryptoAlgorithmAES_CTROpenSSL.cpp b/Source/WebCore/crypto/openssl/CryptoAlgorithmAES_CTROpenSSL.cpp
new file mode 100644 (file)
index 0000000..8f1614d
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2020 Sony Interactive Entertainment Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "CryptoAlgorithmAES_CTR.h"
+
+#if ENABLE(WEB_CRYPTO)
+
+#include "CryptoAlgorithmAesCtrParams.h"
+#include "CryptoKeyAES.h"
+#include "NotImplemented.h"
+
+namespace WebCore {
+
+ExceptionOr<Vector<uint8_t>> CryptoAlgorithmAES_CTR::platformEncrypt(const CryptoAlgorithmAesCtrParams&, const CryptoKeyAES&, const Vector<uint8_t>&)
+{
+    notImplemented();
+    return Exception { NotSupportedError };
+}
+
+ExceptionOr<Vector<uint8_t>> CryptoAlgorithmAES_CTR::platformDecrypt(const CryptoAlgorithmAesCtrParams&, const CryptoKeyAES&, const Vector<uint8_t>&)
+{
+    notImplemented();
+    return Exception { NotSupportedError };
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(WEB_CRYPTO)
diff --git a/Source/WebCore/crypto/openssl/CryptoAlgorithmAES_GCMOpenSSL.cpp b/Source/WebCore/crypto/openssl/CryptoAlgorithmAES_GCMOpenSSL.cpp
new file mode 100644 (file)
index 0000000..bc0e8e8
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2020 Sony Interactive Entertainment Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "CryptoAlgorithmAES_GCM.h"
+
+#if ENABLE(WEB_CRYPTO)
+
+#include "CryptoAlgorithmAesGcmParams.h"
+#include "CryptoKeyAES.h"
+#include "NotImplemented.h"
+
+namespace WebCore {
+
+ExceptionOr<Vector<uint8_t>> CryptoAlgorithmAES_GCM::platformEncrypt(const CryptoAlgorithmAesGcmParams&, const CryptoKeyAES&, const Vector<uint8_t>&)
+{
+    notImplemented();
+    return Exception { NotSupportedError };
+}
+
+ExceptionOr<Vector<uint8_t>> CryptoAlgorithmAES_GCM::platformDecrypt(const CryptoAlgorithmAesGcmParams&, const CryptoKeyAES&, const Vector<uint8_t>&)
+{
+    notImplemented();
+    return Exception { NotSupportedError };
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(WEB_CRYPTO)
diff --git a/Source/WebCore/crypto/openssl/CryptoAlgorithmAES_KWOpenSSL.cpp b/Source/WebCore/crypto/openssl/CryptoAlgorithmAES_KWOpenSSL.cpp
new file mode 100644 (file)
index 0000000..fdebf07
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2020 Sony Interactive Entertainment Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "CryptoAlgorithmAES_KW.h"
+
+#if ENABLE(WEB_CRYPTO)
+
+#include "CryptoKeyAES.h"
+#include "NotImplemented.h"
+
+namespace WebCore {
+
+ExceptionOr<Vector<uint8_t>> CryptoAlgorithmAES_KW::platformWrapKey(const CryptoKeyAES&, const Vector<uint8_t>&)
+{
+    notImplemented();
+    return Exception { NotSupportedError };
+}
+
+ExceptionOr<Vector<uint8_t>> CryptoAlgorithmAES_KW::platformUnwrapKey(const CryptoKeyAES&, const Vector<uint8_t>&)
+{
+    notImplemented();
+    return Exception { NotSupportedError };
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(WEB_CRYPTO)
diff --git a/Source/WebCore/crypto/openssl/CryptoAlgorithmECDHOpenSSL.cpp b/Source/WebCore/crypto/openssl/CryptoAlgorithmECDHOpenSSL.cpp
new file mode 100644 (file)
index 0000000..2ef0ecd
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2020 Sony Interactive Entertainment Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "CryptoAlgorithmECDH.h"
+
+#if ENABLE(WEB_CRYPTO)
+
+#include "CryptoKeyEC.h"
+#include "NotImplemented.h"
+
+namespace WebCore {
+
+Optional<Vector<uint8_t>> CryptoAlgorithmECDH::platformDeriveBits(const CryptoKeyEC&, const CryptoKeyEC&)
+{
+    notImplemented();
+    return { };
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(WEB_CRYPTO)
diff --git a/Source/WebCore/crypto/openssl/CryptoAlgorithmECDSAOpenSSL.cpp b/Source/WebCore/crypto/openssl/CryptoAlgorithmECDSAOpenSSL.cpp
new file mode 100644 (file)
index 0000000..200c0ff
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2020 Sony Interactive Entertainment Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "CryptoAlgorithmECDSA.h"
+
+#if ENABLE(WEB_CRYPTO)
+
+#include "CryptoAlgorithmEcdsaParams.h"
+#include "CryptoKeyEC.h"
+#include "NotImplemented.h"
+
+namespace WebCore {
+
+ExceptionOr<Vector<uint8_t>> CryptoAlgorithmECDSA::platformSign(const CryptoAlgorithmEcdsaParams&, const CryptoKeyEC&, const Vector<uint8_t>&)
+{
+    notImplemented();
+    return Exception { NotSupportedError };
+}
+
+ExceptionOr<bool> CryptoAlgorithmECDSA::platformVerify(const CryptoAlgorithmEcdsaParams&, const CryptoKeyEC&, const Vector<uint8_t>&, const Vector<uint8_t>&)
+{
+    notImplemented();
+    return Exception { NotSupportedError };
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(WEB_CRYPTO)
diff --git a/Source/WebCore/crypto/openssl/CryptoAlgorithmHKDFOpenSSL.cpp b/Source/WebCore/crypto/openssl/CryptoAlgorithmHKDFOpenSSL.cpp
new file mode 100644 (file)
index 0000000..f0b7a46
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2020 Sony Interactive Entertainment Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "CryptoAlgorithmHKDF.h"
+
+#if ENABLE(WEB_CRYPTO)
+
+#include "CryptoAlgorithmHkdfParams.h"
+#include "CryptoKeyEC.h"
+#include "NotImplemented.h"
+
+namespace WebCore {
+
+ExceptionOr<Vector<uint8_t>> CryptoAlgorithmHKDF::platformDeriveBits(const CryptoAlgorithmHkdfParams&, const CryptoKeyRaw&, size_t)
+{
+    notImplemented();
+    return Exception { NotSupportedError };
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(WEB_CRYPTO)
diff --git a/Source/WebCore/crypto/openssl/CryptoAlgorithmHMACOpenSSL.cpp b/Source/WebCore/crypto/openssl/CryptoAlgorithmHMACOpenSSL.cpp
new file mode 100644 (file)
index 0000000..275460d
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2020 Sony Interactive Entertainment Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "CryptoAlgorithmHMAC.h"
+
+#if ENABLE(WEB_CRYPTO)
+
+#include "CryptoKeyHMAC.h"
+#include "NotImplemented.h"
+
+namespace WebCore {
+
+ExceptionOr<Vector<uint8_t>> CryptoAlgorithmHMAC::platformSign(const CryptoKeyHMAC&, const Vector<uint8_t>&)
+{
+    notImplemented();
+    return Exception { NotSupportedError };
+}
+
+ExceptionOr<bool> CryptoAlgorithmHMAC::platformVerify(const CryptoKeyHMAC&, const Vector<uint8_t>&, const Vector<uint8_t>&)
+{
+    notImplemented();
+    return Exception { NotSupportedError };
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(WEB_CRYPTO)
diff --git a/Source/WebCore/crypto/openssl/CryptoAlgorithmPBKDF2OpenSSL.cpp b/Source/WebCore/crypto/openssl/CryptoAlgorithmPBKDF2OpenSSL.cpp
new file mode 100644 (file)
index 0000000..b94f602
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2020 Sony Interactive Entertainment Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "CryptoAlgorithmPBKDF2.h"
+
+#if ENABLE(WEB_CRYPTO)
+
+#include "CryptoAlgorithmPbkdf2Params.h"
+#include "CryptoKeyRaw.h"
+#include "NotImplemented.h"
+
+namespace WebCore {
+
+ExceptionOr<Vector<uint8_t>> CryptoAlgorithmPBKDF2::platformDeriveBits(const CryptoAlgorithmPbkdf2Params&, const CryptoKeyRaw&, size_t)
+{
+    notImplemented();
+    return Exception { NotSupportedError };
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(WEB_CRYPTO)
diff --git a/Source/WebCore/crypto/openssl/CryptoAlgorithmRSAES_PKCS1_v1_5OpenSSL.cpp b/Source/WebCore/crypto/openssl/CryptoAlgorithmRSAES_PKCS1_v1_5OpenSSL.cpp
new file mode 100644 (file)
index 0000000..0aa495e
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2020 Sony Interactive Entertainment Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "CryptoAlgorithmRSAES_PKCS1_v1_5.h"
+
+#if ENABLE(WEB_CRYPTO)
+
+#include "CryptoKeyRSA.h"
+#include "NotImplemented.h"
+
+namespace WebCore {
+
+ExceptionOr<Vector<uint8_t>> CryptoAlgorithmRSAES_PKCS1_v1_5::platformEncrypt(const CryptoKeyRSA&, const Vector<uint8_t>&)
+{
+    notImplemented();
+    return Exception { NotSupportedError };
+}
+
+ExceptionOr<Vector<uint8_t>> CryptoAlgorithmRSAES_PKCS1_v1_5::platformDecrypt(const CryptoKeyRSA&, const Vector<uint8_t>&)
+{
+    notImplemented();
+    return Exception { NotSupportedError };
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(WEB_CRYPTO)
diff --git a/Source/WebCore/crypto/openssl/CryptoAlgorithmRSASSA_PKCS1_v1_5OpenSSL.cpp b/Source/WebCore/crypto/openssl/CryptoAlgorithmRSASSA_PKCS1_v1_5OpenSSL.cpp
new file mode 100644 (file)
index 0000000..cd4d0b5
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2020 Sony Interactive Entertainment Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "CryptoAlgorithmRSASSA_PKCS1_v1_5.h"
+
+#if ENABLE(WEB_CRYPTO)
+
+#include "CryptoKeyRSA.h"
+#include "NotImplemented.h"
+
+namespace WebCore {
+
+ExceptionOr<Vector<uint8_t>> CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign(const CryptoKeyRSA&, const Vector<uint8_t>&)
+{
+    notImplemented();
+    return Exception { NotSupportedError };
+}
+
+ExceptionOr<bool> CryptoAlgorithmRSASSA_PKCS1_v1_5::platformVerify(const CryptoKeyRSA&, const Vector<uint8_t>&, const Vector<uint8_t>&)
+{
+    notImplemented();
+    return Exception { NotSupportedError };
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(WEB_CRYPTO)
diff --git a/Source/WebCore/crypto/openssl/CryptoAlgorithmRSA_OAEPOpenSSL.cpp b/Source/WebCore/crypto/openssl/CryptoAlgorithmRSA_OAEPOpenSSL.cpp
new file mode 100644 (file)
index 0000000..1d8e3d7
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2020 Sony Interactive Entertainment Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "CryptoAlgorithmRSA_OAEP.h"
+
+#if ENABLE(WEB_CRYPTO)
+
+#include "CryptoAlgorithmRsaOaepParams.h"
+#include "CryptoKeyRSA.h"
+#include "NotImplemented.h"
+
+namespace WebCore {
+
+ExceptionOr<Vector<uint8_t>> CryptoAlgorithmRSA_OAEP::platformEncrypt(const CryptoAlgorithmRsaOaepParams&, const CryptoKeyRSA&, const Vector<uint8_t>&)
+{
+    notImplemented();
+    return Exception { NotSupportedError };
+}
+
+ExceptionOr<Vector<uint8_t>> CryptoAlgorithmRSA_OAEP::platformDecrypt(const CryptoAlgorithmRsaOaepParams&, const CryptoKeyRSA&, const Vector<uint8_t>&)
+{
+    notImplemented();
+    return Exception { NotSupportedError };
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(WEB_CRYPTO)
diff --git a/Source/WebCore/crypto/openssl/CryptoAlgorithmRSA_PSSOpenSSL.cpp b/Source/WebCore/crypto/openssl/CryptoAlgorithmRSA_PSSOpenSSL.cpp
new file mode 100644 (file)
index 0000000..c48b2f0
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2020 Sony Interactive Entertainment Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "CryptoAlgorithmRSA_PSS.h"
+
+#if ENABLE(WEB_CRYPTO) && HAVE(RSA_PSS)
+
+#include "CryptoAlgorithmRsaPssParams.h"
+#include "CryptoKeyRSA.h"
+#include "NotImplemented.h"
+
+namespace WebCore {
+
+ExceptionOr<Vector<uint8_t>> CryptoAlgorithmRSA_PSS::platformSign(const CryptoAlgorithmRsaPssParams&, const CryptoKeyRSA&, const Vector<uint8_t>&)
+{
+    notImplemented();
+    return Exception { NotSupportedError };
+}
+
+ExceptionOr<bool> CryptoAlgorithmRSA_PSS::platformVerify(const CryptoAlgorithmRsaPssParams&, const CryptoKeyRSA&, const Vector<uint8_t>&, const Vector<uint8_t>&)
+{
+    notImplemented();
+    return Exception { NotSupportedError };
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(WEB_CRYPTO)
diff --git a/Source/WebCore/crypto/openssl/CryptoAlgorithmRegistryOpenSSL.cpp b/Source/WebCore/crypto/openssl/CryptoAlgorithmRegistryOpenSSL.cpp
new file mode 100644 (file)
index 0000000..e70068e
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2020 Sony Interactive Entertainment Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "CryptoAlgorithmRegistry.h"
+
+#if ENABLE(WEB_CRYPTO)
+
+#include "CryptoAlgorithmSHA1.h"
+#include "CryptoAlgorithmSHA224.h"
+#include "CryptoAlgorithmSHA256.h"
+#include "CryptoAlgorithmSHA384.h"
+#include "CryptoAlgorithmSHA512.h"
+
+namespace WebCore {
+
+void CryptoAlgorithmRegistry::platformRegisterAlgorithms()
+{
+    registerAlgorithm<CryptoAlgorithmSHA1>();
+    registerAlgorithm<CryptoAlgorithmSHA224>();
+    registerAlgorithm<CryptoAlgorithmSHA256>();
+    registerAlgorithm<CryptoAlgorithmSHA384>();
+    registerAlgorithm<CryptoAlgorithmSHA512>();
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(WEB_CRYPTO)
diff --git a/Source/WebCore/crypto/openssl/CryptoKeyECOpenSSL.cpp b/Source/WebCore/crypto/openssl/CryptoKeyECOpenSSL.cpp
new file mode 100644 (file)
index 0000000..b36dd9d
--- /dev/null
@@ -0,0 +1,109 @@
+/*
+ * Copyright (C) 2020 Sony Interactive Entertainment Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "CryptoKeyEC.h"
+
+#if ENABLE(WEB_CRYPTO)
+
+#include "NotImplemented.h"
+
+namespace WebCore {
+
+size_t CryptoKeyEC::keySizeInBits() const
+{
+    notImplemented();
+    return 0;
+}
+
+bool CryptoKeyEC::platformSupportedCurve(NamedCurve)
+{
+    notImplemented();
+    return false;
+}
+
+Optional<CryptoKeyPair> CryptoKeyEC::platformGeneratePair(CryptoAlgorithmIdentifier, NamedCurve, bool extractable, CryptoKeyUsageBitmap)
+{
+    notImplemented();
+    return { };
+}
+
+RefPtr<CryptoKeyEC> CryptoKeyEC::platformImportRaw(CryptoAlgorithmIdentifier, NamedCurve, Vector<uint8_t>&& keyData, bool extractable, CryptoKeyUsageBitmap)
+{
+    notImplemented();
+    return nullptr;
+}
+
+RefPtr<CryptoKeyEC> CryptoKeyEC::platformImportJWKPublic(CryptoAlgorithmIdentifier, NamedCurve, Vector<uint8_t>&& x, Vector<uint8_t>&& y, bool extractable, CryptoKeyUsageBitmap)
+{
+    notImplemented();
+    return nullptr;
+}
+
+RefPtr<CryptoKeyEC> CryptoKeyEC::platformImportJWKPrivate(CryptoAlgorithmIdentifier, NamedCurve, Vector<uint8_t>&& x, Vector<uint8_t>&& y, Vector<uint8_t>&& d, bool extractable, CryptoKeyUsageBitmap)
+{
+    notImplemented();
+    return nullptr;
+}
+
+RefPtr<CryptoKeyEC> CryptoKeyEC::platformImportSpki(CryptoAlgorithmIdentifier, NamedCurve, Vector<uint8_t>&& keyData, bool extractable, CryptoKeyUsageBitmap)
+{
+    notImplemented();
+    return nullptr;
+}
+
+RefPtr<CryptoKeyEC> CryptoKeyEC::platformImportPkcs8(CryptoAlgorithmIdentifier, NamedCurve, Vector<uint8_t>&& keyData, bool extractable, CryptoKeyUsageBitmap)
+{
+    notImplemented();
+    return nullptr;
+}
+
+Vector<uint8_t> CryptoKeyEC::platformExportRaw() const
+{
+    notImplemented();
+    return { };
+}
+
+bool CryptoKeyEC::platformAddFieldElements(JsonWebKey&) const
+{
+    notImplemented();
+    return false;
+}
+
+Vector<uint8_t> CryptoKeyEC::platformExportSpki() const
+{
+    notImplemented();
+    return { };
+}
+
+Vector<uint8_t> CryptoKeyEC::platformExportPkcs8() const
+{
+    notImplemented();
+    return { };
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(WEB_CRYPTO)
diff --git a/Source/WebCore/crypto/openssl/CryptoKeyRSAOpenSSL.cpp b/Source/WebCore/crypto/openssl/CryptoKeyRSAOpenSSL.cpp
new file mode 100644 (file)
index 0000000..3646486
--- /dev/null
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2020 Sony Interactive Entertainment Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "CryptoKeyRSA.h"
+
+#if ENABLE(WEB_CRYPTO)
+
+#include "CryptoKeyRSAComponents.h"
+#include "NotImplemented.h"
+
+namespace WebCore {
+
+RefPtr<CryptoKeyRSA> CryptoKeyRSA::create(CryptoAlgorithmIdentifier, CryptoAlgorithmIdentifier hash, bool hasHash, const CryptoKeyRSAComponents&, bool extractable, CryptoKeyUsageBitmap)
+{
+    notImplemented();
+    return nullptr;
+}
+
+bool CryptoKeyRSA::isRestrictedToHash(CryptoAlgorithmIdentifier&) const
+{
+    notImplemented();
+    return true;
+}
+
+size_t CryptoKeyRSA::keySizeInBits() const
+{
+    notImplemented();
+    return 0;
+}
+
+void CryptoKeyRSA::generatePair(CryptoAlgorithmIdentifier, CryptoAlgorithmIdentifier hash, bool hasHash, unsigned modulusLength, const Vector<uint8_t>& publicExponent, bool extractable, CryptoKeyUsageBitmap, KeyPairCallback&&, VoidCallback&& failureCallback, ScriptExecutionContext*)
+{
+    notImplemented();
+}
+
+RefPtr<CryptoKeyRSA> CryptoKeyRSA::importSpki(CryptoAlgorithmIdentifier, Optional<CryptoAlgorithmIdentifier> hash, Vector<uint8_t>&&, bool extractable, CryptoKeyUsageBitmap)
+{
+    notImplemented();
+    return nullptr;
+}
+
+RefPtr<CryptoKeyRSA> CryptoKeyRSA::importPkcs8(CryptoAlgorithmIdentifier, Optional<CryptoAlgorithmIdentifier> hash, Vector<uint8_t>&&, bool extractable, CryptoKeyUsageBitmap)
+{
+    notImplemented();
+    return nullptr;
+}
+
+ExceptionOr<Vector<uint8_t>> CryptoKeyRSA::exportSpki() const
+{
+    notImplemented();
+    return Exception { NotSupportedError };
+}
+
+ExceptionOr<Vector<uint8_t>> CryptoKeyRSA::exportPkcs8() const
+{
+    notImplemented();
+    return Exception { NotSupportedError };
+}
+
+std::unique_ptr<CryptoKeyRSAComponents> CryptoKeyRSA::exportData() const
+{
+    notImplemented();
+    return nullptr;
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(WEB_CRYPTO)
diff --git a/Source/WebCore/crypto/openssl/SerializedCryptoKeyWrapOpenSSL.cpp b/Source/WebCore/crypto/openssl/SerializedCryptoKeyWrapOpenSSL.cpp
new file mode 100644 (file)
index 0000000..e848a50
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2020 Sony Interactive Entertainment Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "CryptoAlgorithmAES_CTR.h"
+
+#if ENABLE(WEB_CRYPTO)
+
+#include "NotImplemented.h"
+
+namespace WebCore {
+
+bool getDefaultWebCryptoMasterKey(Vector<uint8_t>& masterKey)
+{
+    notImplemented();
+    UNUSED_PARAM(masterKey);
+
+    return false;
+}
+
+// Initially these helper functions were intended to perform KEK wrapping and unwrapping,
+// but this is not required anymore, despite the function names and the Mac implementation
+// still indicating otherwise.
+// See https://bugs.webkit.org/show_bug.cgi?id=173883 for more info.
+
+bool wrapSerializedCryptoKey(const Vector<uint8_t>& masterKey, const Vector<uint8_t>& key, Vector<uint8_t>& result)
+{
+    UNUSED_PARAM(masterKey);
+
+    // No wrapping performed -- the serialized key data is copied into the `result` variable.
+    result = Vector<uint8_t>(key);
+    return true;
+}
+
+bool unwrapSerializedCryptoKey(const Vector<uint8_t>& masterKey, const Vector<uint8_t>& wrappedKey, Vector<uint8_t>& key)
+{
+    UNUSED_PARAM(masterKey);
+
+    // No unwrapping performed -- the serialized key data is copied into the `key` variable.
+    key = Vector<uint8_t>(wrappedKey);
+    return true;
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(WEB_CRYPTO)
diff --git a/Source/WebCore/platform/OpenSSL.cmake b/Source/WebCore/platform/OpenSSL.cmake
new file mode 100644 (file)
index 0000000..a4e2aa5
--- /dev/null
@@ -0,0 +1,22 @@
+if (ENABLE_WEB_CRYPTO)
+    list(APPEND WebCore_SOURCES
+        crypto/openssl/CryptoAlgorithmAES_CBCOpenSSL.cpp
+        crypto/openssl/CryptoAlgorithmAES_CFBOpenSSL.cpp
+        crypto/openssl/CryptoAlgorithmAES_CTROpenSSL.cpp
+        crypto/openssl/CryptoAlgorithmAES_GCMOpenSSL.cpp
+        crypto/openssl/CryptoAlgorithmAES_KWOpenSSL.cpp
+        crypto/openssl/CryptoAlgorithmECDHOpenSSL.cpp
+        crypto/openssl/CryptoAlgorithmECDSAOpenSSL.cpp
+        crypto/openssl/CryptoAlgorithmHKDFOpenSSL.cpp
+        crypto/openssl/CryptoAlgorithmHMACOpenSSL.cpp
+        crypto/openssl/CryptoAlgorithmPBKDF2OpenSSL.cpp
+        crypto/openssl/CryptoAlgorithmRSAES_PKCS1_v1_5OpenSSL.cpp
+        crypto/openssl/CryptoAlgorithmRSASSA_PKCS1_v1_5OpenSSL.cpp
+        crypto/openssl/CryptoAlgorithmRSA_OAEPOpenSSL.cpp
+        crypto/openssl/CryptoAlgorithmRSA_PSSOpenSSL.cpp
+        crypto/openssl/CryptoAlgorithmRegistryOpenSSL.cpp
+        crypto/openssl/CryptoKeyECOpenSSL.cpp
+        crypto/openssl/CryptoKeyRSAOpenSSL.cpp
+        crypto/openssl/SerializedCryptoKeyWrapOpenSSL.cpp
+    )
+endif ()
index 6b229d6..0b554e8 100644 (file)
@@ -247,6 +247,7 @@ SET_AND_EXPOSE_TO_BUILD(USE_EGL ON)
 SET_AND_EXPOSE_TO_BUILD(USE_EXPORT_MACROS ON)
 SET_AND_EXPOSE_TO_BUILD(USE_OPENGL_ES ON)
 SET_AND_EXPOSE_TO_BUILD(HAVE_OPENGL_ES_3 ON)
+SET_AND_EXPOSE_TO_BUILD(USE_OPENSSL ON)
 SET_AND_EXPOSE_TO_BUILD(USE_TEXTURE_MAPPER ON)
 SET_AND_EXPOSE_TO_BUILD(USE_TEXTURE_MAPPER_GL ON)
 #SET_AND_EXPOSE_TO_BUILD(USE_INSPECTOR_SOCKET_SERVER ${ENABLE_REMOTE_INSPECTOR})
index f126bc6..3bbcec2 100644 (file)
@@ -38,6 +38,7 @@ WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_LAYOUT_FORMATTING_CONTEXT PRIVATE ${ENAB
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_REMOTE_INSPECTOR PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_SERVICE_WORKER PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEBGL PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEB_CRYPTO PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
 
 # Features to investigate
 #
@@ -59,7 +60,6 @@ WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_NOTIFICATIONS PRIVATE OFF)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_SVG_FONTS PRIVATE OFF)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_USERSELECT_ALL PRIVATE OFF)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_USER_MESSAGE_HANDLERS PRIVATE OFF)
-WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEB_CRYPTO PRIVATE OFF)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_XSLT PRIVATE OFF)
 
 WEBKIT_OPTION_END()
@@ -107,6 +107,9 @@ find_package(WebP REQUIRED)
 find_package(WPE REQUIRED)
 find_package(ZLIB REQUIRED)
 
+# TODO: Add a check for HAVE_RSA_PSS for support of CryptoAlgorithmRSA_PSS
+# https://bugs.webkit.org/show_bug.cgi?id=206635
+
 # Emulate what pkg-config would do with statically compiled libraries
 # FIXME: https://bugs.webkit.org/show_bug.cgi?id=192410
 list(APPEND CAIRO_LIBRARIES ${PIXMAN_LIBRARIES})
@@ -121,6 +124,7 @@ SET_AND_EXPOSE_TO_BUILD(USE_CURL ON)
 SET_AND_EXPOSE_TO_BUILD(USE_FREETYPE ON)
 SET_AND_EXPOSE_TO_BUILD(USE_HARFBUZZ ON)
 SET_AND_EXPOSE_TO_BUILD(USE_LIBWPE ON)
+SET_AND_EXPOSE_TO_BUILD(USE_OPENSSL ON)
 SET_AND_EXPOSE_TO_BUILD(USE_WPE_RENDERER ON)
 
 SET_AND_EXPOSE_TO_BUILD(USE_INSPECTOR_SOCKET_SERVER ${ENABLE_REMOTE_INSPECTOR})
index 1019fce..935a7fd 100644 (file)
@@ -68,7 +68,6 @@ WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_XSLT PUBLIC ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_SMOOTH_SCROLLING PRIVATE OFF)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_USERSELECT_ALL PRIVATE OFF)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEBGL PRIVATE OFF)
-WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEB_CRYPTO PRIVATE OFF)
 
 # FIXME: Port bmalloc to Windows. https://bugs.webkit.org/show_bug.cgi?id=143310
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(USE_SYSTEM_MALLOC PRIVATE ON)
@@ -91,17 +90,20 @@ if (${WTF_PLATFORM_WIN_CAIRO})
     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_SERVICE_WORKER PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_VARIATION_FONTS PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEBDRIVER PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
+    WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEB_CRYPTO PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
 
     # FIXME: Implement plugin process on Modern WebKit. https://bugs.webkit.org/show_bug.cgi?id=185313
     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_NETSCAPE_PLUGIN_API PRIVATE OFF)
 else ()
     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_COMPOSITING PUBLIC OFF)
-    WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_USER_MESSAGE_HANDLERS PRIVATE OFF)
-    WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_LEGACY_ENCRYPTED_MEDIA PUBLIC ON)
     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_INTL PUBLIC OFF)
+    WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_LEGACY_ENCRYPTED_MEDIA PUBLIC ON)
     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_PUBLIC_SUFFIX_LIST PRIVATE OFF)
-    WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEBGL PUBLIC OFF)
     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_REMOTE_INSPECTOR PRIVATE OFF)
+    WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_USER_MESSAGE_HANDLERS PRIVATE OFF)
+    WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEBGL PUBLIC OFF)
+    WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEB_CRYPTO PRIVATE OFF)
+
     WEBKIT_OPTION_DEFAULT_PORT_VALUE(USE_VERSION_STAMPER PRIVATE ON)
 endif ()
 
index 2ee2aad..bafcb09 100644 (file)
@@ -31,6 +31,9 @@ if (WEBP_FOUND)
     SET_AND_EXPOSE_TO_BUILD(USE_WEBP ON)
 endif ()
 
+# TODO: Add a check for HAVE_RSA_PSS for support of CryptoAlgorithmRSA_PSS
+# https://bugs.webkit.org/show_bug.cgi?id=206635
+
 set(USE_ANGLE_EGL ON)
 
 SET_AND_EXPOSE_TO_BUILD(USE_CAIRO ON)
@@ -39,6 +42,7 @@ SET_AND_EXPOSE_TO_BUILD(USE_CURL ON)
 SET_AND_EXPOSE_TO_BUILD(USE_EGL ON)
 SET_AND_EXPOSE_TO_BUILD(USE_OPENGL_ES ON)
 SET_AND_EXPOSE_TO_BUILD(HAVE_OPENGL_ES_3 ON)
+SET_AND_EXPOSE_TO_BUILD(USE_OPENSSL ON)
 SET_AND_EXPOSE_TO_BUILD(USE_TEXTURE_MAPPER ON)
 SET_AND_EXPOSE_TO_BUILD(USE_TEXTURE_MAPPER_GL ON)
 SET_AND_EXPOSE_TO_BUILD(USE_MEDIA_FOUNDATION ON)