Init encryption module before calculating unencrypted block-size#40240
Merged
Init encryption module before calculating unencrypted block-size#40240
Conversation
|
Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes. |
|
Kudos, SonarCloud Quality Gate passed! |
Contributor
|
Nice catch! |
butonic
approved these changes
Jul 27, 2022
Contributor
Contributor
Author
|
@phil-davis I'll take care, merged a bit too early. Sorry. |
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.








Description
Fixes a bug where the un-encrypted blocksize was calculated before initializing the encryption-module. This yields the wrong size after a file-scan. The issue is only triggered if encryption.use_legacy_encoding is set to true.
Related Issue
Related test PR: owncloud/encryption#360 (comment)
Motivation and Context
When restoring encrypted files from backup and doing a
occ file:scan --repairandencryption:fix-encrypted-versionthe file was still not readable correctly because the size in oc_filecache is wrong.The wrong calculation was introduced via #38249 where the size calculation depends on the encoding mode (binary vs base64). The code assumes that the begin method is called before the size is calculated which is not the case for the call-site which this PR fixes.
How Has This Been Tested?
Types of changes
Checklist: