|
|
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_Encryption_EncryptionModeLRW ! 10: #define TC_HEADER_Encryption_EncryptionModeLRW ! 11: ! 12: #include "Platform/Platform.h" ! 13: #include "EncryptionMode.h" ! 14: ! 15: namespace TrueCrypt ! 16: { ! 17: class EncryptionModeLRW : public EncryptionMode ! 18: { ! 19: public: ! 20: EncryptionModeLRW () { } ! 21: virtual ~EncryptionModeLRW () { } ! 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 { return 16; }; ! 28: virtual wstring GetName () const { return L"LRW"; }; ! 29: virtual shared_ptr <EncryptionMode> GetNew () const { return shared_ptr <EncryptionMode> (new EncryptionModeLRW); } ! 30: virtual void SetKey (const ConstBufferPtr &key); ! 31: ! 32: protected: ! 33: void DecryptBuffer (byte *plainText, uint64 length, uint64 blockIndex) const; ! 34: void EncryptBuffer (byte *plainText, uint64 length, uint64 blockIndex) const; ! 35: void IncrementBlockIndex (byte *index) const; ! 36: uint64 SectorToBlockIndex (uint64 sectorIndex) const; ! 37: void Xor64 (uint64 *a, const uint64 *b) const; ! 38: void Xor128 (uint64 *a, const uint64 *b) const; ! 39: ! 40: SecureBuffer GfContext; ! 41: ! 42: private: ! 43: EncryptionModeLRW (const EncryptionModeLRW &); ! 44: EncryptionModeLRW &operator= (const EncryptionModeLRW &); ! 45: }; ! 46: } ! 47: ! 48: #endif // TC_HEADER_Encryption_EncryptionModeLRW
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.