Cleared -Wcast-align (Issue 122)
parent
9d6e3ae6ef
commit
7cff3c8d05
18
camellia.cpp
18
camellia.cpp
|
|
@ -91,11 +91,15 @@ void Camellia::Base::UncheckedSetKey(const byte *key, unsigned int keylen, const
|
||||||
kwl = (word64(k0) << 32) | k1; \
|
kwl = (word64(k0) << 32) | k1; \
|
||||||
kwr = (word64(k2) << 32) | k3
|
kwr = (word64(k2) << 32) | k3
|
||||||
#define KS_ROUND_0(i) \
|
#define KS_ROUND_0(i) \
|
||||||
*(word64*)CALC_ADDR(ks32, i+EFI(0)) = kwl; \
|
assert(IsAlignedOn(CALC_ADDR(ks32, i+EFI(0)),GetAlignmentOf<word64>())); \
|
||||||
*(word64*)CALC_ADDR(ks32, i+EFI(1)) = kwr
|
assert(IsAlignedOn(CALC_ADDR(ks32, i+EFI(1)),GetAlignmentOf<word64>())); \
|
||||||
|
*(word64*)(void*)CALC_ADDR(ks32, i+EFI(0)) = kwl; \
|
||||||
|
*(word64*)(void*)CALC_ADDR(ks32, i+EFI(1)) = kwr
|
||||||
#define KS_ROUND(i, r, which) \
|
#define KS_ROUND(i, r, which) \
|
||||||
if (which & (1<<int(r<64))) *(word64*)CALC_ADDR(ks32, i+EFI(r<64)) = (kwr << (r%64)) | (kwl >> (64 - (r%64))); \
|
assert(IsAlignedOn(CALC_ADDR(ks32, i+EFI(r<64)),GetAlignmentOf<word64>())); \
|
||||||
if (which & (1<<int(r>64))) *(word64*)CALC_ADDR(ks32, i+EFI(r>64)) = (kwl << (r%64)) | (kwr >> (64 - (r%64)))
|
assert(IsAlignedOn(CALC_ADDR(ks32, i+EFI(r>64)),GetAlignmentOf<word64>())); \
|
||||||
|
if (which & (1<<int(r<64))) *(word64*)(void*)CALC_ADDR(ks32, i+EFI(r<64)) = (kwr << (r%64)) | (kwl >> (64 - (r%64))); \
|
||||||
|
if (which & (1<<int(r>64))) *(word64*)(void*)CALC_ADDR(ks32, i+EFI(r>64)) = (kwl << (r%64)) | (kwr >> (64 - (r%64)))
|
||||||
#else
|
#else
|
||||||
// SSE2 version is 30% faster on Intel Core 2. Doesn't seem worth the hassle of maintenance, but left here
|
// SSE2 version is 30% faster on Intel Core 2. Doesn't seem worth the hassle of maintenance, but left here
|
||||||
// #if'd out in case someone needs it.
|
// #if'd out in case someone needs it.
|
||||||
|
|
@ -216,9 +220,11 @@ void Camellia::Base::ProcessAndXorBlock(const byte *inBlock, const byte *xorBloc
|
||||||
const int cacheLineSize = GetCacheLineSize();
|
const int cacheLineSize = GetCacheLineSize();
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
word32 u = 0;
|
word32 u = 0;
|
||||||
|
|
||||||
|
assert(IsAlignedOn(s1,GetAlignmentOf<word32>()));
|
||||||
for (i=0; i<256; i+=cacheLineSize)
|
for (i=0; i<256; i+=cacheLineSize)
|
||||||
u &= *(const word32 *)(s1+i);
|
u &= *(const word32 *)(void*)(s1+i);
|
||||||
u &= *(const word32 *)(s1+252);
|
u &= *(const word32 *)(void*)(s1+252);
|
||||||
lh |= u; ll |= u;
|
lh |= u; ll |= u;
|
||||||
|
|
||||||
SLOW_ROUND(lh, ll, rh, rl, KS(1,0), KS(1,1))
|
SLOW_ROUND(lh, ll, rh, rl, KS(1,0), KS(1,1))
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ class Camellia : public Camellia_Info, public BlockCipherDocumentation
|
||||||
void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
|
void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static const byte s1[256];
|
CRYPTOPP_ALIGN_DATA(4) static const byte s1[256];
|
||||||
static const word32 SP[4][256];
|
static const word32 SP[4][256];
|
||||||
|
|
||||||
unsigned int m_rounds;
|
unsigned int m_rounds;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue