Fix build
This commit is contained in:
parent
00db0bc4b3
commit
35c79d1768
|
|
@ -717,8 +717,6 @@ extern "C" {
|
|||
#[cfg(feature = "rfc5114")]
|
||||
pub fn DH_get_2048_256() -> *mut DH;
|
||||
|
||||
pub fn DH_new_from_params(p: *mut BIGNUM, g: *mut BIGNUM, q: *mut BIGNUM) -> *mut DH;
|
||||
|
||||
pub fn ERR_get_error() -> c_ulong;
|
||||
|
||||
pub fn ERR_lib_error_string(err: c_ulong) -> *const c_char;
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ x509_clone = ["c_helpers"]
|
|||
x509_generator_request = ["c_helpers"]
|
||||
ssl_context_clone = ["c_helpers"]
|
||||
hmac = ["c_helpers"]
|
||||
dh_from_params = ["c_helpers"]
|
||||
|
||||
[dependencies]
|
||||
bitflags = ">= 0.5.0, < 0.8.0"
|
||||
|
|
|
|||
|
|
@ -15,6 +15,18 @@ STACK_OF(X509_EXTENSION) *rust_X509_get_extensions(X509 *x) {
|
|||
return x->cert_info ? x->cert_info->extensions : NULL;
|
||||
}
|
||||
|
||||
DH *rust_DH_new_from_params(BIGNUM *p, BIGNUM *g, BIGNUM *q) {
|
||||
DH *dh;
|
||||
|
||||
if ((dh = DH_new()) == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
dh->p = p;
|
||||
dh->g = g;
|
||||
dh->q = q;
|
||||
return dh;
|
||||
}
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER < 0x10000000L
|
||||
int rust_HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int key_len, const EVP_MD *md, ENGINE *impl) {
|
||||
HMAC_Init_ex(ctx, key, key_len, md, impl);
|
||||
|
|
|
|||
|
|
@ -10,4 +10,5 @@ extern "C" {
|
|||
pub fn rust_HMAC_Init_ex(ctx: *mut ffi::HMAC_CTX, key: *const c_void, keylen: c_int, md: *const ffi::EVP_MD, impl_: *mut ffi::ENGINE) -> c_int;
|
||||
pub fn rust_HMAC_Final(ctx: *mut ffi::HMAC_CTX, output: *mut c_uchar, len: *mut c_uint) -> c_int;
|
||||
pub fn rust_HMAC_Update(ctx: *mut ffi::HMAC_CTX, input: *const c_uchar, len: c_uint) -> c_int;
|
||||
pub fn rust_DH_new_from_params(p: *mut ffi::BIGNUM, g: *mut ffi::BIGNUM, q: *mut ffi::BIGNUM) -> *mut ffi::DH;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,9 +7,11 @@ use std::ptr;
|
|||
pub struct DH(*mut ffi::DH);
|
||||
|
||||
impl DH {
|
||||
/// Requires the `dh_from_params` feature.
|
||||
#[cfg(feature = "dh_from_params")]
|
||||
pub fn from_params(p: BigNum, g: BigNum, q: BigNum) -> Result<DH, ErrorStack> {
|
||||
let dh = unsafe {
|
||||
try_ssl_null!(ffi::DH_new_from_params(p.into_raw(), g.into_raw(), q.into_raw()))
|
||||
try_ssl_null!(::c_helpers::rust_DH_new_from_params(p.into_raw(), g.into_raw(), q.into_raw()))
|
||||
};
|
||||
Ok(DH(dh))
|
||||
}
|
||||
|
|
@ -75,6 +77,7 @@ mod tests {
|
|||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(feature = "dh_from_params")]
|
||||
fn test_dh() {
|
||||
let mut ctx = SslContext::new(Sslv23).unwrap();
|
||||
let p = BigNum::from_hex_str("87A8E61DB4B6663CFFBBD19C651959998CEEF608660DD0F25D2CEED4435\
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ set -e
|
|||
MAIN_TARGETS=https://static.rust-lang.org/dist
|
||||
|
||||
if [ "$TEST_FEATURES" == "true" ]; then
|
||||
FEATURES="tlsv1_2 tlsv1_1 dtlsv1 dtlsv1_2 sslv3 aes_xts aes_ctr npn alpn rfc5114 ecdh_auto pkcs5_pbkdf2_hmac x509_clone ssl_context_clone x509_generator_request hmac hmac_clone"
|
||||
FEATURES="tlsv1_2 tlsv1_1 dtlsv1 dtlsv1_2 sslv3 aes_xts aes_ctr npn alpn rfc5114 ecdh_auto pkcs5_pbkdf2_hmac x509_clone ssl_context_clone x509_generator_request hmac hmac_clone dh_from_params"
|
||||
fi
|
||||
|
||||
if [ "$TRAVIS_OS_NAME" != "osx" ]; then
|
||||
|
|
|
|||
Loading…
Reference in New Issue