Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cipher: restore allocating padded encrypt/decrypt #936

Merged
merged 3 commits into from
Feb 16, 2022

Conversation

Keruspe
Copy link
Contributor

@Keruspe Keruspe commented Feb 12, 2022

Copy link
Member

@newpavlov newpavlov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! Looks good.

Can you please also add [UNRELEASED] section with description of the changes in this PR to the crate's CHANGELOG?

cipher/src/block.rs Outdated Show resolved Hide resolved
fn encrypt_padded_vec_mut<P: Padding<Self::BlockSize>>(self, msg: &[u8]) -> Vec<u8> {
let mut out = allocate_out_vec::<Self>(msg.len());
self.encrypt_padded_b2b_mut::<P>(msg, &mut out)
.expect("enough space for encrypting is allocated");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to check whether the compiler is smart enough to eliminate this expect. I can do it later myself.

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
@Keruspe
Copy link
Contributor Author

Keruspe commented Feb 13, 2022

We should probably truncate the vec for encrypt methods too, right?

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a way to estimate the encryption buffer needed size
2 participants