From 344a066adafd2013d73778b79dc28a78a22c8c3a Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Mon, 24 Feb 2020 18:02:01 -0800 Subject: [PATCH] ro: implement 9.1.0 security measures --- .../include/stratosphere/ro/ro_types.hpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/libstratosphere/include/stratosphere/ro/ro_types.hpp b/libstratosphere/include/stratosphere/ro/ro_types.hpp index db913496..31abdfe5 100644 --- a/libstratosphere/include/stratosphere/ro/ro_types.hpp +++ b/libstratosphere/include/stratosphere/ro/ro_types.hpp @@ -86,8 +86,12 @@ namespace ams::ro { return this->num_hashes; } + size_t GetHashesOffset() const { + return this->hashes_offset; + } + uintptr_t GetHashes() const { - return reinterpret_cast(this) + this->hashes_offset; + return reinterpret_cast(this) + this->GetHashesOffset(); } u32 GetKeyGeneration() const { @@ -114,12 +118,16 @@ namespace ams::ro { return reinterpret_cast(std::addressof(this->program_id)); } - size_t GetSignedAreaSize() const; + size_t GetSignedAreaSize() const { + return this->size - this->GetSignedAreaOffset(); + } + + size_t GetSignedAreaOffset() const; }; static_assert(sizeof(NrrHeader) == 0x350, "NrrHeader definition!"); - inline size_t NrrHeader::GetSignedAreaSize() const { - return this->size - OFFSETOF(NrrHeader, program_id); + inline size_t NrrHeader::GetSignedAreaOffset() const { + return OFFSETOF(NrrHeader, program_id); } class NroHeader {