Work on clinet, OpenCL code enablement and client config stuff.

This commit is contained in:
Kirill Shakirov
2026-01-16 16:21:14 +01:00
parent 194f4e734b
commit 8d4c1ed96d
8 changed files with 456 additions and 158 deletions
@@ -32,7 +32,7 @@
// g_key_found uint[9] - 0 element - flag that sets to 1 if key found.
// Other 8 elements is found key
__kernel void search_key_test(const uint batch_size, const ulong g_Ti, const uint g_Tj,
__kernel void search_key(const uint batch_size, const ulong g_Ti, const uint g_Tj,
__global const uint8* g_start_enc_key,
__global const uint4* g_uenc_data,
__global const uint4* g_target_data,
@@ -48,11 +48,12 @@ __kernel void search_key_test(const uint batch_size, const ulong g_Ti, const uin
uint d_ks[44]; // data expanded key
uint t_ks[44]; // tweak expanded key
// set disk sector number
uint sec_n[4] = {0};
sec_n[0] = ((uint*)&g_Ti)[0];
sec_n[1] = ((uint*)&g_Ti)[1];
uint Tj = g_Tj;
uint Tj = g_Tj; // AES block number
vstore4(*g_uenc_data, 0, uenc_data);
vstore8(*g_start_enc_key, 0, enc_key);
@@ -60,8 +61,9 @@ __kernel void search_key_test(const uint batch_size, const ulong g_Ti, const uin
// Set initial start key for every work thread
uint k_data_carry = add_uint_to_bigint4_ (enc_key, (g_id*batch_size));
uint k_tweak_carry = add_one_to_bigint4_ (&enc_key[4]);
if (k_tweak_carry != 0u) return; // if reached max key value exit thread
// uint k_tweak_carry = add_uint_to_bigint4_ (&enc_key[4], k_data_carry);
// No need to store tweak carry
if (add_uint_to_bigint4_ (&enc_key[4], k_data_carry) != 0u) return; // if reached max key value exit thread
// Generate tweak
aes128_set_encrypt_key (t_ks, &enc_key[4]);
@@ -88,14 +90,20 @@ __kernel void search_key_test(const uint batch_size, const ulong g_Ti, const uin
// Tweak changes only once in 2^128 times
if (k_data_carry != 0u) {
// Increment tweak part
k_tweak_carry = add_one_to_bigint4_ (&enc_key[4]);
if (k_tweak_carry != 0u) return; // if reached max key value exit thread
// k_tweak_carry = add_one_to_bigint4_ (&enc_key[4]);
add_one_to_bigint4_ (&enc_key[4]); // no need to store tweak carry
// *** I commented next line because, its a really!! lol! rare event,
// *** and in a worse case we just do a bit of noneed work.
// *** But additional check on every itaration actually mesurable cost.
// if (k_tweak_carry != 0u) return; // if reached max key value exit thread
// Gen new tweak
aes128_set_encrypt_key (t_ks, &enc_key[4]);
aes_xts256_gen_tweak (t_ks, sec_n, Tj, tweak);
}
}
}