Skip to content

Commit 6e1fe3c

Browse files
authored
Bump aead to v0.6.0-rc.3; restore getrandom features (#741)
This release drops the dependency on `rand_core` when using `getrandom`, which was the original feature name for this functionality, and in doing so also avoids a breaking change. It also updates `rand_core` to the v0.10 prereleases. Dependencies which depend on `rand_core` v0.10 prereleases have also been bumped to ensure we don't pull in old versions.
1 parent a20063f commit 6e1fe3c

File tree

26 files changed

+330
-291
lines changed

26 files changed

+330
-291
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,3 @@ members = [
1818
[patch.crates-io]
1919
aead-stream = { path = "aead-stream" }
2020
aes-gcm = { path = "aes-gcm" }
21-
22-
# https://github.com/RustCrypto/traits/pull/2019
23-
aead = { git = "https://github.com/RustCrypto/traits.git" }
24-
crypto-common = { git = "https://github.com/RustCrypto/traits.git" }

aead-stream/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ categories = ["cryptography", "no-std"]
1313
rust-version = "1.85"
1414

1515
[dependencies]
16-
aead = { version = "0.6.0-rc.2", default-features = false }
16+
aead = { version = "0.6.0-rc.3", default-features = false }
1717

1818
[features]
1919
alloc = ["aead/alloc"]

aes-gcm-siv/Cargo.toml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,23 @@ categories = ["cryptography", "no-std"]
1717
rust-version = "1.85"
1818

1919
[dependencies]
20-
aead = { version = "0.6.0-rc.2", default-features = false }
21-
aes = { version = "0.9.0-rc.1", optional = true }
22-
cipher = "0.5.0-rc.1"
23-
ctr = "0.10.0-rc.1"
24-
polyval = { version = "0.7.0-rc.2", default-features = false }
20+
aead = { version = "0.6.0-rc.3", default-features = false }
21+
aes = { version = "0.9.0-rc.2", optional = true }
22+
cipher = "0.5.0-rc.2"
23+
ctr = "0.10.0-rc.2"
24+
polyval = { version = "0.7.0-rc.3", default-features = false }
2525
subtle = { version = "2", default-features = false }
2626
zeroize = { version = "1", optional = true, default-features = false }
2727

2828
[dev-dependencies]
29-
aead = { version = "0.6.0-rc.2", features = ["dev"], default-features = false }
29+
aead = { version = "0.6.0-rc.3", features = ["dev"], default-features = false }
3030

3131
[features]
32-
default = ["aes", "alloc", "os_rng"]
32+
default = ["aes", "alloc", "getrandom"]
3333
alloc = ["aead/alloc"]
3434
arrayvec = ["aead/arrayvec"]
3535
bytes = ["aead/bytes"]
36-
os_rng = ["aead/os_rng", "rand_core"]
36+
getrandom = ["aead/getrandom"]
3737
rand_core = ["aead/rand_core"]
3838

3939
[package.metadata.docs.rs]

aes-gcm-siv/src/lib.rs

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,20 @@
1111
//!
1212
//! Simple usage (allocating, no associated data):
1313
//!
14-
#![cfg_attr(feature = "os_rng", doc = "```")]
15-
#![cfg_attr(not(feature = "os_rng"), doc = "```ignore")]
14+
#![cfg_attr(feature = "getrandom", doc = "```")]
15+
#![cfg_attr(not(feature = "getrandom"), doc = "```ignore")]
1616
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
1717
//! use aes_gcm_siv::{
18-
//! aead::{Aead, AeadCore, KeyInit, rand_core::OsRng},
18+
//! aead::{Aead, AeadCore, KeyInit},
1919
//! Aes256GcmSiv, Nonce // Or `Aes128GcmSiv`
2020
//! };
2121
//!
22-
//! let key = Aes256GcmSiv::generate_key().expect("generate key");
22+
//! let key = Aes256GcmSiv::generate_key().expect("key generation failure");
2323
//! let cipher = Aes256GcmSiv::new(&key);
24-
//! let nonce = Aes256GcmSiv::generate_nonce().expect("generate nonce"); // 96-bits; unique per message
24+
//!
25+
//! let nonce = Aes256GcmSiv::generate_nonce().expect("nonce failure"); // MUST be unique per message
2526
//! let ciphertext = cipher.encrypt(&nonce, b"plaintext message".as_ref())?;
27+
//!
2628
//! let plaintext = cipher.decrypt(&nonce, ciphertext.as_ref())?;
2729
//! assert_eq!(&plaintext, b"plaintext message");
2830
//! # Ok(())
@@ -47,29 +49,32 @@
4749
//! It can then be passed as the `buffer` parameter to the in-place encrypt
4850
//! and decrypt methods:
4951
//!
50-
#![cfg_attr(all(feature = "os_rng", feature = "arrayvec"), doc = "```")]
51-
#![cfg_attr(not(all(feature = "os_rng", feature = "arrayvec")), doc = "```ignore")]
52+
#![cfg_attr(all(feature = "getrandom", feature = "arrayvec"), doc = "```")]
53+
#![cfg_attr(
54+
not(all(feature = "getrandom", feature = "arrayvec")),
55+
doc = "```ignore"
56+
)]
5257
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
5358
//! use aes_gcm_siv::{
54-
//! aead::{AeadInOut, Buffer, KeyInit, rand_core::OsRng, arrayvec::ArrayVec},
59+
//! aead::{AeadInOut, AeadCore, Buffer, KeyInit, arrayvec::ArrayVec},
5560
//! Aes256GcmSiv, Nonce, // Or `Aes128GcmSiv`
5661
//! };
5762
//!
58-
//! let key = Aes256GcmSiv::generate_key().expect("generate key");
63+
//! let key = Aes256GcmSiv::generate_key().expect("key generation failure");
5964
//! let cipher = Aes256GcmSiv::new(&key);
60-
//! let nonce = Nonce::from_slice(b"unique nonce"); // 96-bits; unique per message
6165
//!
66+
//! let nonce = Aes256GcmSiv::generate_nonce().expect("nonce failure"); // 96-bits; unique per message
6267
//! let mut buffer: ArrayVec<u8, 128> = ArrayVec::new(); // Note: buffer needs 16-bytes overhead for auth tag
6368
//! buffer.extend_from_slice(b"plaintext message");
6469
//!
6570
//! // Encrypt `buffer` in-place, replacing the plaintext contents with ciphertext
66-
//! cipher.encrypt_in_place(nonce, b"", &mut buffer)?;
71+
//! cipher.encrypt_in_place(&nonce, b"", &mut buffer)?;
6772
//!
6873
//! // `buffer` now contains the message ciphertext
6974
//! assert_ne!(buffer.as_ref(), b"plaintext message");
7075
//!
7176
//! // Decrypt `buffer` in-place, replacing its ciphertext context with the original plaintext
72-
//! cipher.decrypt_in_place(nonce, b"", &mut buffer)?;
77+
//! cipher.decrypt_in_place(&nonce, b"", &mut buffer)?;
7378
//! assert_eq!(buffer.as_ref(), b"plaintext message");
7479
//! # Ok(())
7580
//! # }

aes-gcm/Cargo.toml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,27 @@ categories = ["cryptography", "no-std"]
1717
rust-version = "1.85"
1818

1919
[dependencies]
20-
aead = { version = "0.6.0-rc.2", default-features = false }
21-
aes = { version = "0.9.0-rc.1", optional = true }
22-
cipher = "0.5.0-rc.1"
23-
ctr = "0.10.0-rc.1"
24-
ghash = { version = "0.6.0-rc.2", default-features = false }
20+
aead = { version = "0.6.0-rc.3", default-features = false }
21+
cipher = "0.5.0-rc.2"
22+
ctr = "0.10.0-rc.2"
23+
ghash = { version = "0.6.0-rc.3", default-features = false }
2524
subtle = { version = "2", default-features = false }
25+
26+
# optional dependencies
27+
aes = { version = "0.9.0-rc.2", optional = true }
2628
zeroize = { version = "1", optional = true, default-features = false }
2729

2830
[dev-dependencies]
29-
aead = { version = "0.6.0-rc.2", features = ["alloc", "dev"], default-features = false }
31+
aead = { version = "0.6.0-rc.3", features = ["alloc", "dev"], default-features = false }
3032
hex-literal = "1"
3133

3234
[features]
33-
default = ["aes", "alloc", "os_rng"]
35+
default = ["aes", "alloc", "getrandom"]
3436
alloc = ["aead/alloc"]
37+
3538
arrayvec = ["aead/arrayvec"]
3639
bytes = ["aead/bytes"]
37-
os_rng = ["aead/os_rng", "rand_core"]
40+
getrandom = ["aead/getrandom"]
3841
rand_core = ["aead/rand_core"]
3942

4043
[package.metadata.docs.rs]

0 commit comments

Comments
 (0)