diff options
| author | Steven Fackler <[email protected]> | 2018-06-09 21:33:35 -0700 |
|---|---|---|
| committer | Steven Fackler <[email protected]> | 2018-06-09 21:49:36 -0700 |
| commit | 115cb730b0ec9a2010d7a803586a7fcce214cb83 (patch) | |
| tree | a9559c3a76b3b8e1ce43f065eb571eb48e742d0e /openssl-sys | |
| parent | Merge pull request #936 from sfackler/windows-static (diff) | |
| download | rust-openssl-115cb730b0ec9a2010d7a803586a7fcce214cb83.tar.xz rust-openssl-115cb730b0ec9a2010d7a803586a7fcce214cb83.zip | |
Switch to accessors in libressl where possible
Some accessors are mysteriously still macros so we can't make everything
opaque yet, unfortunately.
cc #909
Diffstat (limited to 'openssl-sys')
| -rw-r--r-- | openssl-sys/build/cfgs.rs | 3 | ||||
| -rw-r--r-- | openssl-sys/src/lib.rs | 2 | ||||
| -rw-r--r-- | openssl-sys/src/libressl/mod.rs | 4 | ||||
| -rw-r--r-- | openssl-sys/src/libressl/v273.rs | 106 |
4 files changed, 114 insertions, 1 deletions
diff --git a/openssl-sys/build/cfgs.rs b/openssl-sys/build/cfgs.rs index 4648f6f5..1634da6b 100644 --- a/openssl-sys/build/cfgs.rs +++ b/openssl-sys/build/cfgs.rs @@ -13,6 +13,9 @@ pub fn get(openssl_version: Option<u64>, libressl_version: Option<u64>) -> Vec<& if libressl_version >= 0x2_07_00_00_0 { cfgs.push("libressl270"); } + if libressl_version >= 0x2_07_03_00_0 { + cfgs.push("libressl273"); + } } else { let openssl_version = openssl_version.unwrap(); diff --git a/openssl-sys/src/lib.rs b/openssl-sys/src/lib.rs index aaeb9713..c70d6a26 100644 --- a/openssl-sys/src/lib.rs +++ b/openssl-sys/src/lib.rs @@ -2616,7 +2616,7 @@ extern "C" { pub fn SSL_set_session(ssl: *mut SSL, session: *mut SSL_SESSION) -> c_int; #[cfg(all(ossl102, not(ossl110f)))] pub fn SSL_is_server(s: *mut SSL) -> c_int; - #[cfg(ossl110f)] + #[cfg(any(ossl110f, libressl273))] pub fn SSL_is_server(s: *const SSL) -> c_int; pub fn SSL_get_finished(s: *const SSL, buf: *mut c_void, count: size_t) -> size_t; pub fn SSL_get_peer_finished(s: *const SSL, buf: *mut c_void, count: size_t) -> size_t; diff --git a/openssl-sys/src/libressl/mod.rs b/openssl-sys/src/libressl/mod.rs index 0080fc7d..c65f6464 100644 --- a/openssl-sys/src/libressl/mod.rs +++ b/openssl-sys/src/libressl/mod.rs @@ -8,11 +8,15 @@ use std::sync::{Once, ONCE_INIT}; pub use libressl::v250::*; #[cfg(libressl251)] pub use libressl::v251::*; +#[cfg(libressl273)] +pub use libressl::v273::*; #[cfg(not(libressl251))] mod v250; #[cfg(libressl251)] mod v251; +#[cfg(libressl273)] +mod v273; #[repr(C)] pub struct stack_st_ASN1_OBJECT { diff --git a/openssl-sys/src/libressl/v273.rs b/openssl-sys/src/libressl/v273.rs new file mode 100644 index 00000000..74c331f6 --- /dev/null +++ b/openssl-sys/src/libressl/v273.rs @@ -0,0 +1,106 @@ +use libc::{c_char, c_int, c_long, c_uchar, c_void, size_t}; + +extern "C" { + pub fn ASN1_STRING_get0_data(x: *const ::ASN1_STRING) -> *const c_uchar; + + pub fn BIO_set_init(a: *mut ::BIO, init: c_int); + pub fn BIO_set_data(a: *mut ::BIO, data: *mut c_void); + pub fn BIO_get_data(a: *mut ::BIO) -> *mut c_void; + pub fn BIO_meth_new(type_: c_int, name: *const c_char) -> *mut ::BIO_METHOD; + pub fn BIO_meth_free(biom: *mut ::BIO_METHOD); + // FIXME should wrap in Option + pub fn BIO_meth_set_write( + biom: *mut ::BIO_METHOD, + write: unsafe extern "C" fn(*mut ::BIO, *const c_char, c_int) -> c_int, + ) -> c_int; + pub fn BIO_meth_set_read( + biom: *mut ::BIO_METHOD, + read: unsafe extern "C" fn(*mut ::BIO, *mut c_char, c_int) -> c_int, + ) -> c_int; + pub fn BIO_meth_set_puts( + biom: *mut ::BIO_METHOD, + read: unsafe extern "C" fn(*mut ::BIO, *const c_char) -> c_int, + ) -> c_int; + pub fn BIO_meth_set_ctrl( + biom: *mut ::BIO_METHOD, + read: unsafe extern "C" fn(*mut ::BIO, c_int, c_long, *mut c_void) -> c_long, + ) -> c_int; + pub fn BIO_meth_set_create( + biom: *mut ::BIO_METHOD, + create: unsafe extern "C" fn(*mut ::BIO) -> c_int, + ) -> c_int; + pub fn BIO_meth_set_destroy( + biom: *mut ::BIO_METHOD, + destroy: unsafe extern "C" fn(*mut ::BIO) -> c_int, + ) -> c_int; + + pub fn DH_set0_pqg( + dh: *mut ::DH, + p: *mut ::BIGNUM, + q: *mut ::BIGNUM, + g: *mut ::BIGNUM, + ) -> c_int; + + pub fn DSA_get0_pqg( + d: *const ::DSA, + p: *mut *const ::BIGNUM, + q: *mut *const ::BIGNUM, + q: *mut *const ::BIGNUM, + ); + + pub fn ECDSA_SIG_get0( + sig: *const ::ECDSA_SIG, + pr: *mut *const ::BIGNUM, + ps: *mut *const ::BIGNUM, + ); + pub fn ECDSA_SIG_set0(sig: *mut ::ECDSA_SIG, pr: *mut ::BIGNUM, ps: *mut ::BIGNUM) -> c_int; + + pub fn EVP_CIPHER_key_length(cipher: *const ::EVP_CIPHER) -> c_int; + pub fn EVP_CIPHER_block_size(cipher: *const ::EVP_CIPHER) -> c_int; + pub fn EVP_CIPHER_iv_length(cipher: *const ::EVP_CIPHER) -> c_int; + + pub fn RSA_get0_key( + r: *const ::RSA, + n: *mut *const ::BIGNUM, + e: *mut *const ::BIGNUM, + d: *mut *const ::BIGNUM, + ); + pub fn RSA_get0_factors(r: *const ::RSA, p: *mut *const ::BIGNUM, q: *mut *const ::BIGNUM); + pub fn RSA_get0_crt_params( + r: *const ::RSA, + dmp1: *mut *const ::BIGNUM, + dmq1: *mut *const ::BIGNUM, + iqmp: *mut *const ::BIGNUM, + ); + pub fn RSA_set0_key( + r: *mut ::RSA, + n: *mut ::BIGNUM, + e: *mut ::BIGNUM, + d: *mut ::BIGNUM, + ) -> c_int; + pub fn RSA_set0_factors(r: *mut ::RSA, p: *mut ::BIGNUM, q: *mut ::BIGNUM) -> c_int; + pub fn RSA_set0_crt_params( + r: *mut ::RSA, + dmp1: *mut ::BIGNUM, + dmq1: *mut ::BIGNUM, + iqmp: *mut ::BIGNUM, + ) -> c_int; + + pub fn SSL_CTX_up_ref(x: *mut ::SSL_CTX) -> c_int; + + pub fn SSL_SESSION_get_master_key( + session: *const ::SSL_SESSION, + out: *mut c_uchar, + outlen: size_t, + ) -> size_t; + pub fn SSL_SESSION_up_ref(ses: *mut ::SSL_SESSION) -> c_int; + + pub fn X509_getm_notAfter(x: *const ::X509) -> *mut ::ASN1_TIME; + pub fn X509_getm_notBefore(x: *const ::X509) -> *mut ::ASN1_TIME; + pub fn X509_get0_signature( + psig: *mut *const ::ASN1_BIT_STRING, + palg: *mut *const ::X509_ALGOR, + x: *const ::X509, + ); + pub fn X509_up_ref(x: *mut ::X509) -> c_int; +} |