diff --git a/cryptest.sh b/cryptest.sh index 79b85733..0d7d02f9 100755 --- a/cryptest.sh +++ b/cryptest.sh @@ -3560,62 +3560,6 @@ if [[ ("$HAVE_X86_AES" -ne "0" || "$HAVE_X86_RDRAND" -ne "0" || "$HAVE_X86_RDSEE fi fi -############################################ -# ARM CRC32 -if [[ "$HAVE_ARM_CRC" -ne "0" ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: ARM CRC32" | tee -a "$TEST_RESULTS" - echo - - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 - - CXXFLAGS="$RELEASE_CXXFLAGS -march=armv8-a+crc" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" - else - ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to execute validation suite" | tee -a "$TEST_RESULTS" - fi - ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" - fi - fi -fi - -############################################ -# ARM Crypto -if [[ "$HAVE_ARM_CRYPTO" -ne "0" ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: ARM Crypto" | tee -a "$TEST_RESULTS" - echo - - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 - - CXXFLAGS="$RELEASE_CXXFLAGS -march=armv8-a+crypto" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" - else - ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to execute validation suite" | tee -a "$TEST_RESULTS" - fi - ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" - fi - fi -fi - ############################################ # Benchmarks if [[ "$WANT_BENCHMARKS" -ne "0" ]]; then @@ -4357,13 +4301,13 @@ echo | tee -a "$TEST_RESULTS" # "Error" is from the GNU assembler # "error" is from the sanitizers # "Illegal", "Conditional", "0 errors" and "suppressed errors" are from Valgrind. -ECOUNT=$("$EGREP" '(Error|ERROR|error|FAILED|Illegal|Conditional|Exception)' $TEST_RESULTS | "$EGREP" -v '( 0 errors|suppressed errors|error detector)' | wc -l | "$AWK" '{print $1}') +ECOUNT=$("$EGREP" '(Error|ERROR|error|FAILED|Illegal|Conditional|CryptoPP::Exception)' $TEST_RESULTS | "$EGREP" -v '( 0 errors|suppressed errors|error detector)' | wc -l | "$AWK" '{print $1}') if (( "$ECOUNT" == "0" )); then echo "No failures detected" | tee -a "$TEST_RESULTS" else echo "$ECOUNT errors detected. See $TEST_RESULTS for details" | tee -a "$TEST_RESULTS" if (( "$ECOUNT" < 16 )); then - "$EGREP" -n '(Error|ERROR|error|FAILED|Illegal|Conditional|Exception)' "$TEST_RESULTS" | "$EGREP" -v '( 0 errors|suppressed errors|error detector)' + "$EGREP" -n '(Error|ERROR|error|FAILED|Illegal|Conditional|CryptoPP::Exception)' "$TEST_RESULTS" | "$EGREP" -v '( 0 errors|suppressed errors|error detector)' fi fi diff --git a/rijndael.cpp b/rijndael.cpp index 0546c2a9..9139c227 100644 --- a/rijndael.cpp +++ b/rijndael.cpp @@ -274,8 +274,15 @@ void Rijndael::Base::UncheckedSetKey(const byte *userKey, unsigned int keylen, c rk = m_key; unsigned int i, j; +#if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x5120) + // __m128i is an unsigned long long[2], and support for swapping it was not formally added until C++11. + // SunCC 12.1 - 12.3 fail to consume the swap; while SunCC 12.4 consumes it without -std=c++11. + __m128i t = *(__m128i *)(rk); + *(__m128i *)(rk) = *(__m128i *)(rk+4*m_rounds); + *(__m128i *)(rk+4*m_rounds) = t; +#else std::swap(*(__m128i *)(void *)(rk), *(__m128i *)(void *)(rk+4*m_rounds)); - +#endif for (i = 4, j = 4*m_rounds-4; i < j; i += 4, j -= 4) { temp = _mm_aesimc_si128(*(__m128i *)(void *)(rk+i));