SSL_CTX_SET_INFO_CALLBACK(3ssl) OpenSSL SSL_CTX_SET_INFO_CALLBACK(3ssl) SSL_CTX_set_info_callback, SSL_CTX_get_info_callback, SSL_set_info_callback, SSL_get_info_callback - SSL #include void SSL_CTX_set_info_callback(SSL_CTX *ctx, void (*callback) (const SSL *ssl, int type, int val)); void (*SSL_CTX_get_info_callback(SSL_CTX *ctx)) (const SSL *ssl, int type, int val)); void SSL_set_info_callback(SSL *ssl, void (*callback) (const SSL *ssl, int type, int val)); void (*SSL_get_info_callback(const SSL *ssl)) (const SSL *ssl, int type, int val)); SSL_CTX_set_info_callback() callback SSL ctx . ctx SSL . callback NULL . SSL_set_info_callback() callback ssl . callback NULL ctx. ssl NULL. SSL_CTX_get_info_callback() ctx. SSL_get_info_callback() ssl. SSL/TLS. : . callback(SSL *ssl, int where, int ret). where ( ) . ret 0 . SSL_CB_ALERT ret . where : SSL_CB_LOOP . . SSL_CB_EXIT . / . SSL_CB_READ . SSL_CB_WRITE . SSL_CB_ALERT . SSL_CB_READ_ALERT (SSL_CB_ALERT|SSL_CB_READ) SSL_CB_WRITE_ALERT (SSL_CB_ALERT|SSL_CB_WRITE) SSL_CB_ACCEPT_LOOP (SSL_ST_ACCEPT|SSL_CB_LOOP) SSL_CB_ACCEPT_EXIT (SSL_ST_ACCEPT|SSL_CB_EXIT) SSL_CB_CONNECT_LOOP (SSL_ST_CONNECT|SSL_CB_LOOP) SSL_CB_CONNECT_EXIT (SSL_ST_CONNECT|SSL_CB_EXIT) SSL_CB_HANDSHAKE_START . . SSL_CB_HANDSHAKE_DONE . . SSL_state_string(3). ret SSL_alert_type_string(3). SSL_set_info_callback() . SSL_get_info_callback() . BIO bio_err. void apps_ssl_info_callback(const SSL *s, int where, int ret) { const char *str; int w = where & ~SSL_ST_MASK; if (w & SSL_ST_CONNECT) str = "SSL_connect"; else if (w & SSL_ST_ACCEPT) str = "SSL_accept"; else str = "undefined"; if (where & SSL_CB_LOOP) { BIO_printf(bio_err, "%s:%s\n", str, SSL_state_string_long(s)); } else if (where & SSL_CB_ALERT) { str = (where & SSL_CB_READ) ? "read" : "write"; BIO_printf(bio_err, "SSL3 alert %s:%s:%s\n", str, SSL_alert_type_string_long(ret), SSL_alert_desc_string_long(ret)); } else if (where & SSL_CB_EXIT) { if (ret == 0) { BIO_printf(bio_err, "%s:failed in %s\n", str, SSL_state_string_long(s)); } else if (ret < 0) { BIO_printf(bio_err, "%s:error in %s\n", str, SSL_state_string_long(s)); } } } ssl(7), SSL_state_string(3), SSL_alert_type_string(3) 2001-2020 OpenSSL. . Apache 2.0 ( ""). . LICENSE . 3 . . : . 3.6.2 7 2026 SSL_CTX_SET_INFO_CALLBACK(3ssl)