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.
This change is known to fix decryption of "Assassin's Creed III" and "Darts Up". This is a port of another PR: Xpl0itU/WiiUDownloader#44
Previously, when attempting to decrypt either of these games with
cdecrypt
, decryption would fail and you'd get a message like this:Notice that the second hexdump contains an ELF header, as if the file was properly decrypted. However, the second hexdump is of
cdecrypt
's array of verification hashes, not file content. I also noticed that JNUSLib works fine, and decrypts both games without issue.The problem turned out to be in how
cdecrypt
decides whether the file contains hashes throughout or not.cdecrypt
previously checkedfe[i].Flags & 0x440
for each entry, but apparently in the case of these two games, those bits don't correspond to whether the file is hashed or not. Apparently, JNUSLib decides based on the TMD file entry, which is still accurate in these cases. So, this PR changescdecrypt
to use the same method as JNUSLib for determining whether the file contains hashes or not.I haven't tested this on a huge sample, but the games I have tested it on still work, and since JNUSLib uses it (apparently) successfully, it seems safe enough to me.