strat: fix linux clang build

This commit is contained in:
Michael Scire 2022-04-17 14:01:03 -07:00
parent 895b6d0470
commit 9056e0b05f
5 changed files with 27 additions and 25 deletions

View file

@ -67,7 +67,7 @@ endif
ifeq ($(ATMOSPHERE_BOARD),nx-hac-001)
export LDFLAGS = -specs=$(ATMOSPHERE_LIBRARIES_DIR)/libstratosphere/stratosphere.specs -specs=$(DEVKITPRO)/libnx/switch.specs $(CXXFLAGS) $(CXXWRAPS) $(CXXREQUIRED) -Wl,-Map,$(notdir $*.map)
else ifeq ($(ATMOSPHERE_COMPILER_NAME),clang)
else ifeq ($(ATMOSPHERE_OS_NAME),macos)
export LDFLAGS = $(CXXFLAGS) $(CXXWRAPS) $(CXXREQUIRED) -Wl,-map,$(notdir $@.map)
else
export LDFLAGS = $(CXXFLAGS) $(CXXWRAPS) $(CXXREQUIRED) -Wl,-Map,$(notdir $@.map)

View file

@ -29,7 +29,9 @@ namespace ams::fssystem {
NON_COPYABLE(ShaHashGenerator);
NON_MOVEABLE(ShaHashGenerator);
private:
Traits::Generator m_generator;
using Generator = typename Traits::Generator;
private:
Generator m_generator;
public:
ShaHashGenerator() = default;
protected:

View file

@ -17,7 +17,7 @@
namespace ams::fssystem {
template<typename BasePointer>
template<fs::PointerToStorage BasePointer>
void AesCtrStorage<BasePointer>::MakeIv(void *dst, size_t dst_size, u64 upper, s64 offset) {
AMS_ASSERT(dst != nullptr);
AMS_ASSERT(dst_size == IvSize);
@ -30,7 +30,7 @@ namespace ams::fssystem {
util::StoreBigEndian(reinterpret_cast<s64 *>(out_addr + sizeof(u64)), static_cast<s64>(offset / BlockSize));
}
template<typename BasePointer>
template<fs::PointerToStorage BasePointer>
AesCtrStorage<BasePointer>::AesCtrStorage(BasePointer base, const void *key, size_t key_size, const void *iv, size_t iv_size) : m_base_storage(std::move(base)) {
AMS_ASSERT(m_base_storage != nullptr);
AMS_ASSERT(key != nullptr);
@ -43,7 +43,7 @@ namespace ams::fssystem {
std::memcpy(m_iv, iv, IvSize);
}
template<typename BasePointer>
template<fs::PointerToStorage BasePointer>
Result AesCtrStorage<BasePointer>::Read(s64 offset, void *buffer, size_t size) {
/* Allow zero-size reads. */
R_SUCCEED_IF(size == 0);
@ -73,7 +73,7 @@ namespace ams::fssystem {
R_SUCCEED();
}
template<typename BasePointer>
template<fs::PointerToStorage BasePointer>
Result AesCtrStorage<BasePointer>::Write(s64 offset, const void *buffer, size_t size) {
/* Allow zero-size writes. */
R_SUCCEED_IF(size == 0);
@ -127,23 +127,23 @@ namespace ams::fssystem {
R_SUCCEED();
}
template<typename BasePointer>
template<fs::PointerToStorage BasePointer>
Result AesCtrStorage<BasePointer>::Flush() {
R_RETURN(m_base_storage->Flush());
}
template<typename BasePointer>
template<fs::PointerToStorage BasePointer>
Result AesCtrStorage<BasePointer>::SetSize(s64 size) {
AMS_UNUSED(size);
R_THROW(fs::ResultUnsupportedSetSizeForAesCtrStorage());
}
template<typename BasePointer>
template<fs::PointerToStorage BasePointer>
Result AesCtrStorage<BasePointer>::GetSize(s64 *out) {
R_RETURN(m_base_storage->GetSize(out));
}
template<typename BasePointer>
template<fs::PointerToStorage BasePointer>
Result AesCtrStorage<BasePointer>::OperateRange(void *dst, size_t dst_size, fs::OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) {
/* If operation isn't invalidate, special case. */
if (op_id != fs::OperationId::Invalidate) {

View file

@ -17,7 +17,7 @@
namespace ams::fssystem {
template<typename BasePointer>
template<fs::PointerToStorage BasePointer>
void AesXtsStorage<BasePointer>::MakeAesXtsIv(void *dst, size_t dst_size, s64 offset, size_t block_size) {
AMS_ASSERT(dst != nullptr);
AMS_ASSERT(dst_size == IvSize);
@ -29,7 +29,7 @@ namespace ams::fssystem {
util::StoreBigEndian<s64>(reinterpret_cast<s64 *>(out_addr + sizeof(s64)), offset / block_size);
}
template<typename BasePointer>
template<fs::PointerToStorage BasePointer>
AesXtsStorage<BasePointer>::AesXtsStorage(BasePointer base, const void *key1, const void *key2, size_t key_size, const void *iv, size_t iv_size, size_t block_size) : m_base_storage(std::move(base)), m_block_size(block_size), m_mutex() {
AMS_ASSERT(m_base_storage != nullptr);
AMS_ASSERT(key1 != nullptr);
@ -45,7 +45,7 @@ namespace ams::fssystem {
std::memcpy(m_iv, iv, IvSize);
}
template<typename BasePointer>
template<fs::PointerToStorage BasePointer>
Result AesXtsStorage<BasePointer>::Read(s64 offset, void *buffer, size_t size) {
/* Allow zero-size reads. */
R_SUCCEED_IF(size == 0);
@ -111,7 +111,7 @@ namespace ams::fssystem {
R_SUCCEED();
}
template<typename BasePointer>
template<fs::PointerToStorage BasePointer>
Result AesXtsStorage<BasePointer>::Write(s64 offset, const void *buffer, size_t size) {
/* Allow zero-size writes. */
R_SUCCEED_IF(size == 0);
@ -209,24 +209,24 @@ namespace ams::fssystem {
R_SUCCEED();
}
template<typename BasePointer>
template<fs::PointerToStorage BasePointer>
Result AesXtsStorage<BasePointer>::Flush() {
R_RETURN(m_base_storage->Flush());
}
template<typename BasePointer>
template<fs::PointerToStorage BasePointer>
Result AesXtsStorage<BasePointer>::SetSize(s64 size) {
R_UNLESS(util::IsAligned(size, AesBlockSize), fs::ResultUnexpectedInAesXtsStorageA());
R_RETURN(m_base_storage->SetSize(size));
}
template<typename BasePointer>
template<fs::PointerToStorage BasePointer>
Result AesXtsStorage<BasePointer>::GetSize(s64 *out) {
R_RETURN(m_base_storage->GetSize(out));
}
template<typename BasePointer>
template<fs::PointerToStorage BasePointer>
Result AesXtsStorage<BasePointer>::OperateRange(void *dst, size_t dst_size, fs::OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) {
/* Unless invalidating cache, check the arguments. */
if (op_id != fs::OperationId::Invalidate) {

View file

@ -17,7 +17,7 @@
namespace ams::fssystem {
template<typename BasePointer>
template<fs::PointerToStorage BasePointer>
AesXtsStorageExternal<BasePointer>::AesXtsStorageExternal(BasePointer bs, const void *key1, const void *key2, size_t key_size, const void *iv, size_t iv_size, size_t block_size, CryptAesXtsFunction ef, CryptAesXtsFunction df) : m_base_storage(std::move(bs)), m_block_size(block_size), m_encrypt_function(ef), m_decrypt_function(df) {
AMS_ASSERT(key_size == KeySize);
AMS_ASSERT(iv_size == IvSize);
@ -34,7 +34,7 @@ namespace ams::fssystem {
std::memcpy(m_iv, iv, IvSize);
}
template<typename BasePointer>
template<fs::PointerToStorage BasePointer>
Result AesXtsStorageExternal<BasePointer>::Read(s64 offset, void *buffer, size_t size) {
/* Allow zero size. */
R_SUCCEED_IF(size == 0);
@ -102,7 +102,7 @@ namespace ams::fssystem {
R_SUCCEED();
}
template<typename BasePointer>
template<fs::PointerToStorage BasePointer>
Result AesXtsStorageExternal<BasePointer>::Write(s64 offset, const void *buffer, size_t size) {
/* Allow zero-size writes. */
R_SUCCEED_IF(size == 0);
@ -195,7 +195,7 @@ namespace ams::fssystem {
R_SUCCEED();
}
template<typename BasePointer>
template<fs::PointerToStorage BasePointer>
Result AesXtsStorageExternal<BasePointer>::OperateRange(void *dst, size_t dst_size, fs::OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) {
/* Unless invalidating cache, check the arguments. */
if (op_id != fs::OperationId::Invalidate) {
@ -210,17 +210,17 @@ namespace ams::fssystem {
R_RETURN(m_base_storage->OperateRange(dst, dst_size, op_id, offset, size, src, src_size));
}
template<typename BasePointer>
template<fs::PointerToStorage BasePointer>
Result AesXtsStorageExternal<BasePointer>::GetSize(s64 *out) {
R_RETURN(m_base_storage->GetSize(out));
}
template<typename BasePointer>
template<fs::PointerToStorage BasePointer>
Result AesXtsStorageExternal<BasePointer>::Flush() {
R_RETURN(m_base_storage->Flush());
}
template<typename BasePointer>
template<fs::PointerToStorage BasePointer>
Result AesXtsStorageExternal<BasePointer>::SetSize(s64 size) {
R_UNLESS(util::IsAligned(size, AesBlockSize), fs::ResultUnexpectedInAesXtsStorageA());