aboutsummaryrefslogtreecommitdiffstats
path: root/src/block/aes_ni
diff options
context:
space:
mode:
authorlloyd <[email protected]>2013-11-20 10:05:11 +0000
committerlloyd <[email protected]>2013-11-20 10:05:11 +0000
commitd2f6455b2f5d4f4c092d6999469928dd033c7cdf (patch)
tree54521f1031129b1743ef7b38a38e8529263390bf /src/block/aes_ni
parentc83790b5bc35cd186da81276afcf6b17a4269520 (diff)
Fix old style cast warnings
Diffstat (limited to 'src/block/aes_ni')
-rw-r--r--src/block/aes_ni/aes_ni.cpp60
1 files changed, 30 insertions, 30 deletions
diff --git a/src/block/aes_ni/aes_ni.cpp b/src/block/aes_ni/aes_ni.cpp
index c6567518e..c752d359c 100644
--- a/src/block/aes_ni/aes_ni.cpp
+++ b/src/block/aes_ni/aes_ni.cpp
@@ -35,7 +35,7 @@ void aes_192_key_expansion(__m128i* K1, __m128i* K2, __m128i key2_with_rcon,
key1 = _mm_xor_si128(key1, key2_with_rcon);
*K1 = key1;
- _mm_storeu_si128((__m128i*)out, key1);
+ _mm_storeu_si128(reinterpret_cast<__m128i*>(out), key1);
if(last)
return;
@@ -105,10 +105,10 @@ __m128i aes_256_key_expansion(__m128i key, __m128i key2)
*/
void AES_128_NI::encrypt_n(const byte in[], byte out[], size_t blocks) const
{
- const __m128i* in_mm = (const __m128i*)in;
- __m128i* out_mm = (__m128i*)out;
+ const __m128i* in_mm = reinterpret_cast<const __m128i*>(in);
+ __m128i* out_mm = reinterpret_cast<__m128i*>(out);
- const __m128i* key_mm = (const __m128i*)&EK[0];
+ const __m128i* key_mm = reinterpret_cast<const __m128i*>(&EK[0]);
__m128i K0 = _mm_loadu_si128(key_mm);
__m128i K1 = _mm_loadu_si128(key_mm + 1);
@@ -181,10 +181,10 @@ void AES_128_NI::encrypt_n(const byte in[], byte out[], size_t blocks) const
*/
void AES_128_NI::decrypt_n(const byte in[], byte out[], size_t blocks) const
{
- const __m128i* in_mm = (const __m128i*)in;
- __m128i* out_mm = (__m128i*)out;
+ const __m128i* in_mm = reinterpret_cast<const __m128i*>(in);
+ __m128i* out_mm = reinterpret_cast<__m128i*>(out);
- const __m128i* key_mm = (const __m128i*)&DK[0];
+ const __m128i* key_mm = reinterpret_cast<const __m128i*>(&DK[0]);
__m128i K0 = _mm_loadu_si128(key_mm);
__m128i K1 = _mm_loadu_si128(key_mm + 1);
@@ -263,7 +263,7 @@ void AES_128_NI::key_schedule(const byte key[], size_t)
#define AES_128_key_exp(K, RCON) \
aes_128_key_expansion(K, _mm_aeskeygenassist_si128(K, RCON))
- __m128i K0 = _mm_loadu_si128((const __m128i*)(key));
+ __m128i K0 = _mm_loadu_si128(reinterpret_cast<const __m128i*>(key));
__m128i K1 = AES_128_key_exp(K0, 0x01);
__m128i K2 = AES_128_key_exp(K1, 0x02);
__m128i K3 = AES_128_key_exp(K2, 0x04);
@@ -275,7 +275,7 @@ void AES_128_NI::key_schedule(const byte key[], size_t)
__m128i K9 = AES_128_key_exp(K8, 0x1B);
__m128i K10 = AES_128_key_exp(K9, 0x36);
- __m128i* EK_mm = (__m128i*)&EK[0];
+ __m128i* EK_mm = reinterpret_cast<__m128i*>(&EK[0]);
_mm_storeu_si128(EK_mm , K0);
_mm_storeu_si128(EK_mm + 1, K1);
_mm_storeu_si128(EK_mm + 2, K2);
@@ -290,7 +290,7 @@ void AES_128_NI::key_schedule(const byte key[], size_t)
// Now generate decryption keys
- __m128i* DK_mm = (__m128i*)&DK[0];
+ __m128i* DK_mm = reinterpret_cast<__m128i*>(&DK[0]);
_mm_storeu_si128(DK_mm , K10);
_mm_storeu_si128(DK_mm + 1, _mm_aesimc_si128(K9));
_mm_storeu_si128(DK_mm + 2, _mm_aesimc_si128(K8));
@@ -318,10 +318,10 @@ void AES_128_NI::clear()
*/
void AES_192_NI::encrypt_n(const byte in[], byte out[], size_t blocks) const
{
- const __m128i* in_mm = (const __m128i*)in;
- __m128i* out_mm = (__m128i*)out;
+ const __m128i* in_mm = reinterpret_cast<const __m128i*>(in);
+ __m128i* out_mm = reinterpret_cast<__m128i*>(out);
- const __m128i* key_mm = (const __m128i*)&EK[0];
+ const __m128i* key_mm = reinterpret_cast<const __m128i*>(&EK[0]);
__m128i K0 = _mm_loadu_si128(key_mm);
__m128i K1 = _mm_loadu_si128(key_mm + 1);
@@ -400,10 +400,10 @@ void AES_192_NI::encrypt_n(const byte in[], byte out[], size_t blocks) const
*/
void AES_192_NI::decrypt_n(const byte in[], byte out[], size_t blocks) const
{
- const __m128i* in_mm = (const __m128i*)in;
- __m128i* out_mm = (__m128i*)out;
+ const __m128i* in_mm = reinterpret_cast<const __m128i*>(in);
+ __m128i* out_mm = reinterpret_cast<__m128i*>(out);
- const __m128i* key_mm = (const __m128i*)&DK[0];
+ const __m128i* key_mm = reinterpret_cast<const __m128i*>(&DK[0]);
__m128i K0 = _mm_loadu_si128(key_mm);
__m128i K1 = _mm_loadu_si128(key_mm + 1);
@@ -485,8 +485,8 @@ void AES_192_NI::key_schedule(const byte key[], size_t)
EK.resize(52);
DK.resize(52);
- __m128i K0 = _mm_loadu_si128((const __m128i*)(key));
- __m128i K1 = _mm_loadu_si128((const __m128i*)(key + 8));
+ __m128i K0 = _mm_loadu_si128(reinterpret_cast<const __m128i*>(key));
+ __m128i K1 = _mm_loadu_si128(reinterpret_cast<const __m128i*>(key + 8));
K1 = _mm_srli_si128(K1, 8);
load_le(&EK[0], key, 6);
@@ -508,9 +508,9 @@ void AES_192_NI::key_schedule(const byte key[], size_t)
#undef AES_192_key_exp
// Now generate decryption keys
- const __m128i* EK_mm = (const __m128i*)&EK[0];
+ const __m128i* EK_mm = reinterpret_cast<const __m128i*>(&EK[0]);
- __m128i* DK_mm = (__m128i*)&DK[0];
+ __m128i* DK_mm = reinterpret_cast<__m128i*>(&DK[0]);
_mm_storeu_si128(DK_mm , _mm_loadu_si128(EK_mm + 12));
_mm_storeu_si128(DK_mm + 1, _mm_aesimc_si128(_mm_loadu_si128(EK_mm + 11)));
_mm_storeu_si128(DK_mm + 2, _mm_aesimc_si128(_mm_loadu_si128(EK_mm + 10)));
@@ -540,10 +540,10 @@ void AES_192_NI::clear()
*/
void AES_256_NI::encrypt_n(const byte in[], byte out[], size_t blocks) const
{
- const __m128i* in_mm = (const __m128i*)in;
- __m128i* out_mm = (__m128i*)out;
+ const __m128i* in_mm = reinterpret_cast<const __m128i*>(in);
+ __m128i* out_mm = reinterpret_cast<__m128i*>(out);
- const __m128i* key_mm = (const __m128i*)&EK[0];
+ const __m128i* key_mm = reinterpret_cast<const __m128i*>(&EK[0]);
__m128i K0 = _mm_loadu_si128(key_mm);
__m128i K1 = _mm_loadu_si128(key_mm + 1);
@@ -628,10 +628,10 @@ void AES_256_NI::encrypt_n(const byte in[], byte out[], size_t blocks) const
*/
void AES_256_NI::decrypt_n(const byte in[], byte out[], size_t blocks) const
{
- const __m128i* in_mm = (const __m128i*)in;
- __m128i* out_mm = (__m128i*)out;
+ const __m128i* in_mm = reinterpret_cast<const __m128i*>(in);
+ __m128i* out_mm = reinterpret_cast<__m128i*>(out);
- const __m128i* key_mm = (const __m128i*)&DK[0];
+ const __m128i* key_mm = reinterpret_cast<const __m128i*>(&DK[0]);
__m128i K0 = _mm_loadu_si128(key_mm);
__m128i K1 = _mm_loadu_si128(key_mm + 1);
@@ -719,8 +719,8 @@ void AES_256_NI::key_schedule(const byte key[], size_t)
EK.resize(60);
DK.resize(60);
- __m128i K0 = _mm_loadu_si128((const __m128i*)(key));
- __m128i K1 = _mm_loadu_si128((const __m128i*)(key + 16));
+ __m128i K0 = _mm_loadu_si128(reinterpret_cast<const __m128i*>(key));
+ __m128i K1 = _mm_loadu_si128(reinterpret_cast<const __m128i*>(key + 16));
__m128i K2 = aes_128_key_expansion(K0, _mm_aeskeygenassist_si128(K1, 0x01));
__m128i K3 = aes_256_key_expansion(K1, K2);
@@ -742,7 +742,7 @@ void AES_256_NI::key_schedule(const byte key[], size_t)
__m128i K14 = aes_128_key_expansion(K12, _mm_aeskeygenassist_si128(K13, 0x40));
- __m128i* EK_mm = (__m128i*)&EK[0];
+ __m128i* EK_mm = reinterpret_cast<__m128i*>(&EK[0]);
_mm_storeu_si128(EK_mm , K0);
_mm_storeu_si128(EK_mm + 1, K1);
_mm_storeu_si128(EK_mm + 2, K2);
@@ -760,7 +760,7 @@ void AES_256_NI::key_schedule(const byte key[], size_t)
_mm_storeu_si128(EK_mm + 14, K14);
// Now generate decryption keys
- __m128i* DK_mm = (__m128i*)&DK[0];
+ __m128i* DK_mm = reinterpret_cast<__m128i*>(&DK[0]);
_mm_storeu_si128(DK_mm , K14);
_mm_storeu_si128(DK_mm + 1, _mm_aesimc_si128(K13));
_mm_storeu_si128(DK_mm + 2, _mm_aesimc_si128(K12));