Fix "X86_SHA256_HashBlocks was not declared in this scope" when using CRYPTOPP_DISABLE_ASM
parent
82009ecf41
commit
50f0c84ea0
40
sha.cpp
40
sha.cpp
|
|
@ -95,6 +95,10 @@ static void SHA1_CXX_Transform(word32 *state, const word32 *data)
|
||||||
// end of Steve Reid's code //
|
// end of Steve Reid's code //
|
||||||
//////////////////////////////
|
//////////////////////////////
|
||||||
|
|
||||||
|
///////////////////////////////////
|
||||||
|
// start of Walton/Gulley's code //
|
||||||
|
///////////////////////////////////
|
||||||
|
|
||||||
#if CRYPTOPP_BOOL_SSE_SHA_INTRINSICS_AVAILABLE
|
#if CRYPTOPP_BOOL_SSE_SHA_INTRINSICS_AVAILABLE
|
||||||
// Based on http://software.intel.com/en-us/articles/intel-sha-extensions and code by Sean Gulley.
|
// Based on http://software.intel.com/en-us/articles/intel-sha-extensions and code by Sean Gulley.
|
||||||
static void SHA1_SSE_SHA_Transform(word32 *state, const word32 *data)
|
static void SHA1_SSE_SHA_Transform(word32 *state, const word32 *data)
|
||||||
|
|
@ -282,6 +286,10 @@ static void SHA1_SSE_SHA_Transform(word32 *state, const word32 *data)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/////////////////////////////////
|
||||||
|
// end of Walton/Gulley's code //
|
||||||
|
/////////////////////////////////
|
||||||
|
|
||||||
pfnSHATransform InitializeSHA1Transform()
|
pfnSHATransform InitializeSHA1Transform()
|
||||||
{
|
{
|
||||||
#if CRYPTOPP_BOOL_SSE_SHA_INTRINSICS_AVAILABLE
|
#if CRYPTOPP_BOOL_SSE_SHA_INTRINSICS_AVAILABLE
|
||||||
|
|
@ -693,7 +701,17 @@ static void SHA256_SSE_SHA_HashBlocks(word32 *state, const word32 *data, size_t
|
||||||
|
|
||||||
#if (defined(CRYPTOPP_X86_ASM_AVAILABLE) || defined(CRYPTOPP_X32_ASM_AVAILABLE) || defined(CRYPTOPP_X64_MASM_AVAILABLE)) && !defined(CRYPTOPP_DISABLE_SHA_ASM)
|
#if (defined(CRYPTOPP_X86_ASM_AVAILABLE) || defined(CRYPTOPP_X32_ASM_AVAILABLE) || defined(CRYPTOPP_X64_MASM_AVAILABLE)) && !defined(CRYPTOPP_DISABLE_SHA_ASM)
|
||||||
|
|
||||||
pfnSHAHashBlocks InitializeSHA256HashBlocks();
|
pfnSHAHashBlocks InitializeSHA256HashBlocks()
|
||||||
|
{
|
||||||
|
#if CRYPTOPP_BOOL_SSE_SHA_INTRINSICS_AVAILABLE
|
||||||
|
if (HasSHA())
|
||||||
|
return &SHA256_SSE_SHA_HashBlocks;
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return &X86_SHA256_HashBlocks;
|
||||||
|
}
|
||||||
|
|
||||||
size_t SHA256::HashMultipleBlocks(const word32 *input, size_t length)
|
size_t SHA256::HashMultipleBlocks(const word32 *input, size_t length)
|
||||||
{
|
{
|
||||||
static const pfnSHAHashBlocks s_pfn = InitializeSHA256HashBlocks();
|
static const pfnSHAHashBlocks s_pfn = InitializeSHA256HashBlocks();
|
||||||
|
|
@ -707,7 +725,6 @@ size_t SHA224::HashMultipleBlocks(const word32 *input, size_t length)
|
||||||
s_pfn(m_state, input, (length&(size_t(0)-BLOCKSIZE)) - !HasSSE2());
|
s_pfn(m_state, input, (length&(size_t(0)-BLOCKSIZE)) - !HasSSE2());
|
||||||
return length % BLOCKSIZE;
|
return length % BLOCKSIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define blk2(i) (W[i&15]+=s1(W[(i-2)&15])+W[(i-7)&15]+s0(W[(i-15)&15]))
|
#define blk2(i) (W[i&15]+=s1(W[(i-2)&15])+W[(i-7)&15]+s0(W[(i-15)&15]))
|
||||||
|
|
@ -851,6 +868,10 @@ static void SHA256_SSE_SHA_Transform(word32 *state, const word32 *data)
|
||||||
return SHA256_SSE_SHA_HashBlocks(state, data, SHA256::BLOCKSIZE);
|
return SHA256_SSE_SHA_HashBlocks(state, data, SHA256::BLOCKSIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////
|
||||||
|
// start of Walton/Gulley's code //
|
||||||
|
///////////////////////////////////
|
||||||
|
|
||||||
// Based on http://software.intel.com/en-us/articles/intel-sha-extensions and code by Sean Gulley.
|
// Based on http://software.intel.com/en-us/articles/intel-sha-extensions and code by Sean Gulley.
|
||||||
static void SHA256_SSE_SHA_HashBlocks(word32 *state, const word32 *data, size_t length)
|
static void SHA256_SSE_SHA_HashBlocks(word32 *state, const word32 *data, size_t length)
|
||||||
{
|
{
|
||||||
|
|
@ -1049,6 +1070,10 @@ static void SHA256_SSE_SHA_HashBlocks(word32 *state, const word32 *data, size_t
|
||||||
}
|
}
|
||||||
#endif // CRYPTOPP_BOOL_SSE_SHA_INTRINSICS_AVAILABLE
|
#endif // CRYPTOPP_BOOL_SSE_SHA_INTRINSICS_AVAILABLE
|
||||||
|
|
||||||
|
/////////////////////////////////
|
||||||
|
// end of Walton/Gulley's code //
|
||||||
|
/////////////////////////////////
|
||||||
|
|
||||||
pfnSHATransform InitializeSHA256Transform()
|
pfnSHATransform InitializeSHA256Transform()
|
||||||
{
|
{
|
||||||
#if CRYPTOPP_BOOL_SSE_SHA_INTRINSICS_AVAILABLE
|
#if CRYPTOPP_BOOL_SSE_SHA_INTRINSICS_AVAILABLE
|
||||||
|
|
@ -1060,17 +1085,6 @@ pfnSHATransform InitializeSHA256Transform()
|
||||||
return &SHA256_CXX_Transform;
|
return &SHA256_CXX_Transform;
|
||||||
}
|
}
|
||||||
|
|
||||||
pfnSHAHashBlocks InitializeSHA256HashBlocks()
|
|
||||||
{
|
|
||||||
#if CRYPTOPP_BOOL_SSE_SHA_INTRINSICS_AVAILABLE
|
|
||||||
if (HasSHA())
|
|
||||||
return &SHA256_SSE_SHA_HashBlocks;
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return &X86_SHA256_HashBlocks;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SHA256::Transform(word32 *state, const word32 *data)
|
void SHA256::Transform(word32 *state, const word32 *data)
|
||||||
{
|
{
|
||||||
static const pfnSHATransform s_pfn = InitializeSHA256Transform();
|
static const pfnSHATransform s_pfn = InitializeSHA256Transform();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue