net/socket.hpp | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-)
New commits: commit 9707cf5e54dbacf32264f9702811e3ec62364681 Author: Ashod Nakashian <[email protected]> Date: Fri Feb 17 13:01:48 2017 -0500 nb: create SSL socket Change-Id: I2d5cc3441bcdb67b868557fefe93e2d0bd7770af Reviewed-on: https://gerrit.libreoffice.org/34389 Reviewed-by: Ashod Nakashian <[email protected]> Tested-by: Ashod Nakashian <[email protected]> diff --git a/net/socket.hpp b/net/socket.hpp index 5332456..8982380 100644 --- a/net/socket.hpp +++ b/net/socket.hpp @@ -20,6 +20,8 @@ #include <Poco/Net/SocketAddress.h> +#include "ssl.hpp" + /// A non-blocking, streaming socket. class Socket { @@ -406,11 +408,34 @@ public: protected: SslStreamSocket(const int fd) : - BufferingSocket(fd) + BufferingSocket(fd), + _ssl(nullptr) { + BIO* bio = BIO_new(BIO_s_socket()); + if (bio == nullptr) + { + throw std::runtime_error("Failed to create SSL BIO."); + } + + BIO_set_fd(bio, fd, BIO_NOCLOSE); + + _ssl = SslContext::newSsl(); + if (!_ssl) + { + BIO_free(bio); + throw std::runtime_error("Failed to create SSL."); + } + + SSL_set_bio(_ssl, bio, bio); + + // We are a server-side socket. + SSL_set_accept_state(_ssl); } friend class ServerSocket; + +private: + SSL* _ssl; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
