Skip to content

Commit b3526cb

Browse files
committed
Add LibreSSL 2.5.0 support
1 parent 53c470c commit b3526cb

File tree

8 files changed

+81
-122
lines changed

8 files changed

+81
-122
lines changed

openssl-sys/build.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,15 @@ fn validate_headers(include_dirs: &[PathBuf],
247247
} else if version_text.contains("0x10100") {
248248
println!("cargo:rustc-cfg=ossl110");
249249
println!("cargo:version=110");
250+
} else if version_text.contains("0x20000000L") {
251+
// Check if it is really LibreSSL
252+
if version_header.lines().any(|l| {
253+
l.contains("define ") && l.contains("LIBRESSL_VERSION_NUMBER")
254+
}) {
255+
println!("cargo:rustc-cfg=libressl");
256+
println!("cargo:libressl=true");
257+
println!("cargo:version=101");
258+
}
250259
} else {
251260
panic!("
252261

openssl-sys/src/lib.rs

Lines changed: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ mod ossl110;
1717
#[cfg(ossl110)]
1818
pub use ossl110::*;
1919

20+
#[cfg(libressl)]
21+
mod libressl;
22+
#[cfg(libressl)]
23+
pub use libressl::*;
24+
2025
pub enum ASN1_INTEGER {}
2126
pub enum ASN1_STRING {}
2227
pub enum ASN1_TIME {}
@@ -1075,8 +1080,11 @@ pub const SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER: c_long = 0x2;
10751080
pub const SSL_MODE_AUTO_RETRY: c_long = 0x4;
10761081
pub const SSL_MODE_NO_AUTO_CHAIN: c_long = 0x8;
10771082
pub const SSL_MODE_RELEASE_BUFFERS: c_long = 0x10;
1083+
#[cfg(not(libressl))]
10781084
pub const SSL_MODE_SEND_CLIENTHELLO_TIME: c_long = 0x20;
1085+
#[cfg(not(libressl))]
10791086
pub const SSL_MODE_SEND_SERVERHELLO_TIME: c_long = 0x40;
1087+
#[cfg(not(libressl))]
10801088
pub const SSL_MODE_SEND_FALLBACK_SCSV: c_long = 0x80;
10811089

10821090
pub const SSL_ERROR_NONE: c_int = 0;
@@ -1095,26 +1103,31 @@ pub const SSL_VERIFY_FAIL_IF_NO_PEER_CERT: c_int = 2;
10951103
#[cfg(not(ossl101))]
10961104
pub const SSL_OP_TLSEXT_PADDING: c_ulong = 0x00000010;
10971105
pub const SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS: c_ulong = 0x00000800;
1106+
#[cfg(not(libressl))]
10981107
pub const SSL_OP_ALL: c_ulong = 0x80000BFF;
10991108
pub const SSL_OP_NO_QUERY_MTU: c_ulong = 0x00001000;
11001109
pub const SSL_OP_COOKIE_EXCHANGE: c_ulong = 0x00002000;
11011110
pub const SSL_OP_NO_TICKET: c_ulong = 0x00004000;
1111+
#[cfg(not(libressl))]
11021112
pub const SSL_OP_CISCO_ANYCONNECT: c_ulong = 0x00008000;
11031113
pub const SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION: c_ulong = 0x00010000;
1114+
#[cfg(not(libressl))]
11041115
pub const SSL_OP_NO_COMPRESSION: c_ulong = 0x00020000;
1116+
#[cfg(not(libressl))]
11051117
pub const SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION: c_ulong = 0x00040000;
11061118
pub const SSL_OP_CIPHER_SERVER_PREFERENCE: c_ulong = 0x00400000;
11071119
pub const SSL_OP_TLS_ROLLBACK_BUG: c_ulong = 0x00800000;
1120+
#[cfg(not(libressl))]
11081121
pub const SSL_OP_NO_SSLv3: c_ulong = 0x02000000;
11091122
pub const SSL_OP_NO_TLSv1: c_ulong = 0x04000000;
11101123
pub const SSL_OP_NO_TLSv1_2: c_ulong = 0x08000000;
11111124
pub const SSL_OP_NO_TLSv1_1: c_ulong = 0x10000000;
11121125

1113-
#[cfg(not(ossl101))]
1126+
#[cfg(not(any(ossl101, libressl)))]
11141127
pub const SSL_OP_NO_DTLSv1: c_ulong = 0x04000000;
1115-
#[cfg(not(ossl101))]
1128+
#[cfg(not(any(ossl101, libressl)))]
11161129
pub const SSL_OP_NO_DTLSv1_2: c_ulong = 0x08000000;
1117-
#[cfg(not(ossl101))]
1130+
#[cfg(not(any(ossl101, libressl)))]
11181131
pub const SSL_OP_NO_SSL_MASK: c_ulong = SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3 |
11191132
SSL_OP_NO_TLSv1 | SSL_OP_NO_TLSv1_1 | SSL_OP_NO_TLSv1_2;
11201133

@@ -1292,9 +1305,9 @@ extern {
12921305
pub fn BIO_new_socket(sock: c_int, close_flag: c_int) -> *mut BIO;
12931306
pub fn BIO_read(b: *mut BIO, buf: *mut c_void, len: c_int) -> c_int;
12941307
pub fn BIO_write(b: *mut BIO, buf: *const c_void, len: c_int) -> c_int;
1295-
#[cfg(ossl101)]
1308+
#[cfg(any(ossl101, libressl))]
12961309
pub fn BIO_new_mem_buf(buf: *mut c_void, len: c_int) -> *mut BIO;
1297-
#[cfg(not(ossl101))]
1310+
#[cfg(not(any(ossl101, libressl)))]
12981311
pub fn BIO_new_mem_buf(buf: *const c_void, len: c_int) -> *mut BIO;
12991312
pub fn BIO_set_flags(b: *mut BIO, flags: c_int);
13001313
pub fn BIO_clear_flags(b: *mut BIO, flags: c_int);
@@ -1375,11 +1388,11 @@ extern {
13751388

13761389
pub fn DH_new() -> *mut DH;
13771390
pub fn DH_free(dh: *mut DH);
1378-
#[cfg(not(ossl101))]
1391+
#[cfg(not(any(ossl101, libressl)))]
13791392
pub fn DH_get_1024_160() -> *mut DH;
1380-
#[cfg(not(ossl101))]
1393+
#[cfg(not(any(ossl101, libressl)))]
13811394
pub fn DH_get_2048_224() -> *mut DH;
1382-
#[cfg(not(ossl101))]
1395+
#[cfg(not(any(ossl101, libressl)))]
13831396
pub fn DH_get_2048_256() -> *mut DH;
13841397

13851398
pub fn EC_KEY_new() -> *mut EC_KEY;
@@ -1495,11 +1508,11 @@ extern {
14951508
type_: *const EVP_MD,
14961509
e: *mut ENGINE,
14971510
pkey: *mut EVP_PKEY) -> c_int;
1498-
#[cfg(ossl101)]
1511+
#[cfg(any(ossl101, libressl))]
14991512
pub fn EVP_DigestVerifyFinal(ctx: *mut EVP_MD_CTX,
15001513
sigret: *mut c_uchar,
15011514
siglen: size_t) -> c_int;
1502-
#[cfg(not(ossl101))]
1515+
#[cfg(not(any(ossl101, libressl)))]
15031516
pub fn EVP_DigestVerifyFinal(ctx: *mut EVP_MD_CTX,
15041517
sigret: *const c_uchar,
15051518
siglen: size_t) -> c_int;
@@ -1634,8 +1647,10 @@ extern {
16341647
pub fn SSL_get_ex_data_X509_STORE_CTX_idx() -> c_int;
16351648
pub fn SSL_get_SSL_CTX(ssl: *const SSL) -> *mut SSL_CTX;
16361649
pub fn SSL_set_SSL_CTX(ssl: *mut SSL, ctx: *mut SSL_CTX) -> *mut SSL_CTX;
1637-
#[cfg(not(osslconf = "OPENSSL_NO_COMP"))]
1650+
#[cfg(not(any(osslconf = "OPENSSL_NO_COMP", libressl)))]
16381651
pub fn SSL_get_current_compression(ssl: *mut SSL) -> *const COMP_METHOD;
1652+
#[cfg(libressl)]
1653+
pub fn SSL_get_current_compression(ssl: *mut SSL) -> *const libc::c_void;
16391654
pub fn SSL_get_peer_certificate(ssl: *const SSL) -> *mut X509;
16401655
pub fn SSL_get_ssl_method(ssl: *mut SSL) -> *const SSL_METHOD;
16411656
pub fn SSL_get_version(ssl: *const SSL) -> *const c_char;
@@ -1648,14 +1663,14 @@ extern {
16481663
pub fn SSL_get_ex_data(ssl: *const SSL, idx: c_int) -> *mut c_void;
16491664
pub fn SSL_get_servername(ssl: *const SSL, name_type: c_int) -> *const c_char;
16501665
pub fn SSL_get_current_cipher(ssl: *const SSL) -> *const SSL_CIPHER;
1651-
#[cfg(not(ossl101))]
1666+
#[cfg(not(any(ossl101, libressl)))]
16521667
pub fn SSL_get0_param(ssl: *mut SSL) -> *mut X509_VERIFY_PARAM;
16531668
pub fn SSL_get_verify_result(ssl: *const SSL) -> c_long;
16541669
pub fn SSL_shutdown(ssl: *mut SSL) -> c_int;
16551670
pub fn SSL_get_certificate(ssl: *const SSL) -> *mut X509;
1656-
#[cfg(ossl101)]
1671+
#[cfg(any(ossl101, libressl))]
16571672
pub fn SSL_get_privatekey(ssl: *mut SSL) -> *mut EVP_PKEY;
1658-
#[cfg(not(ossl101))]
1673+
#[cfg(not(any(ossl101, libressl)))]
16591674
pub fn SSL_get_privatekey(ssl: *const SSL) -> *mut EVP_PKEY;
16601675
pub fn SSL_load_client_CA_file(file: *const c_char) -> *mut stack_st_X509_NAME;
16611676
pub fn SSL_set_tmp_dh_callback(ctx: *mut SSL,
@@ -1664,8 +1679,10 @@ extern {
16641679
keylength: c_int)
16651680
-> *mut DH);
16661681

1667-
#[cfg(not(osslconf = "OPENSSL_NO_COMP"))]
1682+
#[cfg(not(any(osslconf = "OPENSSL_NO_COMP", libressl)))]
16681683
pub fn SSL_COMP_get_name(comp: *const COMP_METHOD) -> *const c_char;
1684+
#[cfg(libressl)]
1685+
pub fn SSL_COMP_get_name(comp: *const libc::c_void) -> *const c_char;
16691686

16701687
pub fn SSL_CIPHER_get_name(cipher: *const SSL_CIPHER) -> *const c_char;
16711688
pub fn SSL_CIPHER_get_bits(cipher: *const SSL_CIPHER, alg_bits: *mut c_int) -> c_int;
@@ -1701,9 +1718,9 @@ extern {
17011718
keylength: c_int)
17021719
-> *mut DH);
17031720

1704-
#[cfg(not(ossl101))]
1721+
#[cfg(not(any(ossl101, libressl)))]
17051722
pub fn SSL_CTX_get0_certificate(ctx: *const SSL_CTX) -> *mut X509;
1706-
#[cfg(not(ossl101))]
1723+
#[cfg(not(any(ossl101, libressl)))]
17071724
pub fn SSL_CTX_get0_privatekey(ctx: *const SSL_CTX) -> *mut EVP_PKEY;
17081725

17091726
pub fn SSL_CTX_set_cipher_list(ssl: *mut SSL_CTX, s: *const c_char) -> c_int;
@@ -1787,9 +1804,9 @@ extern {
17871804

17881805
#[cfg(not(ossl101))]
17891806
pub fn X509_VERIFY_PARAM_free(param: *mut X509_VERIFY_PARAM);
1790-
#[cfg(not(ossl101))]
1807+
#[cfg(not(any(ossl101, libressl)))]
17911808
pub fn X509_VERIFY_PARAM_set_hostflags(param: *mut X509_VERIFY_PARAM, flags: c_uint);
1792-
#[cfg(not(ossl101))]
1809+
#[cfg(not(any(ossl101, libressl)))]
17931810
pub fn X509_VERIFY_PARAM_set1_host(param: *mut X509_VERIFY_PARAM,
17941811
name: *const c_char,
17951812
namelen: size_t) -> c_int;

openssl-sys/src/libressl.rs

Lines changed: 14 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ use std::sync::{Once, ONCE_INIT};
33
use std::mem;
44

55
use libc::{c_int, c_char, c_void, c_long, c_uchar, size_t, c_uint, c_ulong};
6-
#[cfg(not(ossl101))]
76
use libc::time_t;
87

98
#[repr(C)]
@@ -88,7 +87,6 @@ pub struct RSA {
8887
pub _method_mod_p: *mut ::BN_MONT_CTX,
8988
pub _method_mod_q: *mut ::BN_MONT_CTX,
9089

91-
pub bignum_data: *mut c_char,
9290
pub blinding: *mut ::BN_BLINDING,
9391
pub mt_blinding: *mut ::BN_BLINDING,
9492
}
@@ -155,7 +153,6 @@ pub struct BIO {
155153
#[repr(C)]
156154
pub struct CRYPTO_EX_DATA {
157155
pub sk: *mut ::stack_st_void,
158-
pub dummy: c_int,
159156
}
160157

161158
#[repr(C)]
@@ -258,10 +255,6 @@ pub struct X509 {
258255
crldp: *mut c_void,
259256
altname: *mut c_void,
260257
nc: *mut c_void,
261-
#[cfg(not(osslconf = "OPENSSL_NO_RFC3779"))]
262-
rfc3779_addr: *mut c_void,
263-
#[cfg(not(osslconf = "OPENSSL_NO_RFC3779"))]
264-
rfc3779_asid: *mut c_void,
265258
#[cfg(not(osslconf = "OPENSSL_NO_SHA"))]
266259
sha1_hash: [c_uchar; 20],
267260
aux: *mut c_void,
@@ -346,99 +339,26 @@ pub struct SSL_CTX {
346339
#[cfg(not(osslconf = "OPENSSL_NO_ENGINE"))]
347340
client_cert_engine: *mut c_void,
348341

349-
#[cfg(not(osslconf = "OPENSSL_NO_TLSEXT"))]
350342
tlsext_servername_callback: *mut c_void,
351-
#[cfg(not(osslconf = "OPENSSL_NO_TLSEXT"))]
352343
tlsect_servername_arg: *mut c_void,
353-
#[cfg(not(osslconf = "OPENSSL_NO_TLSEXT"))]
354344
tlsext_tick_key_name: [c_uchar; 16],
355-
#[cfg(not(osslconf = "OPENSSL_NO_TLSEXT"))]
356345
tlsext_tick_hmac_key: [c_uchar; 16],
357-
#[cfg(not(osslconf = "OPENSSL_NO_TLSEXT"))]
358346
tlsext_tick_aes_key: [c_uchar; 16],
359-
#[cfg(not(osslconf = "OPENSSL_NO_TLSEXT"))]
360347
tlsext_ticket_key_cb: *mut c_void,
361-
#[cfg(not(osslconf = "OPENSSL_NO_TLSEXT"))]
362348
tlsext_status_cb: *mut c_void,
363-
#[cfg(not(osslconf = "OPENSSL_NO_TLSEXT"))]
364349
tlsext_status_arg: *mut c_void,
365-
#[cfg(not(osslconf = "OPENSSL_NO_TLSEXT"))]
366350
tlsext_opaque_prf_input_callback: *mut c_void,
367-
#[cfg(not(osslconf = "OPENSSL_NO_TLSEXT"))]
368351
tlsext_opaque_prf_input_callback_arg: *mut c_void,
369352

370-
#[cfg(not(osslconf = "OPENSSL_NO_PSK"))]
371-
psk_identity_hint: *mut c_void,
372-
#[cfg(not(osslconf = "OPENSSL_NO_PSK"))]
373-
psk_client_callback: *mut c_void,
374-
#[cfg(not(osslconf = "OPENSSL_NO_PSK"))]
375-
psk_server_callback: *mut c_void,
376-
377-
#[cfg(not(osslconf = "OPENSSL_NO_BUF_FREELISTS"))]
378-
freelist_max_len: c_uint,
379-
#[cfg(not(osslconf = "OPENSSL_NO_BUF_FREELISTS"))]
380-
wbuf_freelist: *mut c_void,
381-
#[cfg(not(osslconf = "OPENSSL_NO_BUF_FREELISTS"))]
382-
rbuf_freelist: *mut c_void,
383-
384-
#[cfg(not(osslconf = "OPENSSL_NO_SRP"))]
385-
srp_ctx: SRP_CTX,
386-
387-
#[cfg(all(not(osslconf = "OPENSSL_NO_TLSEXT"), not(osslconf = "OPENSSL_NO_NEXTPROTONEG")))]
388353
next_protos_advertised_cb: *mut c_void,
389-
#[cfg(all(not(osslconf = "OPENSSL_NO_TLSEXT"), not(osslconf = "OPENSSL_NO_NEXTPROTONEG")))]
390354
next_protos_advertised_cb_arg: *mut c_void,
391-
#[cfg(all(not(osslconf = "OPENSSL_NO_TLSEXT"), not(osslconf = "OPENSSL_NO_NEXTPROTONEG")))]
392355
next_proto_select_cb: *mut c_void,
393-
#[cfg(all(not(osslconf = "OPENSSL_NO_TLSEXT"), not(osslconf = "OPENSSL_NO_NEXTPROTONEG")))]
394356
next_proto_select_cb_arg: *mut c_void,
395357

396-
#[cfg(all(not(osslconf = "OPENSSL_NO_TLSEXT"), ossl101))]
397-
srtp_profiles: *mut c_void,
398-
399-
#[cfg(all(not(osslconf = "OPENSSL_NO_TLSEXT"), ossl102))]
400358
srtp_profiles: *mut c_void,
401-
#[cfg(all(not(osslconf = "OPENSSL_NO_TLSEXT"), ossl102))]
402-
alpn_select_cb: *mut c_void,
403-
#[cfg(all(not(osslconf = "OPENSSL_NO_TLSEXT"), ossl102))]
404-
alpn_select_cb_arg: *mut c_void,
405-
#[cfg(all(not(osslconf = "OPENSSL_NO_TLSEXT"), ossl102))]
406-
alpn_client_proto_list: *mut c_void,
407-
#[cfg(all(not(osslconf = "OPENSSL_NO_TLSEXT"), ossl102))]
408-
alpn_client_proto_list_len: c_uint,
409-
410-
#[cfg(all(not(osslconf = "OPENSSL_NO_TLSEXT"), not(osslconf = "OPENSSL_NO_EC"), ossl102))]
411-
tlsext_ecpointformatlist_length: size_t,
412-
#[cfg(all(not(osslconf = "OPENSSL_NO_TLSEXT"), not(osslconf = "OPENSSL_NO_EC"), ossl102))]
413-
tlsext_ecpointformatlist: *mut c_uchar,
414-
#[cfg(all(not(osslconf = "OPENSSL_NO_TLSEXT"), not(osslconf = "OPENSSL_NO_EC"), ossl102))]
415-
tlsext_ellipticcurvelist_length: size_t,
416-
#[cfg(all(not(osslconf = "OPENSSL_NO_TLSEXT"), not(osslconf = "OPENSSL_NO_EC"), ossl102))]
417-
tlsext_ellipticcurvelist: *mut c_uchar,
418-
}
419-
420-
#[repr(C)]
421-
pub struct SRP_CTX {
422-
SRP_cb_arg: *mut c_void,
423-
TLS_ext_srp_username_callback: *mut c_void,
424-
SRP_verify_param_callback: *mut c_void,
425-
SRP_give_srp_client_pwd_callback: *mut c_void,
426-
login: *mut c_void,
427-
N: *mut c_void,
428-
g: *mut c_void,
429-
s: *mut c_void,
430-
B: *mut c_void,
431-
A: *mut c_void,
432-
a: *mut c_void,
433-
b: *mut c_void,
434-
v: *mut c_void,
435-
info: *mut c_void,
436-
stringth: c_int,
437-
srp_Mask: c_ulong,
438359
}
439360

440361
#[repr(C)]
441-
#[cfg(not(ossl101))]
442362
pub struct X509_VERIFY_PARAM {
443363
pub name: *mut c_char,
444364
pub check_time: time_t,
@@ -448,27 +368,30 @@ pub struct X509_VERIFY_PARAM {
448368
pub trust: c_int,
449369
pub depth: c_int,
450370
pub policies: *mut stack_st_ASN1_OBJECT,
451-
pub id: *mut X509_VERIFY_PARAM_ID,
371+
//pub id: *mut X509_VERIFY_PARAM_ID,
452372
}
453373

454-
#[cfg(not(ossl101))]
455374
pub enum X509_VERIFY_PARAM_ID {}
456375

457376
pub const SSL_CTRL_OPTIONS: c_int = 32;
458377
pub const SSL_CTRL_CLEAR_OPTIONS: c_int = 77;
459-
#[cfg(ossl102)]
460378
pub const SSL_CTRL_SET_ECDH_AUTO: c_int = 94;
461379

462-
pub const SSL_OP_MICROSOFT_SESS_ID_BUG: c_ulong = 0x00000001;
463-
pub const SSL_OP_NETSCAPE_CHALLENGE_BUG: c_ulong = 0x00000002;
464-
pub const SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG: c_ulong = 0x00000008;
465-
pub const SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER: c_ulong = 0x00000020;
466-
pub const SSL_OP_SSLEAY_080_CLIENT_DH_BUG: c_ulong = 0x00000080;
467-
pub const SSL_OP_TLS_D5_BUG: c_ulong = 0x00000100;
468-
pub const SSL_OP_TLS_BLOCK_PADDING_BUG: c_ulong = 0x00000200;
380+
pub const SSL_OP_ALL: c_ulong = 0x80000014;
381+
pub const SSL_OP_CISCO_ANYCONNECT: c_ulong = 0x0;
382+
pub const SSL_OP_NO_COMPRESSION: c_ulong = 0x0;
383+
pub const SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION: c_ulong = 0x0;
384+
pub const SSL_OP_NO_SSLv3: c_ulong = 0x0;
385+
pub const SSL_OP_MICROSOFT_SESS_ID_BUG: c_ulong = 0x0;
386+
pub const SSL_OP_NETSCAPE_CHALLENGE_BUG: c_ulong = 0x0;
387+
pub const SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG: c_ulong = 0x0;
388+
pub const SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER: c_ulong = 0x0;
389+
pub const SSL_OP_SSLEAY_080_CLIENT_DH_BUG: c_ulong = 0x0;
390+
pub const SSL_OP_TLS_D5_BUG: c_ulong = 0x0;
391+
pub const SSL_OP_TLS_BLOCK_PADDING_BUG: c_ulong = 0x0;
469392
pub const SSL_OP_SINGLE_ECDH_USE: c_ulong = 0x00080000;
470393
pub const SSL_OP_SINGLE_DH_USE: c_ulong = 0x00100000;
471-
pub const SSL_OP_NO_SSLv2: c_ulong = 0x01000000;
394+
pub const SSL_OP_NO_SSLv2: c_ulong = 0x0;
472395

473396
pub const SSLEAY_VERSION : c_int = 0;
474397
pub const SSLEAY_CFLAGS : c_int = 2;
@@ -534,12 +457,10 @@ fn set_id_callback() {}
534457

535458
// macros
536459

537-
#[cfg(ossl102)]
538460
pub unsafe fn SSL_CTX_set_ecdh_auto(ctx: *mut SSL_CTX, onoff: c_int) -> c_int {
539461
::SSL_CTX_ctrl(ctx, SSL_CTRL_SET_ECDH_AUTO, onoff as c_long, ::std::ptr::null_mut()) as c_int
540462
}
541463

542-
#[cfg(ossl102)]
543464
pub unsafe fn SSL_set_ecdh_auto(ssl: *mut ::SSL, onoff: c_int) -> c_int {
544465
::SSL_ctrl(ssl, SSL_CTRL_SET_ECDH_AUTO, onoff as c_long, ::std::ptr::null_mut()) as c_int
545466
}
@@ -578,15 +499,11 @@ extern {
578499
pub fn OPENSSL_add_all_algorithms_noconf();
579500
pub fn HMAC_CTX_init(ctx: *mut ::HMAC_CTX);
580501
pub fn HMAC_CTX_cleanup(ctx: *mut ::HMAC_CTX);
581-
#[cfg(not(osslconf = "OPENSSL_NO_SSL3_METHOD"))]
582-
pub fn SSLv3_method() -> *const ::SSL_METHOD;
583502
pub fn TLSv1_method() -> *const ::SSL_METHOD;
584503
pub fn SSLv23_method() -> *const ::SSL_METHOD;
585504
pub fn TLSv1_1_method() -> *const ::SSL_METHOD;
586505
pub fn TLSv1_2_method() -> *const ::SSL_METHOD;
587506
pub fn DTLSv1_method() -> *const ::SSL_METHOD;
588-
#[cfg(ossl102)]
589-
pub fn DTLSv1_2_method() -> *const ::SSL_METHOD;
590507
pub fn SSL_get_ex_new_index(argl: c_long, argp: *mut c_void,
591508
new_func: Option<::CRYPTO_EX_new>,
592509
dup_func: Option<::CRYPTO_EX_dup>,

openssl/build.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ fn main() {
1616
_ => panic!("Unable to detect OpenSSL version"),
1717
}
1818

19+
if let Ok(_) = env::var("DEP_OPENSSL_LIBRESSL") {
20+
println!("cargo:rustc-cfg=libressl");
21+
}
22+
1923
if let Ok(vars) = env::var("DEP_OPENSSL_CONF") {
2024
for var in vars.split(",") {
2125
println!("cargo:rustc-cfg=osslconf=\"{}\"", var);

0 commit comments

Comments
 (0)