Closed cjxqhhh closed 7 years ago
find_library( z-lib z )
include_directories( ${OpenSSL_DIR}/include )
# Specifies libraries CMake should link to your target library. You
# can link multiple libraries, such as libraries you define in this
# build script, prebuilt third-party libraries, or system libraries.
target_link_libraries( # Specifies the target library.
keystore
# Links the target library to the log library
# included in the NDK.
ssl
crypto
${log-lib}
${z-lib})
把zlib添加进去就好
现在变成这个错误了?求教~
OpenSSL 静态库是你自己编译的么?
不是,是直接用你这里的~
你尝试编译我那个 Example 了么?
嗯嗯,那个android的example是吧? 我这里只是用aes的话不报错,用到hmac的时候就错了
方便贴一下 C++ 的代码吗?我写到 Example 里编译试试
void hmacSha256(unsigned char output, const char key, const char input, unsigned int &outputLen) { const EVP_MD engine = EVP_sha256(); output = (unsigned char)malloc(EVP_MAX_MD_SIZE); HMAC_CTX ctx = HMAC_CTX_new(); HMAC_Init_ex(ctx, key, strlen(key), engine, NULL); HMAC_Update(ctx, (unsigned char *)input, strlen(input)); HMAC_Final(ctx, output, &outputLen); HMAC_CTX_free(ctx);
}
你试下这个函数能不能跑?别的代码可能不方便贴,非常抱歉啊~
参看
https://github.com/openssl/openssl/issues/988
貌似需要使用 NDK 并且 Android-21 以前版本编译的 OpenSSL 才支持,我尝试重新编译看看
嗯嗯,我也看到这些资料了,这个东西搞了一天,惨,你有时间的话试试哈~辛苦了
解决了,用低版本的 API 重新编译一下就好了,你给我你邮箱,我发你我编译好的,低版本编译的问题就是不支持 64 位 ARM 设备的编译,不过这个还好。。。。。。影响不大
cjxqhhh@gmail.com,谢谢~
810196673@qq.com 也发我一个吧,怎么都有错误,快哭了。。。 @leenjewel
已经上传到 GitHub 了,直接下载即可
请问cmakelist里面需要加和zlib有关的项目吗?我这里一直没有办法运行: 谢谢~