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

fix: LuksDump not parsing multiple data segments #3569

Merged
merged 2 commits into from
Nov 3, 2022

Conversation

danzatt
Copy link
Contributor

@danzatt danzatt commented Oct 27, 2022

Signed-off-by: daniel.zatovic [email protected]

All Pull Requests:

Check all that apply:

  • Have you followed the guidelines in our Contributing document, including the instructions about commit messages?
  • Is this PR to correct an issue?
  • Is this PR an enhancement?

Complete Description of Additions/Changes:

Every second-level section in the cryptsetup luksDump output is immediately followed (without a newline) by another second-level section. E.g. the "Digests" section

Digests:
  0: pbkdf2
	Hash:       sha256
	Iterations: 119373
  1: pbkdf2
	Hash:       sha256
	Iterations: 1000

However, when there are multiple data segments, there is a newline:

Data segments:
  0: crypt
	offset: 16777216 [bytes]
	length: (whole device)
	cipher: aes-xts-plain64
	sector: 4096 [bytes]

  1: crypt
	offset: 16777216 [bytes]
	length: (whole device)
	cipher: aes-xts-plain64
	sector: 4096 [bytes]
	flags : backup-previous

Most of the time, there is a single data segment. However, during re-encryption, there might appear multiple segments. The parser didn't assume this.

@xiangce
Copy link
Contributor

xiangce commented Oct 28, 2022

Hey @danzatt, would you mind adding such a case to the test of this parser?

@danzatt danzatt force-pushed the fix-luksdump-parser branch from d22485a to 77e2d69 Compare October 28, 2022 09:47
@danzatt
Copy link
Contributor Author

danzatt commented Oct 28, 2022

Sorry, I missed that one. Done now.

@psachin psachin merged commit 568dbf9 into RedHatInsights:master Nov 3, 2022
psachin pushed a commit that referenced this pull request Nov 3, 2022
* fix: LuksDump not parsing multiple data segments

Signed-off-by: daniel.zatovic <[email protected]>

* Add regression test for parsing luksDump segments

Signed-off-by: daniel.zatovic <[email protected]>

Signed-off-by: daniel.zatovic <[email protected]>
(cherry picked from commit 568dbf9)
xiangce pushed a commit that referenced this pull request Sep 6, 2024
* fix: LuksDump not parsing multiple data segments

Signed-off-by: daniel.zatovic <[email protected]>

* Add regression test for parsing luksDump segments

Signed-off-by: daniel.zatovic <[email protected]>

Signed-off-by: daniel.zatovic <[email protected]>
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.

3 participants