David Korth
92c49e34fe
[librvth] verify: KB value for errors should be 1-31, not 0-30.
...
The first kilobyte of encrypted Wii sectors contains hashes, so we
shouldn't use 0 to prevent confusion.
2022-02-12 02:42:55 -05:00
David Korth
ca0292fa85
[librvth] verify.cpp: Sanity check: Only the last group can be truncated.
2022-02-12 00:08:01 -05:00
David Korth
b75e883377
[librvth] verify.cpp: Update max_sector in the "incomplete group" path.
...
This fixes swupdate discs.
2022-02-12 00:05:58 -05:00
David Korth
fefe1315c8
[rvthtool] verify.cpp: Move pt_current++ to the top to prevent an extra '\n' from duplicating the line when finished.
2022-02-12 00:03:43 -05:00
David Korth
9c7e2b0e96
[rvthtool] verify.cpp: +'\n'
2022-02-12 00:01:27 -05:00
David Korth
27ed887d79
[rvthtool] verify.cpp: fflush(stdout) before verifying.
2022-02-12 00:01:00 -05:00
David Korth
8e80d806d6
[librvth] verify.cpp: Fall back to H3 counting if the partition header has a 0 data length.
...
This partially fixes an RVT-H image I dumped a while back, but it
results in the zeroed sector warnings again. Better than failing
outright, I guess...
2022-02-11 23:59:30 -05:00
David Korth
a73972bbbc
[librvth] verify.cpp: Make sure data_size is under 9 GiB.
2022-02-11 23:41:34 -05:00
David Korth
2b094576f1
verify: Check the partition's data length to determine how much to check in the last group.
...
The data in the last group past the partition data length has invalid
hashed data. It might be algorithmically generated; I should check
how nkit handles this. For now, ignore it.
Note that we're no longer checking for the "last block group" in the
H3 hash table.
This fixes Sonic Colours (RVT-R), but not swupdate_SDK-3_2_us.gcm.
2022-02-11 23:38:10 -05:00
David Korth
777a3e60c1
[librvth] RvtH::verifyWiiPartitions(): Add pte->lba_start when checking lba for incomplete groups.
...
Fixes I/O errors occurring near, but not at, the end of the second
partition on multi-partition discs (i.e. most of them).
2022-02-11 22:46:10 -05:00
David Korth
9d6a158075
[rvthtool] verify.cpp: Fix "partition 3/2" when finished verifying.
2022-02-11 22:43:00 -05:00
David Korth
0ffeff4d6a
verify: Partition ID improvements.
...
- librvth: Update state.pt_current so it actually shows the
correct partition ID.
- rvthtool: Print the partition number (0-based) in errors.
2022-02-11 22:35:26 -05:00
David Korth
f5274f3760
[rvthtool] verify.cpp: Partition 1/2, not 0/2. (current partition)
2022-02-11 22:31:15 -05:00
David Korth
284913a727
[librvth] verify: Add error messages to the callback.
...
Error messages include hash verification and table copies.
NOTE: We're also checking for zeroed sectors (scrubbed/truncated).
Since this would be zeroed *before* decryption, we have to maintain
two group buffers, one for the encrypted contents, and one for the
decrypted contents. This means 4 MB RAM. Most systems should be able
to handle this in 2022...
2022-02-11 22:26:18 -05:00
David Korth
5a68c4f4ea
[librvth] RvtH::verifyWiiPartitions(): Actually call the callback after each group.
2022-02-11 21:59:24 -05:00
David Korth
19f6efcd18
rvthtool: Initial implementation of the 'verify' command.
...
This command allows verifying encrypted discs using the built-in hash
tables. Note that if the signature is invalid, the hashes can't be
guaranteed to be accurate, but it can at least help identify data
corruption (versus intentional malicious modifications).
Errors are currently reported using printf()s in verifyWiiPartitions(),
which isn't ideal. An error list and improved callback need to be added.
Split several things from extract_crypt.cpp:
- title_key.c: decrypt_title_key()
- wii_sector.h: Wii_Disc_Hashes_t and related
TODO:
- Better error reporting.
- Detect zeroed sectors, e.g. scrubbed images and/or truncated.
- Tested with swupdate_SDK-3_2_us.gcm, which is truncated.
2022-02-11 21:43:09 -05:00
David Korth
60fd817bf7
README.md: Mention Dolphin supports debug-signed images, and also mention nusresign.
...
This was updated locally on 2021/04/16 11:47 AM EDT, but I never
committed it for some reason.
2022-02-11 18:48:49 -05:00
David Korth
4798c01548
[cmake] platform.cmake: Fix ARM CPU detection.
2021-05-19 18:15:20 -04:00
David Korth
3b4181c5f2
[nettle] Updated the Win32 precompiled build of Nettle from 3.5.1 to 3.7.2.
2021-04-03 04:14:29 -04:00
David Korth
0d98bea72a
[cmake] platform.cmake: Detect other 32-bit ARM variants.
2021-03-07 12:21:53 -05:00
David Korth
ef9dada963
cmake/platform.cmake: Fix 32-bit ARM platform detection.
...
Reported by @vaguerant.
2021-03-03 20:43:10 -05:00
David Korth
f396d8f6a8
[qrvthtool] MessageSound: s/s_notifyInterface/iface/
2020-09-06 23:03:33 -04:00
David Korth
ebf492c487
[qrvthtool] MessageSound: Always instantiate QPluginLoader when needed.
...
The older method may technically be undefined behavior...
2020-09-06 22:49:15 -04:00
David Korth
de27111915
[rvthtool] main.c: Added _T() for options; return EXIT_SUCCESS if displaying help.
...
This was originally added to my working copy on 2020/08/14, but I forgot
to commit it.
2020-09-06 22:48:32 -04:00
David Korth
33455d47d0
[doc] compiling.md: Added qttools5-dev; fixed qttools5-dev-tools.
2020-07-24 18:21:12 -04:00
David Korth
da40efbdbb
[qrvthtool] CMakeLists.txt: Fix debug file installation.
2020-07-24 18:20:56 -04:00
David Korth
c60cc17143
[nusresign] resign-nus.cpp: #include <errno.h>
...
Needed for Mac OS X.
2020-07-13 02:21:37 -04:00
David Korth
c61413c0c5
[libwiicrypto] bin2h.c: Remove #include <malloc.h>.
...
It's not available on Mac OS X, and it shouldn't be needed elsewhere.
2020-07-13 02:16:19 -04:00
David Korth
f625fdb66b
[libwiicrypto] CMakeLists.txt: Make sure the output certs directory exists.
...
This should fix the travis-ci build, and local builds when using `make`
instead of `ninja`. (I *think* that's the cause?)
2020-07-13 02:12:08 -04:00
David Korth
427eb3fa20
[libwiicrypto] bin2h.c: Handle errors if a file couldn't be opened.
...
Better to show an error message than to crash.
2020-07-13 02:11:02 -04:00
David Korth
010bb6672f
Revert "travis.sh: Enable verbose Makefile to debug bin2h issues."
...
This reverts commit 06fa24d1db
.
2020-07-13 02:06:08 -04:00
David Korth
06fa24d1db
travis.sh: Enable verbose Makefile to debug bin2h issues.
2020-07-13 01:44:08 -04:00
David Korth
346f95f06c
Added partial support for the Korean debug key.
...
Taken from a CAT-DEV OTP.
TODO: Add RVL_CryptoType_Korean_Debug? (and vWii)
[librvth] recrypt.cpp: Set signature statuses to OK, not fake, when
recrypting with the vWii debug key, though we don't actually support
this operation right now.
2020-07-11 02:58:14 -04:00
David Korth
b893ab93a8
[nusresign] print-info.cpp: The H0 hashes cover the data area of the 64 KB block.
...
It covers 63 KB out of 64 KB.
2020-07-10 19:14:26 -04:00
David Korth
dac43c6af4
[nusresign] resign-nus.cpp: Another Windows Unicode compile error...
2020-07-10 18:47:39 -04:00
David Korth
6c1677543e
[nusresign] resign-nus.cpp: Write an updated title.cert file.
...
title.cert is always the same based on the PKI in use.
2020-07-10 18:36:26 -04:00
David Korth
9d69efdc65
[nusresign] resign-nus.cpp: Print the NUS information before re-signing.
2020-07-10 18:35:37 -04:00
David Korth
ff7cd6c754
[nusresign] print-info.cpp: Added maximum sizes for ticket and TMD.
...
resign-nus.cpp: Check minimum and maximum sizes for ticket and TMD.
2020-07-08 22:08:22 -04:00
David Korth
f0d3e24510
[nusresign] print-info.cpp: Only check the WUP_Ticket portion of the ticket.
...
There might be a certificate chain appended to it, and we don't want to
include that in the signature.
2020-07-08 22:06:18 -04:00
David Korth
a281fc4e96
[nusresign] main.c: Fix issues with 'info' trying to use 'info' as a filename.
...
Also updated the filename check code at the end to look for directories,
since nusresign works on directories, not files.
2020-07-08 21:51:01 -04:00
David Korth
8a628636a4
[nusresign] print-info.cpp: Remove debugging code that will definitely crash on other systems.
...
...and fail to build on Windows due to TCHAR shenanigans.
2020-07-08 21:12:44 -04:00
David Korth
7f94c1d22d
[nusresign] print-info.cpp: Fix more Windows TCHAR issues, again...
2020-07-08 20:28:28 -04:00
David Korth
2676dc1ca8
Merge branch 'feature/nusresign'
...
Everything seems to be mostly up to par with wadresign, aside from
WAD-specific stuff like BWF format.
2020-07-08 20:21:49 -04:00
David Korth
468efd44db
[nusresign] print-info.cpp: The content index filenames always use lowercase hex.
2020-07-08 20:18:25 -04:00
David Korth
dbd23445d8
[nusresign] main.c: Uncomment help for commands that are now available.
2020-07-08 20:16:46 -04:00
David Korth
94fe24d827
[nusresign] print-info.cpp: Implement H3 table verification.
...
The .h3 file has one SHA-1 hash for every 256 MB of data.
The final H4 hash is stored in the TMD content entry and is equal to
the SHA-1 hash of the .h3 file.
2020-07-08 20:14:16 -04:00
David Korth
0a80471626
[nusresign] print-info.cpp: Another fopen() -> _tfopen() fix.
2020-07-08 19:44:57 -04:00
David Korth
50b96d33d5
[nusresign] CMakeLists.txt: We need to link to GMP and Nettle.
...
Otherwise, the Windows build fails.
2020-07-08 19:43:58 -04:00
David Korth
eae936bd05
[nusresign] Fix some Windows build errors related to TCHAR.
2020-07-08 19:32:05 -04:00
David Korth
f68150f56e
[nusresign] print-info.cpp: Implemented the 'verify' command.
...
FIXME: Contents with an H3 table aren't handled correctly.
Need to figure out how to handle these...
2020-07-08 19:17:26 -04:00