summaryrefslogtreecommitdiff
path: root/cpu.h
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2017-09-22 08:58:50 -0400
committerJeffrey Walton <noloader@gmail.com>2017-09-22 08:58:50 -0400
commit3bd01f73bae3ded9bc5b01681151bcfaf252d7cf (patch)
tree2bbd5b708af9eb10f1727dd8f9a03d4846226a6f /cpu.h
parent375d5e18b30cb4f53b3315ea95f092e001ed50b4 (diff)
downloadcryptopp-git-3bd01f73bae3ded9bc5b01681151bcfaf252d7cf.tar.gz
Add Power8 SHA256 and SHA512 support (GH #513)
Diffstat (limited to 'cpu.h')
-rw-r--r--cpu.h18
1 files changed, 9 insertions, 9 deletions
diff --git a/cpu.h b/cpu.h
index 9e2b7572..35710a93 100644
--- a/cpu.h
+++ b/cpu.h
@@ -398,7 +398,7 @@ inline bool HasSHA2()
// Hide from Doxygen
#ifndef CRYPTOPP_DOXYGEN_PROCESSING
extern bool g_PowerpcDetectionDone;
-extern bool g_hasAltivec, g_hasPower7, g_hasPower8, g_hasAES, g_hasSHA1, g_hasSHA2;
+extern bool g_hasAltivec, g_hasPower7, g_hasPower8, g_hasAES, g_hasSHA256, g_hasSHA512;
extern word32 g_cacheLineSize;
void CRYPTOPP_API DetectPowerpcFeatures();
#endif // CRYPTOPP_DOXYGEN_PROCESSING
@@ -445,32 +445,32 @@ inline bool HasAES()
return g_hasAES;
}
-//! \brief Determine if a PowerPC processor has SHA1 available
-//! \returns true if the hardware is capable of SHA1 at runtime, false otherwise.
+//! \brief Determine if a PowerPC processor has SHA256 available
+//! \returns true if the hardware is capable of SHA256 at runtime, false otherwise.
//! \details SHA is part of the in-crypto extensions on Power8 and Power9.
//! \details Runtime support requires compile time support. When compiling with GCC, you may
//! need to compile with <tt>-mcpu=power8</tt>; while IBM XL C/C++ compilers require
//! <tt>-qarch=pwr8 -qaltivec</tt>. Also see PowerPC's <tt>__CRYPTO</tt> preprocessor macro.
//! \note This function is only available on PowerPC and PowerPC-64 platforms
-inline bool HasSHA1()
+inline bool HasSHA256()
{
if (!g_PowerpcDetectionDone)
DetectPowerpcFeatures();
- return g_hasSHA1;
+ return g_hasSHA256;
}
-//! \brief Determine if a PowerPC processor has SHA2 available
-//! \returns true if the hardware is capable of SHA2 at runtime, false otherwise.
+//! \brief Determine if a PowerPC processor has SHA512 available
+//! \returns true if the hardware is capable of SHA512 at runtime, false otherwise.
//! \details SHA is part of the in-crypto extensions on Power8 and Power9.
//! \details Runtime support requires compile time support. When compiling with GCC, you may
//! need to compile with <tt>-mcpu=power8</tt>; while IBM XL C/C++ compilers require
//! <tt>-qarch=pwr8 -qaltivec</tt>. Also see PowerPC's <tt>__CRYPTO</tt> preprocessor macro.
//! \note This function is only available on PowerPC and PowerPC-64 platforms
-inline bool HasSHA2()
+inline bool HasSHA512()
{
if (!g_PowerpcDetectionDone)
DetectPowerpcFeatures();
- return g_hasSHA2;
+ return g_hasSHA512;
}
//! \brief Provides the cache line size