26#ifndef ROUTER_SRC_HTTP_SRC_TLS_SSL_OPERATION_H_
27#define ROUTER_SRC_HTTP_SRC_TLS_SSL_OPERATION_H_
29#include <openssl/bio.h>
30#include <openssl/err.h>
31#include <openssl/ssl.h>
34#define NET_TLS_USE_BACKWARD_COMPATIBLE_OPENSSL 0x10100000L
55 auto pending = BIO_pending(
bio_);
59 if (ssl_result <= 0) {
60 auto error_cause = SSL_get_error(
ssl_, ssl_result);
62 switch (error_cause) {
63 case SSL_ERROR_WANT_READ:
67 case SSL_ERROR_WANT_WRITE:
71 case SSL_ERROR_ZERO_RETURN:
74 case SSL_ERROR_SYSCALL:
103#if OPENSSL_VERSION_NUMBER >= NET_TLS_USE_BACKWARD_COMPATIBLE_OPENSSL
105 size_t *out_number_of_bytes_io) {
106 return SSL_read_ex(
ssl,
buf, num, out_number_of_bytes_io);
110 size_t *out_number_of_bytes_io) {
111 *out_number_of_bytes_io = 0;
119 size_t *out_number_of_bytes_io) {
127 return op.check_ssl_result(
134#if OPENSSL_VERSION_NUMBER >= NET_TLS_USE_BACKWARD_COMPATIBLE_OPENSSL
136 size_t *out_number_of_bytes_io) {
137 return SSL_write_ex(
ssl,
buf, num, out_number_of_bytes_io);
141 size_t *out_number_of_bytes_io) {
142 *out_number_of_bytes_io = 0;
152 const size_t buffer_size,
size_t *out_number_of_bytes_io) {
160 return op.check_ssl_result(
171 [[maybe_unused]]
size_t *out_number_of_bytes_io) {
177 return op.check_ssl_result(SSL_connect(
ssl));
Definition: ssl_operation.h:47
Result check_ssl_result(int ssl_result)
Definition: ssl_operation.h:54
AnalyzeOperation(BIO *bio, SSL *ssl)
Definition: ssl_operation.h:49
BIO * bio_
Definition: ssl_operation.h:93
int pending_
Definition: ssl_operation.h:95
SSL * ssl_
Definition: ssl_operation.h:94
Definition: ssl_operation.h:39
Result
Definition: ssl_operation.h:41
@ want_read
Definition: ssl_operation.h:41
@ fatal
Definition: ssl_operation.h:41
@ want_write
Definition: ssl_operation.h:41
@ ok
Definition: ssl_operation.h:41
@ close
Definition: ssl_operation.h:41
virtual ~Operation()=default
Definition: ssl_operation.h:165
static Result op(BIO *bio, SSL *ssl, const void *buffer, const size_t buffer_size, size_t *out_number_of_bytes_io)
Definition: ssl_operation.h:169
static bool is_read_operation()
Definition: ssl_operation.h:167
Definition: ssl_operation.h:99
static int read_ex(SSL *ssl, void *buf, size_t num, size_t *out_number_of_bytes_io)
Definition: ssl_operation.h:109
static Result op(BIO *bio, SSL *ssl, void *buffer, const size_t buffer_size, size_t *out_number_of_bytes_io)
Definition: ssl_operation.h:118
static bool is_read_operation()
Definition: ssl_operation.h:101
Definition: ssl_operation.h:132
static bool is_read_operation()
Definition: ssl_operation.h:149
static Result op(BIO *bio, SSL *ssl, const void *buffer, const size_t buffer_size, size_t *out_number_of_bytes_io)
Definition: ssl_operation.h:151
static int write_ex(SSL *ssl, const void *buf, size_t num, size_t *out_number_of_bytes_io)
Definition: ssl_operation.h:140
Definition: buf0block_hint.cc:30
constexpr value_type ssl
Definition: classic_protocol_constants.h:49
mutable_buffer buffer(void *p, size_t n) noexcept
Definition: buffer.h:418
size_t buffer_size(const ConstBufferSequence &buffers) noexcept
Definition: buffer.h:313
Definition: tls_keylog_dumper.h:32
struct result result
Definition: result.h:34