-
Notifications
You must be signed in to change notification settings - Fork 284
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make the OpenSSL 1.1 compatibility code conditional with a VibeUseOpe…
- Loading branch information
Showing
1 changed file
with
51 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,76 +46,75 @@ version(VibeForceALPN) enum alpn_forced = true; | |
else enum alpn_forced = false; | ||
enum haveALPN = OPENSSL_VERSION_NUMBER >= 0x10200000 || alpn_forced; | ||
|
||
// openssl 1.1.0 hack | ||
version (Have_openssl) { | ||
extern(C) const(SSL_METHOD)* TLS_client_method(); | ||
// openssl 1.1.0 hack: provides a 1.0.x API in terms of the 1.1.x API | ||
version (VibeUseOpenSSL11) { | ||
extern(C) const(SSL_METHOD)* TLS_client_method(); | ||
|
||
const(SSL_METHOD)* SSLv23_client_method() { | ||
return TLS_client_method(); | ||
} | ||
|
||
extern(C) const(SSL_METHOD)* TLS_server_method(); | ||
const(SSL_METHOD)* SSLv23_client_method() { | ||
return TLS_client_method(); | ||
} | ||
|
||
const(SSL_METHOD)* SSLv23_server_method() { | ||
return TLS_server_method(); | ||
} | ||
extern(C) const(SSL_METHOD)* TLS_server_method(); | ||
|
||
// this does nothing in > openssl 1.1.0 | ||
void SSL_load_error_strings() {} | ||
const(SSL_METHOD)* SSLv23_server_method() { | ||
return TLS_server_method(); | ||
} | ||
|
||
extern(C) int OPENSSL_init_ssl(ulong opts, const void* settings); | ||
// this does nothing in > openssl 1.1.0 | ||
void SSL_load_error_strings() {} | ||
|
||
// # define SSL_library_init() OPENSSL_init_ssl(0, NULL) | ||
int SSL_library_init() { | ||
return OPENSSL_init_ssl(0, null); | ||
} | ||
extern(C) int OPENSSL_init_ssl(ulong opts, const void* settings); | ||
|
||
//# define CRYPTO_num_locks() (1) | ||
int CRYPTO_num_locks() { | ||
return 1; | ||
} | ||
// # define SSL_library_init() OPENSSL_init_ssl(0, NULL) | ||
int SSL_library_init() { | ||
return OPENSSL_init_ssl(0, null); | ||
} | ||
|
||
void CRYPTO_set_id_callback(T)(T t) { | ||
} | ||
//# define CRYPTO_num_locks() (1) | ||
int CRYPTO_num_locks() { | ||
return 1; | ||
} | ||
|
||
void CRYPTO_set_locking_callback(T)(T t) { | ||
void CRYPTO_set_id_callback(T)(T t) { | ||
} | ||
|
||
} | ||
void CRYPTO_set_locking_callback(T)(T t) { | ||
|
||
// #define SSL_get_ex_new_index(l, p, newf, dupf, freef) \ | ||
// CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_SSL, l, p, newf, dupf, freef) | ||
} | ||
|
||
extern(C) int CRYPTO_get_ex_new_index(int class_index, long argl, void *argp, | ||
CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, | ||
CRYPTO_EX_free *free_func); | ||
// #define SSL_get_ex_new_index(l, p, newf, dupf, freef) \ | ||
// CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_SSL, l, p, newf, dupf, freef) | ||
|
||
int SSL_get_ex_new_index(long argl, void *argp, | ||
CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, | ||
CRYPTO_EX_free *free_func) { | ||
// # define CRYPTO_EX_INDEX_SSL 0 | ||
return CRYPTO_get_ex_new_index(0, argl, argp, new_func, dup_func, | ||
free_func); | ||
} | ||
extern(C) int CRYPTO_get_ex_new_index(int class_index, long argl, void *argp, | ||
CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, | ||
CRYPTO_EX_free *free_func); | ||
|
||
extern(C) BIGNUM* BN_get_rfc3526_prime_2048(BIGNUM *bn); | ||
int SSL_get_ex_new_index(long argl, void *argp, | ||
CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, | ||
CRYPTO_EX_free *free_func) { | ||
// # define CRYPTO_EX_INDEX_SSL 0 | ||
return CRYPTO_get_ex_new_index(0, argl, argp, new_func, dup_func, | ||
free_func); | ||
} | ||
|
||
BIGNUM* get_rfc3526_prime_2048(BIGNUM *bn) { | ||
return BN_get_rfc3526_prime_2048(bn); | ||
} | ||
extern(C) BIGNUM* BN_get_rfc3526_prime_2048(BIGNUM *bn); | ||
|
||
// # define sk_num OPENSSL_sk_num | ||
extern(C) int OPENSSL_sk_num(const void *); | ||
extern(C) int sk_num(const void *a) { | ||
return OPENSSL_sk_num(a); | ||
} | ||
BIGNUM* get_rfc3526_prime_2048(BIGNUM *bn) { | ||
return BN_get_rfc3526_prime_2048(bn); | ||
} | ||
|
||
// # define sk_value OPENSSL_sk_value | ||
extern(C) void *OPENSSL_sk_value(const void *, int); | ||
// # define sk_num OPENSSL_sk_num | ||
extern(C) int OPENSSL_sk_num(const void *); | ||
extern(C) int sk_num(const void *a) { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
s-ludwig
Author
Member
|
||
return OPENSSL_sk_num(a); | ||
} | ||
|
||
extern(C) void *sk_value(const void *s, int l) { | ||
return OPENSSL_sk_value(s, l); | ||
} | ||
// # define sk_value OPENSSL_sk_value | ||
extern(C) void *OPENSSL_sk_value(const void *, int); | ||
|
||
extern(C) void *sk_value(const void *s, int l) { | ||
return OPENSSL_sk_value(s, l); | ||
} | ||
} | ||
|
||
/** | ||
|
why is this
extern(C)
. It means it clashes with the declaration in https://github.com/D-Programming-Deimos/openssl/blob/master/deimos/openssl/stack.d#L79The same applies for
sk_value