Fix missing entrypoints and add build-time validation (#54785)
authorKevin Jones <kevin@vcsjones.com>
Mon, 28 Jun 2021 01:04:20 +0000 (21:04 -0400)
committerGitHub <noreply@github.com>
Mon, 28 Jun 2021 01:04:20 +0000 (18:04 -0700)
* Fix missing entrypoints and add build-time validation

* Fix missing include

* Update src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/CMakeLists.txt

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/CMakeLists.txt
src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/entrypoints.c

index a9029ec..77aa423 100644 (file)
@@ -73,6 +73,17 @@ if (GEN_SHARED_LIB)
     target_link_libraries(System.Security.Cryptography.Native.Apple
         ${NATIVE_LIBS_EXTRA}
     )
+
+    if (NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS)
+        add_custom_command(TARGET System.Security.Cryptography.Native.Apple POST_BUILD
+            COMMENT "Verifying System.Security.Cryptography.Native.Apple points against entrypoints.c "
+            COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/../verify-entrypoints.sh
+                $<TARGET_FILE:System.Security.Cryptography.Native.Apple>
+                ${CMAKE_CURRENT_SOURCE_DIR}/entrypoints.c
+                ${CMAKE_NM}
+            VERBATIM
+        )
+    endif()
 endif()
 
 if (GEN_SHARED_LIB)
index 1833d4a..5162b7a 100644 (file)
@@ -21,6 +21,7 @@
 #include "pal_x509_macos.h"
 #include "pal_x509chain.h"
 #include "pal_keyderivation_macos.h"
+#include "pal_keyagree.h"
 
 static const Entry s_cryptoAppleNative[] =
 {
@@ -30,8 +31,11 @@ static const Entry s_cryptoAppleNative[] =
     DllImportEntry(AppleCryptoNative_DigestFinal)
     DllImportEntry(AppleCryptoNative_DigestCurrent)
     DllImportEntry(AppleCryptoNative_DigestOneShot)
+    DllImportEntry(AppleCryptoNative_DigestReset)
     DllImportEntry(AppleCryptoNative_EccGenerateKey)
     DllImportEntry(AppleCryptoNative_EccGetKeySizeInBits)
+    DllImportEntry(AppleCryptoNative_EcdhKeyAgree)
+    DllImportEntry(AppleCryptoNative_GetRandomBytes)
     DllImportEntry(AppleCryptoNative_HmacFree)
     DllImportEntry(AppleCryptoNative_HmacCreate)
     DllImportEntry(AppleCryptoNative_HmacInit)
@@ -40,14 +44,22 @@ static const Entry s_cryptoAppleNative[] =
     DllImportEntry(AppleCryptoNative_HmacCurrent)
     DllImportEntry(AppleCryptoNative_HmacOneShot)
     DllImportEntry(AppleCryptoNative_SecKeychainItemCopyKeychain)
+    DllImportEntry(AppleCryptoNative_SecKeychainCopyDefault)
     DllImportEntry(AppleCryptoNative_SecKeychainCreate)
     DllImportEntry(AppleCryptoNative_SecKeychainDelete)
-    DllImportEntry(AppleCryptoNative_SecKeychainCopyDefault)
+    DllImportEntry(AppleCryptoNative_SecKeychainEnumerateCerts)
     DllImportEntry(AppleCryptoNative_SecKeychainOpen)
     DllImportEntry(AppleCryptoNative_SecKeychainUnlock)
-    DllImportEntry(AppleCryptoNative_SetKeychainNeverLock)
     DllImportEntry(AppleCryptoNative_SecKeychainEnumerateIdentities)
-    DllImportEntry(AppleCryptoNative_GetRandomBytes)
+    DllImportEntry(AppleCryptoNative_SetKeychainNeverLock)
+    DllImportEntry(AppleCryptoNative_SslCopyCADistinguishedNames)
+    DllImportEntry(AppleCryptoNative_SslCopyCertChain)
+    DllImportEntry(AppleCryptoNative_SslIsHostnameMatch)
+    DllImportEntry(AppleCryptoNative_SslRead)
+    DllImportEntry(AppleCryptoNative_SslSetBreakOnClientAuth)
+    DllImportEntry(AppleCryptoNative_SslSetBreakOnServerAuth)
+    DllImportEntry(AppleCryptoNative_SslSetIoCallbacks)
+    DllImportEntry(AppleCryptoNative_SslWrite)
     DllImportEntry(AppleCryptoNative_RsaGenerateKey)
     DllImportEntry(AppleCryptoNative_RsaDecryptOaep)
     DllImportEntry(AppleCryptoNative_RsaDecryptPkcs)
@@ -87,7 +99,10 @@ static const Entry s_cryptoAppleNative[] =
     DllImportEntry(AppleCryptoNative_StoreEnumerateMachineRoot)
     DllImportEntry(AppleCryptoNative_StoreEnumerateUserDisallowed)
     DllImportEntry(AppleCryptoNative_StoreEnumerateMachineDisallowed)
+    DllImportEntry(AppleCryptoNative_X509ChainCreate)
+    DllImportEntry(AppleCryptoNative_X509DemuxAndRetainHandle)
     DllImportEntry(AppleCryptoNative_X509GetContentType)
+    DllImportEntry(AppleCryptoNative_X509GetPublicKey)
     DllImportEntry(AppleCryptoNative_X509CopyCertFromIdentity)
     DllImportEntry(AppleCryptoNative_X509CopyPrivateKeyFromIdentity)
     DllImportEntry(AppleCryptoNative_X509ImportCollection)
@@ -105,6 +120,8 @@ static const Entry s_cryptoAppleNative[] =
     DllImportEntry(AppleCryptoNative_X509ChainGetStatusAtIndex)
     DllImportEntry(AppleCryptoNative_GetOSStatusForChainStatus)
     DllImportEntry(AppleCryptoNative_X509ChainSetTrustAnchorCertificates)
+    DllImportEntry(AppleCryptoNative_X509StoreAddCertificate)
+    DllImportEntry(AppleCryptoNative_X509StoreRemoveCertificate)
     DllImportEntry(AppleCryptoNative_Pbkdf2)
     DllImportEntry(AppleCryptoNative_X509GetSubjectSummary)
 };