VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Crypto/Sha2.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/Crypto/Sha2.h')
-rw-r--r--src/Crypto/Sha2.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/Crypto/Sha2.h b/src/Crypto/Sha2.h
index 37625ce8..1fbcb8d1 100644
--- a/src/Crypto/Sha2.h
+++ b/src/Crypto/Sha2.h
@@ -12,6 +12,13 @@
#include "Common/Endian.h"
#include "Crypto/config.h"
+#ifdef WOLFCRYPT_BACKEND
+ #include <wolfssl/options.h>
+ #include <wolfssl/wolfcrypt/sha256.h>
+ #include <wolfssl/wolfcrypt/sha512.h>
+ #include <wolfssl/wolfcrypt/hash.h>
+#endif
+
#if defined(__cplusplus)
extern "C" {
#endif
@@ -22,12 +29,16 @@ extern "C" {
#define SHA512_DIGEST_SIZE 64
#define SHA512_BLOCK_SIZE 128
-#if CRYPTOPP_BOOL_X64
+#if CRYPTOPP_BOOL_X64 && !defined(CRYPTOPP_DISABLE_ASM)
#define SHA2_ALIGN CRYPTOPP_ALIGN_DATA(32)
#else
#define SHA2_ALIGN CRYPTOPP_ALIGN_DATA(16)
#endif
+#ifdef WOLFCRYPT_BACKEND
+typedef struct wc_Sha512 sha512_ctx;
+typedef struct wc_Sha256 sha256_ctx;
+#else
typedef struct
{ uint_64t count[2];
SHA2_ALIGN uint_64t hash[8];
@@ -39,6 +50,7 @@ typedef struct
SHA2_ALIGN uint_32t hash[8];
SHA2_ALIGN uint_32t wbuf[16];
} sha256_ctx;
+#endif
void sha512_begin(sha512_ctx* ctx);