Correctly bind BIO_new_mem_buf
This commit is contained in:
parent
d7501d4285
commit
228b8fbc5b
|
|
@ -344,6 +344,9 @@ extern {
|
|||
pub fn BIO_new_socket(sock: c_int, close_flag: c_int) -> *mut BIO;
|
||||
pub fn BIO_read(b: *mut BIO, buf: *mut c_void, len: c_int) -> c_int;
|
||||
pub fn BIO_write(b: *mut BIO, buf: *const c_void, len: c_int) -> c_int;
|
||||
#[cfg(ossl101)]
|
||||
pub fn BIO_new_mem_buf(buf: *mut c_void, len: c_int) -> *mut BIO;
|
||||
#[cfg(not(ossl101))]
|
||||
pub fn BIO_new_mem_buf(buf: *const c_void, len: c_int) -> *mut BIO;
|
||||
pub fn BIO_set_flags(b: *mut BIO, flags: c_int);
|
||||
pub fn BIO_clear_flags(b: *mut BIO, flags: c_int);
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ impl<'a> MemBioSlice<'a> {
|
|||
|
||||
assert!(buf.len() <= c_int::max_value() as usize);
|
||||
let bio = unsafe {
|
||||
try_ssl_null!(ffi::BIO_new_mem_buf(buf.as_ptr() as *const _, buf.len() as c_int))
|
||||
try_ssl_null!(BIO_new_mem_buf(buf.as_ptr() as *const _, buf.len() as c_int))
|
||||
};
|
||||
|
||||
Ok(MemBioSlice(bio, PhantomData))
|
||||
|
|
@ -65,3 +65,12 @@ impl MemBio {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(ossl101))]
|
||||
use ffi::BIO_new_mem_buf;
|
||||
|
||||
#[cfg(ossl101)]
|
||||
#[allow(bad_style)]
|
||||
unsafe fn BIO_new_mem_buf(buf: *const ::libc::c_void, len: ::libc::c_int) -> *mut ffi::BIO {
|
||||
ffi::BIO_new_mem_buf(buf as *mut _, len)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,10 +81,6 @@ fn main() {
|
|||
s == "X509V3_EXT_conf_nid" || // weird lhash first param
|
||||
s == "X509V3_EXT_conf" || // weird lhash first param
|
||||
|
||||
// one parameter is `const` in OpenSSL 1.0.1, no need for a new
|
||||
// definition or a new file here.
|
||||
(s == "BIO_new_mem_buf" && env::var("DEP_OPENSSL_IS_101").is_ok()) ||
|
||||
|
||||
// Skip some functions with function pointers on windows, not entirely
|
||||
// sure how to get them to work out...
|
||||
(target.contains("windows") && {
|
||||
|
|
|
|||
Loading…
Reference in New Issue