"Fossies" - the Fresh Open Source Software Archive

Member "src/Volume/EncryptionModeXTS.h" (10 Oct 2018, 2324 Bytes) of package /windows/misc/VeraCrypt_1.23-Hotfix-2_Source.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "EncryptionModeXTS.h" see the Fossies "Dox" file reference documentation.

    1 /*
    2  Derived from source code of TrueCrypt 7.1a, which is
    3  Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
    4  by the TrueCrypt License 3.0.
    5 
    6  Modifications and additions to the original source code (contained in this file)
    7  and all other portions of this file are Copyright (c) 2013-2017 IDRIX
    8  and are governed by the Apache License 2.0 the full text of which is
    9  contained in the file License.txt included in VeraCrypt binary and source
   10  code distribution packages.
   11 */
   12 
   13 #ifndef TC_HEADER_Volume_EncryptionModeXTS
   14 #define TC_HEADER_Volume_EncryptionModeXTS
   15 
   16 #include "Platform/Platform.h"
   17 #include "EncryptionMode.h"
   18 
   19 namespace VeraCrypt
   20 {
   21     class EncryptionModeXTS : public EncryptionMode
   22     {
   23     public:
   24         EncryptionModeXTS () { }
   25         virtual ~EncryptionModeXTS () { }
   26 
   27         virtual void Decrypt (byte *data, uint64 length) const;
   28         virtual void DecryptSectorsCurrentThread (byte *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const;
   29         virtual void Encrypt (byte *data, uint64 length) const;
   30         virtual void EncryptSectorsCurrentThread (byte *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const;
   31         virtual const SecureBuffer &GetKey () const { return SecondaryKey; }
   32         virtual size_t GetKeySize () const;
   33         virtual wstring GetName () const { return L"XTS"; };
   34         virtual shared_ptr <EncryptionMode> GetNew () const { return shared_ptr <EncryptionMode> (new EncryptionModeXTS); }
   35         virtual void SetCiphers (const CipherList &ciphers);
   36         virtual void SetKey (const ConstBufferPtr &key);
   37 
   38     protected:
   39         void DecryptBuffer (byte *data, uint64 length, uint64 startDataUnitNo) const;
   40         void DecryptBufferXTS (const Cipher &cipher, const Cipher &secondaryCipher, byte *buffer, uint64 length, uint64 startDataUnitNo, unsigned int startCipherBlockNo) const;
   41         void EncryptBuffer (byte *data, uint64 length, uint64 startDataUnitNo) const;
   42         void EncryptBufferXTS (const Cipher &cipher, const Cipher &secondaryCipher, byte *buffer, uint64 length, uint64 startDataUnitNo, unsigned int startCipherBlockNo) const;
   43         void SetSecondaryCipherKeys ();
   44 
   45         SecureBuffer SecondaryKey;
   46         CipherList SecondaryCiphers;
   47 
   48     private:
   49         EncryptionModeXTS (const EncryptionModeXTS &);
   50         EncryptionModeXTS &operator= (const EncryptionModeXTS &);
   51     };
   52 }
   53 
   54 #endif // TC_HEADER_Volume_EncryptionModeXTS