xts_encryption_layer.h 702 B

12345678910111213141516171819202122232425
  1. // Copyright 2018 yuzu emulator team
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #pragma once
  5. #include "core/crypto/aes_util.h"
  6. #include "core/crypto/encryption_layer.h"
  7. #include "core/crypto/key_manager.h"
  8. namespace Core::Crypto {
  9. // Sits on top of a VirtualFile and provides XTS-mode AES decription.
  10. class XTSEncryptionLayer : public EncryptionLayer {
  11. public:
  12. XTSEncryptionLayer(FileSys::VirtualFile base, Key256 key);
  13. std::size_t Read(u8* data, std::size_t length, std::size_t offset) const override;
  14. private:
  15. // Must be mutable as operations modify cipher contexts.
  16. mutable AESCipher<Key256> cipher;
  17. };
  18. } // namespace Core::Crypto