From 76d3bc631eff60841026f2526d69f6d661d218a3 Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Thu, 2 Jun 2016 00:10:39 +0200 Subject: Crypto: Add support for Japanese encryption standard Camellia, including for system encryption. --- src/Volume/Cipher.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/Volume/Cipher.cpp') diff --git a/src/Volume/Cipher.cpp b/src/Volume/Cipher.cpp index 4acea91e..2f3594ab 100644 --- a/src/Volume/Cipher.cpp +++ b/src/Volume/Cipher.cpp @@ -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 (new CipherAES ())); l.push_back (shared_ptr (new CipherSerpent ())); l.push_back (shared_ptr (new CipherTwofish ())); + l.push_back (shared_ptr (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; -- cgit v1.2.3