|
|
1.1 root 1: /*
2: Copyright (c) 2008 TrueCrypt Foundation. All rights reserved.
3:
4: Governed by the TrueCrypt License 2.4 the full text of which is contained
5: in the file License.txt included in TrueCrypt binary and source code
6: distribution packages.
7: */
8:
9: #ifndef TC_HEADER_Volume_EncryptionModeXTS
10: #define TC_HEADER_Volume_EncryptionModeXTS
11:
12: #include "Platform/Platform.h"
13: #include "EncryptionMode.h"
14:
15: namespace TrueCrypt
16: {
17: class EncryptionModeXTS : public EncryptionMode
18: {
19: public:
20: EncryptionModeXTS () { }
21: virtual ~EncryptionModeXTS () { }
22:
23: virtual void Decrypt (byte *data, uint64 length) const;
24: virtual void DecryptSectors (byte *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const;
25: virtual void Encrypt (byte *data, uint64 length) const;
26: virtual void EncryptSectors (byte *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const;
27: virtual size_t GetKeySize () const;
28: virtual wstring GetName () const { return L"XTS"; };
29: virtual shared_ptr <EncryptionMode> GetNew () const { return shared_ptr <EncryptionMode> (new EncryptionModeXTS); }
30: virtual void SetCiphers (const CipherList &ciphers);
31: virtual void SetKey (const ConstBufferPtr &key);
32:
33: protected:
34: void DecryptBuffer (byte *data, uint64 length, uint64 startDataUnitNo) const;
35: void DecryptBufferXTS (const Cipher &cipher, const Cipher &secondaryCipher, byte *buffer, uint64 length, uint64 startDataUnitNo, unsigned int startCipherBlockNo) const;
36: void EncryptBuffer (byte *data, uint64 length, uint64 startDataUnitNo) const;
37: void EncryptBufferXTS (const Cipher &cipher, const Cipher &secondaryCipher, byte *buffer, uint64 length, uint64 startDataUnitNo, unsigned int startCipherBlockNo) const;
38: void SetSecondaryCipherKeys ();
39:
40: SecureBuffer SecondaryKey;
41: CipherList SecondaryCiphers;
42:
43: private:
44: EncryptionModeXTS (const EncryptionModeXTS &);
45: EncryptionModeXTS &operator= (const EncryptionModeXTS &);
46: };
47: }
48:
49: #endif // TC_HEADER_Volume_EncryptionModeXTS
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.