aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Fackler <[email protected]>2015-02-13 21:13:27 -0800
committerSteven Fackler <[email protected]>2015-02-13 21:39:41 -0800
commit15ff737b8c625cb5821f9644bb00ff7f952f7eaa (patch)
tree04285a0ab9f554fe55dbc1740ff1ffdc05d36cf9
parentOops, pass include dirs through for 1.0.0 versions too (diff)
downloadrust-openssl-15ff737b8c625cb5821f9644bb00ff7f952f7eaa.tar.xz
rust-openssl-15ff737b8c625cb5821f9644bb00ff7f952f7eaa.zip
Ask openssl what version it is
-rw-r--r--openssl-sys/build.rs18
-rw-r--r--openssl-sys/src/old_openssl_shim.c6
2 files changed, 7 insertions, 17 deletions
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<Path>) {
+fn build_old_openssl_shim(include_paths: Vec<Path>) {
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 <openssl/hmac.h>
-#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