From 3bd01f73bae3ded9bc5b01681151bcfaf252d7cf Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Fri, 22 Sep 2017 08:58:50 -0400 Subject: Add Power8 SHA256 and SHA512 support (GH #513) --- cpu.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'cpu.h') 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 -mcpu=power8; while IBM XL C/C++ compilers require //! -qarch=pwr8 -qaltivec. Also see PowerPC's __CRYPTO 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 -mcpu=power8; while IBM XL C/C++ compilers require //! -qarch=pwr8 -qaltivec. Also see PowerPC's __CRYPTO 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 -- cgit v1.2.1