-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for AES-GCM and ChaCha20Poly1305 on iOS/tvOS/MacCatalyst via CryptoKit #104383
Conversation
…via CryptoKit Now that we support minimum OS versions that ship with Swift we can enable CryptoKit and pal_swiftbindings.swift. Fixes dotnet#91523
Note regarding the
|
1 similar comment
Note regarding the
|
if (CMAKE_BUILD_TYPE STREQUAL "Debug") | ||
set(SWIFT_OPTIMIZATION_FLAG "-Onone") | ||
elseif (CMAKE_BUILD_TYPE STREQUAL "Release") | ||
set(SWIFT_OPTIMIZATION_FLAG "-O") | ||
endif() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed that we didn't compile the swift code with optimizations so fixed this as well
...n/tests/System/Security/Cryptography/AlgorithmImplementations/ECDsa/ECDsaTests.netcoreapp.cs
Show resolved
Hide resolved
src/native/libs/System.Security.Cryptography.Native.Apple/extra_libs.cmake
Outdated
Show resolved
Hide resolved
src/libraries/System.Security.Cryptography/ref/System.Security.Cryptography.cs
Show resolved
Hide resolved
src/libraries/System.Security.Cryptography/tests/AesGcmTests.cs
Outdated
Show resolved
Hide resolved
src/native/libs/System.Security.Cryptography.Native.Apple/CMakeLists.txt
Outdated
Show resolved
Hide resolved
For NativeAOT failures, the "osx" restriction should be changed to here runtime/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets Line 180 in 4f96b8f
and here runtime/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets Lines 191 to 192 in 4f96b8f
|
Interesting, I explicitly checked this locally and it worked without that change for me. |
@akoeplinger oh and probably runtime/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets Line 217 in 4f96b8f
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes to the actual crypto parts seem reasonable to me. I will have to defer on the building and linking changes to the appropriate folks though.
@@ -203,7 +196,7 @@ public static void TwoEncryptionsAndDecryptionsUsingOneInstance() | |||
byte[] nonce2 = "8ba10892e8b87d031196bf99".HexToByteArray(); | |||
|
|||
byte[] expectedCiphertext1 = "f1af1fb2d4485cc536d618475d52ff".HexToByteArray(); | |||
byte[] expectedTag1 = PlatformDetection.IsOSX ? | |||
byte[] expectedTag1 = (PlatformDetection.IsOSX || PlatformDetection.UsesMobileAppleCrypto) ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not blocking but we could simplify this to PlatformDetection.IsApplePlatform
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
/ba-g the one unknown test failure is happening on wasm so can't be related to the changes in this PR. |
Now that we support minimum OS versions that ship with Swift we can enable CryptoKit and pal_swiftbindings.swift.
Fixes #91523
Fixes #52482