mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2026-05-20 11:31:31 +00:00
wolfCrypt as crypto backend for VeraCrypt (#1227)
* wolfCrypt as crypto backend for VeraCrypt * Refactor to use EncryptionModeWolfCryptXTS class
This commit is contained in:
@@ -12,6 +12,9 @@
|
||||
|
||||
#include "Volume/EncryptionMode.h"
|
||||
#include "Volume/EncryptionModeXTS.h"
|
||||
#ifdef WOLFCRYPT_BACKEND
|
||||
#include "Volume/EncryptionModeWolfCryptXTS.h"
|
||||
#endif
|
||||
#include "VolumeLayout.h"
|
||||
#include "Boot/Windows/BootCommon.h"
|
||||
|
||||
@@ -66,6 +69,7 @@ namespace VeraCrypt
|
||||
HeaderSize = TC_VOLUME_HEADER_SIZE_LEGACY;
|
||||
|
||||
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new AES ()));
|
||||
#ifndef WOLFCRYPT_BACKEND
|
||||
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new Serpent ()));
|
||||
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new Twofish ()));
|
||||
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new Camellia ()));
|
||||
@@ -75,7 +79,10 @@ namespace VeraCrypt
|
||||
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new SerpentTwofishAES ()));
|
||||
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new TwofishSerpent ()));
|
||||
|
||||
SupportedEncryptionModes.push_back (shared_ptr <EncryptionMode> (new EncryptionModeXTS ()));
|
||||
SupportedEncryptionModes.push_back (shared_ptr <EncryptionMode> (new EncryptionModeXTS ()));
|
||||
#else
|
||||
SupportedEncryptionModes.push_back (shared_ptr <EncryptionMode> (new EncryptionModeWolfCryptXTS ()));
|
||||
#endif
|
||||
}
|
||||
|
||||
uint64 VolumeLayoutV1Normal::GetDataOffset (uint64 volumeHostSize) const
|
||||
@@ -97,6 +104,7 @@ namespace VeraCrypt
|
||||
BackupHeaderOffset = -TC_VOLUME_HEADER_GROUP_SIZE;
|
||||
|
||||
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new AES ()));
|
||||
#ifndef WOLFCRYPT_BACKEND
|
||||
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new Serpent ()));
|
||||
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new Twofish ()));
|
||||
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new Camellia ()));
|
||||
@@ -111,9 +119,12 @@ namespace VeraCrypt
|
||||
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new SerpentAES ()));
|
||||
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new SerpentTwofishAES ()));
|
||||
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new TwofishSerpent ()));
|
||||
|
||||
SupportedEncryptionModes.push_back (shared_ptr <EncryptionMode> (new EncryptionModeXTS ()));
|
||||
}
|
||||
#else
|
||||
SupportedEncryptionModes.push_back (shared_ptr <EncryptionMode> (new EncryptionModeWolfCryptXTS ()));
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
uint64 VolumeLayoutV2Normal::GetDataOffset (uint64 volumeHostSize) const
|
||||
{
|
||||
@@ -142,6 +153,7 @@ namespace VeraCrypt
|
||||
BackupHeaderOffset = -TC_HIDDEN_VOLUME_HEADER_OFFSET;
|
||||
|
||||
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new AES ()));
|
||||
#ifndef WOLFCRYPT_BACKEND
|
||||
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new Serpent ()));
|
||||
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new Twofish ()));
|
||||
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new Camellia ()));
|
||||
@@ -158,6 +170,9 @@ namespace VeraCrypt
|
||||
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new TwofishSerpent ()));
|
||||
|
||||
SupportedEncryptionModes.push_back (shared_ptr <EncryptionMode> (new EncryptionModeXTS ()));
|
||||
#else
|
||||
SupportedEncryptionModes.push_back (shared_ptr <EncryptionMode> (new EncryptionModeWolfCryptXTS ()));
|
||||
#endif
|
||||
}
|
||||
|
||||
uint64 VolumeLayoutV2Hidden::GetDataOffset (uint64 volumeHostSize) const
|
||||
@@ -194,6 +209,7 @@ namespace VeraCrypt
|
||||
HeaderSize = TC_BOOT_ENCRYPTION_VOLUME_HEADER_SIZE;
|
||||
|
||||
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new AES ()));
|
||||
#ifndef WOLFCRYPT_BACKEND
|
||||
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new Serpent ()));
|
||||
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new Twofish ()));
|
||||
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new Camellia ()));
|
||||
@@ -208,9 +224,13 @@ namespace VeraCrypt
|
||||
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new SerpentAES ()));
|
||||
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new SerpentTwofishAES ()));
|
||||
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new TwofishSerpent ()));
|
||||
|
||||
SupportedEncryptionModes.push_back (shared_ptr <EncryptionMode> (new EncryptionModeXTS ()));
|
||||
}
|
||||
|
||||
SupportedEncryptionModes.push_back (shared_ptr <EncryptionMode> (new EncryptionModeXTS ()));
|
||||
#else
|
||||
SupportedEncryptionModes.push_back (shared_ptr <EncryptionMode> (new EncryptionModeWolfCryptXTS ()));
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
uint64 VolumeLayoutSystemEncryption::GetDataOffset (uint64 volumeHostSize) const
|
||||
{
|
||||
@@ -226,10 +246,12 @@ namespace VeraCrypt
|
||||
{
|
||||
Pkcs5KdfList l;
|
||||
l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacSha256_Boot ()));
|
||||
l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacBlake2s_Boot ()));
|
||||
l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacSha512 ()));
|
||||
#ifndef WOLFCRYPT_BACKEND
|
||||
l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacBlake2s_Boot ()));
|
||||
l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacWhirlpool ()));
|
||||
l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacStreebog ()));
|
||||
return l;
|
||||
#endif
|
||||
return l;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user