diff --git a/openssl-sys/build.rs b/openssl-sys/build.rs index 0388a184..e7fb3ac1 100644 --- a/openssl-sys/build.rs +++ b/openssl-sys/build.rs @@ -19,19 +19,13 @@ fn main() { if target.contains("win32") || target.contains("win64") || target.contains("windows") { println!("cargo:rustc-flags=-l crypto -l ssl -l gdi32 -l wsock32"); - // going to assume the user has a new version of openssl - build_old_openssl_shim(false, vec![]); - return; - } - - if let Ok(info) = pkg_config::Config::new().atleast_version("1.0.0").find("openssl") { - build_old_openssl_shim(false, info.include_paths); + build_old_openssl_shim(vec![]); return; } let err = match pkg_config::find_library("openssl") { Ok(info) => { - build_old_openssl_shim(true, info.include_paths); + build_old_openssl_shim(info.include_paths); return; } Err(err) => err, @@ -40,23 +34,19 @@ fn main() { // pkg-config doesn't know of OpenSSL on FreeBSD 10.1 and OpenBSD uses LibreSSL if target.contains("bsd") { println!("cargo:rustc-flags=-l crypto -l ssl"); - // going to assume the base system includes a new version of openssl - build_old_openssl_shim(false, vec![]); + build_old_openssl_shim(vec![]); return; } panic!("unable to find openssl: {}", err); } -fn build_old_openssl_shim(is_old: bool, include_paths: Vec) { +fn build_old_openssl_shim(include_paths: Vec) { let mut config = gcc::Config::new(); for path in include_paths { config.include(path); } - if is_old { - config.define("OLD_OPENSSL", None); - } config.file("src/old_openssl_shim.c") .compile("libold_openssl_shim.a"); diff --git a/openssl-sys/src/old_openssl_shim.c b/openssl-sys/src/old_openssl_shim.c index 473bd2ae..19ce74fc 100644 --- a/openssl-sys/src/old_openssl_shim.c +++ b/openssl-sys/src/old_openssl_shim.c @@ -1,6 +1,6 @@ #include -#ifdef OLD_OPENSSL +#if OPENSSL_VERSION_NUMBER < 0x1000000L // Copied from openssl crypto/hmac/hmac.c int HMAC_CTX_copy(HMAC_CTX *dctx, HMAC_CTX *sctx) { @@ -33,7 +33,7 @@ int HMAC_Final_shim(HMAC_CTX *ctx, unsigned char *md, unsigned int *len) { return 1; } -#else /* OLD_OPENSSL */ +#else int HMAC_Init_ex_shim(HMAC_CTX *ctx, const void *key, int key_len, const EVP_MD *md, ENGINE *impl) { return HMAC_Init_ex(ctx, key, key_len, md, impl); @@ -46,4 +46,4 @@ int HMAC_Update_shim(HMAC_CTX *ctx, const unsigned char *data, int len) { int HMAC_Final_shim(HMAC_CTX *ctx, unsigned char *md, unsigned int *len) { return HMAC_Final(ctx, md, len); } -#endif /* OLD_OPENSSL */ +#endif