[webkit-changes] [WebKit/WebKit] d7dfe4: Adding CryptoKit for AESKW algorithm

Commit Queue noreply at github.com
Tue Feb 13 11:11:00 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d7dfe471d335e81bb13d94c7615eecea097f2b7f
      https://github.com/WebKit/WebKit/commit/d7dfe471d335e81bb13d94c7615eecea097f2b7f
  Author: nmahendru <nitinmahendru at apple.com>
  Date:   2024-02-13 (Tue, 13 Feb 2024)

  Changed paths:
    M LayoutTests/crypto/subtle/aes-gcm-generate-key-encrypt-decrypt-null-plain-text-expected.txt
    M LayoutTests/crypto/subtle/aes-gcm-generate-key-encrypt-decrypt-null-plain-text.html
    M LayoutTests/crypto/subtle/aes-gcm-import-key-encrypt-additional-data-expected.txt
    M LayoutTests/crypto/subtle/aes-gcm-import-key-encrypt-additional-data-tag-length-32-expected.txt
    M LayoutTests/crypto/subtle/aes-gcm-import-key-encrypt-additional-data-tag-length-32.html
    M LayoutTests/crypto/subtle/aes-gcm-import-key-encrypt-additional-data.html
    M LayoutTests/crypto/subtle/aes-gcm-import-key-encrypt-expected.txt
    M LayoutTests/crypto/subtle/aes-gcm-import-key-encrypt-tagLengths-expected.txt
    M LayoutTests/crypto/subtle/aes-gcm-import-key-encrypt-tagLengths.html
    M LayoutTests/crypto/subtle/aes-gcm-import-key-encrypt.html
    M Source/WebCore/SourcesCocoa.txt
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/WebCoreSwift/CryptoKitShim.swift
    M Source/WebCore/crypto/CryptoAlgorithm.cpp
    M Source/WebCore/crypto/CryptoAlgorithm.h
    M Source/WebCore/crypto/SubtleCrypto.cpp
    M Source/WebCore/crypto/algorithms/CryptoAlgorithmAESKW.cpp
    M Source/WebCore/crypto/algorithms/CryptoAlgorithmAESKW.h
    M Source/WebCore/crypto/cocoa/CryptoAlgorithmAESGCMMac.mm
    R Source/WebCore/crypto/cocoa/CryptoAlgorithmAESKWMac.cpp
    A Source/WebCore/crypto/cocoa/CryptoAlgorithmAESKWMac.mm
    M Source/WebCore/crypto/gcrypt/CryptoAlgorithmAESGCMGCrypt.cpp
    M Source/WebCore/crypto/gcrypt/CryptoAlgorithmAESKWGCrypt.cpp
    M Source/WebCore/crypto/openssl/CryptoAlgorithmAESGCMOpenSSL.cpp
    M Source/WebCore/crypto/openssl/CryptoAlgorithmAESKWOpenSSL.cpp
    A Tools/Scripts/swift/.swift-format
    A Tools/Scripts/swift/format

  Log Message:
  -----------
  Adding CryptoKit for AESKW algorithm
rdar://121541112

Reviewed by Alex Christensen.

The only AES algorithm left is AESCTR for which cryptokit
does not have an API. So we will continue to use CommonCrypto.
Also AESGCM decrypt is not added as the decrypt in cryptokit forces
a 16 byte tag but WebCrypto needs support for shorter tags.

We have also added a script to format swift code that will be useful
going forward as we continue to add it to Webkit.
example run:
./Tools/Scripts/swift/format Source/WebCore/WebCoreSwift/CryptoKitShim.swift

We have also reverted the duplicate tests for AESGCM added in this PR:
https://github.com/WebKit/WebKit/pull/22731
Copying tests for all algorithms that we will be using CryptoKit going forward
is not really scalable. Instead we can test using --internal-feature cryptoKitEnabled=true.

* LayoutTests/crypto/subtle/aes-gcm-generate-key-encrypt-decrypt-null-plain-text-expected.txt:
* LayoutTests/crypto/subtle/aes-gcm-generate-key-encrypt-decrypt-null-plain-text.html:
* LayoutTests/crypto/subtle/aes-gcm-import-key-encrypt-additional-data-expected.txt:
* LayoutTests/crypto/subtle/aes-gcm-import-key-encrypt-additional-data-tag-length-32-expected.txt:
* LayoutTests/crypto/subtle/aes-gcm-import-key-encrypt-additional-data-tag-length-32.html:
* LayoutTests/crypto/subtle/aes-gcm-import-key-encrypt-additional-data.html:
* LayoutTests/crypto/subtle/aes-gcm-import-key-encrypt-expected.txt:
* LayoutTests/crypto/subtle/aes-gcm-import-key-encrypt-tagLengths-expected.txt:
* LayoutTests/crypto/subtle/aes-gcm-import-key-encrypt-tagLengths.html:
* LayoutTests/crypto/subtle/aes-gcm-import-key-encrypt.html:
* Source/WebCore/SourcesCocoa.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/WebCoreSwift/CryptoKitShim.swift:
* Source/WebCore/crypto/CryptoAlgorithm.cpp:
(WebCore::CryptoAlgorithm::wrapKey):
(WebCore::CryptoAlgorithm::unwrapKey):
* Source/WebCore/crypto/CryptoAlgorithm.h:
* Source/WebCore/crypto/SubtleCrypto.cpp:
(WebCore::SubtleCrypto::wrapKey):
(WebCore::SubtleCrypto::unwrapKey):
* Source/WebCore/crypto/algorithms/CryptoAlgorithmAESKW.cpp:
(WebCore::CryptoAlgorithmAESKW::wrapKey):
(WebCore::CryptoAlgorithmAESKW::unwrapKey):
* Source/WebCore/crypto/algorithms/CryptoAlgorithmAESKW.h:
* Source/WebCore/crypto/cocoa/CryptoAlgorithmAESGCMMac.mm:
(WebCore::encryptCryptoKitAESGCM):
* Source/WebCore/crypto/cocoa/CryptoAlgorithmAESKWMac.mm: Renamed from Source/WebCore/crypto/cocoa/CryptoAlgorithmAESKWMac.cpp.
(WebCore::wrapKeyAESKWCryptoKit):
(WebCore::unwrapKeyAESKWCryptoKit):
(WebCore::CryptoAlgorithmAESKW::platformWrapKey):
(WebCore::CryptoAlgorithmAESKW::platformUnwrapKey):
* Source/WebCore/crypto/gcrypt/CryptoAlgorithmAESKWGCrypt.cpp:
(WebCore::CryptoAlgorithmAESKW::platformWrapKey):
(WebCore::CryptoAlgorithmAESKW::platformUnwrapKey):
* Source/WebCore/crypto/openssl/CryptoAlgorithmAESKWOpenSSL.cpp:
(WebCore::CryptoAlgorithmAESKW::platformWrapKey):
(WebCore::CryptoAlgorithmAESKW::platformUnwrapKey):
* Tools/Scripts/swift/format: Added.
* Tools/Scripts/swift/.swift-format: Added.

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




More information about the webkit-changes mailing list