10
10
#include <algorithm>
12
#ifdef CRYPTOPP_X86ASM_AVAILABLE
15
#if (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 500)) || (defined(__ICL) && (__ICL >= 500))
16
#define SSE2_INTRINSICS_AVAILABLE
17
#define CRYPTOPP_MM_MALLOC_AVAILABLE
18
#elif defined(_MSC_VER)
19
// _mm_free seems to be the only way to tell if the Processor Pack is installed or not
22
#define SSE2_INTRINSICS_AVAILABLE
23
#define CRYPTOPP_MM_MALLOC_AVAILABLE
28
// SSE2 intrinsics work in GCC 3.3 or later
29
#if defined(__SSE2__) && (__GNUC__ > 3 || __GNUC_MINOR__ > 2)
30
#define SSE2_INTRINSICS_AVAILABLE
35
12
NAMESPACE_BEGIN(CryptoPP)
37
#if defined(SSE2_INTRINSICS_AVAILABLE)
39
class AlignedAllocator : public AllocatorBase<T>
42
CRYPTOPP_INHERIT_ALLOCATOR_TYPES
44
pointer allocate(size_type n, const void *);
45
void deallocate(void *p, size_type n);
46
pointer reallocate(T *p, size_type oldSize, size_type newSize, bool preserve)
48
return StandardReallocate(*this, p, oldSize, newSize, preserve);
51
#if !(defined(CRYPTOPP_MALLOC_ALIGNMENT_IS_16) || defined(CRYPTOPP_MEMALIGN_AVAILABLE) || defined(CRYPTOPP_MM_MALLOC_AVAILABLE))
52
#define CRYPTOPP_NO_ALIGNED_ALLOC
53
AlignedAllocator() : m_pBlock(NULL) {}
59
#ifdef CRYPTOPP_IMPORTS
60
CRYPTOPP_DLL_TEMPLATE_CLASS AlignedAllocator<word>;
63
typedef SecBlock<word, AlignedAllocator<word> > SecAlignedWordBlock;
65
typedef SecWordBlock SecAlignedWordBlock;
68
void CRYPTOPP_DLL CRYPTOPP_API DisableSSE2();
70
14
struct InitializeInteger // used to initialize static variables
72
16
InitializeInteger();
19
typedef SecBlock<word, AllocatorWithCleanup<word, CRYPTOPP_BOOL_X86> > IntegerSecBlock;
75
21
//! multiple precision integer and basic arithmetics
76
22
/*! This class can represent positive and negative integers
77
23
with absolute value less than (256**sizeof(word)) ** (256**sizeof(int)).
429
375
friend void PositiveMultiply(Integer &product, const Integer &a, const Integer &b);
430
376
friend void PositiveDivide(Integer &remainder, Integer "ient, const Integer ÷nd, const Integer &divisor);
432
SecAlignedWordBlock reg;