hookenz
hookenz

Reputation: 38859

Simple C++ OpenSSL code crashing

I'm working through a tutorial on using OpenSSL and when I try something rather basic it seems to crash. Any idea what I'm doing wrong?

#include <openssl/ssl.h>

int main(int argc, char* argv[])
{
    SSL_load_error_strings();
    ERR_load_BIO_strings();
    OpenSSL_add_all_algorithms();

    SSL_CTX * ctx = SSL_CTX_new(SSLv23_client_method());
    SSL * ssl;

    if (!SSL_CTX_load_verify_locations(ctx, NULL, "/etc/ssl/certs"))
    {
        /* Handle failed load here */
    }
    return 0;
}

Upvotes: 1

Views: 1170

Answers (1)

cababunga
cababunga

Reputation: 3114

It might be because you didn't call SSL_library_init().

Upvotes: 3

Related Questions