Skip to content

Commit 0d96a18

Browse files
committed
ssl: Re-introduceold SSLv23_*method, add compatibility aliases
With this, the client code can update to the new API while remaining compatible with old versions.
1 parent 2561621 commit 0d96a18

File tree

1 file changed

+18
-3
lines changed
  • source/deimos/openssl

1 file changed

+18
-3
lines changed

source/deimos/openssl/ssl.d

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@
143143
module deimos.openssl.ssl;
144144

145145
import deimos.openssl._d_util;
146+
import deimos.openssl.opensslv;
146147

147148
import deimos.openssl.x509_vfy; // Needed for x509_store_st.
148149
import deimos.openssl.ssl2; // Needed for SSL2_TXT_NULL_WITH_MD5, etc.
@@ -1994,9 +1995,23 @@ const(SSL_METHOD)* SSLv3_method(); /* SSLv3 */
19941995
const(SSL_METHOD)* SSLv3_server_method(); /* SSLv3 */
19951996
const(SSL_METHOD)* SSLv3_client_method(); /* SSLv3 */
19961997

1997-
const(SSL_METHOD)* TLS_method(); /* handshake SSLv3 or later, negotiate to highest possible security */
1998-
const(SSL_METHOD)* TLS_server_method(); /* see above */
1999-
const(SSL_METHOD)* TLS_client_method(); /* see above */
1998+
static if (OPENSSL_VERSION_BEFORE(1, 1, 0))
1999+
{
2000+
const(SSL_METHOD)* SSLv23_method();
2001+
const(SSL_METHOD)* SSLv23_server_method();
2002+
const(SSL_METHOD)* SSLv23_client_method();
2003+
2004+
/// Forward compatible alias
2005+
alias TLS_method = SSLv23_method;
2006+
alias TLS_server_method = SSLv23_server_method;
2007+
alias TLS_client_method = SSLv23_server_method;
2008+
}
2009+
else
2010+
{
2011+
const(SSL_METHOD)* TLS_method(); /* handshake SSLv3 or later, negotiate to highest possible security */
2012+
const(SSL_METHOD)* TLS_server_method(); /* see above */
2013+
const(SSL_METHOD)* TLS_client_method(); /* see above */
2014+
}
20002015

20012016
const(SSL_METHOD)* TLSv1_method(); /* TLSv1.0 */
20022017
const(SSL_METHOD)* TLSv1_server_method(); /* TLSv1.0 */

0 commit comments

Comments
 (0)