VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Crypto/Aes.h
diff options
context:
space:
mode:
authorlealem47 <60322859+lealem47@users.noreply.github.com>2023-11-12 16:51:31 -0700
committerGitHub <noreply@github.com>2023-11-13 00:51:31 +0100
commit9247ce1bb90c44d19a0069fadb12c0c480ac9b4f (patch)
tree66fb4728d502759271d03eba59d51c1a129b2ffb /src/Crypto/Aes.h
parent458be85f84a097aa829658c50ce41d82791fb6a8 (diff)
downloadVeraCrypt-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/Crypto/Aes.h')
-rw-r--r--src/Crypto/Aes.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/Crypto/Aes.h b/src/Crypto/Aes.h
index e12c6fc8..db1bed27 100644
--- a/src/Crypto/Aes.h
+++ b/src/Crypto/Aes.h
@@ -35,6 +35,11 @@
#include "Common/Tcdefs.h"
+#ifdef WOLFCRYPT_BACKEND
+ #include <wolfssl/options.h>
+ #include <wolfssl/wolfcrypt/aes.h>
+#endif
+
#ifndef EXIT_SUCCESS
#define EXIT_SUCCESS 0
#define EXIT_FAILURE 1
@@ -93,11 +98,19 @@ typedef union
typedef struct
{ uint_32t ks[KS_LENGTH];
aes_inf inf;
+#ifdef WOLFCRYPT_BACKEND
+ XtsAes wc_enc_xts;
+ Aes wc_enc_aes;
+#endif
} aes_encrypt_ctx;
typedef struct
{ uint_32t ks[KS_LENGTH];
aes_inf inf;
+#ifdef WOLFCRYPT_BACKEND
+ XtsAes wc_dec_xts;
+ Aes wc_dec_aes;
+#endif
} aes_decrypt_ctx;
/* This routine must be called before first use if non-static */
@@ -152,6 +165,13 @@ AES_RETURN aes_decrypt(const unsigned char *in, unsigned char *out, const aes_de
#endif
+#ifdef WOLFCRYPT_BACKEND
+AES_RETURN xts_encrypt_key256(const unsigned char *key, aes_encrypt_ctx cx[1]);
+AES_RETURN xts_decrypt_key256(const unsigned char *key, aes_decrypt_ctx cx[1]);
+AES_RETURN xts_encrypt(const unsigned char *in, unsigned char *out, word64 length, word64 sector, const aes_encrypt_ctx cx[1]);
+AES_RETURN xts_decrypt(const unsigned char *in, unsigned char *out, word64 length, word64 sector, const aes_decrypt_ctx cx[1]);
+#endif
+
#if defined(AES_MODES)
/* Multiple calls to the following subroutines for multiple block */