Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix over-zeroing of destination buffer for zero padding symmetric encryption#52465

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
bartonjs merged 1 commit intodotnet:mainfromvcsjones:2406-fix-zero-padding
May 7, 2021

Conversation

@vcsjones
Copy link
Member

This addresses one issue with how zero padding is handled and another theoretical one.

The first is performance. When applying zero padding, we were clearing the entire destination, then copying the plaintext over it. We were zeroing more data than required, the only data that needed to be zeroed is where the zero padding is applied.

The second is in the case of overlapping buffers for the plaintext and ciphertext. However, this cannot happen currently since we always ensure the destination buffer does not overlap the input buffer. If overlapping is permitted in a future change, this would clear the plaintext, not just where padding is required.

Contributes to#2406


I'm submitting this separately from the upcoming one-shot PR since that PR is getting fairly large and this is not immediately related to the one-shot APIs, but is adjacent.

This addresses two issues with how zero padding is handled.The first is performance. When applying zero padding, we were clearingthe entire destination, then copying the plaintext over it. We werezeroing more data than required, the only data that needed to be zeroedis where the zero padding is applied.The second is in the case of overlapping buffers for the plaintextand ciphertext. However, this cannot happen currently since we alwaysensure the destination buffer does not overlap the input buffer.If overlapping is permitted in a future change, this would clear theplaintext, not just where padding is required.
@ghost
Copy link

I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly onearea label.

@ghost
Copy link

Tagging subscribers to this area:@bartonjs,@vcsjones,@krwq,@GrabYourPitchforks
See info inarea-owners.md if you want to be subscribed.

Issue Details

This addresses one issue with how zero padding is handled and another theoretical one.

The first is performance. When applying zero padding, we were clearing the entire destination, then copying the plaintext over it. We were zeroing more data than required, the only data that needed to be zeroed is where the zero padding is applied.

The second is in the case of overlapping buffers for the plaintext and ciphertext. However, this cannot happen currently since we always ensure the destination buffer does not overlap the input buffer. If overlapping is permitted in a future change, this would clear the plaintext, not just where padding is required.

Contributes to#2406


I'm submitting this separately from the upcoming one-shot PR since that PR is getting fairly large and this is not immediately related to the one-shot APIs, but is adjacent.

Author:vcsjones
Assignees:-
Labels:

area-System.Security

Milestone:-

@vcsjones
Copy link
MemberAuthor

Just to be clear: nothing is "broken" right now. As-is, this is a performance improvement. But it will be more important for the one-shot APIs.

@bartonjsbartonjs merged commit74cafe7 intodotnet:mainMay 7, 2021
@vcsjonesvcsjones deleted the 2406-fix-zero-padding branchMay 7, 2021 22:58
@karelzkarelz added this to the6.0.0 milestoneMay 20, 2021
@ghostghost locked asresolvedand limited conversation to collaboratorsJun 19, 2021
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

@GrabYourPitchforksGrabYourPitchforksGrabYourPitchforks approved these changes

@bartonjsbartonjsbartonjs approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

6.0.0

Development

Successfully merging this pull request may close these issues.

4 participants

@vcsjones@GrabYourPitchforks@bartonjs@karelz

[8]ページ先頭

©2009-2025 Movatter.jp