From 152fb9fa9f5fd976515c706b7b690dc16c43dde7 Mon Sep 17 00:00:00 2001 From: Dan Melnic Date: Thu, 17 Aug 2023 18:06:50 -0700 Subject: [PATCH] StopTLS: add support for io_uring socket cert Summary: StopTLS: add support for io_uring socket cert Reviewed By: robertroeser, mingtaoy Differential Revision: D48442529 fbshipit-source-id: f73f13d26793704dd2815765fd7d311c7e4b8dff --- folly/experimental/io/AsyncIoUringSocket.h | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/folly/experimental/io/AsyncIoUringSocket.h b/folly/experimental/io/AsyncIoUringSocket.h index b941bca2cc2..6fe1f9f2575 100644 --- a/folly/experimental/io/AsyncIoUringSocket.h +++ b/folly/experimental/io/AsyncIoUringSocket.h @@ -54,6 +54,7 @@ class IoUringBackend; class AsyncIoUringSocket : public AsyncSocketTransport { public: + using Cert = folly::AsyncTransportCertificate; struct Options { Options() : allocateNoBufferPoolBuffer(defaultAllocateNoBufferPoolBuffer), @@ -212,6 +213,26 @@ class AsyncIoUringSocket : public AsyncSocketTransport { applicationProtocol_ = std::move(s); } + const folly::AsyncTransportCertificate* getPeerCertificate() const override { + return peerCert_.get(); + } + + const folly::AsyncTransportCertificate* getSelfCertificate() const override { + return selfCert_.get(); + } + + void dropPeerCertificate() noexcept override { peerCert_.reset(); } + + void dropSelfCertificate() noexcept override { selfCert_.reset(); } + + void setPeerCertificate(const std::shared_ptr& peerCert) { + peerCert_ = peerCert; + } + + void setSelfCertificate(const std::shared_ptr& selfCert) { + selfCert_ = selfCert; + } + void asyncDetachFd(AsyncDetachFdCallback* callback); bool readSqeInFlight() const { return readSqe_->inFlight(); } bool getTFOSucceded() const override; @@ -470,6 +491,9 @@ class AsyncIoUringSocket : public AsyncSocketTransport { std::string securityProtocol_; std::string applicationProtocol_; + std::shared_ptr selfCert_; + std::shared_ptr peerCert_; + // shutdown: int shutdownFlags_ = 0;