diff options
author | Jeffrey Walton <noloader@gmail.com> | 2016-09-06 02:51:16 -0400 |
---|---|---|
committer | Jeffrey Walton <noloader@gmail.com> | 2016-09-06 02:51:16 -0400 |
commit | 45323bddd83982a183714d91167194f73bab1440 (patch) | |
tree | 8b6d2543d1fba8a03b12572b8571155a8e972df7 /square.cpp | |
parent | 33522b39b1de5806798bded49e481baecb56dc58 (diff) | |
download | cryptopp-git-45323bddd83982a183714d91167194f73bab1440.tar.gz |
Initial fix for older Apple ld's non_lazy_ptr missing symbols (Issue 255)
Diffstat (limited to 'square.cpp')
-rw-r--r-- | square.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
@@ -18,14 +18,17 @@ NAMESPACE_BEGIN(CryptoPP)
+// Hack for OS X 10.5 ld, http://github.com/weidai11/cryptopp/issues/255
+static const size_t s_unused = Square::KEYLENGTH;
+
// apply theta to a roundkey
static void SquareTransform (word32 in[4], word32 out[4])
{
- static const byte G[4][4] =
+ static const byte G[4][4] =
{
- 0x02U, 0x01U, 0x01U, 0x03U,
- 0x03U, 0x02U, 0x01U, 0x01U,
- 0x01U, 0x03U, 0x02U, 0x01U,
+ 0x02U, 0x01U, 0x01U, 0x03U,
+ 0x03U, 0x02U, 0x01U, 0x01U,
+ 0x01U, 0x03U, 0x02U, 0x01U,
0x01U, 0x01U, 0x03U, 0x02U
};
@@ -62,7 +65,7 @@ void Square::Base::UncheckedSetKey(const byte *userKey, unsigned int length, con roundkeys(i, 1) = roundkeys(i-1, 1) ^ roundkeys(i, 0);
roundkeys(i, 2) = roundkeys(i-1, 2) ^ roundkeys(i, 1);
roundkeys(i, 3) = roundkeys(i-1, 3) ^ roundkeys(i, 2);
- }
+ }
/* produce the round keys */
if (IsForwardTransformation())
@@ -138,13 +141,13 @@ void Square::Enc::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, {
word32 text[4], temp[4];
Block::Get(inBlock)(text[0])(text[1])(text[2])(text[3]);
-
+
/* initial key addition */
text[0] ^= roundkeys(0, 0);
text[1] ^= roundkeys(0, 1);
text[2] ^= roundkeys(0, 2);
text[3] ^= roundkeys(0, 3);
-
+
/* ROUNDS - 1 full rounds */
for (int i=1; i+1<ROUNDS; i+=2)
{
@@ -163,13 +166,13 @@ void Square::Dec::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, {
word32 text[4], temp[4];
Block::Get(inBlock)(text[0])(text[1])(text[2])(text[3]);
-
+
/* initial key addition */
text[0] ^= roundkeys(0, 0);
text[1] ^= roundkeys(0, 1);
text[2] ^= roundkeys(0, 2);
text[3] ^= roundkeys(0, 3);
-
+
/* ROUNDS - 1 full rounds */
for (int i=1; i+1<ROUNDS; i+=2)
{
|