diff options
author | Wiktor Kwapisiewicz <wiktor@metacode.biz> | 2022-10-03 11:51:41 +0200 |
---|---|---|
committer | Wiktor Kwapisiewicz <wiktor@metacode.biz> | 2022-12-22 12:46:08 +0100 |
commit | 0d0d757f90b8b49010f998435a7e295cc0719ed2 (patch) | |
tree | e064d21b27c08b7e3371a5e51e30ba92da999381 /openpgp/build.rs | |
parent | 31564c1c6e5b5ff4ff3596bb755ba2f7395f83df (diff) |
openpgp: Add OpenSSL cryptographic backend.
- Adds the backend behind `crypto-openssl` feature.
- Add CI configuration to run tests with the new backend.
- See #333.
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<_>>(); |