Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to build OpenSSL 1.1.1 for 64 bit Android using NDK 17

Failing to build OpenSSL for 64bit Android. Here are the steps I've taken:

  1. Downloaded the setenv_android.sh from https://wiki.openssl.org/images/7/70/Setenv-android.sh
  2. Downloaded OpenSSL 1.1.1 from https://www.openssl.org/source/old/1.1.1/openssl-1.1.1.tar.gz
  3. Unpacked the tar file
  4. Modified the setenv_android script so that running it produced this output:

    ANDROID_NDK_ROOT: /Users/spartygw/android-ndk-r17
    ANDROID_ARCH: arch-arm64
    ANDROID_EABI: aarch64-linux-android-4.9
    ANDROID_API: android-22
    ANDROID_SYSROOT: /Users/spartygw/android-ndk-r17/platforms/android-22/arch-arm64
    ANDROID_TOOLCHAIN: /Users/spartygw/android-ndk-r17/toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64/bin
    FIPS_SIG: 
    CROSS_COMPILE: aarch64-linux-android-
    ANDROID_DEV: /Users/spartygw/android-ndk-r17/platforms/android-22/arch-arm64/usr
    
  5. Configured the openssl with: ./Configure no-rc5 no-idea no-md2 no-cast linux-aarch64

  6. Ran make depend; make

Output:

In file included from crypto/aes/aesv8-armx.S:1:
crypto/arm_arch.h:55:6: error: "unsupported ARM architecture"
#    error "unsupported ARM architecture"
     ^
1 error generated.
make[1]: *** [crypto/aes/aesv8-armx.o] Error 1
make: *** [all] Error 2

This writeup makes it sound like I ran into this problem and stopped. I assure you I've spent a complete workday trying various things and googling to no avail. I don't want to litter the question with junk that I tried (passing in different ARM_ARCH values, trying other versions of openSSL, trying different NDKs).

like image 428
spartygw Avatar asked Sep 12 '25 22:09

spartygw


1 Answers

The scripts and examples on OpenSSL Wiki are badly outdated. The specific build script does not support arm64.

Luckily, GitHub comes to rescue: try https://github.com/noloader/Android-PRNG/blob/master/setenv-android.sh.

like image 85
Alex Cohn Avatar answered Sep 15 '25 13:09

Alex Cohn