|
|
1.1 root 1: /*
2: Copyright (c) 2008 TrueCrypt Foundation. All rights reserved.
3:
4: Governed by the TrueCrypt License 2.4 the full text of which is contained
5: in the file License.txt included in TrueCrypt binary and source code
6: distribution packages.
7: */
8:
9: #ifndef XTS_H
10: #define XTS_H
11:
12: // Header files (optional)
13:
14: #include "Tcdefs.h"
15: #include "Common/Endian.h"
16: #include "Crypto.h"
17:
18: // Macros
19:
20: #ifndef LITTLE_ENDIAN
21: # define LITTLE_ENDIAN 1
22: #endif
23:
24: #ifndef BIG_ENDIAN
25: # define BIG_ENDIAN 2
26: #endif
27:
28: #ifndef BYTE_ORDER
29: # define BYTE_ORDER LITTLE_ENDIAN
30: #endif
31:
32: #ifndef LE64
33: # if BYTE_ORDER == LITTLE_ENDIAN
34: # define LE64(x) (x)
35: # endif
36: #endif
37:
38: // Custom data types
39:
40: #ifndef TC_LARGEST_COMPILER_UINT
41: # ifdef TC_NO_COMPILER_INT64
42: typedef unsigned __int32 TC_LARGEST_COMPILER_UINT;
43: # else
44: typedef unsigned __int64 TC_LARGEST_COMPILER_UINT;
45: # endif
46: #endif
47:
48: #ifndef TCDEFS_H
49: typedef union
50: {
51: struct
52: {
53: unsigned __int32 LowPart;
54: unsigned __int32 HighPart;
55: };
56: # ifndef TC_NO_COMPILER_INT64
57: unsigned __int64 Value;
58: # endif
59:
60: } UINT64_STRUCT;
61: #endif
62:
63: // Public function prototypes
64:
65: 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);
66: 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);
67:
68: #endif // #ifndef XTS_H
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.