diff options
author | Jeffrey Walton <noloader@gmail.com> | 2018-01-20 19:39:49 -0500 |
---|---|---|
committer | Jeffrey Walton <noloader@gmail.com> | 2018-01-20 19:39:49 -0500 |
commit | 565bd844fcc0dec4712f8c4c3e74e056f4a9ed78 (patch) | |
tree | 9ab43180511b53005490cea580954d9630830f40 /aria.cpp | |
parent | 2816efe188d5f335c4713ab68145d1b9df59452e (diff) | |
download | cryptopp-git-565bd844fcc0dec4712f8c4c3e74e056f4a9ed78.tar.gz |
Clear GCC -Wcast-align warnings on ARM
The buffers and workspaces are aligned
Diffstat (limited to 'aria.cpp')
-rw-r--r-- | aria.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
@@ -15,6 +15,10 @@ # define CRYPTOPP_ENABLE_ARIA_SSSE3_INTRINSICS 1
#endif
+// GCC cast warning
+#define UINT32_CAST(x) ((uint32_t *)(void *)(x))
+#define CONST_UINT32_CAST(x) ((const uint32_t *)(const void *)(x))
+
NAMESPACE_BEGIN(CryptoPP)
NAMESPACE_BEGIN(ARIATab)
@@ -97,10 +101,10 @@ inline void ARIA_GSRK(const word32 X[4], const word32 Y[4], byte RK[16]) // MSVC is not generating a "rotate immediate". Constify to help it along.
static const unsigned int Q = 4-(N/32);
static const unsigned int R = N % 32;
- reinterpret_cast<word32*>(RK)[0] = (X[0]) ^ ((Y[(Q )%4])>>R) ^ ((Y[(Q+3)%4])<<(32-R));
- reinterpret_cast<word32*>(RK)[1] = (X[1]) ^ ((Y[(Q+1)%4])>>R) ^ ((Y[(Q )%4])<<(32-R));
- reinterpret_cast<word32*>(RK)[2] = (X[2]) ^ ((Y[(Q+2)%4])>>R) ^ ((Y[(Q+1)%4])<<(32-R));
- reinterpret_cast<word32*>(RK)[3] = (X[3]) ^ ((Y[(Q+3)%4])>>R) ^ ((Y[(Q+2)%4])<<(32-R));
+ UINT32_CAST(RK)[0] = (X[0]) ^ ((Y[(Q )%4])>>R) ^ ((Y[(Q+3)%4])<<(32-R));
+ UINT32_CAST(RK)[1] = (X[1]) ^ ((Y[(Q+1)%4])>>R) ^ ((Y[(Q )%4])<<(32-R));
+ UINT32_CAST(RK)[2] = (X[2]) ^ ((Y[(Q+2)%4])>>R) ^ ((Y[(Q+1)%4])<<(32-R));
+ UINT32_CAST(RK)[3] = (X[3]) ^ ((Y[(Q+3)%4])>>R) ^ ((Y[(Q+2)%4])<<(32-R));
}
void ARIA::Base::UncheckedSetKey(const byte *key, unsigned int keylen, const NameValuePairs ¶ms)
@@ -213,7 +217,7 @@ void ARIA::Base::UncheckedSetKey(const byte *key, unsigned int keylen, const Nam rk = m_rk.data();
r = R; q = Q;
- a=reinterpret_cast<word32*>(rk); s=m_w.data()+24; z=a+r*4;
+ a=UINT32_CAST(rk); s=m_w.data()+24; z=a+r*4;
::memcpy(t, a, 16); ::memcpy(a, z, 16); ::memcpy(z, t, 16);
a+=4; z-=4;
@@ -314,7 +318,7 @@ void ARIA::Base::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, b outBlock[14] = (byte)(S1[ARIA_BRF(t[3],1)] );
outBlock[15] = (byte)(S2[ARIA_BRF(t[3],0)] );
- t = reinterpret_cast<word32*>(outBlock);
+ t = UINT32_CAST(outBlock);
BigEndianBlock::Put(rk, t)(t[0])(t[1])(t[2])(t[3]);
#endif
|