22#if ((__GNUC__ >= 4) || defined(__IBM_GCC_ASM)) && !defined(__APPLE__)
23# define GCC_DARN_ASM_AVAILABLE 1
27#if CRYPTOPP_MSC_VERSION
28# pragma warning(disable: 4702)
36#if (CRYPTOPP_BOOL_PPC32 || CRYPTOPP_BOOL_PPC64)
40#if (CRYPTOPP_BOOL_PPC32)
43inline void DARN32(
void* output)
48#if defined(GCC_DARN_ASM_AVAILABLE)
55 __asm__ __volatile__ (
56 #
if (CRYPTOPP_BIG_ENDIAN)
57 ".byte 0x7c, 0x60, 0x05, 0xe6 \n\t"
60 ".byte 0xe6, 0x05, 0x60, 0x7c \n\t"
63 :
"=r" (*ptr) : :
"r3"
65 }
while (*ptr == 0xFFFFFFFFu);
66#elif defined(_ARCH_PWR9)
69 *ptr = __builtin_darn_32();
70#elif defined(__APPLE__)
83#if (CRYPTOPP_BOOL_PPC64)
86inline void DARN64(
void* output)
91#if defined(GCC_DARN_ASM_AVAILABLE)
97 __asm__ __volatile__ (
98 #
if (CRYPTOPP_BIG_ENDIAN)
99 ".byte 0x7c, 0x61, 0x05, 0xe6 \n\t"
102 ".byte 0xe6, 0x05, 0x61, 0x7c \n\t"
105 :
"=r" (*ptr) : :
"r3"
107 }
while (*ptr == 0xFFFFFFFFFFFFFFFFull);
108#elif defined(_ARCH_PWR9)
111 *ptr = __builtin_darn();
112#elif defined(__APPLE__)
137 if (size == 0)
return;
140#if (CRYPTOPP_BOOL_PPC64)
143 i =
reinterpret_cast<uintptr_t
>(output) & 0x7;
147 std::memcpy(output, m_temp, i);
154 for (i = 0; i < size/8; i++)
163 std::memcpy(output, m_temp, size);
166#elif (CRYPTOPP_BOOL_PPC32)
169 i =
reinterpret_cast<uintptr_t
>(output) & 0x3;
173 std::memcpy(output, m_temp, i);
180 for (i = 0; i < size/4; i++)
189 std::memcpy(output, m_temp, size);
194 CRYPTOPP_UNUSED(output);
195 throw NotImplemented(
"DARN: failed to find a suitable implementation");
225 CRYPTOPP_UNUSED(output); CRYPTOPP_UNUSED(size);
Exception thrown when a DARN generator encounters a generator related error.
DARN()
Construct a DARN generator.
virtual void DiscardBytes(size_t n)
Generate and discard n bytes.
virtual void GenerateBlock(byte *output, size_t size)
Generate random array of bytes.
Fixed size stack-based SecBlock.
A method was called which was not implemented.
void New(size_type newSize)
Change size without preserving contents.
size_type SizeInBytes() const
Provides the number of bytes in the SecBlock.
byte * BytePtr()
Provides a byte pointer to the first element in the memory block.
Library configuration file.
unsigned int word32
32-bit unsigned datatype
unsigned long long word64
64-bit unsigned datatype
Functions for CPU features and intrinsics.
Abstract base classes that provide a uniform interface to this library.
T1 RoundUpToMultipleOf(const T1 &n, const T2 &m)
Rounds a value up to a multiple of a second value.
const T & STDMIN(const T &a, const T &b)
Replacement function for std::min.
bool IsAlignedOn(const void *ptr, unsigned int alignment)
Determines whether ptr is aligned to a minimum value.
Crypto++ library namespace.
Classes and functions for secure memory allocations.
#define CRYPTOPP_ASSERT(exp)
Debugging and diagnostic assertion.