1 /*
2  * This software is Copyright (c) 2015 Sayantan Datta <stdatta at openwall dot com>
3  * and it is hereby released to the general public under the following terms:
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted.
6  */
7 #ifdef HAVE_OPENCL
8 
9 #include "opencl_common.h"
10 
11 #define FORMAT_LABEL	           "mscash2-opencl"
12 
13 /*
14  * Acceptable Values : 2 , 4 , 8 ,16 , 32 , 64 , 128 ,256 , 512 , 1024 , 2048 , 5120 , 10240
15  */
16 #define ITERATION_COUNT_PER_CALL  	1024
17 #define MAX_SALT_LENGTH           	128
18 #define SALT_BUFFER_SIZE		((((MAX_SALT_LENGTH + 1) << 1) + sizeof(cl_uint)) / sizeof(cl_uint) * sizeof(cl_uint))
19 
20 /*
21  * Initialize host side buffer for all devices.
22  */
23 extern void initNumDevices(void);
24 
25 /*
26  * selectDevice(int jtrUniqDevNo,struct fmt_main *fmt)
27  * jtrUniqDevNo:Each device is assigned a unqiue number by john.
28  * Returns optimal global work size for selected device/
29  */
30 extern size_t selectDevice(int jtrUniqDevId, struct fmt_main *self);
31 
32 /*
33  * Release various host/device buffers.
34  */
35 extern void releaseAll(void);
36 
37 /*
38  *  Enque kernels and synchronize multiple devices.
39  */
40 extern void dcc2Execute(cl_uint *hostDccHashes, cl_uint *hostSha1Hashes, cl_uint *hostSalt, cl_uint saltlen, cl_uint iterCount, cl_uint *hostDcc2Hashes, cl_uint numKeys);
41 
42 #endif
43