Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 2ca10927173d23111c5d44e97fab308f397e49b8
      
https://github.com/WebKit/WebKit/commit/2ca10927173d23111c5d44e97fab308f397e49b8
  Author: Nitin Mahendru <nitinmahen...@apple.com>
  Date:   2024-04-18 (Thu, 18 Apr 2024)

  Changed paths:
    M Source/WebCore/Modules/webauthn/AuthenticatorAttestationResponse.cpp
    M Source/WebCore/Modules/webauthn/fido/Pin.cpp
    M Source/WebCore/Modules/webauthn/fido/Pin.h
    M Source/WebCore/PAL/pal/PALSwift/CryptoKitShim.swift
    M Source/WebCore/PAL/pal/PALSwift/UnsafeOverlays.swift
    M Source/WebCore/PAL/pal/crypto/CryptoDigest.h
    M Source/WebCore/PAL/pal/crypto/commoncrypto/CryptoDigestCommonCrypto.cpp
    M Source/WebCore/PAL/pal/crypto/gcrypt/CryptoDigestGCrypt.cpp
    M Source/WebCore/PAL/pal/crypto/openssl/CryptoDigestOpenSSL.cpp
    M Source/WebCore/bindings/js/SerializedScriptValue.cpp
    M Source/WebCore/crypto/CryptoAlgorithm.cpp
    M Source/WebCore/crypto/CryptoAlgorithm.h
    M Source/WebCore/crypto/CryptoKey.h
    M Source/WebCore/crypto/SubtleCrypto.cpp
    M Source/WebCore/crypto/algorithms/CryptoAlgorithmAESCBC.cpp
    M Source/WebCore/crypto/algorithms/CryptoAlgorithmAESCBC.h
    M Source/WebCore/crypto/algorithms/CryptoAlgorithmAESCFB.cpp
    M Source/WebCore/crypto/algorithms/CryptoAlgorithmAESCFB.h
    M Source/WebCore/crypto/algorithms/CryptoAlgorithmAESCTR.cpp
    M Source/WebCore/crypto/algorithms/CryptoAlgorithmAESCTR.h
    M Source/WebCore/crypto/algorithms/CryptoAlgorithmAESGCM.cpp
    M Source/WebCore/crypto/algorithms/CryptoAlgorithmAESGCM.h
    M Source/WebCore/crypto/algorithms/CryptoAlgorithmAESKW.cpp
    M Source/WebCore/crypto/algorithms/CryptoAlgorithmAESKW.h
    M Source/WebCore/crypto/algorithms/CryptoAlgorithmECDH.cpp
    M Source/WebCore/crypto/algorithms/CryptoAlgorithmECDH.h
    M Source/WebCore/crypto/algorithms/CryptoAlgorithmECDSA.cpp
    M Source/WebCore/crypto/algorithms/CryptoAlgorithmECDSA.h
    M Source/WebCore/crypto/algorithms/CryptoAlgorithmEd25519.cpp
    M Source/WebCore/crypto/algorithms/CryptoAlgorithmEd25519.h
    M Source/WebCore/crypto/algorithms/CryptoAlgorithmHKDF.cpp
    M Source/WebCore/crypto/algorithms/CryptoAlgorithmHKDF.h
    M Source/WebCore/crypto/algorithms/CryptoAlgorithmHMAC.cpp
    M Source/WebCore/crypto/algorithms/CryptoAlgorithmHMAC.h
    M Source/WebCore/crypto/algorithms/CryptoAlgorithmPBKDF2.cpp
    M Source/WebCore/crypto/algorithms/CryptoAlgorithmPBKDF2.h
    M Source/WebCore/crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp
    M Source/WebCore/crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h
    M Source/WebCore/crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp
    M Source/WebCore/crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h
    M Source/WebCore/crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp
    M Source/WebCore/crypto/algorithms/CryptoAlgorithmRSA_OAEP.h
    M Source/WebCore/crypto/algorithms/CryptoAlgorithmRSA_PSS.cpp
    M Source/WebCore/crypto/algorithms/CryptoAlgorithmRSA_PSS.h
    M Source/WebCore/crypto/algorithms/CryptoAlgorithmX25519.cpp
    M Source/WebCore/crypto/algorithms/CryptoAlgorithmX25519.h
    M Source/WebCore/crypto/cocoa/CryptoAlgorithmAESGCMMac.cpp
    M Source/WebCore/crypto/cocoa/CryptoAlgorithmAESKWMac.cpp
    M Source/WebCore/crypto/cocoa/CryptoAlgorithmECDHMac.cpp
    M Source/WebCore/crypto/cocoa/CryptoAlgorithmECDSAMac.cpp
    M Source/WebCore/crypto/cocoa/CryptoKeyECMac.cpp
    M Source/WebCore/crypto/gcrypt/CryptoAlgorithmAESGCMGCrypt.cpp
    M Source/WebCore/crypto/gcrypt/CryptoAlgorithmAESKWGCrypt.cpp
    M Source/WebCore/crypto/gcrypt/CryptoAlgorithmECDHGCrypt.cpp
    M Source/WebCore/crypto/gcrypt/CryptoAlgorithmECDSAGCrypt.cpp
    M Source/WebCore/crypto/gcrypt/CryptoKeyECGCrypt.cpp
    M Source/WebCore/crypto/keys/CryptoKeyAES.cpp
    M Source/WebCore/crypto/keys/CryptoKeyAES.h
    M Source/WebCore/crypto/keys/CryptoKeyEC.cpp
    M Source/WebCore/crypto/keys/CryptoKeyEC.h
    M Source/WebCore/crypto/openssl/CryptoAlgorithmAESGCMOpenSSL.cpp
    M Source/WebCore/crypto/openssl/CryptoAlgorithmAESKWOpenSSL.cpp
    M Source/WebCore/crypto/openssl/CryptoAlgorithmECDHOpenSSL.cpp
    M Source/WebCore/crypto/openssl/CryptoAlgorithmECDSAOpenSSL.cpp
    M Source/WebCore/crypto/openssl/CryptoKeyECOpenSSL.cpp
    M Source/WebKit/UIProcess/WebAuthentication/fido/CtapAuthenticator.cpp
    M Tools/TestWebKitAPI/Tests/WebCore/CtapPinTest.cpp

  Log Message:
  -----------
  Adding CryptoKit for ECDSA/ECDH
