summaryrefslogtreecommitdiff
path: root/sha.cpp
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2017-09-22 09:39:36 -0400
committerJeffrey Walton <noloader@gmail.com>2017-09-22 09:39:36 -0400
commitced7cff64f87ae4fec781e00e4e111f6c188dea2 (patch)
tree9168956275ace8315535f1bdca70879d170cf5cd /sha.cpp
parent3bd01f73bae3ded9bc5b01681151bcfaf252d7cf (diff)
downloadcryptopp-git-ced7cff64f87ae4fec781e00e4e111f6c188dea2.tar.gz
Add Power8 SHA256 and SHA512 support (GH #513)
Diffstat (limited to 'sha.cpp')
-rw-r--r--sha.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/sha.cpp b/sha.cpp
index 04dfb4d9..d1c8d454 100644
--- a/sha.cpp
+++ b/sha.cpp
@@ -783,6 +783,13 @@ size_t SHA224::HashMultipleBlocks(const word32 *input, size_t length)
return length & (SHA256::BLOCKSIZE - 1);
}
#endif
+#if CRYPTOPP_POWER8_SHA_AVAILABLE
+ if (HasSHA256())
+ {
+ SHA256_HashMultipleBlocks_POWER8(m_state, input, length, BIG_ENDIAN_ORDER);
+ return length & (SHA256::BLOCKSIZE - 1);
+ }
+#endif
const bool noReverse = NativeByteOrderIs(this->GetByteOrder());
word32 *dataBuf = this->DataBuf();
@@ -1164,6 +1171,13 @@ void SHA512::Transform(word64 *state, const word64 *data)
return;
}
#endif
+#if CRYPTOPP_POWER8_SHA_AVAILABLE
+ if (HasSHA512())
+ {
+ SHA512_HashMultipleBlocks_POWER8(state, data, SHA512::BLOCKSIZE, BIG_ENDIAN_ORDER);
+ return;
+ }
+#endif
SHA512_HashBlock_CXX(state, data);
}