Skip to content

Commit c4c6dc0

Browse files
committed
cipher: restore StreamCipherCoreWrapper::from_core
Removed in #1959 but there are definitely still quite a few usages and I don't see ways to completely replace all of them with `KeyIvInit` (though that seems ideal). See RustCrypto/AEADs#710
1 parent a55964a commit c4c6dc0

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

cipher/src/stream/wrapper.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ impl<T: StreamCipherCore + fmt::Debug> fmt::Debug for StreamCipherCoreWrapper<T>
3737
}
3838

3939
impl<T: StreamCipherCore> StreamCipherCoreWrapper<T> {
40+
/// Initialize from a [`StreamCipherCore`] instance.
41+
pub fn from_core(core: T) -> Self {
42+
Self {
43+
core,
44+
buffer: Default::default(),
45+
}
46+
}
47+
4048
fn check_remaining(&self, data_len: usize) -> Result<(), StreamCipherError> {
4149
let rem_blocks = match self.core.remaining_blocks() {
4250
Some(v) => v,

0 commit comments

Comments
 (0)