Repository navigation
Rework the partially overlapping handling - #11780
Closed
bernd-edlinger wants to merge 1 commit into
Closed
bernd-edlinger wants to merge 1 commit into
bernd-edlinger wants to merge 1 commit into
Conversation
bernd-edlinger
force-pushed
the
rework_partially_overlapping_code_1
branch
3 times, most recently
from
May 22, 2020 12:14
49ea0d3 to
76aaba0
Compare
Member
This is a bit misleading: #5427 was not merged, so these changes are not being backported from Also there might be a need to discuss if all the changes in here are fixes or if some are new features (which are not allowed in 1.1.1 without a vote to make an exception). |
The problem here is that in the default case of EVP_EncryptUpdate the in and out buffers can have different sizes: Suppose we have a block_size=16 and already buf_len=15. EVP_EncryptUpdate is called with in==out and inl==2. In this case, is_partially_overlapping(in+15, in, 2) returns false, because the intervals are not overlapping at all. But ctx->cipher->do_cipher(ctx, out, ctx->buf, bl) clobbers the second byte before it is used. Fix error handling in aes_ocb_cipher Avoid undefined behavior in des_ede3_unwrap Add a sentence about in-place encryption to the doc Add a statement about the output buffer size for WRAP mode ciphers Add a definition for partially overlapping Add test cases for invalid overlapping Add test cases for overlapping encryption Add AES-xxx-CFB1/8 test vectors from NIST SP800-38A Reuse the second DES-EDE3-CFB1 as BitLen test [extended tests]
bernd-edlinger
force-pushed
the
rework_partially_overlapping_code_1
branch
from
May 22, 2020 20:35
76aaba0 to
e25caaa
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The problem here is that in the default case of EVP_EncryptUpdate
the in and out buffers can have different sizes:
Suppose we have a block_size=16 and already buf_len=15.
EVP_EncryptUpdate is called with in==out and inl==2.
In this case, is_partially_overlapping(in+15, in, 2)
returns false, because the intervals are not overlapping at all.
But ctx->cipher->do_cipher(ctx, out, ctx->buf, bl) clobbers the
second byte before it is used.
Make partially overlapping more permissive, i.e.
allow essentially all kinds of overlapping that "work"
Fix error handling in aes_ocb_cipher
Avoid undefined behavior in des_ede3_unwrap
Add a sentence about in-place encryption to the doc
Add a statement about the output buffer size for WRAP mode ciphers
Add a definition for partially overlapping
Add test cases for invalid overlapping
Add test cases for overlapping encryption
Add AES-xxx-CFB1/8 test vectors from NIST SP800-38A
Reuse the second DES-EDE3-CFB1 as BitLen test
Checklist
Backport of #5427 to 1.1.1