Skip to content

Commit

Permalink
stream-cipher: remove NewBlockCipher bound on FromBlockCipher (#333)
Browse files Browse the repository at this point in the history
Note: breaking change.

As far as I can tell this was an oversight: `FromBlockCipher` never
needs to instantiate a new block cipher (isn't that the point?),
making this bound needlessly limiting.

The rationale for it in the first place appears to be for the blanket
impl of `NewStreamCipher` for `C: FromBlockCipher` which needs it, but
we can add the bound to the blanket impl, rather than (needlessly)
sticking it on the trait.
  • Loading branch information
tarcieri authored Oct 14, 2020
1 parent 1524ac4 commit 6c23a07
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions cryptography/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cryptography"
version = "0.4.1"
version = "0.5.0-pre"
authors = ["The RustCrypto Project Developers"]
license = "Apache-2.0 OR MIT"
description = "Facade crate for the RustCrypto project's traits"
Expand All @@ -18,7 +18,7 @@ digest = { version = "0.9", optional = true, path = "../digest" }
elliptic-curve = { version = "0.6", optional = true, path = "../elliptic-curve" }
mac = { version = "0.9", package = "crypto-mac", optional = true, path = "../crypto-mac" }
signature = { version = "1.2.0", optional = true, default-features = false, path = "../signature" }
stream-cipher = { version = "0.7", optional = true, path = "../stream-cipher" }
stream-cipher = { version = "0.8.0-pre", optional = true, path = "../stream-cipher" }
universal-hash = { version = "0.4", optional = true, path = "../universal-hash" }

[features]
Expand Down
2 changes: 1 addition & 1 deletion stream-cipher/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "stream-cipher"
description = "Stream cipher traits"
version = "0.7.1"
version = "0.8.0-pre"
authors = ["RustCrypto Developers"]
license = "MIT OR Apache-2.0"
readme = "README.md"
Expand Down
3 changes: 2 additions & 1 deletion stream-cipher/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ impl<C: SyncStreamCipher> SyncStreamCipher for &mut C {
#[cfg_attr(docsrs, doc(cfg(feature = "block-cipher")))]
pub trait FromBlockCipher {
/// Block cipher
type BlockCipher: BlockCipher + NewBlockCipher;
type BlockCipher: BlockCipher;
/// Nonce size in bytes
type NonceSize: ArrayLength<u8>;

Expand All @@ -188,6 +188,7 @@ pub trait FromBlockCipher {
impl<C> NewStreamCipher for C
where
C: FromBlockCipher,
C::BlockCipher: NewBlockCipher,
{
type KeySize = <<Self as FromBlockCipher>::BlockCipher as NewBlockCipher>::KeySize;
type NonceSize = <Self as FromBlockCipher>::NonceSize;
Expand Down

0 comments on commit 6c23a07

Please sign in to comment.