androidandroid-ndkopensslheartbleed-bug

Do openssl-1.0.1g has android platform support?


Because of the heartbleed issue in some versions of OpenSSL, I need to update my OpenSSL version to openssl-1.0.1g. Does it has support for android platform? If yes, can somebody suggest me about the building procedures? I couldn't compile the source for android platform.

Any kind suggestion is highly appreciated.

Note: I will use openssl for android-ndk


Solution

  • Do openssl-1.0.1g has android platform support?

    Yes.

    1. Go to OpenSSL and Android and fetch setenv-android.sh
    2. Ensure ANDROID_NDK_ROOT is set
    3. Ensure ANDROID_SDK_ROOT is set
    4. Open setenv-android.sh, and ensure _ANDROID_NDK, _ANDROID_EABI and _ANDROID_API suit your taste
    5. Run the following commands (note the leading dot when running setenv-android.sh)

      $ . ./setenv-android.sh

      $ cd openssl-1.0.1g/

      $ perl -pi -e 's/install: all install_docs install_sw/install: install_docs install_sw/g' Makefile.org

      $ ./config shared -no-ssl2 -no-ssl3 -no-comp -no-hw -no-engine --openssldir=/usr/local/ssl/$ANDROID_API

      $ make all

      $ sudo -E make install CC=$ANDROID_TOOLCHAIN/arm-linux-androideabi-gcc RANLIB=$ANDROID_TOOLCHAIN/arm-linux-androideabi-ranlib

    After the install, your Android OpenSSL will be located in, for example, /usr/local/ssl/android-18.


    Any kind suggestion is highly appreciated.

    Note: Android's Zygote is like Linux/Unix init. All processes inherit from it. The problem is, Zygote loads OpenSSL and its probably a down level version. So you will have to create a wrapper shared object that statically links to OpenSSL. Your program will call into your wrapper shared object to avoid the already-mapped-in and down level version of OpenSSL.