xts_encryption_layer.h 687 B

123456789101112131415161718192021222324
  1. // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #pragma once
  4. #include "core/crypto/aes_util.h"
  5. #include "core/crypto/encryption_layer.h"
  6. #include "core/crypto/key_manager.h"
  7. namespace Core::Crypto {
  8. // Sits on top of a VirtualFile and provides XTS-mode AES description.
  9. class XTSEncryptionLayer : public EncryptionLayer {
  10. public:
  11. XTSEncryptionLayer(FileSys::VirtualFile base, Key256 key);
  12. std::size_t Read(u8* data, std::size_t length, std::size_t offset) const override;
  13. private:
  14. // Must be mutable as operations modify cipher contexts.
  15. mutable AESCipher<Key256> cipher;
  16. };
  17. } // namespace Core::Crypto