Move constant table to unnamed namespace

This commit is contained in:
Jeffrey Walton 2018-08-18 21:41:13 -04:00
parent 03d78fb783
commit 92163356db
No known key found for this signature in database
GPG Key ID: B36AB348921B1838

View File

@ -5,6 +5,15 @@
#include "wake.h"
#include "smartptr.h"
ANONYMOUS_NAMESPACE_BEGIN
const unsigned int TT[8]= {
0x726a8f3b, 0xe69a3b5c, 0xd3c71fe5, 0xab3c73d2,
0x4d3a8eb3, 0x0396d6e8, 0x3d4c2f7a, 0x9ee27cf3
} ;
ANONYMOUS_NAMESPACE_END
NAMESPACE_BEGIN(CryptoPP)
#if defined(CRYPTOPP_DEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
@ -25,17 +34,7 @@ void WAKE_Base::GenKey(word32 k0, word32 k1, word32 k2, word32 k3)
{
// this code is mostly copied from David Wheeler's paper "A Bulk Data Encryption Algorithm"
signed int x, z, p;
// x and z were declared as "long" in Wheeler's paper, which is a signed type. I don't know if that was intentional, but it's too late to change it now. -- Wei 7/4/2010
CRYPTOPP_COMPILE_ASSERT(sizeof(x) == 4);
static unsigned int tt[10]= {
0x726a8f3b, // table
0xe69a3b5c,
0xd3c71fe5,
0xab3c73d2,
0x4d3a8eb3,
0x0396d6e8,
0x3d4c2f7a,
0x9ee27cf3, } ;
t[0] = k0;
t[1] = k1;
t[2] = k2;
@ -43,7 +42,7 @@ void WAKE_Base::GenKey(word32 k0, word32 k1, word32 k2, word32 k3)
for (p=4 ; p<256 ; p++)
{
x=t[p-4]+t[p-1] ; // fill t
t[p]= (x>>3) ^ tt[x&7] ;
t[p]= (x>>3) ^ TT[x&7] ;
}
for (p=0 ; p<23 ; p++)