diff options
Diffstat (limited to 'openpgp/build.rs')
-rw-r--r-- | openpgp/build.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/openpgp/build.rs b/openpgp/build.rs index aabf157d..9de8fb76 100644 --- a/openpgp/build.rs +++ b/openpgp/build.rs @@ -6,10 +6,23 @@ use std::process::exit; fn main() { crypto_backends_sanity_check(); + include_openssl_conf(); lalrpop::process_root().unwrap(); include_test_data().unwrap(); } +/// Optionally include configuration passed from openssl-sys build +/// script. This configuration is then exposed as a set of `osslconf` +/// parameters and is used by OpenSSL backend to enable or disable +/// algorithms available by the current environment. +fn include_openssl_conf() { + if let Ok(vars) = env::var("DEP_OPENSSL_CONF") { + for var in vars.split(',') { + println!("cargo:rustc-cfg=osslconf=\"{}\"", var); + } + } +} + /// Builds the index of the test data for use with the `::tests` /// module. fn include_test_data() -> io::Result<()> { @@ -68,6 +81,12 @@ fn crypto_backends_sanity_check() { production_ready: false, constant_time: false, }), + (cfg!(feature = "crypto-openssl"), + Backend { + name: "OpenSSL", + production_ready: true, + constant_time: true, + }), ].into_iter().filter_map(|(selected, backend)| { if selected { Some(backend) } else { None } }).collect::<Vec<_>>(); |