#ifndef CRYPTOPP_MISC_H #define CRYPTOPP_MISC_H #include "config.h" #if !defined(_UEFI) #include // for memcpy and memmove #ifndef _WIN32 #include // for strcasecmp #define _stricmp strcasecmp #endif #else #include "Tcdefs.h" #endif // !defined(_UEFI) #ifdef __cplusplus extern "C" { #endif #if defined(_MSC_VER) && !defined(_UEFI) #if _MSC_VER >= 1400 #if !defined(TC_WINDOWS_DRIVER) && !defined(_UEFI) // VC2005 workaround: disable declarations that conflict with winnt.h #define _interlockedbittestandset CRYPTOPP_DISABLED_INTRINSIC_1 #define _interlockedbittestandreset CRYPTOPP_DISABLED_INTRINSIC_2 #define _interlockedbittestandset64 CRYPTOPP_DISABLED_INTRINSIC_3 #define _interlockedbittestandreset64 CRYPTOPP_DISABLED_INTRINSIC_4 #include #undef _interlockedbittestandset #undef _interlockedbittestandreset #undef _interlockedbittestandset64 #undef _interlockedbittestandreset64 #endif #define CRYPTOPP_FAST_ROTATE(x) 1 #elif !defined(_UEFI) && _MSC_VER >= 1300 #define CRYPTOPP_FAST_ROTATE(x) ((x) == 32 | (x) == 64) #else #define CRYPTOPP_FAST_ROTATE(x) ((x) == 32) #endif #elif (defined(__MWERKS__) && TARGET_CPU_PPC) || \ (defined(__GNUC__) && (defined(_ARCH_PWR2) || defined(_ARCH_PWR) || defined(_ARCH_PPC) || defined(_ARCH_PPC64) || defined(_ARCH_COM))) #define CRYPTOPP_FAST_ROTATE(x) ((x) == 32) #elif defined(__GNUC__) && (CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X86) // depend on GCC's peephole optimization to generate rotate instructions #define CRYPTOPP_FAST_ROTATE(x) 1 #else #define CRYPTOPP_FAST_ROTATE(x) 0 #endif #if defined( _MSC_VER ) && ( _MSC_VER > 800 ) && !defined(_UEFI) #pragma intrinsic(memcpy,memset) #endif #if _MSC_VER >= 1300 && !defined(__INTEL_COMPILER) // Intel C++ Compiler 10.0 calls a function instead of using the rotate instruction when using these instructions #pragma intrinsic(_rotr,_rotl,_rotr64,_rotl64) #define rotr32(x,n) _rotr(x, n) #define rotl32(x,n) _rotl(x, n) #define rotr64(x,n) _rotr64(x, n) #define rotl64(x,n) _rotl64(x, n) #else #define rotr32(x,n) (((x) >> n) | ((x) << (32 - n))) #define rotl32(x,n) (((x) << n) | ((x) >> (32 - n))) #define rotr64(x,n) (((x) >> n) | ((x) << (64 - n))) #define rotl64(x,n) (((x) << n) | ((x) >> (64 - n))) #endif #if _MSC_VER >= 1400 && !defined(__INTEL_COMPILER) // Intel C++ Compiler 10.0 calls a function instead of using the rotate instruction when using these instructions #pragma intrinsic(_rotr8,_rotl8,_rotr16,_rotl16) #define rotr8(x,n) _rotr8(x, n) #define rotl8(x,n) _rotl8(x, n) #define rotr16(x,n) _rotr16(x, n) #define rotl16(x,n) _rotl16(x, n) #else #define rotr8(x,n) (((x) >> n) | ((x) << (8 - n))) #define rotl8(x,n) (((x) << n) | ((x) >> (8 - n))) #define rotr16(x,n) (((x) >> n) | ((x) << (16 - n))) #define rotl16(x,n) (((x) << n) | ((x) >> (16 - n))) #endif #if defined(__GNUC__) && defined(__linux__) #define CRYPTOPP_BYTESWAP_AVAILABLE #include #elif defined(_MSC_VER) && _MSC_VER >= 1300 && !defined(_UEFI) #pragma intrinsic(_byteswap_ulong,_byteswap_uint64) #define CRYPTOPP_BYTESWAP_AVAILABLE #define bswap_32(x) _byteswap_ulong(x) #define bswap_64(x) _byteswap_uint64(x) #elif defined(__APPLE__) #include #define CRYPTOPP_BYTESWAP_AVAILABLE #define bswap_16 OSSwapInt16 #define bswap_32 OSSwapInt32 #define bswap_64 OSSwapInt64 #else #if CRYPTOPP_FAST_ROTATE(32) #define bswap_32(x) (rotr32((x), 8U) & 0xff00ff00) | (rotl32((x), 8U) & 0x00ff00ff) #else #define CRYPTOPP_BYTESWAP_AVAILABLE #define bswap_32(x) (rotl32((((x) & 0xFF00FF00) >> 8) | (((x) & 0x00FF00FF) << 8), 16U)) #define bswap_64(x) rotl64(((((((x & LL(0xFF00FF00FF00FF00)) >> 8) | ((x & LL(0x00FF00FF00FF00FF)) << 8)) & LL(0xFFFF0000FFFF0000)) >> 16) | (((((x & LL(0xFF00FF00FF00FF00)) >> 8) | ((x & LL(0x00FF00FF00FF00FF)) << 8)) & LL(0x0000FFFF0000FFFF)) << 16)), 32U) #endif #ifndef TC_NO_COMPILER_INT64 #define bswap_64(x) rotl64(((((((x & LL(0xFF00FF00FF00FF00)) >> 8) | ((x & LL(0x00FF00FF00FF00FF)) << 8)) & LL(0xFFFF0000FFFF0000)) >> 16) | (((((x & LL(0xFF00FF00FF00FF00)) >> 8) | ((x & LL(0x00FF00FF00FF00FF)) << 8)) & LL(0x0000FFFF0000FFFF)) << 16)), 32U) #endif #endif VC_INLINE uint32 ByteReverseWord32 (uint32 value) { #if defined(__GNUC__) && defined(CRYPTOPP_X86_ASM_AVAILABLE) __asm__ ("
/*
 Legal Notice: Some portions of the source code contained in this file were
 derived from the source code of TrueCrypt 7.1a, which is
 Copyright (c) 2003-2012 TrueCrypt Developers Association and which is
 governed by the TrueCrypt License 3.0, also from the source code of
 Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux
 and which is governed by the 'License Agreement for Encryption for the Masses'
 Modifications and additions to the original source code (contained in this file)
 and all other portions of this file are Copyright (c) 2013-2017 IDRIX
 and are governed by the Apache License 2.0 the full text of which is
 contained in the file License.txt included in VeraCrypt binary and source
 code distribution packages. */

#ifdef __cplusplus
extern "C" {
#endif

#ifndef PBM_SETSTATE

#define PBM_SETSTATE            (WM_USER+16) // wParam = PBST_[State] (NORMAL, ERROR, PAUSED)
#define PBST_NORMAL             0x0001
#define PBST_ERROR              0x0002
#define PBST_PAUSED             0x0003

#endif

void InitProgressBar (__int64 totalBytes, __int64 bytesDone, BOOL bReverse, BOOL bIOThroughput, BOOL bDisplayStatus, BOOL bShowPercent);
BOOL UpdateProgressBar (__int64 byteOffset);
BOOL UpdateProgressBarProc (__int64 byteOffset);

#ifdef __cplusplus
}
#endif