Skip to content
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

[Android] Use Android SDK instead of OpenSSL where possible #43740

Merged
merged 23 commits into from
Nov 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/libraries/Native/Unix/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ elseif(CLR_CMAKE_TARGET_TVOS)
elseif(CLR_CMAKE_TARGET_ANDROID AND NOT CROSS_ROOTFS)
#add_subdirectory(System.Net.Security.Native) # TODO: reenable
if (NOT "$ENV{ANDROID_OPENSSL_AAR}" STREQUAL "")
set(PREFER_OPENSSL_ANDROID 1)
add_subdirectory(System.Security.Cryptography.Native)
endif()
else()
Expand All @@ -237,3 +238,8 @@ endif()
if(CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS)
add_subdirectory(System.Security.Cryptography.Native.Apple)
endif()

# if ANDROID_OPENSSL_AAR is not set - use Android Native Crypto (it's going to replace openssl eventually)
if(CLR_CMAKE_TARGET_ANDROID AND NOT PREFER_OPENSSL_ANDROID)
add_subdirectory(System.Security.Cryptography.Native.Android)
endif()
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
project(System.Security.Cryptography.Native.Android C)

add_compile_options(-Wno-gnu-zero-variadic-macro-arguments)
add_compile_options(-Wno-unused-parameter)
add_compile_options(-Wno-unused-variable)

set(NATIVECRYPTO_SOURCES
android_security.c
)

add_library(System.Security.Cryptography.Native.Android
SHARED
${NATIVECRYPTO_SOURCES}
${VERSION_FILE_PATH}
)

add_library(System.Security.Cryptography.Native.Android-Static
STATIC
${NATIVECRYPTO_SOURCES}
)

set_target_properties(System.Security.Cryptography.Native.Android-Static PROPERTIES OUTPUT_NAME System.Security.Cryptography.Native.Android CLEAN_DIRECT_OUTPUT 1)

target_link_libraries(System.Security.Cryptography.Native.Android
-llog
)

# TODO: Use "System.Security.Cryptography.Native.Android" name (will require a lot of csproj changes here and there)
set_target_properties(System.Security.Cryptography.Native.Android PROPERTIES OUTPUT_NAME "System.Security.Cryptography.Native.OpenSsl")

install_with_stripped_symbols (System.Security.Cryptography.Native.Android PROGRAMS .)
install (TARGETS System.Security.Cryptography.Native.Android-Static DESTINATION .)
Loading