Commit d28d7886 authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa Committed by GitHub

Merge pull request #853 from PiotrSikora/ssl_ctx_set_proto_versions

src: BoringSSL supports SSL_CTX_set_{min,max}_proto_version.
parents e77883e9 cd9ec0d2
...@@ -162,17 +162,13 @@ void libssl_init() { ...@@ -162,17 +162,13 @@ void libssl_init() {
} }
int ssl_ctx_set_proto_versions(SSL_CTX *ssl_ctx, int min, int max) { int ssl_ctx_set_proto_versions(SSL_CTX *ssl_ctx, int min, int max) {
#if OPENSSL_1_1_API #if OPENSSL_1_1_API || defined(OPENSSL_IS_BORINGSSL)
if (SSL_CTX_set_min_proto_version(ssl_ctx, min) != 1 || if (SSL_CTX_set_min_proto_version(ssl_ctx, min) != 1 ||
SSL_CTX_set_max_proto_version(ssl_ctx, max) != 1) { SSL_CTX_set_max_proto_version(ssl_ctx, max) != 1) {
return -1; return -1;
} }
return 0; return 0;
#elif defined(OPENSSL_IS_BORINGSSL) #else // !OPENSSL_1_1_API && !defined(OPENSSL_IS_BORINGSSL)
SSL_CTX_set_min_version(ssl_ctx, min);
SSL_CTX_set_max_version(ssl_ctx, max);
return 0;
#else // !defined(OPENSSL_IS_BORINGSSL)
long int opts = 0; long int opts = 0;
// TODO We depends on the ordering of protocol version macro in // TODO We depends on the ordering of protocol version macro in
...@@ -197,7 +193,7 @@ int ssl_ctx_set_proto_versions(SSL_CTX *ssl_ctx, int min, int max) { ...@@ -197,7 +193,7 @@ int ssl_ctx_set_proto_versions(SSL_CTX *ssl_ctx, int min, int max) {
SSL_CTX_set_options(ssl_ctx, opts); SSL_CTX_set_options(ssl_ctx, opts);
return 0; return 0;
#endif // !defined(OPENSSL_IS_BORINGSSL) #endif // !OPENSSL_1_1_API && !defined(OPENSSL_IS_BORINGSSL)
} }
} // namespace ssl } // namespace ssl
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment