Service::HTTP_C: Add decryption of the ClCertA (#4045)

* Service::HTTP_C: Add decryption of the ClCertA

* fixup! Service::HTTP_C: Add decryption of the ClCertA

* fixup! Service::HTTP_C: Add decryption of the ClCertA

* FileSys:: Add MakeNCCHArchivePath and MakeNCCHFilePath; Small fixes in HTTP_C::DecryptDefaultClientCert

* fixup! fixup! Service::HTTP_C: Add decryption of the ClCertA

* fixup! fixup! fixup! Service::HTTP_C: Add decryption of the ClCertA
This commit is contained in:
Ben
2018-08-09 23:02:53 +02:00
committed by GitHub
parent d09646ab9d
commit 5e658efdb8
5 changed files with 144 additions and 7 deletions

View File

@ -27,12 +27,6 @@
namespace FileSys {
enum class NCCHFilePathType : u32 {
RomFS = 0,
Code = 1,
ExeFS = 2,
};
struct NCCHArchivePath {
u64_le tid;
u32_le media_type;
@ -48,6 +42,28 @@ struct NCCHFilePath {
};
static_assert(sizeof(NCCHFilePath) == 0x14, "NCCHFilePath has wrong size!");
Path MakeNCCHArchivePath(u64 tid, Service::FS::MediaType media_type) {
NCCHArchivePath path;
path.tid = static_cast<u64_le>(tid);
path.media_type = static_cast<u32_le>(media_type);
path.unknown = 0;
std::vector<u8> archive(sizeof(path));
std::memcpy(&archive[0], &path, sizeof(path));
return FileSys::Path(archive);
}
Path MakeNCCHFilePath(NCCHFileOpenType open_type, u32 content_index, NCCHFilePathType filepath_type,
std::array<char, 8>& exefs_filepath) {
NCCHFilePath path;
path.open_type = static_cast<u32_le>(open_type);
path.content_index = static_cast<u32_le>(content_index);
path.filepath_type = static_cast<u32_le>(filepath_type);
path.exefs_filepath = exefs_filepath;
std::vector<u8> file(sizeof(path));
std::memcpy(&file[0], &path, sizeof(path));
return FileSys::Path(file);
}
ResultVal<std::unique_ptr<FileBackend>> NCCHArchive::OpenFile(const Path& path,
const Mode& mode) const {
if (path.GetType() != LowPathType::Binary) {