Skip to content

Commit ce4f1da

Browse files
authored
Bump dependencies (#2148)
Updates the following dependencies: - `cipher` v0.5.0-rc.3 - `crypto-bigint` v0.7.0-rc.13 - `crypto-common` v0.2.0-rc.8 - `crypto-primes` (via git) - `digest` v0.11.0-rc.5 - `ecdsa` v0.17.0-rc.10 - `elliptic-curve` v0.14.0-rc.18 - `getrandom` v0.4.0-rc.0 - `p256` v0.14.0-rc.1 - `primefield` v0.14.0-rc.2 - `primeorder` v0.14.0-rc.2 - `rsa` (via git) - `signature` v3.0.0-rc.6 Notably this involved updating `cms` to use the new `Generate` trait
1 parent d9a7cd5 commit ce4f1da

5 files changed

Lines changed: 96 additions & 75 deletions

File tree

Cargo.lock

Lines changed: 43 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,6 @@ x509-tsp = { path = "./x509-tsp" }
6161
x509-cert = { path = "./x509-cert" }
6262
x509-ocsp = { path = "./x509-ocsp" }
6363

64+
crypto-primes = { git = "https://github.com/tarcieri/crypto-primes", branch = "crypto-bigint/v0.7.0-rc.13" }
6465
rand = { git = "https://github.com/rust-random/rand" }
66+
rsa = { git = "https://github.com/RustCrypto/RSA" }

cms/Cargo.toml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,27 +25,27 @@ aes = { version = "0.9.0-rc.2", optional = true }
2525
aes-kw = { version = "0.3.0-rc.1", optional = true }
2626
ansi-x963-kdf = { version = "0.1.0-rc.1", optional = true }
2727
cbc = { version = "0.2.0-rc.2", optional = true }
28-
cipher = { version = "0.5.0-rc.2", features = ["alloc", "block-padding", "rand_core"], optional = true }
29-
digest = { version = "0.11.0-rc.4", optional = true }
30-
elliptic-curve = { version = "0.14.0-rc.16", optional = true }
28+
cipher = { version = "0.5.0-rc.3", features = ["alloc", "block-padding", "rand_core"], optional = true }
29+
digest = { version = "0.11.0-rc.5", optional = true }
30+
elliptic-curve = { version = "0.14.0-rc.18", optional = true }
3131
rsa = { version = "0.10.0-rc.10", optional = true }
3232
sha1 = { version = "0.11.0-rc.3", optional = true }
3333
sha2 = { version = "0.11.0-rc.3", optional = true }
3434
sha3 = { version = "0.11.0-rc.3", optional = true }
35-
signature = { version = "3.0.0-rc.5", features = ["digest", "alloc"], optional = true }
35+
signature = { version = "3.0.0-rc.6", features = ["digest", "alloc"], optional = true }
3636
zeroize = { version = "1.8.1", optional = true }
3737

3838
[dev-dependencies]
3939
aes = "0.9.0-rc.2"
40-
getrandom = "0.3"
40+
getrandom = "0.4.0-rc.0"
4141
hex-literal = "1"
4242
pem-rfc7468 = "1"
4343
pkcs5 = "0.8.0-rc.10"
4444
pbkdf2 = "0.13.0-rc.2"
45-
rand = "0.10.0-rc.1"
45+
rand = "0.10.0-rc.5"
4646
rsa = { version = "0.10.0-rc.10", features = ["sha2"] }
47-
ecdsa = { version = "0.17.0-rc.6", features = ["digest", "pem"] }
48-
p256 = "0.14.0-rc.1"
47+
ecdsa = { version = "0.17.0-rc.9", features = ["digest", "pem"] }
48+
p256 = "0.14.0-rc.2"
4949
tokio = { version = "1.45.1", features = ["macros", "rt"] }
5050
x509-cert = { version = "0.3.0-rc.0", features = ["pem"] }
5151

cms/src/builder.rs

Lines changed: 40 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,41 @@
1-
#![cfg(feature = "builder")]
1+
//! Cryptographic Message Syntax Builder
22
3-
//! CMS Builder
3+
#![cfg(feature = "builder")]
44

5-
use crate::cert::CertificateChoices;
6-
use crate::content_info::{CmsVersion, ContentInfo};
7-
use crate::enveloped_data::{
8-
EncryptedContentInfo, EncryptedKey, EnvelopedData, KekIdentifier, KeyTransRecipientInfo,
9-
OriginatorInfo, PasswordRecipientInfo, RecipientIdentifier, RecipientInfo, RecipientInfos,
10-
UserKeyingMaterial,
11-
};
12-
use crate::revocation::{RevocationInfoChoice, RevocationInfoChoices};
13-
use crate::signed_data::{
14-
CertificateSet, DigestAlgorithmIdentifiers, EncapsulatedContentInfo, SignatureValue,
15-
SignedAttributes, SignedData, SignerIdentifier, SignerInfo, SignerInfos, UnsignedAttributes,
5+
use crate::{
6+
cert::CertificateChoices,
7+
content_info::{CmsVersion, ContentInfo},
8+
enveloped_data::{
9+
EncryptedContentInfo, EncryptedKey, EnvelopedData, KekIdentifier, KeyTransRecipientInfo,
10+
OriginatorInfo, PasswordRecipientInfo, RecipientIdentifier, RecipientInfo, RecipientInfos,
11+
UserKeyingMaterial,
12+
},
13+
revocation::{RevocationInfoChoice, RevocationInfoChoices},
14+
signed_data::{
15+
CertificateSet, DigestAlgorithmIdentifiers, EncapsulatedContentInfo, SignatureValue,
16+
SignedAttributes, SignedData, SignerIdentifier, SignerInfo, SignerInfos,
17+
UnsignedAttributes,
18+
},
1619
};
1720
use aes::{Aes128, Aes192, Aes256};
18-
use alloc::borrow::ToOwned;
19-
use alloc::boxed::Box;
20-
use alloc::string::{String, ToString};
21-
use alloc::vec::Vec;
21+
use alloc::{
22+
borrow::ToOwned,
23+
boxed::Box,
24+
string::{String, ToString},
25+
vec,
26+
vec::Vec,
27+
};
2228
use cipher::{
23-
BlockModeEncrypt, Key, KeyIvInit, KeySizeUser, block_padding::Pkcs7, rand_core::CryptoRng,
29+
BlockModeEncrypt, Iv, Key, KeyIvInit, block_padding::Pkcs7, crypto_common::Generate,
30+
rand_core::CryptoRng,
2431
};
2532
use const_oid::ObjectIdentifier;
26-
use core::cmp::Ordering;
27-
use core::fmt;
28-
use core::marker::PhantomData;
29-
use der::asn1::{BitString, Null, OctetString, OctetStringRef, SetOfVec};
30-
use der::oid::db::DB;
31-
use der::{Any, AnyRef, Decode, Encode, ErrorKind, Tag};
33+
use core::{cmp::Ordering, fmt, marker::PhantomData};
34+
use der::{
35+
Any, AnyRef, Decode, Encode, ErrorKind, Tag,
36+
asn1::{BitString, Null, OctetString, OctetStringRef, SetOfVec},
37+
oid::db::DB,
38+
};
3239
use digest::Digest;
3340
use rsa::Pkcs1v15Encrypt;
3441
use sha2::digest;
@@ -39,7 +46,6 @@ use spki::{
3946
AlgorithmIdentifierOwned, DynSignatureAlgorithmIdentifier, EncodePublicKey,
4047
SignatureBitStringEncoding,
4148
};
42-
use std::vec;
4349
use x509_cert::{
4450
attr::{Attribute, AttributeValue, Attributes},
4551
builder::{self, AsyncBuilder, Builder},
@@ -1172,18 +1178,16 @@ fn get_hasher(
11721178
macro_rules! encrypt_block_mode {
11731179
($data:expr, $block_mode:ident::$typ:ident<$alg:ident>, $key:expr, $rng:expr, $oid:expr) => {{
11741180
let (key, iv) = match $key {
1175-
None => $block_mode::$typ::<$alg>::generate_key_iv_with_rng($rng),
1181+
None => {
1182+
let key = Key::<$block_mode::$typ<$alg>>::generate_from_rng($rng);
1183+
let iv = Iv::<$block_mode::$typ<$alg>>::generate_from_rng($rng);
1184+
(key, iv)
1185+
}
11761186
Some(key) => {
1177-
if key.len() != $alg::key_size() {
1178-
return Err(Error::Builder(String::from(
1179-
"Invalid key size for chosen algorithm",
1180-
)));
1181-
}
1182-
(
1183-
Key::<$block_mode::$typ<$alg>>::try_from(key)
1184-
.expect("size invariants violation"),
1185-
$block_mode::$typ::<$alg>::generate_iv_with_rng($rng),
1186-
)
1187+
let key = Key::<$block_mode::$typ<$alg>>::try_from(key)
1188+
.map_err(|_| Error::Builder("invalid key size for chosen algorithm".into()))?;
1189+
let iv = Iv::<$block_mode::$typ<$alg>>::generate_from_rng($rng);
1190+
(key, iv)
11871191
}
11881192
};
11891193
let encryptor = $block_mode::$typ::<$alg>::new(&key.into(), &iv.into());

x509-cert/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ tls_codec = { version = "0.4", default-features = false, features = ["derive"],
2929

3030
[dev-dependencies]
3131
hex-literal = "1"
32-
rand = "0.10.0-rc.1"
32+
rand = "0.10.0-rc.5"
3333
rsa = { version = "0.10.0-rc.10", features = ["sha2"] }
34-
ecdsa = { version = "0.17.0-rc.6", features = ["digest", "pem"] }
35-
p256 = "0.14.0-rc.1"
34+
ecdsa = { version = "0.17.0-rc.9", features = ["digest", "pem"] }
35+
p256 = "0.14.0-rc.2"
3636
rstest = "0.26"
3737
sha2 = { version = "0.11.0-rc.3", features = ["oid"] }
3838
tempfile = "3.5"

0 commit comments

Comments
 (0)