本文整理汇总了C++中HANDLE_CLERROR函数的典型用法代码示例。如果您正苦于以下问题:C++ HANDLE_CLERROR函数的具体用法?C++ HANDLE_CLERROR怎么用?C++ HANDLE_CLERROR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了HANDLE_CLERROR函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: set_salt
static void set_salt(void *salt)
{
cur_salt = (pbkdf2_salt*)salt;
HANDLE_CLERROR(clEnqueueWriteBuffer(queue[gpu_id], mem_salt, CL_FALSE, 0, sizeof(pbkdf2_salt), cur_salt, 0, NULL, NULL), "Copy salt to gpu");
#if 0
fprintf(stderr, "\n%s(%.*s) len %u iter %u\n", __FUNCTION__, cur_salt->length, cur_salt->salt, cur_salt->length, cur_salt->iterations);
dump_stuff_msg("salt", cur_salt->salt, cur_salt->length);
#endif
}
开发者ID:Allen-smith,项目名称:ctf-tools,代码行数:9,代码来源:opencl_pbkdf2_hmac_sha1_fmt_plug.c
示例2: init
static void init(struct fmt_main *_self)
{
self = _self;
opencl_init("$JOHN/kernels/phpass_kernel.cl", gpu_id, NULL);
crypt_kernel = clCreateKernel(program[gpu_id], "phpass", &cl_error);
HANDLE_CLERROR(cl_error, "Error creating kernel");
}
开发者ID:Allen-smith,项目名称:ctf-tools,代码行数:9,代码来源:opencl_phpass_fmt_plug.c
示例3: crypt_all
static int crypt_all(int *pcount, struct db_salt *salt)
{
const int count = *pcount;
int index;
size_t *lws = local_work_size ? &local_work_size : NULL;
global_work_size = local_work_size ? (count + local_work_size - 1) / local_work_size * local_work_size : count;
if (any_cracked) {
memset(cracked, 0, cracked_size);
any_cracked = 0;
}
/// Copy data to gpu
HANDLE_CLERROR(clEnqueueWriteBuffer(queue[gpu_id], mem_in, CL_FALSE, 0,
insize, inbuffer, 0, NULL, multi_profilingEvent[0]),
"Copy data to gpu");
/// Run kernel
HANDLE_CLERROR(clEnqueueNDRangeKernel(queue[gpu_id], crypt_kernel, 1,
NULL, &global_work_size, lws, 0, NULL,
multi_profilingEvent[1]), "Run kernel");
/// Read the result back
HANDLE_CLERROR(clEnqueueReadBuffer(queue[gpu_id], mem_out, CL_TRUE, 0,
outsize, outbuffer, 0, NULL, multi_profilingEvent[2]), "Copy result back");
#ifdef _OPENMP
#pragma omp parallel for
#endif
for (index = 0; index < count; index++)
if (!kcdecrypt((unsigned char*)outbuffer[index].v,
salt_struct->iv, salt_struct->ct))
{
cracked[index] = 1;
#ifdef _OPENMP
#pragma omp atomic
#endif
any_cracked |= 1;
}
return count;
}
开发者ID:Allen-smith,项目名称:ctf-tools,代码行数:43,代码来源:opencl_keychain_fmt_plug.c
示例4: crypt_all
static void crypt_all(int count)
{
cl_int code;
code = clEnqueueWriteBuffer(queue[ocl_gpu_id], buffer_keys, CL_TRUE, 0,
(PLAINTEXT_LENGTH) * global_work_size, saved_plain, 0, NULL, NULL);
HANDLE_CLERROR(code, "failed in clEnqueueWriteBuffer saved_plain");
code = clEnqueueNDRangeKernel(queue[ocl_gpu_id], crypt_kernel, 1, NULL,
&global_work_size, &local_work_size, 0, NULL, profilingEvent);
HANDLE_CLERROR(code, "failed in clEnqueueNDRangeKernel");
HANDLE_CLERROR(clFinish(queue[ocl_gpu_id]), "clFinish error");
// read back partial hashes
code = clEnqueueReadBuffer(queue[ocl_gpu_id], buffer_out, CL_TRUE, 0,
sizeof(cl_uint) * global_work_size, outbuffer, 0, NULL, NULL);
HANDLE_CLERROR(code, "failed in clEnqueueReadBuffer -reading partial hashes");
have_full_hashes = 0;
}
开发者ID:bhargavz,项目名称:pac4mac,代码行数:19,代码来源:opencl_nsldaps_fmt.c
示例5: create_clobj
static void create_clobj(int kpc){
pinned_saved_keys = clCreateBuffer(context[ocl_gpu_id], CL_MEM_READ_WRITE | CL_MEM_ALLOC_HOST_PTR,
(PLAINTEXT_LENGTH + 1) * kpc, NULL, &ret_code);
HANDLE_CLERROR(ret_code, "Error creating page-locked memory pinned_saved_keys");
saved_plain = (char *) clEnqueueMapBuffer(queue[ocl_gpu_id], pinned_saved_keys,
CL_TRUE, CL_MAP_WRITE | CL_MAP_READ, 0,
(PLAINTEXT_LENGTH + 1) * kpc, 0, NULL, NULL, &ret_code);
HANDLE_CLERROR(ret_code, "Error mapping page-locked memory saved_plain");
res_hashes = malloc(sizeof(cl_uint) * 3 * kpc);
pinned_partial_hashes = clCreateBuffer(context[ocl_gpu_id],
CL_MEM_READ_WRITE | CL_MEM_ALLOC_HOST_PTR, 4 * kpc, NULL, &ret_code);
HANDLE_CLERROR(ret_code, "Error creating page-locked memory pinned_partial_hashes");
partial_hashes = (cl_uint *) clEnqueueMapBuffer(queue[ocl_gpu_id],
pinned_partial_hashes, CL_TRUE, CL_MAP_READ, 0, 4 * kpc, 0, NULL, NULL, &ret_code);
HANDLE_CLERROR(ret_code, "Error mapping page-locked memory partial_hashes");
// create and set arguments
buffer_keys = clCreateBuffer(context[ocl_gpu_id], CL_MEM_READ_ONLY,
(PLAINTEXT_LENGTH + 1) * kpc, NULL, &ret_code);
HANDLE_CLERROR(ret_code, "Error creating buffer argument buffer_keys");
buffer_out = clCreateBuffer(context[ocl_gpu_id], CL_MEM_WRITE_ONLY,
BINARY_SIZE * kpc, NULL, &ret_code);
HANDLE_CLERROR(ret_code, "Error creating buffer argument buffer_out");
data_info = clCreateBuffer(context[ocl_gpu_id], CL_MEM_READ_ONLY, sizeof(unsigned int) * 2, NULL, &ret_code);
HANDLE_CLERROR(ret_code, "Error creating data_info out argument");
HANDLE_CLERROR(clSetKernelArg(crypt_kernel, 0, sizeof(data_info),
(void *) &data_info), "Error setting argument 0");
HANDLE_CLERROR(clSetKernelArg(crypt_kernel, 1, sizeof(buffer_keys),
(void *) &buffer_keys), "Error setting argument 1");
HANDLE_CLERROR(clSetKernelArg(crypt_kernel, 2, sizeof(buffer_out),
(void *) &buffer_out), "Error setting argument 2");
datai[0] = PLAINTEXT_LENGTH;
datai[1] = kpc;
global_work_size = kpc;
}
开发者ID:bensteinfeld,项目名称:john-the-ripper,代码行数:42,代码来源:opencl_rawmd4_fmt.c
示例6: crypt_all
static void crypt_all(int count)
{
#ifdef DEBUGVERBOSE
int i, j;
unsigned char *p = (unsigned char *) saved_plain;
count--;
for (i = 0; i < count + 1; i++) {
fprintf(stderr, "\npassword : ");
for (j = 0; j < 64; j++) {
fprintf(stderr, "%02x ", p[i * 64 + j]);
}
}
fprintf(stderr, "\n");
#endif
// copy keys to the device
HANDLE_CLERROR( clEnqueueWriteBuffer(queue[ocl_gpu_id], data_info, CL_TRUE, 0,
sizeof(unsigned int) * 2, datai, 0, NULL, NULL),
"failed in clEnqueueWriteBuffer data_info");
HANDLE_CLERROR(clEnqueueWriteBuffer(queue[ocl_gpu_id], buffer_keys, CL_TRUE, 0,
(PLAINTEXT_LENGTH + 1) * max_keys_per_crypt, saved_plain, 0, NULL, NULL),
"failed in clEnqueueWriteBuffer buffer_keys");
HANDLE_CLERROR(clEnqueueNDRangeKernel(queue[ocl_gpu_id], crypt_kernel, 1, NULL,
&global_work_size, &local_work_size, 0, NULL, &profilingEvent),
"failed in clEnqueueNDRangeKernel");
HANDLE_CLERROR(clFinish(queue[ocl_gpu_id]),"failed in clFinish");
// read back partial hashes
HANDLE_CLERROR(clEnqueueReadBuffer(queue[ocl_gpu_id], buffer_out, CL_TRUE, 0,
sizeof(cl_uint) * max_keys_per_crypt, partial_hashes, 0, NULL, NULL),
"failed in reading data back");
have_full_hashes = 0;
#ifdef DEBUGVERBOSE
p = (unsigned char *) partial_hashes;
for (i = 0; i < 2; i++) {
fprintf(stderr, "\n\npartial_hashes : ");
for (j = 0; j < 16; j++)
fprintf(stderr, "%02x ", p[i * 16 + j]);
}
fprintf(stderr, "\n");;
#endif
}
开发者ID:bensteinfeld,项目名称:john-the-ripper,代码行数:42,代码来源:opencl_rawmd4_fmt.c
示例7: init
static void init(struct fmt_main *_self)
{
char build_opts[128];
self = _self;
snprintf(build_opts, sizeof(build_opts),
"-DHASH_LOOPS=%u -DPLAINTEXT_LENGTH=%d -DMAX_SALT_SIZE=%d",
HASH_LOOPS, PLAINTEXT_LENGTH, MAX_SALT_SIZE);
opencl_init("$JOHN/kernels/pbkdf2_hmac_sha512_kernel.cl",
gpu_id, build_opts);
crypt_kernel = clCreateKernel(program[gpu_id], KERNEL_NAME, &cl_error);
HANDLE_CLERROR(cl_error, "Error creating kernel");
split_kernel =
clCreateKernel(program[gpu_id], SPLIT_KERNEL_NAME, &cl_error);
HANDLE_CLERROR(cl_error, "Error creating split kernel");
}
开发者ID:Allen-smith,项目名称:ctf-tools,代码行数:20,代码来源:opencl_pbkdf2_hmac_sha512_fmt_plug.c
示例8: set_salt
static void set_salt(void *salt)
{
cur_salt = (struct custom_salt *)salt;
memcpy((char*)currentsalt.salt, cur_salt->salt, cur_salt->SaltSize);
currentsalt.length = cur_salt->SaltSize;
currentsalt.iterations = cur_salt->NumCyclesPower;
HANDLE_CLERROR(clEnqueueWriteBuffer(queue[gpu_id], mem_salt,
CL_FALSE, 0, saltsize, ¤tsalt, 0, NULL, NULL),
"Transfer salt to gpu");
}
开发者ID:Allen-smith,项目名称:ctf-tools,代码行数:11,代码来源:opencl_7z_fmt_plug.c
示例9: set_salt
static void set_salt(void *salt)
{
salt_struct = (struct custom_salt *)salt;
memcpy((char*)currentsalt.salt, salt_struct->salt, 20);
currentsalt.length = 20;
currentsalt.iterations = 1000;
currentsalt.outlen = 24;
HANDLE_CLERROR(clEnqueueWriteBuffer(queue[gpu_id], mem_setting,
CL_FALSE, 0, settingsize, ¤tsalt, 0, NULL, NULL),
"Copy salt to gpu");
}
开发者ID:Allen-smith,项目名称:ctf-tools,代码行数:11,代码来源:opencl_keychain_fmt_plug.c
示例10: set_salt
static void set_salt(void *salt)
{
cur_salt = (struct custom_salt *)salt;
memcpy((char*)currentsalt.salt, cur_salt->salt, cur_salt->saltlen[0]);
currentsalt.length = cur_salt->saltlen[0];
currentsalt.iterations = cur_salt->iterations[0];
currentsalt.outlen = 16;
HANDLE_CLERROR(clEnqueueWriteBuffer(queue[gpu_id], mem_setting,
CL_FALSE, 0, settingsize, ¤tsalt, 0, NULL, NULL),
"Copy salt to gpu");
}
开发者ID:Allen-smith,项目名称:ctf-tools,代码行数:11,代码来源:opencl_agilekeychain_fmt_plug.c
示例11: create_clobj
static void create_clobj(size_t global_work_size, struct fmt_main *self)
{
cl_int cl_error;
inbuffer = (sevenzip_password*) mem_calloc(1, insize);
outbuffer = (sevenzip_hash*) mem_alloc(outsize);
cracked = mem_calloc(1, cracked_size);
// Allocate memory
mem_in =
clCreateBuffer(context[gpu_id], CL_MEM_READ_ONLY, insize, NULL,
&cl_error);
HANDLE_CLERROR(cl_error, "Error allocating mem in");
mem_salt =
clCreateBuffer(context[gpu_id], CL_MEM_READ_ONLY, saltsize,
NULL, &cl_error);
HANDLE_CLERROR(cl_error, "Error allocating mem salt");
mem_state =
clCreateBuffer(context[gpu_id], CL_MEM_READ_WRITE, statesize,
NULL, &cl_error);
HANDLE_CLERROR(cl_error, "Error allocating mem state");
mem_out =
clCreateBuffer(context[gpu_id], CL_MEM_WRITE_ONLY, outsize, NULL,
&cl_error);
HANDLE_CLERROR(cl_error, "Error allocating mem out");
HANDLE_CLERROR(clSetKernelArg(sevenzip_init, 0, sizeof(mem_in),
&mem_in), "Error while setting mem_in kernel argument");
HANDLE_CLERROR(clSetKernelArg(sevenzip_init, 1, sizeof(mem_salt),
&mem_salt), "Error while setting mem_salt kernel argument");
HANDLE_CLERROR(clSetKernelArg(sevenzip_init, 2, sizeof(mem_state),
&mem_state), "Error while setting mem_state kernel argument");
HANDLE_CLERROR(clSetKernelArg(crypt_kernel, 0, sizeof(mem_state),
&mem_state), "Error while setting mem_state kernel argument");
HANDLE_CLERROR(clSetKernelArg(crypt_kernel, 1, sizeof(mem_salt),
&mem_salt), "Error while setting mem_salt kernel argument");
HANDLE_CLERROR(clSetKernelArg(crypt_kernel, 2, sizeof(mem_out),
&mem_out), "Error while setting mem_out kernel argument");
}
开发者ID:Allen-smith,项目名称:ctf-tools,代码行数:41,代码来源:opencl_7z_fmt_plug.c
示例12: init
static void init(struct fmt_main *self)
{
char build_opts[64];
if (pers_opts.target_enc == UTF_8) {
max_len = self->params.plaintext_length = 3 * PLAINTEXT_LENGTH;
tests[1].plaintext = "\xC3\xBC"; // German u-umlaut in UTF-8
tests[1].ciphertext = "$mskrb5$$$958db4ddb514a6cc8be1b1ccf82b0191$090408357a6f41852d17f3b4bb4634adfd388db1be64d3fe1a1d75ee4338d2a4aea387e5";
tests[2].plaintext = "\xC3\x9C\xC3\x9C"; // 2x uppercase of them
tests[2].ciphertext = "$mskrb5$$$057cd5cb706b3de18e059912b1f057e3$fe2e561bd4e42767e972835ea99f08582ba526e62a6a2b6f61364e30aca7c6631929d427";
} else {
if (CP_to_Unicode[0xfc] == 0x00fc) {
tests[1].plaintext = "\xFC"; // German u-umlaut in many ISO-8859-x
tests[1].ciphertext = "$mskrb5$$$958db4ddb514a6cc8be1b1ccf82b0191$090408357a6f41852d17f3b4bb4634adfd388db1be64d3fe1a1d75ee4338d2a4aea387e5";
}
if (CP_to_Unicode[0xdc] == 0x00dc) {
tests[2].plaintext = "\xDC\xDC"; // 2x uppercase of them
tests[2].ciphertext = "$mskrb5$$$057cd5cb706b3de18e059912b1f057e3$fe2e561bd4e42767e972835ea99f08582ba526e62a6a2b6f61364e30aca7c6631929d427";
}
}
snprintf(build_opts, sizeof(build_opts),
"-D%s -DPLAINTEXT_LENGTH=%u",
cp_id2macro(pers_opts.target_enc), PLAINTEXT_LENGTH);
opencl_init("$JOHN/kernels/krb5pa-md5_kernel.cl", gpu_id, build_opts);
/* create kernels to execute */
krb5pa_md5_nthash = clCreateKernel(program[gpu_id], "krb5pa_md5_nthash", &ret_code);
HANDLE_CLERROR(ret_code, "Error creating kernel. Double-check kernel name?");
crypt_kernel = clCreateKernel(program[gpu_id], "krb5pa_md5_final", &ret_code);
HANDLE_CLERROR(ret_code, "Error creating kernel. Double-check kernel name?");
//Initialize openCL tuning (library) for this format.
opencl_init_auto_setup(SEED, 0, NULL,
warn, 2, self, create_clobj, release_clobj,
PLAINTEXT_LENGTH, 0);
//Auto tune execution from shared/included code.
autotune_run(self, 1, 0, 200);
}
开发者ID:mimaun,项目名称:Rose,代码行数:41,代码来源:opencl_krb5pa-md5_fmt_plug.c
示例13: set_salt
static void set_salt(void *salt)
{
cur_salt = (sxc_cpu_salt*)salt;
memcpy((char*)currentsalt.salt, cur_salt->salt, cur_salt->salt_length);
currentsalt.length = cur_salt->salt_length;
currentsalt.iterations = cur_salt->iterations;
currentsalt.outlen = cur_salt->key_size;
HANDLE_CLERROR(clEnqueueWriteBuffer(queue[gpu_id], mem_setting,
CL_FALSE, 0, settingsize, ¤tsalt, 0, NULL, NULL),
"Copy salt to gpu");
}
开发者ID:truongkma,项目名称:ctf-tools,代码行数:12,代码来源:opencl_sxc_fmt_plug.c
示例14: cmp_all
static int cmp_all(void *binary, int count)
{
uint32_t result;
///Copy binary to GPU memory
HANDLE_CLERROR(clEnqueueWriteBuffer(queue[ocl_gpu_id], mem_binary, CL_FALSE,
0, sizeof(uint64_t), ((uint64_t*)binary)+3, 0, NULL, NULL), "Copy mem_binary");
///Run kernel
HANDLE_CLERROR(clEnqueueNDRangeKernel
(queue[ocl_gpu_id], cmp_kernel, 1, NULL, &global_work_size, &local_work_size,
0, NULL, NULL), "Set ND range");
/// Copy result out
HANDLE_CLERROR(clEnqueueReadBuffer(queue[ocl_gpu_id], mem_cmp, CL_FALSE, 0,
sizeof(uint32_t), &result, 0, NULL, NULL), "Copy data back");
///Await completion of all the above
HANDLE_CLERROR(clFinish(queue[ocl_gpu_id]), "clFinish error");
return result;
}
开发者ID:balidani,项目名称:JohnTheRipper,代码行数:21,代码来源:opencl_rawsha512_fmt.c
示例15: crypt_all
static void crypt_all(int count)
{
///Copy data to GPU memory
HANDLE_CLERROR(clEnqueueWriteBuffer
(queue[gpu_id], mem_in, CL_FALSE, 0, insize, inbuffer, 0, NULL,
NULL), "Copy memin");
HANDLE_CLERROR(clEnqueueWriteBuffer(queue[gpu_id], mem_salt, CL_FALSE,
0, saltsize, &host_salt, 0, NULL, NULL), "Copy memsalt");
///Run kernel
size_t worksize = KEYS_PER_CRYPT;
size_t localworksize = local_work_size;
HANDLE_CLERROR(clEnqueueNDRangeKernel
(queue[gpu_id], crypt_kernel, 1, NULL, &worksize, &localworksize,
0, NULL, NULL), "Set ND range");
HANDLE_CLERROR(clEnqueueReadBuffer(queue[gpu_id], mem_out, CL_FALSE, 0,
outsize, outbuffer, 0, NULL, NULL), "Copy data back");
///Await completion of all the above
HANDLE_CLERROR(clFinish(queue[gpu_id]), "clFinish error");
}
开发者ID:samueletonon,项目名称:samu,代码行数:21,代码来源:cryptmd5_opencl_fmt.c
示例16: set_salt
static void set_salt(void *salt)
{
cur_salt = (zip_cpu_salt*)salt;
memcpy((char*)currentsalt.salt, cur_salt->salt, cur_salt->length);
currentsalt.length = cur_salt->length;
currentsalt.iterations = KEYING_ITERATIONS;
currentsalt.outlen = 2 * KEY_LENGTH(cur_salt->mode) + PWD_VER_LENGTH;
HANDLE_CLERROR(clEnqueueWriteBuffer(queue[ocl_gpu_id], mem_setting,
CL_FALSE, 0, settingsize, ¤tsalt, 0, NULL, NULL),
"Copy setting to gpu");
}
开发者ID:balidani,项目名称:JohnTheRipper,代码行数:12,代码来源:opencl_zip_fmt.c
示例17: crypt_all
static int crypt_all(int *pcount, struct db_salt *salt)
{
int count = *pcount;
opencl_limit_gws(count);
#ifdef DEBUG
printf("crypt_all(%d)\n", count);
printf("LWS = %d, GWS = %d\n",(int)local_work_size, (int)global_work_size);
#endif
/// Copy data to gpu
HANDLE_CLERROR(clEnqueueWriteBuffer(queue[ocl_gpu_id], mem_in, CL_FALSE, 0,
global_work_size * sizeof(pass_t), host_pass, 0, NUUL, NULL), "Copy data to gpu");
HANDLE_CLERROR(clEnqueueWriteBuffer(queue[ocl_gpu_id], mem_salt,
CL_FALSE, 0, sizeof(salt_t), host_salt, 0, NUUL, NULL),
"Copy salt to gpu");
/// Run kernel
HANDLE_CLERROR(clEnqueueNDRangeKernel(queue[ocl_gpu_id], crypt_kernel, 1,
NUUL, &global_work_size, &local_work_size, 0, NULL,
profilingEvent), "Run kernel");
HANDLE_CLERROR(clFinish(queue[ocl_gpu_id]), "clFinish");
/// Read the result back
HANDLE_CLERROR(clEnqueueReadBuffer(queue[ocl_gpu_id], mem_out, CL_FALSE, 0,
global_work_size * sizeof(crack_t), host_crack, 0, NUUL, NULL), "Copy result back");
/// Await completion of all the above
HANDLE_CLERROR(clFinish(queue[ocl_gpu_id]), "clFinish");
return count;
}
开发者ID:ukasz,项目名称:graveyard,代码行数:33,代码来源:opencl_pbkdf2_hmac_sha512_fmt.c
示例18: crypt_all
static void crypt_all(int count)
{
int index;
size_t scalar_gws = VF * global_work_size;
if (new_keys) {
HANDLE_CLERROR(clEnqueueWriteBuffer(queue[ocl_gpu_id], cl_saved_key, CL_FALSE, 0, UNICODE_LENGTH * VF * global_work_size, saved_key, 0, NULL, NULL), "failed in clEnqueueWriteBuffer saved_key");
HANDLE_CLERROR(clEnqueueWriteBuffer(queue[ocl_gpu_id], cl_saved_len, CL_FALSE, 0, sizeof(int) * VF * global_work_size, saved_len, 0, NULL, NULL), "failed in clEnqueueWriteBuffer saved_len");
new_keys = 0;
}
HANDLE_CLERROR(clEnqueueNDRangeKernel(queue[ocl_gpu_id], GenerateSHA1pwhash, 1, NULL, &scalar_gws, &local_work_size, 0, NULL, firstEvent), "failed in clEnqueueNDRangeKernel");
for (index = 0; index < 50000 / HASH_LOOPS; index++)
HANDLE_CLERROR(clEnqueueNDRangeKernel(queue[ocl_gpu_id], crypt_kernel, 1, NULL, &global_work_size, &local_work_size, 0, NULL, NULL), "failed in clEnqueueNDRangeKernel");
HANDLE_CLERROR(clEnqueueNDRangeKernel(queue[ocl_gpu_id], Generate2007key, 1, NULL, &global_work_size, &local_work_size, 0, NULL, lastEvent), "failed in clEnqueueNDRangeKernel");
// read back aes key
HANDLE_CLERROR(clEnqueueReadBuffer(queue[ocl_gpu_id], cl_key, CL_TRUE, 0, 16 * VF * global_work_size, key, 0, NULL, NULL), "failed in reading key back");
#ifdef _OPENMP
#pragma omp parallel for
#endif
for (index = 0; index < count; index++)
cracked[index] = PasswordVerifier(&key[index*16]);
}
开发者ID:bhargavz,项目名称:pac4mac,代码行数:27,代码来源:opencl_office2007_fmt.c
示例19: create_clobj
static void create_clobj(size_t kpc, struct fmt_main *self)
{
kpc *= 8;
insize = sizeof(phpass_password) * kpc;
outsize = sizeof(phpass_hash) * kpc;
settingsize = sizeof(uint8_t) * ACTUAL_SALT_SIZE + 4;
inbuffer = mem_calloc(1, insize);
outbuffer = mem_alloc(outsize);
// Allocate memory
mem_in =
clCreateBuffer(context[gpu_id], CL_MEM_READ_ONLY, insize, NULL,
&cl_error);
HANDLE_CLERROR(cl_error, "Error allocating mem in");
mem_setting =
clCreateBuffer(context[gpu_id], CL_MEM_READ_ONLY, settingsize,
NULL, &cl_error);
HANDLE_CLERROR(cl_error, "Error allocating mem setting");
mem_out =
clCreateBuffer(context[gpu_id], CL_MEM_WRITE_ONLY, outsize, NULL,
&cl_error);
HANDLE_CLERROR(cl_error, "Error allocating mem out");
HANDLE_CLERROR(clSetKernelArg(crypt_kernel, 0, sizeof(mem_in),
&mem_in), "Error while setting mem_in kernel argument");
HANDLE_CLERROR(clSetKernelArg(crypt_kernel, 1, sizeof(mem_out),
&mem_out), "Error while setting mem_out kernel argument");
HANDLE_CLERROR(clSetKernelArg(crypt_kernel, 2, sizeof(mem_setting),
&mem_setting), "Error while setting mem_salt kernel argument");
}
开发者ID:Allen-smith,项目名称:ctf-tools,代码行数:32,代码来源:opencl_phpass_fmt_plug.c
示例20: crypt_all
static int crypt_all(int *pcount, struct db_salt *salt)
{
const int count = *pcount;
int i;
size_t scalar_gws;
global_work_size = ((count + (v_width * local_work_size - 1)) / (v_width * local_work_size)) * local_work_size;
scalar_gws = global_work_size * v_width;
#if 0
fprintf(stderr, "%s(%d) lws "Zu" gws "Zu" sgws "Zu"\n", __FUNCTION__,
count, local_work_size, global_work_size, scalar_gws);
#endif
/// Copy data to gpu
if (new_keys) {
HANDLE_CLERROR(clEnqueueWriteBuffer(queue[gpu_id], mem_in, CL_FALSE, 0, key_buf_size, inbuffer, 0, NULL, NULL), "Copy data to gpu");
new_keys = 0;
}
/// Run kernels
HANDLE_CLERROR(clEnqueueNDRangeKernel(queue[gpu_id], pbkdf1_init, 1, NULL, &global_work_size, &local_work_size, 0, NULL, firstEvent), "Run initial kernel");
for (i = 0; i < LOOP_COUNT; i++) {
HANDLE_CLERROR(clEnqueueNDRangeKernel(queue[gpu_id], pbkdf1_loop, 1, NULL, &global_work_size, &local_work_size, 0, NULL, NULL), "Run loop kernel");
HANDLE_CLERROR(clFinish(queue[gpu_id]), "Error running loop kernel");
opencl_process_event();
}
HANDLE_CLERROR(clEnqueueNDRangeKernel(queue[gpu_id], pbkdf1_final, 1, NULL, &global_work_size, &local_work_size, 0, NULL, NULL), "Run intermediate kernel");
/// Read the result back
HANDLE_CLERROR(clEnqueueReadBuffer(queue[gpu_id], mem_out, CL_TRUE, 0, sizeof(pbkdf1_out) * scalar_gws, host_crack, 0, NULL, NULL), "Copy result back");
return count;
}
开发者ID:truongkma,项目名称:ctf-tools,代码行数:34,代码来源:opencl_sha1crypt_fmt_plug.c
注:本文中的HANDLE_CLERROR函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论