From 0fce6b663b17e8cccaba8c0989f37ad517116591 Mon Sep 17 00:00:00 2001 From: jsteube Date: Sun, 3 Mar 2019 12:12:01 +0100 Subject: [PATCH] Testwise remove all hardcoded volatiles from cipher includes --- OpenCL/inc_cipher_aes.cl | 20 ++++++++++---------- OpenCL/inc_cipher_serpent.cl | 10 +++++----- OpenCL/inc_cipher_twofish.cl | 6 +++--- OpenCL/inc_truecrypt_xts.cl | 32 ++++++++++++++++---------------- OpenCL/inc_veracrypt_xts.cl | 28 ++++++++++++++-------------- 5 files changed, 48 insertions(+), 48 deletions(-) diff --git a/OpenCL/inc_cipher_aes.cl b/OpenCL/inc_cipher_aes.cl index a9d1eb111..f4c0af0dc 100644 --- a/OpenCL/inc_cipher_aes.cl +++ b/OpenCL/inc_cipher_aes.cl @@ -699,7 +699,7 @@ DECLSPEC void aes128_ExpandKey (u32 *ks, const u32 *ukey, SHM_TYPE u32 *s_te0, S ks[2] = ukey[2]; ks[3] = ukey[3]; - for (volatile int i = 0, j = 0; i < 10; i += 1, j += 4) + for (int i = 0, j = 0; i < 10; i += 1, j += 4) { u32 temp = ks[j + 3]; @@ -720,7 +720,7 @@ DECLSPEC void aes128_ExpandKey (u32 *ks, const u32 *ukey, SHM_TYPE u32 *s_te0, S DECLSPEC void aes128_InvertKey (u32 *ks, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4) { - for (volatile int i = 0, j = 40; i < j; i += 4, j -= 4) + for (int i = 0, j = 40; i < j; i += 4, j -= 4) { u32 temp; @@ -730,7 +730,7 @@ DECLSPEC void aes128_InvertKey (u32 *ks, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te temp = ks[i + 3]; ks[i + 3] = ks[j + 3]; ks[j + 3] = temp; } - for (volatile int i = 1, j = 4; i < 10; i += 1, j += 4) + for (int i = 1, j = 4; i < 10; i += 1, j += 4) { ks[j + 0] = s_td0[s_te1[(ks[j + 0] >> 24) & 0xff] & 0xff] ^ @@ -799,7 +799,7 @@ DECLSPEC void aes128_encrypt (const u32 *ks, const u32 *in, u32 *out, SHM_TYPE u #ifdef _unroll #pragma unroll #endif - for (volatile int i = 4; i < 40; i += 4) + for (int i = 4; i < 40; i += 4) { const uchar4 x0 = as_uchar4 (t0); const uchar4 x1 = as_uchar4 (t1); @@ -862,7 +862,7 @@ DECLSPEC void aes128_decrypt (const u32 *ks, const u32 *in, u32 *out, SHM_TYPE u #ifdef _unroll #pragma unroll #endif - for (volatile int i = 4; i < 40; i += 4) + for (int i = 4; i < 40; i += 4) { const uchar4 x0 = as_uchar4 (t0); const uchar4 x1 = as_uchar4 (t1); @@ -926,7 +926,7 @@ DECLSPEC void aes256_ExpandKey (u32 *ks, const u32 *ukey, SHM_TYPE u32 *s_te0, S int i; int j; - for (volatile int i = 0, j = 0; i < 7; i += 1, j += 8) + for (int i = 0, j = 0; i < 7; i += 1, j += 8) { const u32 temp1 = ks[j + 7]; @@ -959,7 +959,7 @@ DECLSPEC void aes256_ExpandKey (u32 *ks, const u32 *ukey, SHM_TYPE u32 *s_te0, S DECLSPEC void aes256_InvertKey (u32 *ks, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4) { - for (volatile int i = 0, j = 56; i < j; i += 4, j -= 4) + for (int i = 0, j = 56; i < j; i += 4, j -= 4) { u32 temp; @@ -969,7 +969,7 @@ DECLSPEC void aes256_InvertKey (u32 *ks, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te temp = ks[i + 3]; ks[i + 3] = ks[j + 3]; ks[j + 3] = temp; } - for (volatile int i = 1, j = 4; i < 14; i += 1, j += 4) + for (int i = 1, j = 4; i < 14; i += 1, j += 4) { ks[j + 0] = s_td0[s_te1[(ks[j + 0] >> 24) & 0xff] & 0xff] ^ @@ -1046,7 +1046,7 @@ DECLSPEC void aes256_encrypt (const u32 *ks, const u32 *in, u32 *out, SHM_TYPE u #ifdef _unroll #pragma unroll #endif - for (volatile int i = 4; i < 56; i += 4) + for (int i = 4; i < 56; i += 4) { const uchar4 x0 = as_uchar4 (t0); const uchar4 x1 = as_uchar4 (t1); @@ -1109,7 +1109,7 @@ DECLSPEC void aes256_decrypt (const u32 *ks, const u32 *in, u32 *out, SHM_TYPE u #ifdef _unroll #pragma unroll #endif - for (volatile int i = 4; i < 56; i += 4) + for (int i = 4; i < 56; i += 4) { const uchar4 x0 = as_uchar4 (t0); const uchar4 x1 = as_uchar4 (t1); diff --git a/OpenCL/inc_cipher_serpent.cl b/OpenCL/inc_cipher_serpent.cl index 9ebea4a64..423a177dd 100644 --- a/OpenCL/inc_cipher_serpent.cl +++ b/OpenCL/inc_cipher_serpent.cl @@ -408,7 +408,7 @@ DECLSPEC void serpent128_set_key (u32 *ks, const u32 *ukey) #ifdef _unroll #pragma unroll #endif - for (volatile int i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) { ks[i] = ukey[i]; } @@ -416,7 +416,7 @@ DECLSPEC void serpent128_set_key (u32 *ks, const u32 *ukey) #ifdef _unroll #pragma unroll #endif - for (volatile int i = 4; i < 8; i++) + for (int i = 4; i < 8; i++) { ks[i] = 0; } @@ -426,7 +426,7 @@ DECLSPEC void serpent128_set_key (u32 *ks, const u32 *ukey) #ifdef _unroll #pragma unroll #endif - for (volatile int i = 0; i < 132; i++) + for (int i = 0; i < 132; i++) { ks[i + 8] = rotl32_S (ks[i + 7] ^ ks[i + 5] ^ ks[i + 3] ^ ks[i + 0] ^ 0x9e3779b9 ^ i, 11); } @@ -576,7 +576,7 @@ DECLSPEC void serpent256_set_key (u32 *ks, const u32 *ukey) #ifdef _unroll #pragma unroll #endif - for (volatile int i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { ks[i] = ukey[i]; } @@ -584,7 +584,7 @@ DECLSPEC void serpent256_set_key (u32 *ks, const u32 *ukey) #ifdef _unroll #pragma unroll #endif - for (volatile int i = 0; i < 132; i++) + for (int i = 0; i < 132; i++) { ks[i + 8] = rotl32_S (ks[i + 7] ^ ks[i + 5] ^ ks[i + 3] ^ ks[i + 0] ^ 0x9e3779b9 ^ i, 11); } diff --git a/OpenCL/inc_cipher_twofish.cl b/OpenCL/inc_cipher_twofish.cl index 86dc59423..bda6e49fd 100644 --- a/OpenCL/inc_cipher_twofish.cl +++ b/OpenCL/inc_cipher_twofish.cl @@ -270,7 +270,7 @@ DECLSPEC u32 mds_rem (u32 p0, u32 p1) { #define G_MOD 0x14d - for (volatile int i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { u32 t = p1 >> 24; @@ -364,7 +364,7 @@ DECLSPEC void twofish128_set_key (u32 *sk, u32 *lk, const u32 *ukey) sk[1] = mds_rem (me_key[0], mo_key[0]); sk[0] = mds_rem (me_key[1], mo_key[1]); - for (volatile int i = 0; i < 40; i += 2) + for (int i = 0; i < 40; i += 2) { u32 a = 0x01010101 * i; u32 b = 0x01010101 + a; @@ -513,7 +513,7 @@ DECLSPEC void twofish256_set_key (u32 *sk, u32 *lk, const u32 *ukey) sk[1] = mds_rem (me_key[2], mo_key[2]); sk[0] = mds_rem (me_key[3], mo_key[3]); - for (volatile int i = 0; i < 40; i += 2) + for (int i = 0; i < 40; i += 2) { u32 a = 0x01010101 * i; u32 b = 0x01010101 + a; diff --git a/OpenCL/inc_truecrypt_xts.cl b/OpenCL/inc_truecrypt_xts.cl index 393f71592..bc6f319d0 100644 --- a/OpenCL/inc_truecrypt_xts.cl +++ b/OpenCL/inc_truecrypt_xts.cl @@ -177,7 +177,7 @@ DECLSPEC int verify_header_aes (__global const tc_t *esalt_bufs, const u32 *ukey // seek to byte 256 - for (volatile int i = 4; i < 64 - 16; i += 4) + for (int i = 4; i < 64 - 16; i += 4) { xts_mul2 (T_aes, T_aes); } @@ -186,7 +186,7 @@ DECLSPEC int verify_header_aes (__global const tc_t *esalt_bufs, const u32 *ukey u32 crc32 = ~0; - for (volatile int i = 64 - 16; i < 128 - 16; i += 4) + for (int i = 64 - 16; i < 128 - 16; i += 4) { data[0] = esalt_bufs[0].data_buf[i + 0]; data[1] = esalt_bufs[0].data_buf[i + 1]; @@ -233,7 +233,7 @@ DECLSPEC int verify_header_serpent (__global const tc_t *esalt_bufs, const u32 * // seek to byte 256 - for (volatile int i = 4; i < 64 - 16; i += 4) + for (int i = 4; i < 64 - 16; i += 4) { xts_mul2 (T_serpent, T_serpent); } @@ -242,7 +242,7 @@ DECLSPEC int verify_header_serpent (__global const tc_t *esalt_bufs, const u32 * u32 crc32 = ~0; - for (volatile int i = 64 - 16; i < 128 - 16; i += 4) + for (int i = 64 - 16; i < 128 - 16; i += 4) { data[0] = esalt_bufs[0].data_buf[i + 0]; data[1] = esalt_bufs[0].data_buf[i + 1]; @@ -290,7 +290,7 @@ DECLSPEC int verify_header_twofish (__global const tc_t *esalt_bufs, const u32 * // seek to byte 256 - for (volatile int i = 4; i < 64 - 16; i += 4) + for (int i = 4; i < 64 - 16; i += 4) { xts_mul2 (T_twofish, T_twofish); } @@ -299,7 +299,7 @@ DECLSPEC int verify_header_twofish (__global const tc_t *esalt_bufs, const u32 * u32 crc32 = ~0; - for (volatile int i = 64 - 16; i < 128 - 16; i += 4) + for (int i = 64 - 16; i < 128 - 16; i += 4) { data[0] = esalt_bufs[0].data_buf[i + 0]; data[1] = esalt_bufs[0].data_buf[i + 1]; @@ -353,7 +353,7 @@ DECLSPEC int verify_header_aes_twofish (__global const tc_t *esalt_bufs, const u // seek to byte 256 - for (volatile int i = 4; i < 64 - 16; i += 4) + for (int i = 4; i < 64 - 16; i += 4) { xts_mul2 (T_aes, T_aes); xts_mul2 (T_twofish, T_twofish); @@ -363,7 +363,7 @@ DECLSPEC int verify_header_aes_twofish (__global const tc_t *esalt_bufs, const u u32 crc32 = ~0; - for (volatile int i = 64 - 16; i < 128 - 16; i += 4) + for (int i = 64 - 16; i < 128 - 16; i += 4) { data[0] = esalt_bufs[0].data_buf[i + 0]; data[1] = esalt_bufs[0].data_buf[i + 1]; @@ -414,7 +414,7 @@ DECLSPEC int verify_header_serpent_aes (__global const tc_t *esalt_bufs, const u // seek to byte 256 - for (volatile int i = 4; i < 64 - 16; i += 4) + for (int i = 4; i < 64 - 16; i += 4) { xts_mul2 (T_serpent, T_serpent); xts_mul2 (T_aes, T_aes); @@ -424,7 +424,7 @@ DECLSPEC int verify_header_serpent_aes (__global const tc_t *esalt_bufs, const u u32 crc32 = ~0; - for (volatile int i = 64 - 16; i < 128 - 16; i += 4) + for (int i = 64 - 16; i < 128 - 16; i += 4) { data[0] = esalt_bufs[0].data_buf[i + 0]; data[1] = esalt_bufs[0].data_buf[i + 1]; @@ -477,7 +477,7 @@ DECLSPEC int verify_header_twofish_serpent (__global const tc_t *esalt_bufs, con // seek to byte 256 - for (volatile int i = 4; i < 64 - 16; i += 4) + for (int i = 4; i < 64 - 16; i += 4) { xts_mul2 (T_twofish, T_twofish); xts_mul2 (T_serpent, T_serpent); @@ -487,7 +487,7 @@ DECLSPEC int verify_header_twofish_serpent (__global const tc_t *esalt_bufs, con u32 crc32 = ~0; - for (volatile int i = 64 - 16; i < 128 - 16; i += 4) + for (int i = 64 - 16; i < 128 - 16; i += 4) { data[0] = esalt_bufs[0].data_buf[i + 0]; data[1] = esalt_bufs[0].data_buf[i + 1]; @@ -546,7 +546,7 @@ DECLSPEC int verify_header_aes_twofish_serpent (__global const tc_t *esalt_bufs, // seek to byte 256 - for (volatile int i = 4; i < 64 - 16; i += 4) + for (int i = 4; i < 64 - 16; i += 4) { xts_mul2 (T_aes, T_aes); xts_mul2 (T_twofish, T_twofish); @@ -557,7 +557,7 @@ DECLSPEC int verify_header_aes_twofish_serpent (__global const tc_t *esalt_bufs, u32 crc32 = ~0; - for (volatile int i = 64 - 16; i < 128 - 16; i += 4) + for (int i = 64 - 16; i < 128 - 16; i += 4) { data[0] = esalt_bufs[0].data_buf[i + 0]; data[1] = esalt_bufs[0].data_buf[i + 1]; @@ -615,7 +615,7 @@ DECLSPEC int verify_header_serpent_twofish_aes (__global const tc_t *esalt_bufs, // seek to byte 256 - for (volatile int i = 4; i < 64 - 16; i += 4) + for (int i = 4; i < 64 - 16; i += 4) { xts_mul2 (T_serpent, T_serpent); xts_mul2 (T_twofish, T_twofish); @@ -626,7 +626,7 @@ DECLSPEC int verify_header_serpent_twofish_aes (__global const tc_t *esalt_bufs, u32 crc32 = ~0; - for (volatile int i = 64 - 16; i < 128 - 16; i += 4) + for (int i = 64 - 16; i < 128 - 16; i += 4) { data[0] = esalt_bufs[0].data_buf[i + 0]; data[1] = esalt_bufs[0].data_buf[i + 1]; diff --git a/OpenCL/inc_veracrypt_xts.cl b/OpenCL/inc_veracrypt_xts.cl index d4ee74533..d6310d274 100644 --- a/OpenCL/inc_veracrypt_xts.cl +++ b/OpenCL/inc_veracrypt_xts.cl @@ -119,7 +119,7 @@ DECLSPEC int verify_header_camellia (__global const tc_t *esalt_bufs, const u32 // seek to byte 256 - for (volatile int i = 4; i < 64 - 16; i += 4) + for (int i = 4; i < 64 - 16; i += 4) { xts_mul2 (T_camellia, T_camellia); } @@ -128,7 +128,7 @@ DECLSPEC int verify_header_camellia (__global const tc_t *esalt_bufs, const u32 u32 crc32 = ~0; - for (volatile int i = 64 - 16; i < 128 - 16; i += 4) + for (int i = 64 - 16; i < 128 - 16; i += 4) { data[0] = esalt_bufs[0].data_buf[i + 0]; data[1] = esalt_bufs[0].data_buf[i + 1]; @@ -175,7 +175,7 @@ DECLSPEC int verify_header_kuznyechik (__global const tc_t *esalt_bufs, const u3 // seek to byte 256 - for (volatile int i = 4; i < 64 - 16; i += 4) + for (int i = 4; i < 64 - 16; i += 4) { xts_mul2 (T_kuznyechik, T_kuznyechik); } @@ -184,7 +184,7 @@ DECLSPEC int verify_header_kuznyechik (__global const tc_t *esalt_bufs, const u3 u32 crc32 = ~0; - for (volatile int i = 64 - 16; i < 128 - 16; i += 4) + for (int i = 64 - 16; i < 128 - 16; i += 4) { data[0] = esalt_bufs[0].data_buf[i + 0]; data[1] = esalt_bufs[0].data_buf[i + 1]; @@ -236,7 +236,7 @@ DECLSPEC int verify_header_camellia_kuznyechik (__global const tc_t *esalt_bufs, // seek to byte 256 - for (volatile int i = 4; i < 64 - 16; i += 4) + for (int i = 4; i < 64 - 16; i += 4) { xts_mul2 (T_camellia, T_camellia); xts_mul2 (T_kuznyechik, T_kuznyechik); @@ -246,7 +246,7 @@ DECLSPEC int verify_header_camellia_kuznyechik (__global const tc_t *esalt_bufs, u32 crc32 = ~0; - for (volatile int i = 64 - 16; i < 128 - 16; i += 4) + for (int i = 64 - 16; i < 128 - 16; i += 4) { data[0] = esalt_bufs[0].data_buf[i + 0]; data[1] = esalt_bufs[0].data_buf[i + 1]; @@ -297,7 +297,7 @@ DECLSPEC int verify_header_camellia_serpent (__global const tc_t *esalt_bufs, co // seek to byte 256 - for (volatile int i = 4; i < 64 - 16; i += 4) + for (int i = 4; i < 64 - 16; i += 4) { xts_mul2 (T_camellia, T_camellia); xts_mul2 (T_serpent, T_serpent); @@ -307,7 +307,7 @@ DECLSPEC int verify_header_camellia_serpent (__global const tc_t *esalt_bufs, co u32 crc32 = ~0; - for (volatile int i = 64 - 16; i < 128 - 16; i += 4) + for (int i = 64 - 16; i < 128 - 16; i += 4) { data[0] = esalt_bufs[0].data_buf[i + 0]; data[1] = esalt_bufs[0].data_buf[i + 1]; @@ -358,7 +358,7 @@ DECLSPEC int verify_header_kuznyechik_aes (__global const tc_t *esalt_bufs, cons // seek to byte 256 - for (volatile int i = 4; i < 64 - 16; i += 4) + for (int i = 4; i < 64 - 16; i += 4) { xts_mul2 (T_kuznyechik, T_kuznyechik); xts_mul2 (T_aes, T_aes); @@ -368,7 +368,7 @@ DECLSPEC int verify_header_kuznyechik_aes (__global const tc_t *esalt_bufs, cons u32 crc32 = ~0; - for (volatile int i = 64 - 16; i < 128 - 16; i += 4) + for (int i = 64 - 16; i < 128 - 16; i += 4) { data[0] = esalt_bufs[0].data_buf[i + 0]; data[1] = esalt_bufs[0].data_buf[i + 1]; @@ -421,7 +421,7 @@ DECLSPEC int verify_header_kuznyechik_twofish (__global const tc_t *esalt_bufs, // seek to byte 256 - for (volatile int i = 4; i < 64 - 16; i += 4) + for (int i = 4; i < 64 - 16; i += 4) { xts_mul2 (T_kuznyechik, T_kuznyechik); xts_mul2 (T_twofish, T_twofish); @@ -431,7 +431,7 @@ DECLSPEC int verify_header_kuznyechik_twofish (__global const tc_t *esalt_bufs, u32 crc32 = ~0; - for (volatile int i = 64 - 16; i < 128 - 16; i += 4) + for (int i = 64 - 16; i < 128 - 16; i += 4) { data[0] = esalt_bufs[0].data_buf[i + 0]; data[1] = esalt_bufs[0].data_buf[i + 1]; @@ -487,7 +487,7 @@ DECLSPEC int verify_header_kuznyechik_serpent_camellia (__global const tc_t *esa // seek to byte 256 - for (volatile int i = 4; i < 64 - 16; i += 4) + for (int i = 4; i < 64 - 16; i += 4) { xts_mul2 (T_kuznyechik, T_kuznyechik); xts_mul2 (T_serpent, T_serpent); @@ -498,7 +498,7 @@ DECLSPEC int verify_header_kuznyechik_serpent_camellia (__global const tc_t *esa u32 crc32 = ~0; - for (volatile int i = 64 - 16; i < 128 - 16; i += 4) + for (int i = 64 - 16; i < 128 - 16; i += 4) { data[0] = esalt_bufs[0].data_buf[i + 0]; data[1] = esalt_bufs[0].data_buf[i + 1];