diff --git a/Cargo.lock b/Cargo.lock index 5ff49d2..eaf7c74 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -94,7 +94,7 @@ dependencies = [ [[package]] name = "ctr" -version = "0.9.1" +version = "0.9.2" dependencies = [ "aes", "cipher", diff --git a/ctr/CHANGELOG.md b/ctr/CHANGELOG.md index 31c47b0..b60f31d 100644 --- a/ctr/CHANGELOG.md +++ b/ctr/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## 0.9.2 (2022-09-30) +### Changed +- Implement `Clone` directly for `CtrCore`, so it would work with non-`Clone` flavors ([#24]) + +[#24]: https://github.com/RustCrypto/block-modes/pull/24 + ## 0.9.1 (2022-02-17) ### Fixed - Minimal versions build ([#9]) diff --git a/ctr/Cargo.toml b/ctr/Cargo.toml index 9a0d599..5783fff 100644 --- a/ctr/Cargo.toml +++ b/ctr/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ctr" -version = "0.9.1" +version = "0.9.2" description = "CTR block modes of operation" authors = ["RustCrypto Developers"] license = "MIT OR Apache-2.0" diff --git a/ctr/src/ctr_core.rs b/ctr/src/ctr_core.rs index f4412b0..c193596 100644 --- a/ctr/src/ctr_core.rs +++ b/ctr/src/ctr_core.rs @@ -10,7 +10,6 @@ use core::fmt; use cipher::zeroize::ZeroizeOnDrop; /// Generic CTR block mode instance. -#[derive(Clone)] pub struct CtrCore where C: BlockEncryptMut + BlockCipher, @@ -118,6 +117,20 @@ where } } +impl Clone for CtrCore +where + C: BlockEncryptMut + BlockCipher + Clone, + F: CtrFlavor, +{ + #[inline] + fn clone(&self) -> Self { + Self { + cipher: self.cipher.clone(), + ctr_nonce: self.ctr_nonce.clone(), + } + } +} + impl fmt::Debug for CtrCore where C: BlockEncryptMut + BlockCipher + AlgorithmName,