|
|
|
@ -53,9 +53,11 @@ int SSLSocket::NewServerCTX() {
|
|
|
|
|
|
|
|
|
|
if (ctx) SSL_CTX_free(ctx);
|
|
|
|
|
ctx = NULL;
|
|
|
|
|
|
|
|
|
|
#ifdef SSLv23_method
|
|
|
|
|
ctx = SSL_CTX_new(TLS_server_method());
|
|
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
ctx = SSL_CTX_new(TLSv1_2_server_method());
|
|
|
|
|
#endif
|
|
|
|
|
if (SSL_CTX_use_certificate_file(ctx, certfile.c_str(), SSL_FILETYPE_PEM) <= 0 ) {
|
|
|
|
|
ERR_print_errors_fp(stderr);
|
|
|
|
|
if (ctx) SSL_CTX_free(ctx);
|
|
|
|
@ -86,7 +88,11 @@ int SSLSocket::NewServerCTX() {
|
|
|
|
|
int SSLSocket::NewClientCTX() {
|
|
|
|
|
if (ctx) SSL_CTX_free(ctx);
|
|
|
|
|
ctx = NULL;
|
|
|
|
|
#ifdef SSLv23_method
|
|
|
|
|
ctx = SSL_CTX_new(TLS_client_method());
|
|
|
|
|
#else
|
|
|
|
|
ctx = SSL_CTX_new(TLSv1_2_client_method());
|
|
|
|
|
#endif
|
|
|
|
|
return 1;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|