1
0
mirror of https://github.com/veracrypt/VeraCrypt.git synced 2025-11-11 11:08:02 -06:00

Crypto: Add support for Japanese encryption standard Camellia, including for system encryption.

This commit is contained in:
Mounir IDRASSI
2016-06-02 00:10:39 +02:00
parent 99c4031d89
commit 76d3bc631e
67 changed files with 1579 additions and 14 deletions

View File

@@ -15,6 +15,7 @@
#include "Crypto/Aes.h"
#include "Crypto/Serpent.h"
#include "Crypto/Twofish.h"
#include "Crypto/Camellia.h"
#ifdef TC_AES_HW_CPU
# include "Crypto/Aes_hw_cpu.h"
@@ -77,6 +78,7 @@ namespace VeraCrypt
l.push_back (shared_ptr <Cipher> (new CipherAES ()));
l.push_back (shared_ptr <Cipher> (new CipherSerpent ()));
l.push_back (shared_ptr <Cipher> (new CipherTwofish ()));
l.push_back (shared_ptr <Cipher> (new CipherCamellia ()));
return l;
}
@@ -239,6 +241,27 @@ namespace VeraCrypt
{
twofish_set_key ((TwofishInstance *) ScheduledKey.Ptr(), (unsigned int *) key);
}
// Camellia
void CipherCamellia::Decrypt (byte *data) const
{
camellia_decrypt (data, data, (uint64 *) ScheduledKey.Ptr());
}
void CipherCamellia::Encrypt (byte *data) const
{
camellia_encrypt (data, data, (uint64 *) ScheduledKey.Ptr());
}
size_t CipherCamellia::GetScheduledKeySize () const
{
return CAMELLIA_KS;
}
void CipherCamellia::SetCipherKey (const byte *key)
{
camellia_set_key (key, (uint64 *) ScheduledKey.Ptr());
}
bool Cipher::HwSupportEnabled = true;