forked from Atmosphere-NX/Atmosphere
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fs: update nca drivers (and dependents/callees) for 14.0.0 changes
- Loading branch information
Showing
24 changed files
with
1,495 additions
and
461 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
...aries/libstratosphere/include/stratosphere/fssystem/fssystem_aes_ctr_storage_external.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright (c) Atmosphère-NX | ||
* | ||
* This program is free software; you can redistribute it and/or modify it | ||
* under the terms and conditions of the GNU General Public License, | ||
* version 2, as published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
* more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
#pragma once | ||
#include <vapours.hpp> | ||
#include <stratosphere/fs/fs_istorage.hpp> | ||
#include <stratosphere/fs/impl/fs_newable.hpp> | ||
#include <stratosphere/fssystem/fssystem_nca_file_system_driver.hpp> | ||
|
||
namespace ams::fssystem { | ||
|
||
/* ACCURATE_TO_VERSION: 14.3.0.0 */ | ||
class AesCtrStorageExternal : public ::ams::fs::IStorage, public ::ams::fs::impl::Newable { | ||
NON_COPYABLE(AesCtrStorageExternal); | ||
NON_MOVEABLE(AesCtrStorageExternal); | ||
public: | ||
static constexpr size_t BlockSize = crypto::Aes128CtrEncryptor::BlockSize; | ||
static constexpr size_t KeySize = crypto::Aes128CtrEncryptor::KeySize; | ||
static constexpr size_t IvSize = crypto::Aes128CtrEncryptor::IvSize; | ||
private: | ||
std::shared_ptr<fs::IStorage> m_base_storage; | ||
u8 m_iv[IvSize]; | ||
DecryptAesCtrFunction m_decrypt_function; | ||
s32 m_key_index; | ||
s32 m_key_generation; | ||
u8 m_encrypted_key[KeySize]; | ||
public: | ||
AesCtrStorageExternal(std::shared_ptr<fs::IStorage> bs, const void *enc_key, size_t enc_key_size, const void *iv, size_t iv_size, DecryptAesCtrFunction df, s32 kidx, s32 kgen); | ||
|
||
virtual Result Read(s64 offset, void *buffer, size_t size) override; | ||
virtual Result OperateRange(void *dst, size_t dst_size, fs::OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) override; | ||
virtual Result GetSize(s64 *out) override; | ||
virtual Result Flush() override; | ||
virtual Result Write(s64 offset, const void *buffer, size_t size) override; | ||
virtual Result SetSize(s64 size) override; | ||
}; | ||
|
||
} |
54 changes: 54 additions & 0 deletions
54
...aries/libstratosphere/include/stratosphere/fssystem/fssystem_aes_xts_storage_external.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* Copyright (c) Atmosphère-NX | ||
* | ||
* This program is free software; you can redistribute it and/or modify it | ||
* under the terms and conditions of the GNU General Public License, | ||
* version 2, as published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
* more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
#pragma once | ||
#include <vapours.hpp> | ||
#include <stratosphere/fs/fs_istorage.hpp> | ||
#include <stratosphere/fs/impl/fs_newable.hpp> | ||
#include <stratosphere/fssystem/fssystem_nca_file_system_driver.hpp> | ||
|
||
namespace ams::fssystem { | ||
|
||
/* ACCURATE_TO_VERSION: 14.3.0.0 */ | ||
template<fs::PointerToStorage BasePointer> | ||
class AesXtsStorageExternal : public ::ams::fs::IStorage, public ::ams::fs::impl::Newable { | ||
NON_COPYABLE(AesXtsStorageExternal); | ||
NON_MOVEABLE(AesXtsStorageExternal); | ||
public: | ||
static constexpr size_t AesBlockSize = crypto::Aes128XtsEncryptor::BlockSize; | ||
static constexpr size_t KeySize = crypto::Aes128XtsEncryptor::KeySize; | ||
static constexpr size_t IvSize = crypto::Aes128XtsEncryptor::IvSize; | ||
private: | ||
BasePointer m_base_storage; | ||
char m_key[2][KeySize]; | ||
char m_iv[IvSize]; | ||
const size_t m_block_size; | ||
CryptAesXtsFunction m_encrypt_function; | ||
CryptAesXtsFunction m_decrypt_function; | ||
public: | ||
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); | ||
|
||
virtual Result Read(s64 offset, void *buffer, size_t size) override; | ||
virtual Result OperateRange(void *dst, size_t dst_size, fs::OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) override; | ||
virtual Result GetSize(s64 *out) override; | ||
virtual Result Flush() override; | ||
virtual Result Write(s64 offset, const void *buffer, size_t size) override; | ||
virtual Result SetSize(s64 size) override; | ||
}; | ||
|
||
using AesXtsStorageExternalByPointer = AesXtsStorageExternal<fs::IStorage *>; | ||
using AesXtsStorageExternalBySharedPointer = AesXtsStorageExternal<std::shared_ptr<fs::IStorage>>; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.