diff options
author | lealem47 <60322859+lealem47@users.noreply.github.com> | 2023-11-12 16:51:31 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-13 00:51:31 +0100 |
commit | 9247ce1bb90c44d19a0069fadb12c0c480ac9b4f (patch) | |
tree | 66fb4728d502759271d03eba59d51c1a129b2ffb /src/Common/Xts.c | |
parent | 458be85f84a097aa829658c50ce41d82791fb6a8 (diff) | |
download | VeraCrypt-9247ce1bb90c44d19a0069fadb12c0c480ac9b4f.tar.gz VeraCrypt-9247ce1bb90c44d19a0069fadb12c0c480ac9b4f.zip |
wolfCrypt as crypto backend for VeraCrypt (#1227)
* wolfCrypt as crypto backend for VeraCrypt
* Refactor to use EncryptionModeWolfCryptXTS class
Diffstat (limited to 'src/Common/Xts.c')
-rw-r--r-- | src/Common/Xts.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/Common/Xts.c b/src/Common/Xts.c index 390eb31e..4a62aaf3 100644 --- a/src/Common/Xts.c +++ b/src/Common/Xts.c @@ -54,10 +54,14 @@ void EncryptBufferXTS (unsigned __int8 *buffer, unsigned __int8 *ks2, int cipher) { - if (CipherSupportsIntraDataUnitParallelization (cipher)) + #ifndef WOLFCRYPT_BACKEND + if (CipherSupportsIntraDataUnitParallelization (cipher)) EncryptBufferXTSParallel (buffer, length, startDataUnitNo, startCipherBlockNo, ks, ks2, cipher); else EncryptBufferXTSNonParallel (buffer, length, startDataUnitNo, startCipherBlockNo, ks, ks2, cipher); + #else + xts_encrypt(buffer, buffer, length, startDataUnitNo, ks); + #endif } #if (CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE && CRYPTOPP_BOOL_X64) @@ -380,10 +384,14 @@ void DecryptBufferXTS (unsigned __int8 *buffer, unsigned __int8 *ks2, int cipher) { + #ifndef WOLFCRYPT_BACKEND if (CipherSupportsIntraDataUnitParallelization (cipher)) DecryptBufferXTSParallel (buffer, length, startDataUnitNo, startCipherBlockNo, ks, ks2, cipher); else DecryptBufferXTSNonParallel (buffer, length, startDataUnitNo, startCipherBlockNo, ks, ks2, cipher); + #else + xts_decrypt(buffer, buffer, length, startDataUnitNo, ks); + #endif } |