Choi Choi - 3 months ago 7
C Question

Members of SSL structure

In a OpenSSL's SSL/TLS client implementation, a structure

SSL
is defined. For example here is usually the first few lines (from the link).

SSL_CTX* ctx = NULL;
BIO *web = NULL, *out = NULL;
SSL *ssl = NULL;

init_openssl_library();


I have been unable to find its structure in the header files from the OpenSSL library. How can I learn the contents of
SSL * ssl
?

Answer

I have been unable to find its structure type in the header files from the openssl library.

It's unclear which version of openssl you are referring too and how did you look but a grep -r ' SSL;' /usr/include/openssl/ quickly turned up a match in openssl/ossl_typ.h for openssl 1.0.2:

   typedef struct ssl_st SSL;

A following grep for 'ssl_st' lead to its definition in openssl/ssl.h:

#ifndef OPENSSL_NO_SSL_INTERN

struct ssl_st
        {
        /* protocol version
         * (one of SSL2_VERSION, SSL3_VERSION, TLS1_VERSION, DTLS1_VERSION)
         */
        int version;
        int type; /* SSL_ST_CONNECT or SSL_ST_ACCEPT */
...

Note that location and content of the structure might differ in other versions of openssl.