🚸 Print errors if SSL_CTX failed

This commit is contained in:
Simon V. Lejel 2024-02-12 17:54:14 +01:00
parent 414341ebc6
commit a1d17deb5f
Signed by: sl
GPG key ID: 6544A0430A2CFFAD

View file

@ -49,9 +49,14 @@ int main() {
OPENSSL_init_ssl(0, nullptr); OPENSSL_init_ssl(0, nullptr);
} }
// Create new SSL context with server side connections and save it to a
// pointer
SSL_CTX *ctx = SSL_CTX_new(TLS_server_method()); SSL_CTX *ctx = SSL_CTX_new(TLS_server_method());
// Check of the context is null
// If it's null, then an error occurred
if (!ctx) { if (!ctx) {
cout << "Creation of SSL context failed" << endl; cout << "Creation of SSL context failed: " << getCtxError() << endl;
} }
// Load certificate // Load certificate