VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common/Xts.h
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2013-06-22 14:16:13 (GMT)
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2014-11-08 22:18:07 (GMT)
commitc606f0866c3a2a5db3ef9bc41738ef33eb9612a9 (patch)
tree5847c644cdfff3c1dd55b88b565448087ae89f11 /src/Common/Xts.h
downloadVeraCrypt-c606f0866c3a2a5db3ef9bc41738ef33eb9612a9.zip
VeraCrypt-c606f0866c3a2a5db3ef9bc41738ef33eb9612a9.tar.gz
Add original TrueCrypt 7.1a sources
Diffstat (limited to 'src/Common/Xts.h')
-rw-r--r--src/Common/Xts.h80
1 files changed, 80 insertions, 0 deletions
diff --git a/src/Common/Xts.h b/src/Common/Xts.h
new file mode 100644
index 0000000..c034068
--- /dev/null
+++ b/src/Common/Xts.h
@@ -0,0 +1,80 @@
+/*
+ Copyright (c) 2008-2010 TrueCrypt Developers Association. All rights reserved.
+
+ Governed by the TrueCrypt License 3.0 the full text of which is contained in
+ the file License.txt included in TrueCrypt binary and source code distribution
+ packages.
+*/
+
+#ifndef XTS_H
+#define XTS_H
+
+// Header files (optional)
+
+#include "Tcdefs.h"
+#include "Common/Endian.h"
+#include "Crypto.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// Macros
+
+#ifndef LITTLE_ENDIAN
+# define LITTLE_ENDIAN 1
+#endif
+
+#ifndef BIG_ENDIAN
+# define BIG_ENDIAN 2
+#endif
+
+#ifndef BYTE_ORDER
+# define BYTE_ORDER LITTLE_ENDIAN
+#endif
+
+#ifndef LE64
+# if BYTE_ORDER == LITTLE_ENDIAN
+# define LE64(x) (x)
+# endif
+#endif
+
+// Custom data types
+
+#ifndef TC_LARGEST_COMPILER_UINT
+# ifdef TC_NO_COMPILER_INT64
+ typedef unsigned __int32 TC_LARGEST_COMPILER_UINT;
+# else
+ typedef unsigned __int64 TC_LARGEST_COMPILER_UINT;
+# endif
+#endif
+
+#ifndef TCDEFS_H
+typedef union
+{
+ struct
+ {
+ unsigned __int32 LowPart;
+ unsigned __int32 HighPart;
+ };
+# ifndef TC_NO_COMPILER_INT64
+ unsigned __int64 Value;
+# endif
+
+} UINT64_STRUCT;
+#endif
+
+// Public function prototypes
+
+void EncryptBufferXTS (unsigned __int8 *buffer, TC_LARGEST_COMPILER_UINT length, const UINT64_STRUCT *startDataUnitNo, unsigned int startCipherBlockNo, unsigned __int8 *ks, unsigned __int8 *ks2, int cipher);
+static void EncryptBufferXTSParallel (unsigned __int8 *buffer, TC_LARGEST_COMPILER_UINT length, const UINT64_STRUCT *startDataUnitNo, unsigned int startCipherBlockNo, unsigned __int8 *ks, unsigned __int8 *ks2, int cipher);
+static void EncryptBufferXTSNonParallel (unsigned __int8 *buffer, TC_LARGEST_COMPILER_UINT length, const UINT64_STRUCT *startDataUnitNo, unsigned int startCipherBlockNo, unsigned __int8 *ks, unsigned __int8 *ks2, int cipher);
+void DecryptBufferXTS (unsigned __int8 *buffer, TC_LARGEST_COMPILER_UINT length, const UINT64_STRUCT *startDataUnitNo, unsigned int startCipherBlockNo, unsigned __int8 *ks, unsigned __int8 *ks2, int cipher);
+static void DecryptBufferXTSParallel (unsigned __int8 *buffer, TC_LARGEST_COMPILER_UINT length, const UINT64_STRUCT *startDataUnitNo, unsigned int startCipherBlockNo, unsigned __int8 *ks, unsigned __int8 *ks2, int cipher);
+static void DecryptBufferXTSNonParallel (unsigned __int8 *buffer, TC_LARGEST_COMPILER_UINT length, const UINT64_STRUCT *startDataUnitNo, unsigned int startCipherBlockNo, unsigned __int8 *ks, unsigned __int8 *ks2, int cipher);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // #ifndef XTS_H