c - X509_STORE_add_lookup() 中的段错误

标签 c ssl openssl segmentation-fault

我正在编写一个连接到远程服务器并使用自签名证书的程序。我在程序中的几个点出现以下错误。

Program received signal SIGSEGV, Segmentation fault.
0xb7ec3688 in X509_STORE_add_lookup () from /lib/i386-linux-gnu/libcrypto.so.1.0.0

此时:

    if (!SSL_CTX_load_verify_locations(
                ssl_ctx_p, "bundle_test.p12.pem", NULL))

还有一个:

Program received signal SIGSEGV, Segmentation fault.
0xb7ec389e in X509_STORE_get_by_subject () from /lib/i386-linux-gnu/libcrypto.so.1.0.0

这里:

ssl_ret = SSL_connect(ssl_p);

我对此很陌生,不知道出了什么问题,如果有人可以提出更好的调试方法或找出问题所在,我将不胜感激!

最佳答案

该函数本身并没有做太多工作。唯一可能导致此函数内部而不是 X509_STORE_load_locations() 内部出现段错误的是指针取消引用 ctx->cert_store。请验证 ssl_ctx_p 是一个有效的上下文,而不是 NULL

int SSL_CTX_load_verify_locations(SSL_CTX *ctx, const char *CAfile,
                const char *CApath)
        {
        return(X509_STORE_load_locations(ctx->cert_store,CAfile,CApath));
        }

关于c - X509_STORE_add_lookup() 中的段错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18980212/

相关文章:

c - getc 和 getwc : How exactly do they read stdin?

php - SMTP 错误 : Failed to connect to server: Connection timed out (110) with PHPMailer and Outlook SMTP

wordpress - 在 Wordpress 上强制 Cloud Flare Flexible SSL,提要除外

iphone - iOS 中的 PBEWithMD5AndDES 加密

c - 来自/lib/x86_64-linux-gnu/libcrypto.so.1.0.0 的段错误

c - 带有可变参数的 scanf(C 语言)

c - 为什么这个数组的第一个成员被 MPI_Recv 覆盖了?

c - 去鱼卡转账

node.js - 如何使用 create-react-app 提供 SSL 证书?

c++ - OpenSSL AES 加密错误