mirror of
https://github.com/Atmosphere-NX/Atmosphere-libs.git
synced 2025-06-28 14:02:40 +02:00
loader: improve verification terminology
This commit is contained in:
parent
828bd1cc52
commit
4c51c55d1a
@ -19,17 +19,17 @@
|
|||||||
|
|
||||||
namespace ams::fs {
|
namespace ams::fs {
|
||||||
|
|
||||||
struct CodeInfo {
|
struct CodeVerificationData {
|
||||||
u8 signature[crypto::Rsa2048PssSha256Verifier::SignatureSize];
|
u8 signature[crypto::Rsa2048PssSha256Verifier::SignatureSize];
|
||||||
u8 hash[crypto::Rsa2048PssSha256Verifier::HashSize];
|
u8 target_hash[crypto::Rsa2048PssSha256Verifier::HashSize];
|
||||||
bool is_signed;
|
bool has_data;
|
||||||
u8 reserved[3];
|
u8 reserved[3];
|
||||||
};
|
};
|
||||||
static_assert(sizeof(CodeInfo) == crypto::Rsa2048PssSha256Verifier::SignatureSize + crypto::Rsa2048PssSha256Verifier::HashSize + 4);
|
static_assert(sizeof(CodeVerificationData) == crypto::Rsa2048PssSha256Verifier::SignatureSize + crypto::Rsa2048PssSha256Verifier::HashSize + 4);
|
||||||
|
|
||||||
Result MountCode(CodeInfo *out, const char *name, const char *path, ncm::ProgramId program_id);
|
Result MountCode(CodeVerificationData *out, const char *name, const char *path, ncm::ProgramId program_id);
|
||||||
|
|
||||||
Result MountCodeForAtmosphereWithRedirection(CodeInfo *out, const char *name, const char *path, ncm::ProgramId program_id, bool is_hbl, bool is_specific);
|
Result MountCodeForAtmosphereWithRedirection(CodeVerificationData *out, const char *name, const char *path, ncm::ProgramId program_id, bool is_hbl, bool is_specific);
|
||||||
Result MountCodeForAtmosphere(CodeInfo *out, const char *name, const char *path, ncm::ProgramId program_id);
|
Result MountCodeForAtmosphere(CodeVerificationData *out, const char *name, const char *path, ncm::ProgramId program_id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,15 +20,15 @@ namespace ams::fs {
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
Result OpenCodeFileSystemImpl(CodeInfo *out_code_info, std::unique_ptr<fsa::IFileSystem> *out, const char *path, ncm::ProgramId program_id) {
|
Result OpenCodeFileSystemImpl(CodeVerificationData *out_verification_data, std::unique_ptr<fsa::IFileSystem> *out, const char *path, ncm::ProgramId program_id) {
|
||||||
/* Print a path suitable for the remote service. */
|
/* Print a path suitable for the remote service. */
|
||||||
fssrv::sf::Path sf_path;
|
fssrv::sf::Path sf_path;
|
||||||
R_TRY(FspPathPrintf(std::addressof(sf_path), "%s", path));
|
R_TRY(FspPathPrintf(std::addressof(sf_path), "%s", path));
|
||||||
|
|
||||||
/* Open the filesystem using libnx bindings. */
|
/* Open the filesystem using libnx bindings. */
|
||||||
static_assert(sizeof(CodeInfo) == sizeof(::FsCodeInfo));
|
static_assert(sizeof(CodeVerificationData) == sizeof(::FsCodeInfo));
|
||||||
::FsFileSystem fs;
|
::FsFileSystem fs;
|
||||||
R_TRY(fsldrOpenCodeFileSystem(reinterpret_cast<::FsCodeInfo *>(out_code_info), program_id.value, sf_path.str, std::addressof(fs)));
|
R_TRY(fsldrOpenCodeFileSystem(reinterpret_cast<::FsCodeInfo *>(out_verification_data), program_id.value, sf_path.str, std::addressof(fs)));
|
||||||
|
|
||||||
/* Allocate a new filesystem wrapper. */
|
/* Allocate a new filesystem wrapper. */
|
||||||
auto fsa = std::make_unique<RemoteFileSystem>(fs);
|
auto fsa = std::make_unique<RemoteFileSystem>(fs);
|
||||||
@ -62,12 +62,12 @@ namespace ams::fs {
|
|||||||
return OpenPackageFileSystemImpl(out, sf_path.str);
|
return OpenPackageFileSystemImpl(out, sf_path.str);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result OpenSdCardCodeOrCodeFileSystemImpl(CodeInfo *out_code_info, std::unique_ptr<fsa::IFileSystem> *out, const char *path, ncm::ProgramId program_id) {
|
Result OpenSdCardCodeOrCodeFileSystemImpl(CodeVerificationData *out_verification_data, std::unique_ptr<fsa::IFileSystem> *out, const char *path, ncm::ProgramId program_id) {
|
||||||
/* If we can open an sd card code fs, use it. */
|
/* If we can open an sd card code fs, use it. */
|
||||||
R_SUCCEED_IF(R_SUCCEEDED(OpenSdCardCodeFileSystemImpl(out, program_id)));
|
R_SUCCEED_IF(R_SUCCEEDED(OpenSdCardCodeFileSystemImpl(out, program_id)));
|
||||||
|
|
||||||
/* Otherwise, fall back to a normal code fs. */
|
/* Otherwise, fall back to a normal code fs. */
|
||||||
return OpenCodeFileSystemImpl(out_code_info, out, path, program_id);
|
return OpenCodeFileSystemImpl(out_verification_data, out, path, program_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result OpenHblCodeFileSystemImpl(std::unique_ptr<fsa::IFileSystem> *out) {
|
Result OpenHblCodeFileSystemImpl(std::unique_ptr<fsa::IFileSystem> *out) {
|
||||||
@ -227,7 +227,7 @@ namespace ams::fs {
|
|||||||
public:
|
public:
|
||||||
AtmosphereCodeFileSystem() : initialized(false) { /* ... */ }
|
AtmosphereCodeFileSystem() : initialized(false) { /* ... */ }
|
||||||
|
|
||||||
Result Initialize(CodeInfo *out_code_info, const char *path, ncm::ProgramId program_id, bool is_hbl, bool is_specific) {
|
Result Initialize(CodeVerificationData *out_verification_data, const char *path, ncm::ProgramId program_id, bool is_hbl, bool is_specific) {
|
||||||
AMS_ABORT_UNLESS(!this->initialized);
|
AMS_ABORT_UNLESS(!this->initialized);
|
||||||
|
|
||||||
/* If we're hbl, we need to open a hbl fs. */
|
/* If we're hbl, we need to open a hbl fs. */
|
||||||
@ -239,7 +239,7 @@ namespace ams::fs {
|
|||||||
|
|
||||||
/* Open the code filesystem. */
|
/* Open the code filesystem. */
|
||||||
std::unique_ptr<fsa::IFileSystem> fsa;
|
std::unique_ptr<fsa::IFileSystem> fsa;
|
||||||
R_TRY(OpenSdCardCodeOrCodeFileSystemImpl(out_code_info, std::addressof(fsa), path, program_id));
|
R_TRY(OpenSdCardCodeOrCodeFileSystemImpl(out_verification_data, std::addressof(fsa), path, program_id));
|
||||||
this->code_fs.emplace(std::move(fsa), program_id, is_specific);
|
this->code_fs.emplace(std::move(fsa), program_id, is_specific);
|
||||||
|
|
||||||
this->program_id = program_id;
|
this->program_id = program_id;
|
||||||
@ -275,7 +275,7 @@ namespace ams::fs {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Result MountCode(CodeInfo *out, const char *name, const char *path, ncm::ProgramId program_id) {
|
Result MountCode(CodeVerificationData *out, const char *name, const char *path, ncm::ProgramId program_id) {
|
||||||
/* Clear the output. */
|
/* Clear the output. */
|
||||||
std::memset(out, 0, sizeof(*out));
|
std::memset(out, 0, sizeof(*out));
|
||||||
|
|
||||||
@ -293,7 +293,7 @@ namespace ams::fs {
|
|||||||
return fsa::Register(name, std::move(fsa));
|
return fsa::Register(name, std::move(fsa));
|
||||||
}
|
}
|
||||||
|
|
||||||
Result MountCodeForAtmosphereWithRedirection(CodeInfo *out, const char *name, const char *path, ncm::ProgramId program_id, bool is_hbl, bool is_specific) {
|
Result MountCodeForAtmosphereWithRedirection(CodeVerificationData *out, const char *name, const char *path, ncm::ProgramId program_id, bool is_hbl, bool is_specific) {
|
||||||
/* Clear the output. */
|
/* Clear the output. */
|
||||||
std::memset(out, 0, sizeof(*out));
|
std::memset(out, 0, sizeof(*out));
|
||||||
|
|
||||||
@ -314,7 +314,7 @@ namespace ams::fs {
|
|||||||
return fsa::Register(name, std::move(ams_code_fs));
|
return fsa::Register(name, std::move(ams_code_fs));
|
||||||
}
|
}
|
||||||
|
|
||||||
Result MountCodeForAtmosphere(CodeInfo *out, const char *name, const char *path, ncm::ProgramId program_id) {
|
Result MountCodeForAtmosphere(CodeVerificationData *out, const char *name, const char *path, ncm::ProgramId program_id) {
|
||||||
/* Clear the output. */
|
/* Clear the output. */
|
||||||
std::memset(out, 0, sizeof(*out));
|
std::memset(out, 0, sizeof(*out));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user