summaryrefslogtreecommitdiffstats
path: root/openpgp/src/crypto/backend.rs
blob: 03c142ea267ec9bd928cc323bbe5420dba230d55 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
//! Concrete implementation of the crypto primitives used by the rest of the
//! crypto API.

pub(crate) mod interface;
pub(crate) mod sha1cd;

// Nettle is the default backend, but on Windows targets we instead
// enable CNG for running the tests in non-leaf crates that depend on
// sequoia-openpgp.  This creates a conflict, and makes `cargo test`
// fail.  To mitigate this, only enable the Nettle backend if we are
// not compiling the tests and have a different backend selected.
//
// Note: If you add a new crypto backend, add it to the expression,
// and also synchronize the expression to `build.rs`.
#[cfg(all(feature = "crypto-nettle",
          not(all(feature = "__implicit-crypto-backend-for-tests",
                  any(feature = "crypto-openssl",
                      feature = "crypto-botan",
                      feature = "crypto-botan2",
                      feature = "crypto-rust")))))]
mod nettle;
#[cfg(all(feature = "crypto-nettle",
          not(all(feature = "__implicit-crypto-backend-for-tests",
                  any(feature = "crypto-openssl",
                      feature = "crypto-botan",
                      feature = "crypto-botan2",
                      feature = "crypto-rust")))))]
pub use self::nettle::*;
#[cfg(all(feature = "crypto-nettle",
          not(all(feature = "__implicit-crypto-backend-for-tests",
                  any(feature = "crypto-openssl",
                      feature = "crypto-botan",
                      feature = "crypto-rust")))))]
pub use self::nettle::Backend;

// Nettle is the default backend, but on Windows targets we instead
// enable CNG for running the tests in non-leaf crates that depend on
// sequoia-openpgp.  This creates a conflict, and makes `cargo test`
// fail.  To mitigate this, only enable the CNG backend if we are
// not compiling the tests and have a different backend selected.
//
// Note: If you add a new crypto backend, add it to the expression,
// and also synchronize the expression to `build.rs`.
#[cfg(all(feature = "crypto-cng",
          not(all(feature = "__implicit-crypto-backend-for-tests",
                  any(feature = "crypto-nettle",
                      feature = "crypto-openssl",
                      feature = "crypto-botan",
                      feature = "crypto-botan2",
                      feature = "crypto-rust")))))]
mod cng;
#[cfg(all(feature = "crypto-cng",
          not(all(feature = "__implicit-crypto-backend-for-tests",
                  any(feature = "crypto-nettle",
                      feature = "crypto-openssl",
                      feature = "crypto-botan",
                      feature = "crypto-botan2",
                      feature = "crypto-rust")))))]
pub use self::cng::*;
#[cfg(all(feature = "crypto-cng",
          not(all(feature = "__implicit-crypto-backend-for-tests",
                  any(feature = "crypto-nettle",
                      feature = "crypto-openssl",
                      feature = "crypto-botan",
                      feature = "crypto-rust")))))]
pub use self::cng::Backend;

#[cfg(feature = "crypto-rust")]
mod rust;
#[cfg(feature = "crypto-rust")]
pub use self::rust::*;
#[cfg(feature = "crypto-rust")]
pub use self::rust::Backend;

#[cfg(feature = "crypto-openssl")]
mod openssl;
#[cfg(feature = "crypto-openssl")]
pub use self::openssl::*;
#[cfg(feature = "crypto-openssl")]
pub use self::openssl::Backend;

#[cfg(any(feature = "crypto-botan", feature = "crypto-botan2"))]
mod botan;
#[cfg(any(feature = "crypto-botan", feature = "crypto-botan2"))]
pub use self::botan::*;
#[cfg(feature = "crypto-botan")]
pub use self::botan::Backend;