summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@pep.foundation>2023-04-28 11:36:55 +0200
committerNeal H. Walfield <neal@pep.foundation>2023-05-03 12:37:02 +0200
commit4980fd66a7e7db7d7b91f86a7ae1af42b6245478 (patch)
treec29ef04192e1454ab72a287bf7d7dec45ef8d110
parentec4d690dd5f96eccd438b548ccc1264a3e5089b4 (diff)
openpgp: Update win-crypto-ng to 0.5
- Fixes #1014
-rw-r--r--Cargo.lock61
-rw-r--r--openpgp/Cargo.toml7
-rw-r--r--openpgp/NEWS2
-rw-r--r--openpgp/src/crypto/backend/cng/aead.rs13
4 files changed, 60 insertions, 23 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 77c485ba..37f47906 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -25,7 +25,7 @@ checksum = "884391ef1066acaa41e766ba8f596341b96e93ce34f9a43e7d24bf0a0eaf0561"
dependencies = [
"aes-soft",
"aesni",
- "cipher",
+ "cipher 0.2.5",
]
[[package]]
@@ -34,7 +34,7 @@ version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be14c7498ea50828a38d0e24a765ed2effe92a705885b57d029cd67d45744072"
dependencies = [
- "cipher",
+ "cipher 0.2.5",
"opaque-debug",
]
@@ -44,7 +44,7 @@ version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea2e11f5e94c2f7d386164cc2aa1f97823fed6f259e486940a71c174dd01b0ce"
dependencies = [
- "cipher",
+ "cipher 0.2.5",
"opaque-debug",
]
@@ -193,7 +193,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57a0e8073e8baa88212fb5823574c02ebccb395136ba9a164ab89379ec6072f0"
dependencies = [
"block-padding",
- "cipher",
+ "cipher 0.2.5",
]
[[package]]
@@ -209,7 +209,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32fa6a061124e37baba002e496d203e23ba3d7b73750be82dbfbc92913048a5b"
dependencies = [
"byteorder",
- "cipher",
+ "cipher 0.2.5",
"opaque-debug",
]
@@ -332,7 +332,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1285caf81ea1f1ece6b24414c521e625ad0ec94d880625c20f2e65d8d3f78823"
dependencies = [
"byteorder",
- "cipher",
+ "cipher 0.2.5",
"opaque-debug",
]
@@ -382,6 +382,16 @@ dependencies = [
]
[[package]]
+name = "cipher"
+version = "0.4.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad"
+dependencies = [
+ "crypto-common",
+ "inout",
+]
+
+[[package]]
name = "clang-sys"
version = "1.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -575,12 +585,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7"
[[package]]
+name = "crypto-common"
+version = "0.1.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3"
+dependencies = [
+ "generic-array",
+ "typenum",
+]
+
+[[package]]
name = "crypto-mac"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bff07008ec701e8028e2ceb8f83f0e4274ee62bd2dbdc4fefff2e9a91824081a"
dependencies = [
- "cipher",
+ "cipher 0.2.5",
"generic-array",
"subtle",
]
@@ -633,7 +653,7 @@ version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb4a30d54f7443bf3d6191dcd486aca19e67cb3c49fa7a06a319966346707e7f"
dependencies = [
- "cipher",
+ "cipher 0.2.5",
]
[[package]]
@@ -725,7 +745,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b24e7c748888aa2fa8bce21d8c64a52efc810663285315ac7476f7197a982fae"
dependencies = [
"byteorder",
- "cipher",
+ "cipher 0.2.5",
"opaque-debug",
]
@@ -804,7 +824,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1f76e7a5e594b299a0fa9a99de627530725e341df41376aa342aecb2c5eb76e"
dependencies = [
"aead",
- "cipher",
+ "cipher 0.2.5",
"cmac",
"ctr",
"subtle",
@@ -1315,7 +1335,7 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fcdd4b114cf2265123bbdc5d32a39f96a343fbdf141267d2b5232b7e14caacb3"
dependencies = [
- "cipher",
+ "cipher 0.2.5",
"opaque-debug",
]
@@ -1341,6 +1361,15 @@ dependencies = [
]
[[package]]
+name = "inout"
+version = "0.1.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5"
+dependencies = [
+ "generic-array",
+]
+
+[[package]]
name = "instant"
version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2422,7 +2451,7 @@ dependencies = [
"bzip2",
"cast5",
"chrono",
- "cipher",
+ "cipher 0.2.5",
"criterion",
"des",
"digest",
@@ -2964,7 +2993,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0028f5982f23ecc9a1bc3008ead4c664f843ed5d78acd3d213b99ff50c441bc2"
dependencies = [
"byteorder",
- "cipher",
+ "cipher 0.2.5",
"opaque-debug",
]
@@ -3142,11 +3171,11 @@ checksum = "17882f045410753661207383517a6f62ec3dbeb6a4ed2acce01f0728238d1983"
[[package]]
name = "win-crypto-ng"
-version = "0.4.0"
+version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "24cf92e98e8f4ade45b5140795415a0f256fd9b69a1919248dcda11ba5d6466c"
+checksum = "aea60789d46dc8aa7d41758143c1b7dc2d6101a421712f88716a9646da2a4e39"
dependencies = [
- "cipher",
+ "cipher 0.4.4",
"doc-comment",
"rand_core 0.5.1",
"winapi",
diff --git a/openpgp/Cargo.toml b/openpgp/Cargo.toml
index 39b56b3d..7cb210a6 100644
--- a/openpgp/Cargo.toml
+++ b/openpgp/Cargo.toml
@@ -85,7 +85,7 @@ typenum = { version = "1.12.0", optional = true }
x25519-dalek = { version = "1.1.0", optional = true }
[target.'cfg(windows)'.dependencies]
-win-crypto-ng = { version = "0.4", features = ["rand", "block-cipher"], optional = true }
+win-crypto-ng = { version = ">=0.4, <0.6", features = ["rand", "block-cipher"], optional = true }
winapi = { version = "0.3.8", default-features = false, features = ["bcrypt"], optional = true }
[target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dependencies]
@@ -112,7 +112,10 @@ crypto-rust = [
"ripemd160", "rsa", "sha-1", "sha2", "twofish", "typenum", "x25519-dalek", "p256",
"rand_core", "rand_core/getrandom", "ecdsa"
]
-crypto-cng = ["eax", "winapi", "win-crypto-ng", "ed25519-dalek", "num-bigint-dig"]
+crypto-cng = [
+ "cipher", "eax", "winapi", "win-crypto-ng", "ed25519-dalek",
+ "num-bigint-dig"
+]
crypto-openssl = ["openssl", "openssl-sys", "foreign-types-shared"]
crypto-botan = ["botan"]
__implicit-crypto-backend-for-tests = []
diff --git a/openpgp/NEWS b/openpgp/NEWS
index 47c30f4c..5ee14de4 100644
--- a/openpgp/NEWS
+++ b/openpgp/NEWS
@@ -6,6 +6,8 @@
* Changes in 1.15.0
** New functionality
- StandardPolicy::accept_hash_property
+ * Notable changes
+ - Updated the crypto-cng backend.
* Changes in 1.14.0
** New cryptographic backends
- We added a backend that uses Botan.
diff --git a/openpgp/src/crypto/backend/cng/aead.rs b/openpgp/src/crypto/backend/cng/aead.rs
index a3aaefb4..9659812f 100644
--- a/openpgp/src/crypto/backend/cng/aead.rs
+++ b/openpgp/src/crypto/backend/cng/aead.rs
@@ -7,10 +7,11 @@ use crate::crypto::mem::secure_cmp;
use crate::seal;
use crate::types::{AEADAlgorithm, SymmetricAlgorithm};
+use cipher::generic_array::{GenericArray, ArrayLength};
+use cipher::generic_array::typenum::{U16, U128, U192, U256};
+use cipher::Unsigned;
use eax::online::{Eax, Encrypt, Decrypt};
use win_crypto_ng::symmetric::{BlockCipherKey, Aes};
-use win_crypto_ng::symmetric::block_cipher::generic_array::{GenericArray, ArrayLength};
-use win_crypto_ng::symmetric::block_cipher::generic_array::typenum::{U128, U192, U256};
/// Disables authentication checks.
///
@@ -110,12 +111,14 @@ impl AEADAlgorithm {
}
}
+type EaxTagLen = U16;
+
macro_rules! impl_aead {
($($type: ty),*) => {
$(
- impl Aead for Eax<$type, Encrypt> {
+ impl Aead for Eax<$type, Encrypt, EaxTagLen> {
fn digest_size(&self) -> usize {
- <eax::Tag as GenericArrayExt<_, _>>::LEN
+ EaxTagLen::USIZE
}
fn encrypt_seal(&mut self, dst: &mut [u8], src: &[u8]) -> Result<()> {
debug_assert_eq!(dst.len(), src.len() + self.digest_size());
@@ -136,7 +139,7 @@ macro_rules! impl_aead {
$(
impl Aead for Eax<$type, Decrypt> {
fn digest_size(&self) -> usize {
- <eax::Tag as GenericArrayExt<_, _>>::LEN
+ EaxTagLen::USIZE
}
fn encrypt_seal(&mut self, _dst: &mut [u8], _src: &[u8]) -> Result<()> {
panic!("AEAD encryption called in the decryption context")