summaryrefslogtreecommitdiff
path: root/gost.cpp
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2016-09-06 02:51:16 -0400
committerJeffrey Walton <noloader@gmail.com>2016-09-06 02:51:16 -0400
commit45323bddd83982a183714d91167194f73bab1440 (patch)
tree8b6d2543d1fba8a03b12572b8571155a8e972df7 /gost.cpp
parent33522b39b1de5806798bded49e481baecb56dc58 (diff)
downloadcryptopp-git-45323bddd83982a183714d91167194f73bab1440.tar.gz
Initial fix for older Apple ld's non_lazy_ptr missing symbols (Issue 255)
Diffstat (limited to 'gost.cpp')
-rw-r--r--gost.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/gost.cpp b/gost.cpp
index f502f8a1..f60cf031 100644
--- a/gost.cpp
+++ b/gost.cpp
@@ -4,6 +4,9 @@
NAMESPACE_BEGIN(CryptoPP)
+// Hack for OS X 10.5 ld, http://github.com/weidai11/cryptopp/issues/255
+static const size_t s_unused = GOST::KEYLENGTH;
+
// these are the S-boxes given in Applied Cryptography 2nd Ed., p. 333
const byte GOST::Base::sBox[8][16]={
{4, 10, 9, 2, 13, 8, 0, 14, 6, 11, 1, 12, 7, 15, 5, 3},
@@ -24,7 +27,7 @@ const byte GOST::Base::sBox[8][16]={
{ 7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15 },
{10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8 },
{15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10 },
- {14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7 }};
+ {14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7 }};
*/
volatile bool GOST::Base::sTableCalculated = false;
@@ -44,7 +47,7 @@ void GOST::Base::PrecalculateSTable()
if (!sTableCalculated)
{
for (unsigned i = 0; i < 4; i++)
- for (unsigned j = 0; j < 256; j++)
+ for (unsigned j = 0; j < 256; j++)
{
word32 temp = sBox[2*i][j%16] | (sBox[2*i+1][j/16] << 4);
sTable[i][j] = rotlMod(temp, 11+8*i);