mirror of
https://github.com/shadps4-emu/ext-cryptopp.git
synced 2024-11-23 18:09:48 +00:00
Merge pull request #405 from kvirund/alignment.issues
Added -xmemalign=4i for Sparc
This commit is contained in:
commit
ff9b46e513
@ -262,9 +262,12 @@ if ((NOT CRYPTOPP_CROSS_COMPILE) AND "${UNAME_SYSTEM}" STREQUAL "SunOS")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -template=no%extdef")
|
||||
endif()
|
||||
|
||||
# Try this if you are encountering unexplained SIGBUS'es on SPARC
|
||||
# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -xmemalign=4i")
|
||||
|
||||
execute_process(COMMAND "uname" "-p" OUTPUT_VARIABLE PLATFORM_SUNOS_ARCH OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
string(TOUPPER "${PLATFORM_SUNOS_ARCH}" PLATFORM_SUNOS_ARCH)
|
||||
message(STATUS "SunOS platform arch: ${PLATFORM_SUNOS_ARCH}")
|
||||
if (${PLATFORM_SUNOS_ARCH} MATCHES SPARC)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -xmemalign=4i")
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
# Link is driven through the compiler, but CXXFLAGS are not used. Also see
|
||||
|
16
sha.cpp
16
sha.cpp
@ -40,21 +40,7 @@ typedef void (CRYPTOPP_FASTCALL *pfnSHAHashBlocks)(word32 *state, const word32 *
|
||||
// start of Steve Reid's code //
|
||||
////////////////////////////////
|
||||
|
||||
|
||||
template <typename T>
|
||||
inline T BLK0_TEMPLATE(const T* y, const int i)
|
||||
{
|
||||
T t;
|
||||
memcpy(&t, y+i, sizeof(t));
|
||||
return t;
|
||||
}
|
||||
|
||||
#if defined(__SUNPRO_CC)
|
||||
# define blk0(i) (W[i] = BLK0_TEMPLATE(data,i))
|
||||
#else
|
||||
# define blk0(i) (W[i] = data[i])
|
||||
#endif
|
||||
|
||||
#define blk0(i) (W[i] = data[i])
|
||||
#define blk1(i) (W[i&15] = rotlFixed(W[(i+13)&15]^W[(i+8)&15]^W[(i+2)&15]^W[i&15],1))
|
||||
|
||||
#define f1(x,y,z) (z^(x&(y^z)))
|
||||
|
18
vmac.cpp
18
vmac.cpp
@ -546,23 +546,9 @@ void VMAC_Base::VHASH_Update_Template(const word64 *data, size_t blocksRemaining
|
||||
CRYPTOPP_ASSERT(IsAlignedOn(m_polyState(),GetAlignmentOf<word64>()));
|
||||
CRYPTOPP_ASSERT(IsAlignedOn(m_nhKey(),GetAlignmentOf<word64>()));
|
||||
|
||||
#if defined(__SUNPRO_CC)
|
||||
#define PREPARE_D0_D1(j) \
|
||||
word64 d0_original = 0;\
|
||||
memcpy(&d0_original, data + i + 2*j + 0, sizeof(d0_original));\
|
||||
word64 d1_original = 0;\
|
||||
memcpy(&d1_original, data + i + 2*j + 1, sizeof(d1_original));\
|
||||
\
|
||||
word64 d0 = ConditionalByteReverse(LITTLE_ENDIAN_ORDER, d0_original);\
|
||||
word64 d1 = ConditionalByteReverse(LITTLE_ENDIAN_ORDER, d1_original)
|
||||
#else
|
||||
#define PREPARE_D0_D1(j) \
|
||||
word64 d0 = ConditionalByteReverse(LITTLE_ENDIAN_ORDER, data[i+2*j+0]);\
|
||||
word64 d1 = ConditionalByteReverse(LITTLE_ENDIAN_ORDER, data[i+2*j+1])
|
||||
#endif
|
||||
|
||||
#define INNER_LOOP_ITERATION(j) {\
|
||||
PREPARE_D0_D1(j);\
|
||||
word64 d0 = ConditionalByteReverse(LITTLE_ENDIAN_ORDER, data[i+2*j+0]);\
|
||||
word64 d1 = ConditionalByteReverse(LITTLE_ENDIAN_ORDER, data[i+2*j+1]);\
|
||||
AccumulateNH(nhA, d0+nhK[i+2*j+0], d1+nhK[i+2*j+1]);\
|
||||
if (T_128BitTag)\
|
||||
AccumulateNH(nhB, d0+nhK[i+2*j+2], d1+nhK[i+2*j+3]);\
|
||||
|
@ -609,15 +609,7 @@ void Whirlpool::Transform(word64 *digest, const word64 *block)
|
||||
// Compute and apply K^0 to the cipher state
|
||||
// Also apply part of the Miyaguchi-Preneel compression function
|
||||
for (int i=0; i<8; i++)
|
||||
{
|
||||
#if defined (__SUNPRO_CC)
|
||||
word64 block_i = 0;
|
||||
memcpy(&block_i, &block[i], sizeof(block_i));
|
||||
digest[i] = s[i] = block_i ^ (k[i] = digest[i]);
|
||||
#else
|
||||
digest[i] = s[i] = block[i] ^ (k[i] = digest[i]);
|
||||
#endif
|
||||
}
|
||||
|
||||
#define KSL(op, i, a, b, c, d) \
|
||||
t = (word32)k[i];\
|
||||
|
Loading…
Reference in New Issue
Block a user