idk why that makes a difference but now it works

This commit is contained in:
HookedBehemoth 2019-11-27 19:36:28 +01:00
parent f517f179d8
commit 3909194a4a
3 changed files with 7 additions and 14 deletions

View file

@ -45,7 +45,6 @@ namespace tin::install::nsp
virtual void RetrieveHeader();
virtual const PFS0BaseHeader* GetBaseHeader();
virtual void BufferNCAHeader(void* buf, NcmContentId placeholderId);
virtual u64 GetDataOffset();
virtual const PFS0FileEntry* GetFileEntry(unsigned int index);

View file

@ -94,15 +94,16 @@ namespace tin::install::nsp
if (inst::config::validateNCAs && !declinedValidation)
{
tin::install::NcaHeader header;
m_remoteNSP->BufferNCAHeader(&header, ncaId);
Crypto::AesXtr crypto(Crypto::Keys().headerKey);
crypto.decrypt(&header, &header, sizeof(header), 0, 0x200);
tin::install::NcaHeader* header = new NcaHeader;
m_remoteNSP->BufferData(header, m_remoteNSP->GetDataOffset() + fileEntry->dataOffset, sizeof(tin::install::NcaHeader));
if (header.magic != MAGIC_NCA3)
Crypto::AesXtr crypto(Crypto::Keys().headerKey);
crypto.decrypt(header, header, sizeof(tin::install::NcaHeader), 0, 0x200);
if (header->magic != MAGIC_NCA3)
THROW_FORMAT("Invalid NCA magic");
if (!Crypto::rsa2048PssVerify(&header.magic, 0x200, header.fixed_key_sig, Crypto::NCAHeaderSignature))
if (!Crypto::rsa2048PssVerify(&header->magic, 0x200, header->fixed_key_sig, Crypto::NCAHeaderSignature))
{
int rc = inst::ui::mainApp->CreateShowDialog("Invalid NCA signature detected!", "The software you are trying to install may contain malicious contents!\nOnly install improperly signed software from trustworthy sources!\nThis warning can be disabled in Awoo Installer's settings.\n\nAre you sure you want to continue the installation?", {"Cancel", "Yes, I want a brick"}, false);
if (rc != 1)

View file

@ -134,13 +134,6 @@ namespace tin::install::nsp
return reinterpret_cast<PFS0BaseHeader*>(m_headerBytes.data());
}
void RemoteNSP::BufferNCAHeader(void* buf, NcmContentId placeholderId)
{
const PFS0FileEntry* fileEntry = this->GetFileEntryByNcaId(placeholderId);
u64 pfs0Offset = this->GetDataOffset() + fileEntry->dataOffset;
this->BufferData(buf, pfs0Offset, 0xc00);
}
u64 RemoteNSP::GetDataOffset()
{
if (m_headerBytes.empty())