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

Fixing NCCH flag detection code for zerokey #8

Merged
merged 1 commit into from
Nov 15, 2016

Conversation

putnam
Copy link

@putnam putnam commented Nov 15, 2016

Problem:
Encrypted CCIs no longer work with 3dsconv.py. All xorpads are incorrectly displayed as corrupt or a mismatch.

Analysis:
The recently-committed code that checked the NCCH flags for zerokey encryption was calling read(1) once for each flag comparison, which resulted in the wrong byte being used for comparison in the second case. As a result, all encrypted CCIs are incorrectly flagged as being encrypted with a fixed/zero key.

This commit stores the bitmask in a temporary variable instead. Encrypted CCIs are now properly detected and packed as expected.

Problem:
Encrypted CCIs no longer work with 3dsconv.py. All xorpads are incorrectly displayed as corrupt or a mismatch.

Analysis:
The recently-committed code that checked the NCCH flags for zerokey encryption was calling read(1) twice for each flag comparison, which resulted in the wrong byte being used for comparison in the second case. As a result, all encrypted CCIs are incorrectly flagged as being encrypted with a fixed/zero key.

This commit stores the bitmask in a temporary variable instead. Encrypted CCIs are now properly detected and packed as expected.
@ihaveamac ihaveamac merged commit 695954c into ihaveamac:master Nov 15, 2016
@ihaveamac
Copy link
Owner

yeah, someone told me conversion was broken for encrypted roms a few days ago, wasn't sure what was causing it (even though the output says "zerokey" but I never checked that :c). thanks!

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.

2 participants