if (ssl_ver == -1)
goto error;
- SSL_CTX_set_min_proto_version(context, ssl_ver);
+ if (!SSL_CTX_set_min_proto_version(context, ssl_ver))
+ {
+ ereport(isServerStart ? FATAL : LOG,
+ (errmsg("could not set minimum SSL protocol version")));
+ goto error;
+ }
}
if (ssl_max_protocol_version)
if (ssl_ver == -1)
goto error;
- SSL_CTX_set_max_proto_version(context, ssl_ver);
+ if (!SSL_CTX_set_max_proto_version(context, ssl_ver))
+ {
+ ereport(isServerStart ? FATAL : LOG,
+ (errmsg("could not set maximum SSL protocol version")));
+ goto error;
+ }
}
/* disallow SSL session tickets */
if (version > TLS1_VERSION)
ssl_options |= SSL_OP_NO_TLSv1;
+ /*
+ * Some OpenSSL versions define TLS*_VERSION macros but not the
+ * corresponding SSL_OP_NO_* macro, so in those cases we have to return
+ * unsuccessfully here.
+ */
#ifdef TLS1_1_VERSION
if (version > TLS1_1_VERSION)
+ {
+#ifdef SSL_OP_NO_TLSv1_1
ssl_options |= SSL_OP_NO_TLSv1_1;
+#else
+ return 0;
+#endif
+ }
#endif
#ifdef TLS1_2_VERSION
if (version > TLS1_2_VERSION)
+ {
+#ifdef SSL_OP_NO_TLSv1_2
ssl_options |= SSL_OP_NO_TLSv1_2;
+#else
+ return 0;
+#endif
+ }
#endif
SSL_CTX_set_options(ctx, ssl_options);
AssertArg(version != 0);
+ /*
+ * Some OpenSSL versions define TLS*_VERSION macros but not the
+ * corresponding SSL_OP_NO_* macro, so in those cases we have to return
+ * unsuccessfully here.
+ */
#ifdef TLS1_1_VERSION
if (version < TLS1_1_VERSION)
+ {
+#ifdef SSL_OP_NO_TLSv1_1
ssl_options |= SSL_OP_NO_TLSv1_1;
+#else
+ return 0;
+#endif
+ }
#endif
#ifdef TLS1_2_VERSION
if (version < TLS1_2_VERSION)
+ {
+#ifdef SSL_OP_NO_TLSv1_2
ssl_options |= SSL_OP_NO_TLSv1_2;
+#else
+ return 0;
+#endif
+ }
#endif
SSL_CTX_set_options(ctx, ssl_options);