Enable TLS 1.1 and 1.2

This commit is contained in:
Lauri Kasanen 2020-10-14 14:39:33 +03:00 committed by Dmitry Maksyoma
parent a6d37c2a31
commit 0d47d4890a

View File

@ -160,12 +160,14 @@ ws_ctx_t *ws_socket_ssl(ws_ctx_t *ctx, int socket, char * certfile, char * keyfi
} }
ctx->ssl_ctx = SSL_CTX_new(TLSv1_server_method()); ctx->ssl_ctx = SSL_CTX_new(SSLv23_server_method());
if (ctx->ssl_ctx == NULL) { if (ctx->ssl_ctx == NULL) {
ERR_print_errors_fp(stderr); ERR_print_errors_fp(stderr);
fatal("Failed to configure SSL context"); fatal("Failed to configure SSL context");
} }
SSL_CTX_set_options(ctx->ssl_ctx, SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3);
if (SSL_CTX_use_PrivateKey_file(ctx->ssl_ctx, use_keyfile, if (SSL_CTX_use_PrivateKey_file(ctx->ssl_ctx, use_keyfile,
SSL_FILETYPE_PEM) <= 0) { SSL_FILETYPE_PEM) <= 0) {
sprintf(msg, "Unable to load private key file %s\n", use_keyfile); sprintf(msg, "Unable to load private key file %s\n", use_keyfile);