选项 -no-engine 导致 Android 的 OpenSSL 构建出现问题

Option -no-engine causes problems with OpenSSL build for Android

我必须按照 http://wiki.openssl.org/index.php/Android 中的说明在 Debian 7 系统上为 Android 构建 OpenSSL 1.0.1j 库。

我的配置选项是

./Configure dist -no-ssl2 -no-ssl3 -no-comp -no-hw -no-engine

由于错误构建失败

make[2]: *** No rule to make target `../../include/openssl/engine.h', needed by `rsa_lib.o'. 

(备注:使用linux-generic64代替dist没有区别)

提供选项 -no-rsa 会导致 dsa_lib.o 的投诉。它 禁用 RSA 和 DSA 也没有意义,是吗?

我阅读了 NEWS 文件,http://wiki.openssl.org/ 和关于 SO 的问题, 但找不到解决方案。

有什么建议吗?

除此之外: -no-engine 的实际含义是什么?据我了解, ENGINE 是 openssl 加密算法的接口。为什么可以完全禁用它?

Option -no-engine causes problems with OpenSSL build for Android ...
./Configure dist -no-ssl2 -no-ssl3 -no-comp -no-hw -no-engine

您可以安全地省略 no-engine 选项。该选项用于减小二进制文件的大小。


What is the actual meaning of -no-engine? According to my understanding, ENGINE is...

这个观点很好,我无法回答。但我可以说我已经使用 wiki 页面上的程序几年了,而且我知道在使用无引擎选项时 OpenSSL 仍然有效 (compiles/links/runs)。

也许 1.0.1j 发生了一些变化。我没有升级(意思是我没有为 Android 和 iOS 构建 1.0.1j)因为我对那个 Downgrade SCSV 不感兴趣以适应浏览器和它们的破烂,不安全使用 SSLv3 重试的实践。


Using linux-generic64 instead of dist made no difference...

交叉编译脚本(setenv-android.sh) sets the paths to the Android NDK tools AND it sets a few key environmental variables. Of them, CROSS_COMPILE are ANDROID_DEV are critical. From the tail of setenv-android.sh:

# For the Android toolchain
# https://android.googlesource.com/platform/ndk/+/ics-mr0/docs/STANDALONE-TOOLCHAIN.html
export ANDROID_SYSROOT="$ANDROID_NDK_ROOT/platforms/$_ANDROID_API/$_ANDROID_ARCH"
export SYSROOT="$ANDROID_SYSROOT"
export NDK_SYSROOT="$ANDROID_SYSROOT"
export ANDROID_NDK_SYSROOT="$ANDROID_SYSROOT"
export ANDROID_API="$_ANDROID_API"

# CROSS_COMPILE and ANDROID_DEV are DFW (Don't Fiddle With). Its used by OpenSSL build system.
# export CROSS_COMPILE="arm-linux-androideabi-"
export ANDROID_DEV="$ANDROID_NDK_ROOT/platforms/$_ANDROID_API/$_ANDROID_ARCH/usr"
export HOSTCC=gcc

Android 的配置通过 SYSTEMARCH 获取。一旦 Android 启动,就会使用 CROSS_COMPILEANDROID_DEV

因为环境变量,你需要做的就是configure no-ssl2 no-ssl3 ...

在使用 no-engine 构建 OpenSSL 时,不会创建符号 link 到 engine.h。我刚刚添加了

(cd include/openssl ; ln -s ../../crypto/engine/engine.h .)

到我的构建过程。