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_);
57 auto error_cause = SSL_get_error(
ssl_, ssl_result);
60 if (ssl_result <= 0) {
61 switch (error_cause) {
62 case SSL_ERROR_WANT_READ:
66 case SSL_ERROR_WANT_WRITE:
70 case SSL_ERROR_ZERO_RETURN:
73 case SSL_ERROR_SYSCALL:
102#if OPENSSL_VERSION_NUMBER >= NET_TLS_USE_BACKWARD_COMPATIBLE_OPENSSL
104 size_t *out_number_of_bytes_io) {
105 return SSL_read_ex(
ssl,
buf, num, out_number_of_bytes_io);
109 size_t *out_number_of_bytes_io) {
110 *out_number_of_bytes_io = 0;
118 size_t *out_number_of_bytes_io) {
126 return op.check_ssl_result(
133#if OPENSSL_VERSION_NUMBER >= NET_TLS_USE_BACKWARD_COMPATIBLE_OPENSSL
135 size_t *out_number_of_bytes_io) {
136 return SSL_write_ex(
ssl,
buf, num, out_number_of_bytes_io);
140 size_t *out_number_of_bytes_io) {
141 *out_number_of_bytes_io = 0;
150 const size_t buffer_size,
size_t *out_number_of_bytes_io) {
158 return op.check_ssl_result(
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:92
int pending_
Definition: ssl_operation.h:94
SSL * ssl_
Definition: ssl_operation.h:93
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:98
static int read_ex(SSL *ssl, void *buf, size_t num, size_t *out_number_of_bytes_io)
Definition: ssl_operation.h:108
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:117
static bool is_read_operation()
Definition: ssl_operation.h:100
Definition: ssl_operation.h:131
static bool is_read_operation()
Definition: ssl_operation.h:148
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:149
static int write_ex(SSL *ssl, const void *buf, size_t num, size_t *out_number_of_bytes_io)
Definition: ssl_operation.h:139
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