diff options
author | Igor Matuszewski <igor@sequoia-pgp.org> | 2020-04-10 18:30:06 +0200 |
---|---|---|
committer | Igor Matuszewski <igor@sequoia-pgp.org> | 2020-08-13 13:09:51 +0200 |
commit | 38fc08906e0152085af7f9b35a2038f317be087e (patch) | |
tree | 26f8b49111c2ace00fe4713f41ff448d9ed15000 | |
parent | 3cbf53d72f01c269072778d383aafcebd97b708c (diff) |
openpgp: Add Windows CNG crypto backend via crypto-cng feature
-rw-r--r-- | Cargo.lock | 25 | ||||
-rw-r--r-- | openpgp/Cargo.toml | 4 | ||||
-rw-r--r-- | openpgp/src/crypto/backend.rs | 5 | ||||
-rw-r--r-- | openpgp/src/crypto/backend/cng.rs | 2 |
4 files changed, 36 insertions, 0 deletions
@@ -506,6 +506,11 @@ dependencies = [ ] [[package]] +name = "doc-comment" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] name = "docopt" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1777,6 +1782,7 @@ dependencies = [ "rpassword 4.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "thiserror 1.0.20 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-normalization 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "win-crypto-ng 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2399,6 +2405,17 @@ version = "0.9.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] +name = "win-crypto-ng" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "doc-comment 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "zeroize 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] name = "winapi" version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2441,6 +2458,11 @@ name = "zbase32" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "zeroize" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [metadata] "checksum adler32 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234" "checksum aho-corasick 0.7.13 (registry+https://github.com/rust-lang/crates.io-index)" = "043164d8ba5c4c3035fec9bbee8647c0261d788f3474306f93bb65901cae0e86" @@ -2501,6 +2523,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum dirs 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3fd78930633bd1c6e35c4b42b1df7b0cbc6bc191146e512bb3bedf243fcc3901" "checksum dirs 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "13aea89a5c93364a98e9b37b2fa237effbb694d5cfe01c5b70941f7eb087d5e3" "checksum dirs-sys 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "8e93d7f5705de3e49895a2b5e0b8855a1c27f080192ae9c32a6432d50741a57a" +"checksum doc-comment 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" "checksum docopt 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7f525a586d310c87df72ebcd98009e57f1cc030c8c268305287a476beb653969" "checksum dyn-clone 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b3ec9c7fb9a2ce708751c98e31ccbae74b6ab194f5c8e30cfb7ed62e38b70866" "checksum either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3" @@ -2689,6 +2712,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum version_check 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed" "checksum want 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b6395efa4784b027708f7451087e647ec73cc74f5d9bc2e418404248d679a230" "checksum wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)" = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" +"checksum win-crypto-ng 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0367c5be0cae776bb7002523f600c4f9647cef383ca8e54695475e15a0480d87" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" "checksum winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" @@ -2696,3 +2720,4 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" "checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" "checksum zbase32 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9079049688da5871a7558ddacb7f04958862c703e68258594cb7a862b5e33f" +"checksum zeroize 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3cbac2ed2ba24cc90f5e06485ac8c7c1e5449fe8911aef4d8877218af021a5b8" diff --git a/openpgp/Cargo.toml b/openpgp/Cargo.toml index baf78289..e4faece2 100644 --- a/openpgp/Cargo.toml +++ b/openpgp/Cargo.toml @@ -49,6 +49,9 @@ thiserror = "1" backtrace = "= 0.3.46" unicode-normalization = "= 0.1.9" +[target.'cfg(windows)'.dependencies] +win-crypto-ng = { version = "0.2", features = ["rand"], optional = true } + [build-dependencies] lalrpop = "0.17" @@ -65,6 +68,7 @@ rpassword = "=4.0.3" default = ["compression", "crypto-nettle"] # TODO(#333): Allow for/implement more backends crypto-nettle = ["nettle"] +crypto-cng = ["win-crypto-ng"] # The compression algorithms. compression = ["compression-deflate", "compression-bzip2"] diff --git a/openpgp/src/crypto/backend.rs b/openpgp/src/crypto/backend.rs index 2a57889f..abd7d53c 100644 --- a/openpgp/src/crypto/backend.rs +++ b/openpgp/src/crypto/backend.rs @@ -5,3 +5,8 @@ mod nettle; #[cfg(feature = "crypto-nettle")] pub use self::nettle::*; + +#[cfg(feature = "crypto-cng")] +mod cng; +#[cfg(feature = "crypto-cng")] +pub use self::cng::*; diff --git a/openpgp/src/crypto/backend/cng.rs b/openpgp/src/crypto/backend/cng.rs new file mode 100644 index 00000000..96c6a1c4 --- /dev/null +++ b/openpgp/src/crypto/backend/cng.rs @@ -0,0 +1,2 @@ +//! Implementation of crypto primitives using the Windows CNG (Cryptographic API: Next Generation). + |