openssl 쳐내!

This commit is contained in:
2025-06-15 23:21:54 +09:00
parent 9949ec80fb
commit 54fab0ad23
7 changed files with 9 additions and 161 deletions

View File

@@ -1,7 +1,4 @@
#pragma once
#include <openssl/bio.h>
#include <openssl/err.h>
#include <openssl/ssl.h>
#include <functional>
#include <queue>
@@ -35,7 +32,6 @@ struct IOCPPASSINDATA {
OVERLAPPED overlapped;
IOCPEVENT event;
std::shared_ptr<Socket> socket;
std::shared_ptr<SSL> ssl;
std::uint32_t transferredbytes;
WSABUF wsabuf;
std::uint32_t bufsize;
@@ -48,32 +44,6 @@ struct IOCPPASSINDATA {
std::memset(&overlapped, 0, sizeof(overlapped));
event = IOCPEVENT::QUIT;
socket = nullptr;
ssl = nullptr;
transferredbytes = 0;
this->bufsize = bufsize;
IOCPInstance = nullptr;
wsabuf.buf = new char[bufsize];
wsabuf.len = bufsize;
}
IOCPPASSINDATA(std::uint32_t bufsize, SSL_CTX* ctx) {
std::memset(&overlapped, 0, sizeof(overlapped));
event = IOCPEVENT::QUIT;
socket = nullptr;
ssl = std::shared_ptr<SSL>(::SSL_new(ctx), ::SSL_free);
if (ssl == nullptr) {
throw std::runtime_error("SSL_new failed. Check SSL_CTX or memory.");
}
BIO* rbio = BIO_new(BIO_s_mem());
BIO* wbio = BIO_new(BIO_s_mem());
if (!rbio || !wbio) {
BIO_free(rbio);
BIO_free(wbio);
throw std::runtime_error("BIO_new failed");
}
SSL_set_bio(ssl.get(), rbio, wbio);
transferredbytes = 0;
this->bufsize = bufsize;
IOCPInstance = nullptr;