diff --git a/CMakeLists.txt b/CMakeLists.txt index 70e59b8f..841fdab4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 diff --git a/sha.cpp b/sha.cpp index 843b7233..f64ff33d 100644 --- a/sha.cpp +++ b/sha.cpp @@ -40,21 +40,7 @@ typedef void (CRYPTOPP_FASTCALL *pfnSHAHashBlocks)(word32 *state, const word32 * // start of Steve Reid's code // //////////////////////////////// - -template -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))) diff --git a/vmac.cpp b/vmac.cpp index 82b4bf12..30eee34d 100644 --- a/vmac.cpp +++ b/vmac.cpp @@ -546,23 +546,9 @@ void VMAC_Base::VHASH_Update_Template(const word64 *data, size_t blocksRemaining CRYPTOPP_ASSERT(IsAlignedOn(m_polyState(),GetAlignmentOf())); CRYPTOPP_ASSERT(IsAlignedOn(m_nhKey(),GetAlignmentOf())); -#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]);\ diff --git a/whrlpool.cpp b/whrlpool.cpp index 8d065b30..1278ad8a 100644 --- a/whrlpool.cpp +++ b/whrlpool.cpp @@ -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];\