SSL结构的成员

Cho*_*hoi 5 c ssl openssl

在 OpenSSL 的 SSL/TLS 客户端实现中SSL定义了一个结构。例如这里通常是前几行(来自链接)。

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

init_openssl_library();
Run Code Online (Sandbox Code Playgroud)

我一直无法在 OpenSSL 库的头文件中找到它的结构。我怎样才能学习内容SSL * ssl

Ste*_*ich 7

我一直无法在 openssl 库的头文件中找到它的结构类型。

目前还不清楚您指的是哪个版本的 openssl 以及您的外观如何,但grep -r ' SSL;' /usr/include/openssl/很快在 openssl/ossl_typ.h 中找到了与 openssl 1.0.2 匹配的匹配项:

   typedef struct ssl_st SSL;
Run Code Online (Sandbox Code Playgroud)

'ssl_st' 的以下 grep 导致其在 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 */
...
Run Code Online (Sandbox Code Playgroud)

请注意,结构的位置和内容在其他版本的 openssl 中可能有所不同。