使用openssl的一些问题

openssl编译后,会生成bin,include,lib文件夹;

写了一个简单的例子:#include <openssl/md5.h>

#include <openssl/evp.h>
#include <openssl/rsa.h>
#include <openssl/x509.h>
#include <openssl/err.h>
#include <openssl/pem.h>
#include <openssl/ossl_typ.h>

int main()
{

    EVP_PKEY* pkey = EVP_PKEY_new();

    getchar();
    return 1;
}

死活编译不过,提示:undefined struct evp_md_ctx_st。

转到ossl_type.h看,发现typedef struct evp_md_ctx_st EVP_MD_CTX;,但没有evp_md_ctx_st的定义,整个include文件夹的头文件中都没有;只好在下载的源代码包中搜索,发现evp_locl.h中有定义,把它取出放到include文件夹中,然后#include <openssl/evp_locl.h>,再次编译,居然通过了。

原文地址:https://www.cnblogs.com/afan/p/6259011.html