Skip to content

Commit 399dc55

Browse files
authored
fix
1 parent c98ff27 commit 399dc55

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

cipher/src/block.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,15 +134,15 @@ pub trait BlockCipherEncrypt: BlockSizeUser + Sized {
134134
/// If `NoPadding` is used with a message size that is not a multiple of the cipher block size.
135135
#[cfg(all(feature = "block-padding", feature = "alloc"))]
136136
#[inline]
137-
fn encrypt_padded_vec<P: Padding>(&self, msg: &[u8]) -> Vec<u8> {
137+
fn encrypt_padded_vec<P: Padding + 'static>(&self, msg: &[u8]) -> Vec<u8> {
138138
use block_padding::NoPadding;
139139
use core::any::{Any, TypeId};
140140
use crypto_common::typenum::Unsigned;
141141

142142
let bs = Self::BlockSize::USIZE;
143143
let msg_len = msg.len();
144144
let mut buf = vec![0; bs * (msg_len / bs + 1)];
145-
145+
146146
let Ok(res) = self.encrypt_padded_b2b::<P>(msg, &mut buf) else {
147147
let is_no_pad = TypeId::of::<P>() == TypeId::of::<NoPadding>();
148148
if is_no_pad && buf.len() % bs != 0 {
@@ -154,7 +154,7 @@ pub trait BlockCipherEncrypt: BlockSizeUser + Sized {
154154
unreachable!("`buf` has enough space for encryption");
155155
}
156156
};
157-
157+
158158
let res_len = res.len();
159159
buf.truncate(res_len);
160160
buf
@@ -396,15 +396,15 @@ pub trait BlockModeEncrypt: BlockSizeUser + Sized {
396396
/// If `NoPadding` is used with a message size that is not a multiple of the cipher block size.
397397
#[cfg(all(feature = "block-padding", feature = "alloc"))]
398398
#[inline]
399-
fn encrypt_padded_vec<P: Padding>(self, msg: &[u8]) -> Vec<u8> {
399+
fn encrypt_padded_vec<P: Padding + 'static>(self, msg: &[u8]) -> Vec<u8> {
400400
use block_padding::NoPadding;
401401
use core::any::{Any, TypeId};
402402
use crypto_common::typenum::Unsigned;
403403

404404
let bs = Self::BlockSize::USIZE;
405405
let msg_len = msg.len();
406406
let mut buf = vec![0; bs * (msg_len / bs + 1)];
407-
407+
408408
let Ok(res) = self.encrypt_padded_b2b::<P>(msg, &mut buf) else {
409409
let is_no_pad = TypeId::of::<P>() == TypeId::of::<NoPadding>();
410410
if is_no_pad && buf.len() % bs != 0 {
@@ -416,7 +416,7 @@ pub trait BlockModeEncrypt: BlockSizeUser + Sized {
416416
unreachable!("`buf` has enough space for encryption");
417417
}
418418
};
419-
419+
420420
let res_len = res.len();
421421
buf.truncate(res_len);
422422
buf

0 commit comments

Comments
 (0)