From 56dc42dc2f654b2e5b29d6cea39f13c6372e890e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodolphe=20Br=C3=A9ard?= Date: Sun, 13 Jun 2021 16:12:42 +0200 Subject: [PATCH] Allow Ed25519 and Ed448 only if supported --- acme_common/build.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/acme_common/build.rs b/acme_common/build.rs index beef778..d159ea9 100644 --- a/acme_common/build.rs +++ b/acme_common/build.rs @@ -6,15 +6,18 @@ macro_rules! set_rustc_env_var { }}; } +#[allow(clippy::unusual_byte_groupings)] fn main() { - if env::var("DEP_OPENSSL_VERSION_NUMBER").is_ok() { - println!("cargo:rustc-cfg=ed25519"); - println!("cargo:rustc-cfg=ed448"); + if let Ok(v) = env::var("DEP_OPENSSL_VERSION_NUMBER") { + let version = u64::from_str_radix(&v, 16).unwrap(); + // OpenSSL 1.1.1 + if version >= 0x1_01_01_00_0 { + println!("cargo:rustc-cfg=ed25519"); + println!("cargo:rustc-cfg=ed448"); + } set_rustc_env_var!("ACMED_TLS_LIB_NAME", "OpenSSL"); } if env::var("DEP_OPENSSL_LIBRESSL_VERSION_NUMBER").is_ok() { - println!("cargo:rustc-cfg=ed25519"); - println!("cargo:rustc-cfg=ed448"); set_rustc_env_var!("ACMED_TLS_LIB_NAME", "LibreSSL"); } }