Merge pull request #4274 from wwylele/http-direct-fs
http_c: access FS via backend directly
This commit is contained in:
commit
27203c0d47
|
@ -445,29 +445,23 @@ void HTTP_C::CloseClientCertContext(Kernel::HLERequestContext& ctx) {
|
||||||
void HTTP_C::DecryptClCertA() {
|
void HTTP_C::DecryptClCertA() {
|
||||||
static constexpr u32 iv_length = 16;
|
static constexpr u32 iv_length = 16;
|
||||||
|
|
||||||
FileSys::Path archive_path =
|
FileSys::NCCHArchive archive(0x0004001b00010002, Service::FS::MediaType::NAND);
|
||||||
FileSys::MakeNCCHArchivePath(0x0004001b00010002, Service::FS::MediaType::NAND);
|
|
||||||
auto archive_result = Service::FS::OpenArchive(Service::FS::ArchiveIdCode::NCCH, archive_path);
|
|
||||||
if (archive_result.Failed()) {
|
|
||||||
LOG_ERROR(Service_HTTP, "ClCertA archive missing");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::array<char, 8> exefs_filepath;
|
std::array<char, 8> exefs_filepath;
|
||||||
FileSys::Path file_path = FileSys::MakeNCCHFilePath(
|
FileSys::Path file_path = FileSys::MakeNCCHFilePath(
|
||||||
FileSys::NCCHFileOpenType::NCCHData, 0, FileSys::NCCHFilePathType::RomFS, exefs_filepath);
|
FileSys::NCCHFileOpenType::NCCHData, 0, FileSys::NCCHFilePathType::RomFS, exefs_filepath);
|
||||||
FileSys::Mode open_mode = {};
|
FileSys::Mode open_mode = {};
|
||||||
open_mode.read_flag.Assign(1);
|
open_mode.read_flag.Assign(1);
|
||||||
auto file_result = Service::FS::OpenFileFromArchive(*archive_result, file_path, open_mode);
|
auto file_result = archive.OpenFile(file_path, open_mode);
|
||||||
if (file_result.Failed()) {
|
if (file_result.Failed()) {
|
||||||
LOG_ERROR(Service_HTTP, "ClCertA file missing");
|
LOG_ERROR(Service_HTTP, "ClCertA file missing");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto romfs = std::move(file_result).Unwrap();
|
auto romfs = std::move(file_result).Unwrap();
|
||||||
std::vector<u8> romfs_buffer(romfs->backend->GetSize());
|
std::vector<u8> romfs_buffer(romfs->GetSize());
|
||||||
romfs->backend->Read(0, romfs_buffer.size(), romfs_buffer.data());
|
romfs->Read(0, romfs_buffer.size(), romfs_buffer.data());
|
||||||
romfs->backend->Close();
|
romfs->Close();
|
||||||
|
|
||||||
if (!HW::AES::IsNormalKeyAvailable(HW::AES::KeySlotID::SSLKey)) {
|
if (!HW::AES::IsNormalKeyAvailable(HW::AES::KeySlotID::SSLKey)) {
|
||||||
LOG_ERROR(Service_HTTP, "NormalKey in KeySlot 0x0D missing");
|
LOG_ERROR(Service_HTTP, "NormalKey in KeySlot 0x0D missing");
|
||||||
|
|
Loading…
Reference in New Issue