VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Volume/Cipher.cpp
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2016-06-02 00:10:39 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2016-06-02 00:12:00 +0200
commit76d3bc631eff60841026f2526d69f6d661d218a3 (patch)
treececc43976a8c45029b35b08ba3af0819ebee3993 /src/Volume/Cipher.cpp
parent99c4031d89ce4f72e3899b3cac660082a1820a48 (diff)
downloadVeraCrypt-76d3bc631eff60841026f2526d69f6d661d218a3.tar.gz
VeraCrypt-76d3bc631eff60841026f2526d69f6d661d218a3.zip
Crypto: Add support for Japanese encryption standard Camellia, including for system encryption.
Diffstat (limited to 'src/Volume/Cipher.cpp')
-rw-r--r--src/Volume/Cipher.cpp23
1 files changed, 23 insertions, 0 deletions
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 <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;