basic tls setup

This commit is contained in:
keldu 2020-11-10 01:25:43 +01:00
parent cc26022e72
commit 06cd276614
3 changed files with 27 additions and 11 deletions

View File

@ -165,7 +165,7 @@ void EventLoop::leaveScope() {
local_loop = nullptr;
}
bool EventLoop::turnLoop(){
bool EventLoop::turnLoop() {
size_t turn_step = 0;
while (head && turn_step < 65536) {
if (!turn()) {

View File

@ -1,10 +1,26 @@
#include "tls.h"
#include <gnutls/gnutls.h>
#include <gnutls/x509.h>
namespace gin {
class TlsContext::Impl {
private:
gnutls_certificate_credentials_t xcred;
public:
Impl() {
gnutls_global_init();
gnutls_certificate_allocate_credentials(&xcred);
gnutls_certificate_set_x509_system_trust(xcred);
}
~Impl() {
gnutls_certificate_free_credentials(xcred);
gnutls_global_deinit();
}
};
TlsContext::TlsContext():impl{heap<TlsContext::Impl>()}{}
TlsContext::~TlsContext(){}
}
TlsContext::TlsContext() : impl{heap<TlsContext::Impl>()} {}
TlsContext::~TlsContext() {}
} // namespace gin

View File

@ -4,19 +4,19 @@
namespace gin {
class TlsContext {
public:
struct Options {};
private:
/*
* Pimpl pattern to hide GnuTls include
*/
* Pimpl pattern to hide GnuTls include
*/
class Impl;
Own<Impl> impl;
public:
TlsContext();
~TlsContext();
};
class TlsIoProvider {
};
}
} // namespace gin