summaryrefslogtreecommitdiff
path: root/sha.cpp
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2019-05-22 19:00:08 -0400
committerJeffrey Walton <noloader@gmail.com>2019-05-22 19:00:08 -0400
commit7eaa5837e092b25d977040fe2bc8284034fa269a (patch)
tree77d169f08e37ab1083ab661b74996be28f9686c5 /sha.cpp
parentce5d5d5c0fdc3d6fc69884f9125661c1c9ebe492 (diff)
downloadcryptopp-git-7eaa5837e092b25d977040fe2bc8284034fa269a.tar.gz
Fix "unexpected reloc type 0x03" for ARM shared object (GH #846)
Diffstat (limited to 'sha.cpp')
-rw-r--r--sha.cpp37
1 files changed, 14 insertions, 23 deletions
diff --git a/sha.cpp b/sha.cpp
index d120bd93..b752ea24 100644
--- a/sha.cpp
+++ b/sha.cpp
@@ -60,7 +60,6 @@
#endif
#if CRYPTOGAMS_ARM_SHA1 || CRYPTOGAMS_ARM_SHA256 || CRYPTOGAMS_ARM_SHA512
-extern "C" unsigned int CRYPTOGAMS_armcaps;
unsigned int CRYPTOGAMS_armcaps = 0;
#endif
@@ -72,7 +71,7 @@ extern void SHA256_HashMultipleBlocks_SHANI(word32 *state, const word32 *data, s
#endif
#if CRYPTOGAMS_ARM_SHA1
-extern "C" void sha1_block_data_order(word32* state, const word32 *data, size_t blocks);
+extern "C" void sha1_block_data_order(word32* state, const word32 *data, size_t blocks, unsigned int caps);
#endif
#if CRYPTOPP_ARM_SHA1_AVAILABLE
@@ -84,7 +83,7 @@ extern void SHA256_HashMultipleBlocks_ARMV8(word32 *state, const word32 *data, s
#endif
#if CRYPTOGAMS_ARM_SHA256
-extern "C" void sha256_block_data_order(word32* state, const word32 *data, size_t blocks);
+extern "C" void sha256_block_data_order(word32* state, const word32 *data, size_t blocks, unsigned int caps);
#endif
#if CRYPTOPP_ARM_SHA512_AVAILABLE
@@ -97,7 +96,7 @@ extern void SHA512_HashMultipleBlocks_POWER8(word64 *state, const word64 *data,
#endif
#if CRYPTOGAMS_ARM_SHA512
-extern "C" void sha512_block_data_order(word64* state, const word64 *data, size_t blocks);
+extern "C" void sha512_block_data_order(word64* state, const word64 *data, size_t blocks, unsigned int caps);
#endif
// We add extern to export table to sha_simd.cpp, but it
@@ -315,14 +314,13 @@ void SHA1::Transform(word32 *state, const word32 *data)
if (HasARMv7())
{
static const unsigned int caps = CryptogamsArmCaps();
- CRYPTOPP_UNUSED(caps);
# if defined(CRYPTOPP_LITTLE_ENDIAN)
word32 dataBuf[16];
ByteReverse(dataBuf, data, SHA1::BLOCKSIZE);
- sha1_block_data_order(state, data, 1);
+ sha1_block_data_order(state, data, 1, caps);
# else
- sha1_block_data_order(state, data, 1);
+ sha1_block_data_order(state, data, 1, caps);
# endif
return;
}
@@ -353,10 +351,8 @@ size_t SHA1::HashMultipleBlocks(const word32 *input, size_t length)
#if CRYPTOGAMS_ARM_SHA1
if (HasARMv7())
{
- static const unsigned int caps = CryptogamsArmCaps();
- CRYPTOPP_UNUSED(caps);
-
- sha1_block_data_order(m_state, input, length / SHA1::BLOCKSIZE);
+ const unsigned int caps = CryptogamsArmCaps();
+ sha1_block_data_order(m_state, input, length / SHA1::BLOCKSIZE, caps);
return length & (SHA1::BLOCKSIZE - 1);
}
#endif
@@ -866,14 +862,13 @@ void SHA256::Transform(word32 *state, const word32 *data)
if (HasARMv7())
{
static const unsigned int caps = CryptogamsArmCaps();
- CRYPTOPP_UNUSED(caps);
# if defined(CRYPTOPP_LITTLE_ENDIAN)
word32 dataBuf[16];
ByteReverse(dataBuf, data, SHA256::BLOCKSIZE);
- sha256_block_data_order(state, data, 1);
+ sha256_block_data_order(state, data, 1, caps);
# else
- sha256_block_data_order(state, data, 1);
+ sha256_block_data_order(state, data, 1, caps);
# endif
return;
}
@@ -919,10 +914,8 @@ size_t SHA256::HashMultipleBlocks(const word32 *input, size_t length)
#if CRYPTOGAMS_ARM_SHA256
if (HasARMv7())
{
- static const unsigned int caps = CryptogamsArmCaps();
- CRYPTOPP_UNUSED(caps);
-
- sha256_block_data_order(m_state, input, length / SHA256::BLOCKSIZE);
+ const unsigned int caps = CryptogamsArmCaps();
+ sha256_block_data_order(m_state, input, length / SHA256::BLOCKSIZE, caps);
return length & (SHA256::BLOCKSIZE - 1);
}
#endif
@@ -986,9 +979,8 @@ size_t SHA224::HashMultipleBlocks(const word32 *input, size_t length)
if (HasARMv7())
{
static const unsigned int caps = CryptogamsArmCaps();
- CRYPTOPP_UNUSED(caps);
- sha256_block_data_order(m_state, input, length / SHA256::BLOCKSIZE);
+ sha256_block_data_order(m_state, input, length / SHA256::BLOCKSIZE, caps);;
return length & (SHA256::BLOCKSIZE - 1);
}
#endif
@@ -1352,14 +1344,13 @@ void SHA512::Transform(word64 *state, const word64 *data)
if (HasARMv7())
{
static const unsigned int caps = CryptogamsArmCaps();
- CRYPTOPP_UNUSED(caps);
# if defined(CRYPTOPP_LITTLE_ENDIAN)
word64 dataBuf[16];
ByteReverse(dataBuf, data, SHA512::BLOCKSIZE);
- sha512_block_data_order(state, dataBuf, 1);
+ sha512_block_data_order(state, dataBuf, 1, caps);
# else
- sha512_block_data_order(state, data, 1);
+ sha512_block_data_order(state, data, 1, caps);
# endif
return;
}