diff --git a/belt-ctr/CHANGELOG.md b/belt-ctr/CHANGELOG.md index 82958b1..70629ee 100644 --- a/belt-ctr/CHANGELOG.md +++ b/belt-ctr/CHANGELOG.md @@ -5,5 +5,19 @@ 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.2.0 (UNRELEASED) +## Added +- `GenericBeltCtr` and `GenericBeltCtrCore` types ([#112]) + +## Changed +- Bump `cipher` from `0.4` to `0.5` ([#56]) +- Edition changed to 2024 and MSRV bumped to 1.85 ([#76]) +- Relax MSRV policy and allow MSRV bumps in patch releases +- Use type aliases instead of type defaults to define default `belt-block` implementation ([#112]) + +[#56]: https://github.com/RustCrypto/block-modes/pull/56 +[#76]: https://github.com/RustCrypto/block-modes/pull/76 +[#112]: https://github.com/RustCrypto/block-modes/pull/112 + ## 0.1.0 (2023-04-02) - Initial release diff --git a/belt-ctr/README.md b/belt-ctr/README.md index 533f8da..841eca5 100644 --- a/belt-ctr/README.md +++ b/belt-ctr/README.md @@ -32,7 +32,7 @@ let ciphertext: &[u8; 34] = &hex!( "7D1B" ); -let mut cipher: BeltCtr = BeltCtr::new_from_slices(key, iv).unwrap(); +let mut cipher = BeltCtr::new_from_slices(key, iv).unwrap(); // encrypt in-place let mut buf = plaintext.clone(); diff --git a/belt-ctr/src/lib.rs b/belt-ctr/src/lib.rs index 9e85e73..70b0ca6 100644 --- a/belt-ctr/src/lib.rs +++ b/belt-ctr/src/lib.rs @@ -21,10 +21,14 @@ use core::fmt; use cipher::zeroize::{Zeroize, ZeroizeOnDrop}; /// Byte-level BelT CTR -pub type BeltCtr = StreamCipherCoreWrapper>; - +pub type BeltCtr = GenericBeltCtr; /// Block-level BelT CTR -pub struct BeltCtrCore +pub type BeltCtrCore = GenericBeltCtrCore; +/// Byte-level BelT CTR generic over block cipher implementation +pub type GenericBeltCtr = StreamCipherCoreWrapper>; + +/// Block-level BelT CTR generic over block cipher implementation +pub struct GenericBeltCtrCore where C: BlockCipherEncrypt + BlockSizeUser, { @@ -33,7 +37,7 @@ where s_init: u128, } -impl StreamCipherCore for BeltCtrCore +impl StreamCipherCore for GenericBeltCtrCore where C: BlockCipherEncrypt + BlockSizeUser, { @@ -65,7 +69,7 @@ where } } -impl StreamCipherSeekCore for BeltCtrCore +impl StreamCipherSeekCore for GenericBeltCtrCore where C: BlockCipherEncrypt + BlockSizeUser, { @@ -80,28 +84,28 @@ where } } -impl BlockSizeUser for BeltCtrCore +impl BlockSizeUser for GenericBeltCtrCore where C: BlockCipherEncrypt + BlockSizeUser, { type BlockSize = C::BlockSize; } -impl IvSizeUser for BeltCtrCore +impl IvSizeUser for GenericBeltCtrCore where C: BlockCipherEncrypt + BlockSizeUser, { type IvSize = C::BlockSize; } -impl InnerUser for BeltCtrCore +impl InnerUser for GenericBeltCtrCore where C: BlockCipherEncrypt + BlockSizeUser, { type Inner = C; } -impl InnerIvInit for BeltCtrCore +impl InnerIvInit for GenericBeltCtrCore where C: BlockCipherEncrypt + BlockSizeUser, { @@ -118,7 +122,7 @@ where } } -impl IvState for BeltCtrCore +impl IvState for GenericBeltCtrCore where C: BlockCipherEncrypt + BlockCipherDecrypt + BlockSizeUser, { @@ -129,7 +133,7 @@ where } } -impl AlgorithmName for BeltCtrCore +impl AlgorithmName for GenericBeltCtrCore where C: BlockCipherEncrypt + BlockSizeUser + AlgorithmName, { @@ -140,7 +144,7 @@ where } } -impl fmt::Debug for BeltCtrCore +impl fmt::Debug for GenericBeltCtrCore where C: BlockCipherEncrypt + BlockSizeUser + AlgorithmName, { @@ -152,7 +156,7 @@ where } } -impl Drop for BeltCtrCore +impl Drop for GenericBeltCtrCore where C: BlockCipherEncrypt + BlockSizeUser, { @@ -166,7 +170,7 @@ where } #[cfg(feature = "zeroize")] -impl ZeroizeOnDrop for BeltCtrCore where +impl ZeroizeOnDrop for GenericBeltCtrCore where C: BlockCipherEncrypt + BlockSizeUser + ZeroizeOnDrop { }