2018-04-24 05:24:20 +00:00
|
|
|
#pragma once
|
|
|
|
#include <string>
|
|
|
|
#include <fnd/types.h>
|
2018-04-24 07:51:29 +00:00
|
|
|
#include <fnd/IFile.h>
|
2018-09-23 03:29:22 +00:00
|
|
|
#include <fnd/SharedPtr.h>
|
2018-08-07 07:17:51 +00:00
|
|
|
#include <nn/hac/NpdmBinary.h>
|
2018-08-21 12:03:19 +00:00
|
|
|
#include "KeyConfiguration.h"
|
2018-04-24 05:24:20 +00:00
|
|
|
|
2018-09-13 11:06:48 +00:00
|
|
|
#include "common.h"
|
2018-04-24 05:24:20 +00:00
|
|
|
|
|
|
|
class NpdmProcess
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NpdmProcess();
|
|
|
|
|
|
|
|
void process();
|
|
|
|
|
2018-09-23 03:29:22 +00:00
|
|
|
void setInputFile(const fnd::SharedPtr<fnd::IFile>& file);
|
2018-08-21 12:03:19 +00:00
|
|
|
void setKeyCfg(const KeyConfiguration& keycfg);
|
2018-06-18 15:30:19 +00:00
|
|
|
void setCliOutputMode(CliOutputMode type);
|
2018-04-24 05:24:20 +00:00
|
|
|
void setVerifyMode(bool verify);
|
|
|
|
|
2018-08-07 07:17:51 +00:00
|
|
|
const nn::hac::NpdmBinary& getNpdmBinary() const;
|
2018-05-12 15:02:53 +00:00
|
|
|
|
2018-04-24 05:24:20 +00:00
|
|
|
private:
|
|
|
|
const std::string kModuleName = "NpdmProcess";
|
|
|
|
|
2018-09-23 03:29:22 +00:00
|
|
|
fnd::SharedPtr<fnd::IFile> mFile;
|
2018-08-21 12:03:19 +00:00
|
|
|
KeyConfiguration mKeyCfg;
|
2018-06-18 15:30:19 +00:00
|
|
|
CliOutputMode mCliOutputMode;
|
2018-04-24 05:24:20 +00:00
|
|
|
bool mVerify;
|
|
|
|
|
2018-08-07 07:17:51 +00:00
|
|
|
nn::hac::NpdmBinary mNpdm;
|
2018-04-24 05:24:20 +00:00
|
|
|
|
2018-08-13 17:14:21 +00:00
|
|
|
void importNpdm();
|
|
|
|
|
2018-08-07 07:17:51 +00:00
|
|
|
void validateAcidSignature(const nn::hac::AccessControlInfoDescBinary& acid);
|
|
|
|
void validateAciFromAcid(const nn::hac::AccessControlInfoBinary& aci, const nn::hac::AccessControlInfoDescBinary& acid);
|
2018-04-24 05:24:20 +00:00
|
|
|
|
2018-08-07 07:17:51 +00:00
|
|
|
void displayNpdmHeader(const nn::hac::NpdmBinary& hdr);
|
|
|
|
void displayAciHdr(const nn::hac::AccessControlInfoBinary& aci);
|
|
|
|
void displayAciDescHdr(const nn::hac::AccessControlInfoDescBinary& aci);
|
|
|
|
void displayFac(const nn::hac::FileSystemAccessControlBinary& fac);
|
|
|
|
void displaySac(const nn::hac::ServiceAccessControlBinary& sac);
|
|
|
|
void displayKernelCap(const nn::hac::KernelCapabilityBinary& kern);
|
2018-08-12 05:24:34 +00:00
|
|
|
|
|
|
|
const char* getInstructionTypeStr(nn::hac::npdm::InstructionType type) const;
|
|
|
|
const char* getProcAddressSpaceTypeStr(nn::hac::npdm::ProcAddrSpaceType type) const;
|
|
|
|
const char* getAcidFlagStr(nn::hac::aci::Flag flag) const;
|
|
|
|
const char* getMiscFlagStr(nn::hac::MiscFlagsHandler::Flags flag) const;
|
|
|
|
const char* getFsaRightStr(nn::hac::fac::FsAccessFlag flag) const;
|
|
|
|
const char* getSaveDataOwnerAccessModeStr(nn::hac::fac::SaveDataOwnerIdAccessType type) const;
|
|
|
|
const char* getSystemCallStr(byte_t syscall_id) const;
|
|
|
|
const char* getMemMapPermStr(nn::hac::MemoryMappingHandler::MemoryPerm type) const;
|
|
|
|
const char* getMemMapTypeStr(nn::hac::MemoryMappingHandler::MappingType type) const;
|
2018-04-24 05:24:20 +00:00
|
|
|
};
|