Detect presence of OpenSSL for AEAD algorithms on macOS
authorKevin Jones <kevin@vcsjones.com>
Thu, 13 May 2021 20:09:12 +0000 (16:09 -0400)
committerGitHub <noreply@github.com>
Thu, 13 May 2021 20:09:12 +0000 (13:09 -0700)
commit189105a302766b4d71c99c8fe0d6458476a53568
tree35e3b842f8364fa98ce6965eafcf5128474f1498
parenta1517c55fb0db2537313961e4469e27b0f1ef2b8
Detect presence of OpenSSL for AEAD algorithms on macOS

This makes the IsSupported values for AesCcm and AesGcm return false on macOS when the
OpenSSL shim library can't find a suitable OpenSSL, and makes AesCcm/AesGcm throw an
informative exception in those cases.

Additionally it fixes the IsSupported on ChaCha/Poly to not tear down the process when
OpenSSL isn't found on macOS.

Co-authored-by: Filip Navara <filip.navara@gmail.com>
21 files changed:
src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.OpenSslAvailable.cs [new file with mode: 0644]
src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs
src/libraries/Common/tests/TestUtilities/TestUtilities.csproj
src/libraries/Native/Unix/System.Security.Cryptography.Native/entrypoints.c
src/libraries/Native/Unix/System.Security.Cryptography.Native/openssl.c
src/libraries/Native/Unix/System.Security.Cryptography.Native/openssl.h
src/libraries/Native/Unix/System.Security.Cryptography.Native/opensslshim.c
src/libraries/Native/Unix/System.Security.Cryptography.Native/opensslshim.h
src/libraries/System.Security.Cryptography.Algorithms/src/System.Security.Cryptography.Algorithms.csproj
src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AesCcm.Android.cs
src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AesCcm.Unix.cs
src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AesCcm.Windows.cs
src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AesCcm.cs
src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AesGcm.Android.cs
src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AesGcm.Unix.cs
src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AesGcm.Windows.cs
src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AesGcm.cs
src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ChaCha20Poly1305.Unix.cs
src/libraries/System.Security.Cryptography.Algorithms/tests/AesCcmTests.cs
src/libraries/System.Security.Cryptography.Algorithms/tests/AesGcmTests.cs
src/libraries/System.Security.Cryptography.Algorithms/tests/ChaCha20Poly1305Tests.cs