Fix crash in SHA-512 when using different compile options (GH #661)
This also helps clear a crash on Sparc due to unaligned access to an uint64_t (GH #689)pull/696/head
parent
8d6b1af4cf
commit
45ffb7e827
10
sha.h
10
sha.h
|
|
@ -11,12 +11,6 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "iterhash.h"
|
#include "iterhash.h"
|
||||||
|
|
||||||
#if (CRYPTOPP_BOOL_X86)
|
|
||||||
# define SHA_X86_ALIGN16 true
|
|
||||||
#else
|
|
||||||
# define SHA_X86_ALIGN16 false
|
|
||||||
#endif
|
|
||||||
|
|
||||||
NAMESPACE_BEGIN(CryptoPP)
|
NAMESPACE_BEGIN(CryptoPP)
|
||||||
|
|
||||||
/// \brief SHA-1 message digest
|
/// \brief SHA-1 message digest
|
||||||
|
|
@ -138,7 +132,7 @@ protected:
|
||||||
/// \brief SHA-512 message digest
|
/// \brief SHA-512 message digest
|
||||||
/// \sa <a href="http://www.weidai.com/scan-mirror/md.html#SHA-512">SHA-512</a>
|
/// \sa <a href="http://www.weidai.com/scan-mirror/md.html#SHA-512">SHA-512</a>
|
||||||
/// \since SHA2 since Crypto++ 4.0, Power8 SHA since Crypto++ 6.1
|
/// \since SHA2 since Crypto++ 4.0, Power8 SHA since Crypto++ 6.1
|
||||||
class CRYPTOPP_DLL SHA512 : public IteratedHashWithStaticTransform<word64, BigEndian, 128, 64, SHA512, 64, SHA_X86_ALIGN16>
|
class CRYPTOPP_DLL SHA512 : public IteratedHashWithStaticTransform<word64, BigEndian, 128, 64, SHA512, 64, true>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/// \brief Initialize state array
|
/// \brief Initialize state array
|
||||||
|
|
@ -173,7 +167,7 @@ public:
|
||||||
/// \brief SHA-384 message digest
|
/// \brief SHA-384 message digest
|
||||||
/// \sa <a href="http://www.weidai.com/scan-mirror/md.html#SHA-384">SHA-384</a>
|
/// \sa <a href="http://www.weidai.com/scan-mirror/md.html#SHA-384">SHA-384</a>
|
||||||
/// \since SHA2 since Crypto++ 4.0, Power8 SHA since Crypto++ 6.1
|
/// \since SHA2 since Crypto++ 4.0, Power8 SHA since Crypto++ 6.1
|
||||||
class CRYPTOPP_DLL SHA384 : public IteratedHashWithStaticTransform<word64, BigEndian, 128, 64, SHA384, 48, SHA_X86_ALIGN16>
|
class CRYPTOPP_DLL SHA384 : public IteratedHashWithStaticTransform<word64, BigEndian, 128, 64, SHA384, 48, true>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/// \brief Initialize state array
|
/// \brief Initialize state array
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue