使用项目
在Android studio中创建Native项目

导入openssl-cmake源码
解压项目源码放到项目cpp目录下

修改cmake配置
添加头文件和openssl项目
# 导入头文件
target_include_directories(openssl_cmake PRIVATE openssl/include)
# 添加openssl
add_subdirectory(openssl)
添加库文件依赖
target_link_libraries( # Specifies the target library.
openssl_cmake
#添加依赖库
crypto
ssl
# Links the target library to the log library
# included in the NDK.
${log-lib})
运行测试
在jni中打印openssl版本
在C中添加头文件
#include "openssl/opensslv.h"
在测试stringFromJNI添加打印openssl版本
LOGI("openssl version:%s", OpenSSL_version(OPENSSL_VERSION));
成功在logcat看到如下打印

项目源码
项目中还添加了MD5、AES加解密对比测试