https://bugs.webkit.org/show_bug.cgi?id=272162
rdar://125914120

Reviewed by Pascoe and Alex Christensen.

With this change:
1. When CryptoKit is enabled, Swift Objects of type ECKey will be held in C++ 
UniqueRef inside CryptokeyEC.h.
2. C++ UniqueRef should be able to clean memory for Swift objects.
3. TestWebKitAPI also links with the swift generated header for CtapPinTestAPI.
4. CryptoKeyEC is fundamentally changed but when CryptoKit is not enabled, it 
should behave as it does
   before this change.
All layout tests for LayoutTests/crypto have been manually run with 
CryptoKitEnabled to test the functionality.
Layout tests in EWS will test this change with CryptoKit off.
Some calls in Pin.cpp and AuthenticatorAttestationResponse.cpp are not part of 
the SubtleCrypto interface have not been selectively enabled to use CryptoKit 
yet.
They will be enabled once the SubtleCrypto interface is activated and livedOn 
for some time.

* Source/WebCore/Modules/webauthn/AuthenticatorAttestationResponse.cpp:
(WebCore::AuthenticatorAttestationResponse::getPublicKey const):
* Source/WebCore/Modules/webauthn/fido/Pin.cpp:
(fido::pin::KeyAgreementResponse::parseFromCOSE):
(fido::pin::TokenRequest::tryCreate):
(fido::pin::SetPinRequest::tryCreate):
* Source/WebCore/Modules/webauthn/fido/Pin.h:
* Source/WebCore/PAL/pal/PALSwift/CryptoKitShim.swift:
(Digest.sha1(_:)):
(Digest.sha256(_:)):
(Digest.sha384(_:)):
(Digest.sha512(_:)):
(Digest.digest(_:hashFunction:)):
(ECRv.errCode):
(ECRv.signature):
(ECRv.keyBytes):
(ECRv.key):
(ECKey.toPub):
(ECKey.importX963Pub(_:curve:)):
(ECKey.exportX963Pub):
(ECKey.importCompressedPub(_:curve:)):
(ECKey.importX963Private(_:curve:)):
(ECKey.exportX963Private):
(ECKey.sign(_:hashFunction:)):
(ECKey.getInternalPrivate):
(ECKey.getInternalPublic):
(ECKey.deriveBits(_:)):
* Source/WebCore/PAL/pal/PALSwift/UnsafeOverlays.swift:
(HashFunction.update(_:)): Deleted.
* Source/WebCore/bindings/js/SerializedScriptValue.cpp:
(WebCore::CloneSerializer::write):
(WebCore::CloneSerializer::isUsingCryptoKit):
(WebCore::CloneDeserializer::isUsingCryptoKit):
(WebCore::CloneDeserializer::readECKey):
* Source/WebCore/crypto/CryptoAlgorithm.cpp:
(WebCore::CryptoAlgorithm::importKey):
(WebCore::CryptoAlgorithm::exportKey):
* Source/WebCore/crypto/CryptoAlgorithm.h:
* Source/WebCore/crypto/SubtleCrypto.cpp:
(WebCore::SubtleCrypto::deriveKey):
(WebCore::SubtleCrypto::importKey):
(WebCore::SubtleCrypto::exportKey):
(WebCore::SubtleCrypto::wrapKey):
(WebCore::SubtleCrypto::unwrapKey):
* Source/WebCore/crypto/algorithms/CryptoAlgorithmAESCBC.cpp:
(WebCore::CryptoAlgorithmAESCBC::importKey):
(WebCore::CryptoAlgorithmAESCBC::exportKey):
* Source/WebCore/crypto/algorithms/CryptoAlgorithmAESCBC.h:
* Source/WebCore/crypto/algorithms/CryptoAlgorithmAESCFB.cpp:
(WebCore::CryptoAlgorithmAESCFB::importKey):
(WebCore::CryptoAlgorithmAESCFB::exportKey):
* Source/WebCore/crypto/algorithms/CryptoAlgorithmAESCFB.h:
* Source/WebCore/crypto/algorithms/CryptoAlgorithmAESCTR.cpp:
(WebCore::CryptoAlgorithmAESCTR::importKey):
(WebCore::CryptoAlgorithmAESCTR::exportKey):
* Source/WebCore/crypto/algorithms/CryptoAlgorithmAESCTR.h:
* Source/WebCore/crypto/algorithms/CryptoAlgorithmAESGCM.cpp:
(WebCore::CryptoAlgorithmAESGCM::importKey):
(WebCore::CryptoAlgorithmAESGCM::exportKey):
* Source/WebCore/crypto/algorithms/CryptoAlgorithmAESGCM.h:
* Source/WebCore/crypto/algorithms/CryptoAlgorithmAESKW.cpp:
(WebCore::CryptoAlgorithmAESKW::importKey):
(WebCore::CryptoAlgorithmAESKW::exportKey):
* Source/WebCore/crypto/algorithms/CryptoAlgorithmAESKW.h:
* Source/WebCore/crypto/algorithms/CryptoAlgorithmECDH.cpp:
(WebCore::CryptoAlgorithmECDH::generateKey):
(WebCore::CryptoAlgorithmECDH::deriveBits):
(WebCore::CryptoAlgorithmECDH::importKey):
(WebCore::CryptoAlgorithmECDH::exportKey):
* Source/WebCore/crypto/algorithms/CryptoAlgorithmECDH.h:
* Source/WebCore/crypto/algorithms/CryptoAlgorithmECDSA.cpp:
(WebCore::CryptoAlgorithmECDSA::sign):
(WebCore::CryptoAlgorithmECDSA::verify):
(WebCore::CryptoAlgorithmECDSA::generateKey):
(WebCore::CryptoAlgorithmECDSA::importKey):
(WebCore::CryptoAlgorithmECDSA::exportKey):
* Source/WebCore/crypto/algorithms/CryptoAlgorithmECDSA.h:
* Source/WebCore/crypto/algorithms/CryptoAlgorithmEd25519.cpp:
(WebCore::CryptoAlgorithmEd25519::importKey):
(WebCore::CryptoAlgorithmEd25519::exportKey):
* Source/WebCore/crypto/algorithms/CryptoAlgorithmEd25519.h:
* Source/WebCore/crypto/algorithms/CryptoAlgorithmHKDF.cpp:
(WebCore::CryptoAlgorithmHKDF::importKey):
* Source/WebCore/crypto/algorithms/CryptoAlgorithmHKDF.h:
* Source/WebCore/crypto/algorithms/CryptoAlgorithmHMAC.cpp:
(WebCore::CryptoAlgorithmHMAC::importKey):
(WebCore::CryptoAlgorithmHMAC::exportKey):
* Source/WebCore/crypto/algorithms/CryptoAlgorithmHMAC.h:
* Source/WebCore/crypto/algorithms/CryptoAlgorithmPBKDF2.cpp:
(WebCore::CryptoAlgorithmPBKDF2::importKey):
* Source/WebCore/crypto/algorithms/CryptoAlgorithmPBKDF2.h:
* Source/WebCore/crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
(WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::importKey):
(WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::exportKey):
* Source/WebCore/crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h:
* Source/WebCore/crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
(WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey):
(WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::exportKey):
* Source/WebCore/crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
* Source/WebCore/crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
(WebCore::CryptoAlgorithmRSA_OAEP::importKey):
(WebCore::CryptoAlgorithmRSA_OAEP::exportKey):
* Source/WebCore/crypto/algorithms/CryptoAlgorithmRSA_OAEP.h:
* Source/WebCore/crypto/algorithms/CryptoAlgorithmRSA_PSS.cpp:
(WebCore::CryptoAlgorithmRSA_PSS::importKey):
(WebCore::CryptoAlgorithmRSA_PSS::exportKey):
* Source/WebCore/crypto/algorithms/CryptoAlgorithmRSA_PSS.h:
* Source/WebCore/crypto/algorithms/CryptoAlgorithmX25519.cpp:
(WebCore::CryptoAlgorithmX25519::importKey):
(WebCore::CryptoAlgorithmX25519::exportKey):
* Source/WebCore/crypto/algorithms/CryptoAlgorithmX25519.h:
* Source/WebCore/crypto/cocoa/CryptoAlgorithmECDHMac.cpp:
(WebCore::platformDeriveBitsCC):
(WebCore::platformDeriveBitsCryptoKit):
(WebCore::CryptoAlgorithmECDH::platformDeriveBits):
* Source/WebCore/crypto/cocoa/CryptoAlgorithmECDSAMac.cpp:
(WebCore::toCKHashFunction):
(WebCore::signECDSACryptoKit):
(WebCore::verifyECDSACryptoKit):
(WebCore::signECDSA):
(WebCore::verifyECDSA):
(WebCore::CryptoAlgorithmECDSA::platformSign):
(WebCore::CryptoAlgorithmECDSA::platformVerify):
* Source/WebCore/crypto/cocoa/CryptoKeyECMac.cpp:
(WebCore::CryptoKeyEC::keySizeInBits const):
(WebCore::namedCurveToCryptoKitCurve):
(WebCore::CryptoKeyEC::platformGeneratePair):
(WebCore::CryptoKeyEC::platformImportRaw):
(WebCore::CryptoKeyEC::platformExportRaw const):
(WebCore::CryptoKeyEC::platformImportJWKPublic):
(WebCore::CryptoKeyEC::platformImportJWKPrivate):
(WebCore::CryptoKeyEC::platformAddFieldElements const):
(WebCore::CryptoKeyEC::platformImportSpki):
(WebCore::CryptoKeyEC::platformExportSpki const):
(WebCore::CryptoKeyEC::platformImportPkcs8):
(WebCore::CryptoKeyEC::platformExportPkcs8 const):
(WebCore::CryptoKeyEC::usingCryptoKit const):
(WebCore::CryptoKeyEC::platformKey const):
* Source/WebCore/crypto/gcrypt/CryptoAlgorithmECDHGCrypt.cpp:
(WebCore::CryptoAlgorithmECDH::platformDeriveBits):
* Source/WebCore/crypto/gcrypt/CryptoAlgorithmECDSAGCrypt.cpp:
(WebCore::CryptoAlgorithmECDSA::platformSign):
(WebCore::CryptoAlgorithmECDSA::platformVerify):
* Source/WebCore/crypto/gcrypt/CryptoKeyECGCrypt.cpp:
(WebCore::CryptoKeyEC::platformKey const):
(WebCore::CryptoKeyEC::usingCryptoKit const):
(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):
* Source/WebCore/crypto/keys/CryptoKeyAES.cpp:
(WebCore::CryptoKeyAES::importRaw):
(WebCore::CryptoKeyAES::importJwk):
* Source/WebCore/crypto/keys/CryptoKeyAES.h:
* Source/WebCore/crypto/keys/CryptoKeyEC.cpp:
(WebCore::CryptoKeyEC::toCCPlatformECKeyContainer):
(WebCore::CryptoKeyEC::toCKPlatformECKeyContainer):
(WebCore::CryptoKeyEC::generatePair):
(WebCore::CryptoKeyEC::importRaw):
(WebCore::CryptoKeyEC::importJwk):
(WebCore::CryptoKeyEC::importSpki):
(WebCore::CryptoKeyEC::importPkcs8):
(WebCore::CryptoKeyEC::exportRaw const):
(WebCore::CryptoKeyEC::exportJwk const):
(WebCore::CryptoKeyEC::exportSpki const):
(WebCore::CryptoKeyEC::exportPkcs8 const):
* Source/WebCore/crypto/keys/CryptoKeyEC.h:
(WebCore::CCECCryptorRefDeleter::operator() const):
* Source/WebCore/crypto/openssl/CryptoAlgorithmECDHOpenSSL.cpp:
(WebCore::CryptoAlgorithmECDH::platformDeriveBits):
* Source/WebCore/crypto/openssl/CryptoAlgorithmECDSAOpenSSL.cpp:
(WebCore::CryptoAlgorithmECDSA::platformSign):
(WebCore::CryptoAlgorithmECDSA::platformVerify):
* Source/WebCore/crypto/openssl/CryptoKeyECOpenSSL.cpp:
(WebCore::CryptoKeyEC::usingCryptoKit const):
(WebCore::CryptoKeyEC::platformKey const):
(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):
* Source/WebKit/UIProcess/WebAuthentication/fido/CtapAuthenticator.cpp:
* Tools/TestWebKitAPI/Tests/WebCore/CtapPinTest.cpp:
(TestWebKitAPI::TEST(CtapPinTest, TestSetPinRequest)):
(TestWebKitAPI::TEST(CtapPinTest, TestKeyAgreementResponse)):
(TestWebKitAPI::TEST(CtapPinTest, TestTokenRequest)):

Canonical link: https://commits.webkit.org/277711@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to