Skip to content

Commit b5e6a16

Browse files
committed
fix openssl bindgen build
1 parent 9ac9599 commit b5e6a16

File tree

4 files changed

+41
-42
lines changed

4 files changed

+41
-42
lines changed

openssl-sys/src/crypto.rs

Lines changed: 30 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,31 +19,36 @@ cfg_if! {
1919
}
2020
}
2121

22-
// FIXME should be options
23-
pub type CRYPTO_EX_new = unsafe extern "C" fn(
24-
parent: *mut c_void,
25-
ptr: *mut c_void,
26-
ad: *mut CRYPTO_EX_DATA,
27-
idx: c_int,
28-
argl: c_long,
29-
argp: *mut c_void,
30-
) -> CRYPTO_EX_new_ret;
31-
pub type CRYPTO_EX_dup = unsafe extern "C" fn(
32-
to: *mut CRYPTO_EX_DATA,
33-
from: CRYPTO_EX_dup_from,
34-
from_d: CRYPTO_EX_dup_from_d,
35-
idx: c_int,
36-
argl: c_long,
37-
argp: *mut c_void,
38-
) -> c_int;
39-
pub type CRYPTO_EX_free = unsafe extern "C" fn(
40-
parent: *mut c_void,
41-
ptr: *mut c_void,
42-
ad: *mut CRYPTO_EX_DATA,
43-
idx: c_int,
44-
argl: c_long,
45-
argp: *mut c_void,
46-
);
22+
pub type CRYPTO_EX_new = Option<
23+
unsafe extern "C" fn(
24+
parent: *mut c_void,
25+
ptr: *mut c_void,
26+
ad: *mut CRYPTO_EX_DATA,
27+
idx: c_int,
28+
argl: c_long,
29+
argp: *mut c_void,
30+
) -> CRYPTO_EX_new_ret,
31+
>;
32+
pub type CRYPTO_EX_dup = Option<
33+
unsafe extern "C" fn(
34+
to: *mut CRYPTO_EX_DATA,
35+
from: CRYPTO_EX_dup_from,
36+
from_d: CRYPTO_EX_dup_from_d,
37+
idx: c_int,
38+
argl: c_long,
39+
argp: *mut c_void,
40+
) -> c_int,
41+
>;
42+
pub type CRYPTO_EX_free = Option<
43+
unsafe extern "C" fn(
44+
parent: *mut c_void,
45+
ptr: *mut c_void,
46+
ad: *mut CRYPTO_EX_DATA,
47+
idx: c_int,
48+
argl: c_long,
49+
argp: *mut c_void,
50+
),
51+
>;
4752

4853
#[cfg(any(ossl110, libressl390))]
4954
#[inline]

openssl-sys/src/handwritten/crypto.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ extern "C" {
2323
class_index: c_int,
2424
argl: c_long,
2525
argp: *mut c_void,
26-
new_func: Option<CRYPTO_EX_new>,
27-
dup_func: Option<CRYPTO_EX_dup>,
28-
free_func: Option<CRYPTO_EX_free>,
26+
new_func: CRYPTO_EX_new,
27+
dup_func: CRYPTO_EX_dup,
28+
free_func: CRYPTO_EX_free,
2929
) -> c_int;
3030

3131
#[cfg(not(ossl110))]

openssl-sys/src/ssl.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -577,9 +577,9 @@ cfg_if! {
577577
pub unsafe fn SSL_get_ex_new_index(
578578
l: c_long,
579579
p: *mut c_void,
580-
newf: Option<CRYPTO_EX_new>,
581-
dupf: Option<CRYPTO_EX_dup>,
582-
freef: Option<CRYPTO_EX_free>,
580+
newf: CRYPTO_EX_new,
581+
dupf: CRYPTO_EX_dup,
582+
freef: CRYPTO_EX_free,
583583
) -> c_int {
584584
CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_SSL, l, p, newf, dupf, freef)
585585
}
@@ -590,9 +590,9 @@ cfg_if! {
590590
pub unsafe fn SSL_CTX_get_ex_new_index(
591591
l: c_long,
592592
p: *mut c_void,
593-
newf: Option<CRYPTO_EX_new>,
594-
dupf: Option<CRYPTO_EX_dup>,
595-
freef: Option<CRYPTO_EX_free>,
593+
newf: CRYPTO_EX_new,
594+
dupf: CRYPTO_EX_dup,
595+
freef: CRYPTO_EX_free,
596596
) -> c_int {
597597
CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_SSL_CTX, l, p, newf, dupf, freef)
598598
}

openssl/src/ssl/mod.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2218,10 +2218,7 @@ impl SslContext {
22182218
{
22192219
unsafe {
22202220
ffi::init();
2221-
#[cfg(boringssl)]
22222221
let idx = cvt_n(get_new_idx(Some(free_data_box::<T>)))?;
2223-
#[cfg(not(boringssl))]
2224-
let idx = cvt_n(get_new_idx(free_data_box::<T>))?;
22252222
Ok(Index::from_raw(idx))
22262223
}
22272224
}
@@ -2679,10 +2676,7 @@ impl Ssl {
26792676
{
26802677
unsafe {
26812678
ffi::init();
2682-
#[cfg(boringssl)]
26832679
let idx = cvt_n(get_new_ssl_idx(Some(free_data_box::<T>)))?;
2684-
#[cfg(not(boringssl))]
2685-
let idx = cvt_n(get_new_ssl_idx(free_data_box::<T>))?;
26862680
Ok(Index::from_raw(idx))
26872681
}
26882682
}
@@ -5002,7 +4996,7 @@ cfg_if! {
50024996
ptr::null_mut(),
50034997
None,
50044998
None,
5005-
Some(f),
4999+
f,
50065000
)
50075001
}
50085002

@@ -5013,7 +5007,7 @@ cfg_if! {
50135007
ptr::null_mut(),
50145008
None,
50155009
None,
5016-
Some(f),
5010+
f,
50175011
)
50185012
}
50195013
} else {

0 commit comments

Comments
 (0)