From c4c6dc02bde4458cc665a90b1390da71911ed0ff Mon Sep 17 00:00:00 2001 From: Tony Arcieri Date: Tue, 2 Sep 2025 06:08:38 -0600 Subject: [PATCH] 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 --- cipher/src/stream/wrapper.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cipher/src/stream/wrapper.rs b/cipher/src/stream/wrapper.rs index 5789cdddd..5b9513c37 100644 --- a/cipher/src/stream/wrapper.rs +++ b/cipher/src/stream/wrapper.rs @@ -37,6 +37,14 @@ impl fmt::Debug for StreamCipherCoreWrapper } impl StreamCipherCoreWrapper { + /// Initialize from a [`StreamCipherCore`] instance. + pub fn from_core(core: T) -> Self { + Self { + core, + buffer: Default::default(), + } + } + fn check_remaining(&self, data_len: usize) -> Result<(), StreamCipherError> { let rem_blocks = match self.core.remaining_blocks() { Some(v) => v,