Fixing decryption key choice to be more robust.
This commit is contained in:
@@ -415,7 +415,7 @@ int xe_xex2_decrypt_key(xe_xex2_header_t *header) {
|
|||||||
// Guess key based on file info.
|
// Guess key based on file info.
|
||||||
// TODO: better way to finding out which key to use?
|
// TODO: better way to finding out which key to use?
|
||||||
const uint8_t *xexkey;
|
const uint8_t *xexkey;
|
||||||
if (header->file_format_info.encryption_type == XEX_ENCRYPTION_NORMAL) {
|
if (header->execution_info.title_id) {
|
||||||
xexkey = xe_xex2_retail_key;
|
xexkey = xe_xex2_retail_key;
|
||||||
} else {
|
} else {
|
||||||
xexkey = xe_xex2_devkit_key;
|
xexkey = xe_xex2_devkit_key;
|
||||||
@@ -763,6 +763,7 @@ int xe_xex2_load_pe(xe_xex2_ref xex) {
|
|||||||
// Verify DOS signature (MZ).
|
// Verify DOS signature (MZ).
|
||||||
const IMAGE_DOS_HEADER* doshdr = (const IMAGE_DOS_HEADER*)p;
|
const IMAGE_DOS_HEADER* doshdr = (const IMAGE_DOS_HEADER*)p;
|
||||||
if (doshdr->e_magic != IMAGE_DOS_SIGNATURE) {
|
if (doshdr->e_magic != IMAGE_DOS_SIGNATURE) {
|
||||||
|
XELOGE(XT("PE signature mismatch; likely bad decryption/decompression"));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user