As to build a version-less libcrypto
, overwriting CALC_VERSIONS
does the trick (at least for 1.0.2d):
make CALC_VERSIONS="SHLIB_COMPAT=; SHLIB_SOVER=" all
Then, the sub-target link-shared
of the target install_sw
must be disabled (otherwise broken symlinks overwrite the libraries), which can be done by creating a dummy file of the same name at the suitable place (furthermore, SHLIB_EXT must also be set for the version-less files to be copied).
The complete bash-script I used:
ORIG_PATH=$PATH
SCRIPT_PATH=$(dirname $(readlink -f $0))
tar -zxf $SCRIPT_PATH/openssl-fips-2.0.10.tar.gz
tar -zxf $SCRIPT_PATH/openssl-1.0.2d.tar.gz
ANDROID_NDK_PATH=<system-specific-path>/android-ndk-r10e-linux
ANDROID_API=android-14
ANDROID_SYSROOT=$ANDROID_NDK_PATH/platforms/$ANDROID_API/arch-arm
export OPENSSLDIR=$SCRIPT_PATH/ssl/android/arm
export FIPSDIR=$OPENSSLDIR/fips-2.0
export HOSTCC=gcc
export FIPS_SIG=$SCRIPT_PATH/openssl-fips-2.0.10/util/incore
export ANDROID_DEV=$ANDROID_SYSROOT/usr
export PATH=$ANDROID_NDK_PATH/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin:$ORIG_PATH
export MACHINE=armv7
export RELEASE=2.6.37
export SYSTEM=android
export ARCH=arm
export CROSS_COMPILE=arm-linux-androideabi-
cd $SCRIPT_PATH/openssl-fips-2.0.10
./config shared
make clean
make
make install_sw
cd $SCRIPT_PATH/openssl-1.0.2d
./config fips shared -no-sslv2 -no-sslv3 -no-comp -no-hw -no-engines --openssldir=$OPENSSLDIR --with-fipsdir=$FIPSDIR --with-fipslibdir=$FIPSDIR/lib/
make clean
make depend
make CALC_VERSIONS="SHLIB_COMPAT=; SHLIB_SOVER=" MAKE="make -e" all
mkdir -p $OPENSSLDIR/lib
echo "place-holder make target for avoiding symlinks" >> $OPENSSLDIR/lib/link-shared
make SHLIB_EXT=.so install_sw
rm $OPENSSLDIR/lib/link-shared
Then no generated object file should have or reference a versioned so-name:
$ readelf -d ssl/android/arm/lib/libcrypto.so | grep 'SONAME\|NEEDED'
0x00000001 (NEEDED) Shared library: [libdl.so]
0x00000001 (NEEDED) Shared library: [libc.so]
0x0000000e (SONAME) Library soname: [libcrypto.so]
$ readelf -d ssl/android/arm/lib/libssl.so | grep 'SONAME\|NEEDED'
0x00000001 (NEEDED) Shared library: [libcrypto.so]
0x00000001 (NEEDED) Shared library: [libdl.so]
0x00000001 (NEEDED) Shared library: [libc.so]
0x0000000e (SONAME) Library soname: [libssl.so]
$ readelf -d ssl/android/arm/bin/openssl | grep 'SONAME\|NEEDED'
0x00000001 (NEEDED) Shared library: [libssl.so]
0x00000001 (NEEDED) Shared library: [libcrypto.so]
0x00000001 (NEEDED) Shared library: [libdl.so]
0x00000001 (NEEDED) Shared library: [libc.so]