EVP_get_cipherbyname始终返回null

EVP_get_cipherbyname始终返回null,c,macos,openssl,macos-sierra,C,Macos,Openssl,Macos Sierra,在macOS上调用EVP\u get\u cipherbyname时出现问题: const char *cipher_str = "aes-256-cbc"; const evp_cipher_st *cipher1 = EVP_aes_256_cbc(); const evp_cipher_st *cipher2 = EVP_get_cipherbyname(cipher_str); 在上面的代码中,cipher1将始终设置为有效的evp\u cipher\u st*对象,而cipher2将

在macOS上调用
EVP\u get\u cipherbyname
时出现问题:

const char *cipher_str = "aes-256-cbc";
const evp_cipher_st *cipher1 = EVP_aes_256_cbc();
const evp_cipher_st *cipher2 = EVP_get_cipherbyname(cipher_str);
在上面的代码中,
cipher1
将始终设置为有效的
evp\u cipher\u st*
对象,而
cipher2
将始终为空。我还没有找到一个生成非空
cipher2
cipher\u str
实例


我做错什么了吗?我是否还需要打一些其他的电话才能让它工作?

您需要先初始化OpenSSL库。如果你只是使用libcrypto, 电话:


有关如何处理其他情况或openssl版本,请参阅。

您需要首先初始化openssl库。如果你只是使用libcrypto, 电话:


有关如何处理其他情况或openssl版本,请参阅。

有没有理由为两种不同的语言发送垃圾邮件?有没有理由为两种不同的语言发送垃圾邮件?以防万一有人像我一样登陆这里:因为openssl 1.1.0,这不再需要。以防万一有人像我一样登陆这里:因为openssl 1.1.0,这不再需要需要。
OpenSSL_add_all_algorithms();