From 9247ce1bb90c44d19a0069fadb12c0c480ac9b4f Mon Sep 17 00:00:00 2001 From: lealem47 <60322859+lealem47@users.noreply.github.com> Date: Sun, 12 Nov 2023 16:51:31 -0700 Subject: wolfCrypt as crypto backend for VeraCrypt (#1227) * wolfCrypt as crypto backend for VeraCrypt * Refactor to use EncryptionModeWolfCryptXTS class --- src/Main/Forms/BenchmarkDialog.cpp | 11 +++++++++-- src/Main/Forms/EncryptionTestDialog.cpp | 10 +++++++++- src/Main/Forms/WaitDialog.cpp | 3 +++ 3 files changed, 21 insertions(+), 3 deletions(-) (limited to 'src/Main') diff --git a/src/Main/Forms/BenchmarkDialog.cpp b/src/Main/Forms/BenchmarkDialog.cpp index 7b0209ff..da2fe43b 100644 --- a/src/Main/Forms/BenchmarkDialog.cpp +++ b/src/Main/Forms/BenchmarkDialog.cpp @@ -12,6 +12,9 @@ #include "System.h" #include "Volume/EncryptionModeXTS.h" +#ifdef WOLFCRYPT_BACKEND +#include "Volume/EncryptionModeWolfCryptXTS.h" +#endif #include "Main/GraphicUserInterface.h" #include "BenchmarkDialog.h" @@ -209,9 +212,13 @@ namespace VeraCrypt Buffer key (ea->GetKeySize()); ea->SetKey (key); - + #ifdef WOLFCRYPT_BACKEND + shared_ptr xts (new EncryptionModeWolfCryptXTS); + ea->SetKeyXTS (key); + #else shared_ptr xts (new EncryptionModeXTS); - xts->SetKey (key); + #endif + xts->SetKey (key); ea->SetMode (xts); wxLongLong startTime = wxGetLocalTimeMillis(); diff --git a/src/Main/Forms/EncryptionTestDialog.cpp b/src/Main/Forms/EncryptionTestDialog.cpp index 17184a0e..a85bbc94 100644 --- a/src/Main/Forms/EncryptionTestDialog.cpp +++ b/src/Main/Forms/EncryptionTestDialog.cpp @@ -12,6 +12,9 @@ #include "System.h" #include "Volume/EncryptionModeXTS.h" +#ifdef WOLFCRYPT_BACKEND +#include "Volume/EncryptionModeWolfCryptXTS.h" +#endif #include "Volume/EncryptionTest.h" #include "Main/GraphicUserInterface.h" #include "EncryptionTestDialog.h" @@ -94,8 +97,13 @@ namespace VeraCrypt throw StringConversionFailed (SRC_POS); } + #ifdef WOLFCRYPT_BACKEND + shared_ptr xts (new EncryptionModeWolfCryptXTS); + ea->SetKeyXTS (secondaryKey); + #else shared_ptr xts (new EncryptionModeXTS); - xts->SetKey (secondaryKey); + #endif + xts->SetKey (secondaryKey); ea->SetMode (xts); Buffer sector (ENCRYPTION_DATA_UNIT_SIZE); diff --git a/src/Main/Forms/WaitDialog.cpp b/src/Main/Forms/WaitDialog.cpp index d53656f9..102d479a 100644 --- a/src/Main/Forms/WaitDialog.cpp +++ b/src/Main/Forms/WaitDialog.cpp @@ -8,6 +8,9 @@ #include "System.h" #include "Volume/EncryptionModeXTS.h" +#ifdef WOLFCRYPT_BACKEND +#include "Volume/EncryptionModeWolfCryptXTS.h" +#endif #include "Main/GraphicUserInterface.h" #include "Common/PCSCException.h" #include "Common/SecurityToken.h" -- cgit v1.2.3