openssl, tls: replace deprecated openssl 1.1.0 functions
MODIFY
src/main/openssl.c
src/main/openssl.c
@@ -149,8 +149,15 @@ int openssl_init(void)
(void)signal(SIGPIPE, sigpipe_handler);
#endif
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L
+ int err;
+ err = OPENSSL_init_ssl(OPENSSL_INIT_SSL_DEFAULT, NULL);
+ if (!err)
+ return !err;
+#else
SSL_library_init();
SSL_load_error_strings();
+#endif
return 0;
}
@@ -158,7 +165,9 @@ int openssl_init(void)
void openssl_close(void)
{
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
ERR_free_strings();
+#endif
#if defined (HAVE_PTHREAD) && (OPENSSL_VERSION_NUMBER < 0x10100000L)
lockv = mem_deref(lockv);
#endif

MODIFY
src/tls/openssl/tls.c
src/tls/openssl/tls.c
@@ -297,9 +297,15 @@ int tls_set_selfsigned_rsa(struct tls *tls, const char *cn, size_t bits)
!X509_set_subject_name(cert, subj))
goto out;
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L
+ if (!X509_gmtime_adj(X509_getm_notBefore(cert), -3600*24*365) ||
+ !X509_gmtime_adj(X509_getm_notAfter(cert), 3600*24*365*10))
+ goto out;
+#else
if (!X509_gmtime_adj(X509_get_notBefore(cert), -3600*24*365) ||
!X509_gmtime_adj(X509_get_notAfter(cert), 3600*24*365*10))
goto out;
+#endif
if (!X509_set_pubkey(cert, key))
goto out;

openssl, tls: replace deprecated openssl 1.1.0 functions (#5)