Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 2af6dd861a06a3881f98e2f872c49ea04c3533a9
      
https://github.com/WebKit/WebKit/commit/2af6dd861a06a3881f98e2f872c49ea04c3533a9
  Author: nmahendru <nitinmahen...@apple.com>
  Date:   2024-02-20 (Tue, 20 Feb 2024)

  Changed paths:
    M LayoutTests/crypto/subtle/sha1-digest.html
    M LayoutTests/crypto/subtle/sha256-digest.html
    M LayoutTests/crypto/subtle/sha384-digest.html
    M LayoutTests/crypto/subtle/sha512-digest.html
    M Source/WebCore/Configurations/WebCore.xcconfig
    R Source/WebCore/Configurations/WebCoreSwift.xcconfig
    M Source/WebCore/PAL/Configurations/PAL.xcconfig
    M Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj
    A Source/WebCore/PAL/pal/PALSwift/CryptoKitShim.swift
    M Source/WebCore/PAL/pal/PlatformMac.cmake
    M Source/WebCore/PAL/pal/crypto/CryptoDigest.h
    R Source/WebCore/PAL/pal/crypto/commoncrypto/CryptoDigestCommonCrypto.cpp
    A Source/WebCore/PAL/pal/crypto/commoncrypto/CryptoDigestCommonCrypto.mm
    M Source/WebCore/PAL/pal/crypto/gcrypt/CryptoDigestGCrypt.cpp
    M Source/WebCore/PAL/pal/crypto/openssl/CryptoDigestOpenSSL.cpp
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    R Source/WebCore/WebCoreSwift/CryptoKitShim.swift
    M Source/WebCore/crypto/CryptoAlgorithm.cpp
    M Source/WebCore/crypto/CryptoAlgorithm.h
    M Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA1.cpp
    M Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA256.cpp
    M Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA384.cpp
    M Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA512.cpp
    M Source/WebCore/crypto/cocoa/CryptoAlgorithmAESGCMMac.mm
    M Source/WebCore/crypto/cocoa/CryptoAlgorithmAESKWMac.mm

  Log Message:
  -----------
  Adding SHA* implementations using CryptoKit
rdar://122317816

Reviewed by Alex Christensen.

This PR introduces the CryptoDigest implementations from CryptoKit.

This change also moves the CryptoKitShim into PAL from WebCore to avoid 
circular dependencies
from WebCore <== PAL. The CryptoDigest Implementation resides in PAL and still 
needs to use the Shim.
We also add a negative test to for zero length input digests to ensure the new 
implementation supports it.

Another big change is that the Digest implementations have been replaced with a 
one shot implementation
instead of init, update and finalize style. That helps simplify the swift shim 
and does not mandate dealing with swift
allocated memory in C++ land.
The remnants of the init/update/finalize style have been
left in because of this(Just in case we have to implement it in the future):
https://github.com/wintercg/proposal-webcrypto-streams/blob/main/explainer.md

Another change is to introduce smart pointers for managing memory wherever 
possible.

* LayoutTests/crypto/subtle/sha1-digest.html:
* LayoutTests/crypto/subtle/sha256-digest.html:
* LayoutTests/crypto/subtle/sha384-digest.html:
* LayoutTests/crypto/subtle/sha512-digest.html:
* Source/WebCore/Configurations/WebCore.xcconfig:
* Source/WebCore/Configurations/WebCoreSwift.xcconfig: Removed.
* Source/WebCore/PAL/Configurations/PAL.xcconfig:
* Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj:
* Source/WebCore/PAL/pal/PALSwift/CryptoKitShim.swift: Renamed from 
Source/WebCore/WebCoreSwift/CryptoKitShim.swift.
* Source/WebCore/PAL/pal/PlatformMac.cmake:
* Source/WebCore/PAL/pal/crypto/CryptoDigest.h:
* Source/WebCore/PAL/pal/crypto/commoncrypto/CryptoDigestCommonCrypto.mm: 
Renamed from 
Source/WebCore/PAL/pal/crypto/commoncrypto/CryptoDigestCommonCrypto.cpp.
(PAL::toSHA1Context):
(PAL::toSHA224Context):
(PAL::toSHA256Context):
(PAL::toSHA384Context):
(PAL::toSHA512Context):
(PAL::CryptoDigest::CryptoDigest):
(PAL::CryptoDigest::~CryptoDigest):
(PAL::createCryptoDigest):
(PAL::CryptoDigest::create):
(PAL::CryptoDigest::addBytes):
(PAL::CryptoDigest::computeHash):
* Source/WebCore/PAL/pal/crypto/gcrypt/CryptoDigestGCrypt.cpp:
(PAL::CryptoDigest::CryptoDigest):
(PAL::getGcryptAlgorithm):
(PAL::CryptoDigest::create):
(PAL::CryptoDigest::computeHash):
* Source/WebCore/PAL/pal/crypto/openssl/CryptoDigestOpenSSL.cpp:
(PAL::createCryptoDigest):
(PAL::CryptoDigest::create):
(PAL::CryptoDigest::computeHash):
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/crypto/CryptoAlgorithm.cpp:
(WebCore::CryptoAlgorithm::dispatchDigest):
* Source/WebCore/crypto/CryptoAlgorithm.h:
* Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA1.cpp:
(WebCore::CryptoAlgorithmSHA1::digest):
* Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA256.cpp:
(WebCore::CryptoAlgorithmSHA256::digest):
* Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA384.cpp:
(WebCore::CryptoAlgorithmSHA384::digest):
* Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA512.cpp:
(WebCore::CryptoAlgorithmSHA512::digest):
* Source/WebCore/crypto/cocoa/CryptoAlgorithmAESGCMMac.mm:
* Source/WebCore/crypto/cocoa/CryptoAlgorithmAESKWMac.mm:

Canonical link: https://commits.webkit.org/275070@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