1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-29 19:38:18 +00:00

Replace #pragma once with #ifndef #define #endif logic because #pragma once does not work cleanly on OSX

This commit is contained in:
jsteube 2016-09-06 18:44:05 +02:00
parent c3fe5b40b1
commit e4bf86dcbe
31 changed files with 123 additions and 32 deletions

View File

@ -3,7 +3,8 @@
* License.....: MIT * License.....: MIT
*/ */
#pragma once #ifndef _BITOPS_H
#define _BITOPS_H
u32 is_power_of_2 (const u32 v); u32 is_power_of_2 (const u32 v);
@ -14,3 +15,5 @@ u64 rotr64 (const u64 a, const u64 n);
u32 byte_swap_32 (const u32 n); u32 byte_swap_32 (const u32 n);
u64 byte_swap_64 (const u64 n); u64 byte_swap_64 (const u64 n);
#endif // _BITOPS_H

View File

@ -5,7 +5,8 @@
* License.....: MIT * License.....: MIT
*/ */
#pragma once #ifndef _COMMON_H
#define _COMMON_H
#define _POSIX_SOURCE #define _POSIX_SOURCE
#define _GNU_SOURCE #define _GNU_SOURCE
@ -21,7 +22,6 @@
#define BLOCK_SIZE 64 #define BLOCK_SIZE 64
#define EXPECTED_ITERATIONS 10000 #define EXPECTED_ITERATIONS 10000
#define MIN(a,b) (((a) < (b)) ? (a) : (b)) #define MIN(a,b) (((a) < (b)) ? (a) : (b))
@ -38,3 +38,5 @@
#ifdef _WIN #ifdef _WIN
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#endif #endif
#endif // _COMMON_H

View File

@ -3,7 +3,8 @@
* License.....: MIT * License.....: MIT
*/ */
#pragma once #ifndef _CONVERT_H
#define _CONVERT_H
#include <ctype.h> #include <ctype.h>
@ -41,3 +42,5 @@ int base64_encode (u8 (*f) (const u8), const u8 *in_buf, int in_len, u8 *out_buf
void lowercase (u8 *buf, int len); void lowercase (u8 *buf, int len);
void uppercase (u8 *buf, int len); void uppercase (u8 *buf, int len);
#endif // _CONVERT_H

View File

@ -3,7 +3,8 @@
* License.....: MIT * License.....: MIT
*/ */
#pragma once #ifndef _CPU_AES_H
#define _CPU_AES_H
/* AES context. */ /* AES context. */
typedef struct aes_context typedef struct aes_context
@ -24,3 +25,5 @@ void AES_encrypt (AES_KEY *aes_key, const u8 *input, u8 *output);
void AES_decrypt (AES_KEY *aes_key, const u8 *input, u8 *output); void AES_decrypt (AES_KEY *aes_key, const u8 *input, u8 *output);
void AES128_decrypt_cbc (const u32 key[4], const u32 iv[4], const u32 in[16], u32 out[16]); void AES128_decrypt_cbc (const u32 key[4], const u32 iv[4], const u32 in[16], u32 out[16]);
#endif // _CPU_AES_H

View File

@ -3,10 +3,12 @@
* License.....: MIT * License.....: MIT
*/ */
#pragma once #ifndef _CPU_CRC32_H
#define _CPU_CRC32_H
#include <stdio.h> #include <stdio.h>
#include <errno.h> #include <errno.h>
void cpu_crc32 (const char *filename, u8 keytab[64]); void cpu_crc32 (const char *filename, u8 keytab[64]);
#endif // _CPU_CRC32_H

View File

@ -3,7 +3,8 @@
* License.....: MIT * License.....: MIT
*/ */
#pragma once #ifndef _CPU_DES_H
#define _CPU_DES_H
#define PERM_OP(a,b,tt,n,m) \ #define PERM_OP(a,b,tt,n,m) \
{ \ { \
@ -45,3 +46,5 @@
void _des_keysetup (u32 data[2], u32 Kc[16], u32 Kd[16]); void _des_keysetup (u32 data[2], u32 Kc[16], u32 Kd[16]);
void _des_encrypt (u32 data[2], u32 Kc[16], u32 Kd[16]); void _des_encrypt (u32 data[2], u32 Kc[16], u32 Kd[16]);
#endif // _CPU_DES_H

View File

@ -3,9 +3,12 @@
* License.....: MIT * License.....: MIT
*/ */
#pragma once #ifndef _CPU_MD5_H
#define _CPU_MD5_H
#include <string.h> #include <string.h>
void md5_64 (uint block[16], uint digest[4]); void md5_64 (uint block[16], uint digest[4]);
void md5_complete_no_limit (uint digest[4], uint *plain, uint plain_len); void md5_complete_no_limit (uint digest[4], uint *plain, uint plain_len);
#endif // _CPU_MD5_H

View File

@ -3,6 +3,9 @@
* License.....: MIT * License.....: MIT
*/ */
#pragma once #ifndef _CPU_SHA1_H
#define _CPU_SHA1_H
void sha1_64 (uint block[16], uint digest[5]); void sha1_64 (uint block[16], uint digest[5]);
#endif // _CPU_SHA1_H

View File

@ -3,6 +3,9 @@
* License.....: MIT * License.....: MIT
*/ */
#pragma once #ifndef _CPU_SHA256_H
#define _CPU_SHA256_H
void sha256_64 (uint block[16], uint digest[8]); void sha256_64 (uint block[16], uint digest[8]);
#endif // _CPU_SHA256_H

View File

@ -3,7 +3,8 @@
* License.....: MIT * License.....: MIT
*/ */
#pragma once #ifndef _DATA_H
#define _DATA_H
typedef struct typedef struct
{ {
@ -252,3 +253,5 @@ typedef struct
int (*parse_func) (char *, uint, hash_t *); int (*parse_func) (char *, uint, hash_t *);
} hc_global_data_t; } hc_global_data_t;
#endif // _DATA_H

View File

@ -3,7 +3,8 @@
* License.....: MIT * License.....: MIT
*/ */
#pragma once #ifndef _DYNLOADER_H
#define _DYNLOADER_H
#include <stdlib.h> #include <stdlib.h>
@ -67,3 +68,5 @@
return -1; \ return -1; \
} \ } \
} }
#endif // _DYNALOADER_H

View File

@ -6,7 +6,8 @@
* License.....: MIT * License.....: MIT
*/ */
#pragma once #ifndef _EXT_ADL_H
#define _EXT_ADL_H
#include <string.h> #include <string.h>
@ -389,3 +390,5 @@ int hm_ADL_Overdrive6_PowerControl_Caps (ADL_PTR *adl, int iAdapterIndex, int *l
int hm_ADL_Overdrive6_TargetTemperatureData_Get (ADL_PTR *adl, int iAdapterIndex, int *cur_temp, int *default_temp); int hm_ADL_Overdrive6_TargetTemperatureData_Get (ADL_PTR *adl, int iAdapterIndex, int *cur_temp, int *default_temp);
int hm_ADL_Overdrive6_TargetTemperatureRangeInfo_Get (ADL_PTR *adl, int iAdapterIndex, ADLOD6ParameterRange *lpTargetTemperatureInfo); int hm_ADL_Overdrive6_TargetTemperatureRangeInfo_Get (ADL_PTR *adl, int iAdapterIndex, ADLOD6ParameterRange *lpTargetTemperatureInfo);
int hm_ADL_Overdrive6_FanSpeed_Reset (ADL_PTR *adl, int iAdapterIndex); int hm_ADL_Overdrive6_FanSpeed_Reset (ADL_PTR *adl, int iAdapterIndex);
#endif // _EXT_ADL_H

View File

@ -5,7 +5,8 @@
* License.....: MIT * License.....: MIT
*/ */
#pragma once #ifndef _EXT_OPENCL_H
#define _EXT_OPENCL_H
#define CL_PLATFORMS_MAX 16 #define CL_PLATFORMS_MAX 16
@ -168,3 +169,5 @@ cl_int hc_clReleaseMemObject (OCL_PTR *ocl, cl_mem mem);
cl_int hc_clReleaseProgram (OCL_PTR *ocl, cl_program program); cl_int hc_clReleaseProgram (OCL_PTR *ocl, cl_program program);
cl_int hc_clSetKernelArg (OCL_PTR *ocl, cl_kernel kernel, cl_uint arg_index, size_t arg_size, const void *arg_value); cl_int hc_clSetKernelArg (OCL_PTR *ocl, cl_kernel kernel, cl_uint arg_index, size_t arg_size, const void *arg_value);
cl_int hc_clWaitForEvents (OCL_PTR *ocl, cl_uint num_events, const cl_event *event_list); cl_int hc_clWaitForEvents (OCL_PTR *ocl, cl_uint num_events, const cl_event *event_list);
#endif // _EXT_OPENCL_H

View File

@ -5,7 +5,8 @@
* License.....: MIT * License.....: MIT
*/ */
#pragma once #ifndef _EXT_NVAPI_H
#define _EXT_NVAPI_H
/** /**
* Declarations from nvapi.h and subheaders * Declarations from nvapi.h and subheaders
@ -268,3 +269,5 @@ int hm_NvAPI_GPU_GetPerfPoliciesInfo (NVAPI_PTR *nvapi, NvPhysicalGpuHandle hPhy
int hm_NvAPI_GPU_GetPerfPoliciesStatus (NVAPI_PTR *nvapi, NvPhysicalGpuHandle hPhysicalGpu, NV_GPU_PERF_POLICIES_STATUS_PARAMS_V1 *perfPolicies_status); int hm_NvAPI_GPU_GetPerfPoliciesStatus (NVAPI_PTR *nvapi, NvPhysicalGpuHandle hPhysicalGpu, NV_GPU_PERF_POLICIES_STATUS_PARAMS_V1 *perfPolicies_status);
int hm_NvAPI_GPU_SetCoolerLevels (NVAPI_PTR *nvapi, NvPhysicalGpuHandle hPhysicalGpu, NvU32 coolerIndex, NV_GPU_COOLER_LEVELS *pCoolerLevels); int hm_NvAPI_GPU_SetCoolerLevels (NVAPI_PTR *nvapi, NvPhysicalGpuHandle hPhysicalGpu, NvU32 coolerIndex, NV_GPU_COOLER_LEVELS *pCoolerLevels);
int hm_NvAPI_GPU_RestoreCoolerSettings (NVAPI_PTR *nvapi, NvPhysicalGpuHandle hPhysicalGpu, NvU32 coolerIndex); int hm_NvAPI_GPU_RestoreCoolerSettings (NVAPI_PTR *nvapi, NvPhysicalGpuHandle hPhysicalGpu, NvU32 coolerIndex);
#endif // _EXT_NVAPI_H

View File

@ -6,7 +6,8 @@
* License.....: MIT * License.....: MIT
*/ */
#pragma once #ifndef _NVML_H
#define _NVML_H
/** /**
* Declarations from nvml.h * Declarations from nvml.h
@ -246,3 +247,5 @@ nvmlReturn_t hm_NVML_nvmlDeviceSetGpuOperationMode (NVML_PTR *nvml, int, nvmlDev
nvmlReturn_t hm_NVML_nvmlDeviceGetPowerManagementLimitConstraints (NVML_PTR *nvml, int, nvmlDevice_t device, unsigned int *minLimit, unsigned int *maxLimit); nvmlReturn_t hm_NVML_nvmlDeviceGetPowerManagementLimitConstraints (NVML_PTR *nvml, int, nvmlDevice_t device, unsigned int *minLimit, unsigned int *maxLimit);
nvmlReturn_t hm_NVML_nvmlDeviceSetPowerManagementLimit (NVML_PTR *nvml, int skip_warnings, nvmlDevice_t device, unsigned int limit); nvmlReturn_t hm_NVML_nvmlDeviceSetPowerManagementLimit (NVML_PTR *nvml, int skip_warnings, nvmlDevice_t device, unsigned int limit);
nvmlReturn_t hm_NVML_nvmlDeviceGetPowerManagementLimit (NVML_PTR *nvml, int skip_warnings, nvmlDevice_t device, unsigned int *limit); nvmlReturn_t hm_NVML_nvmlDeviceGetPowerManagementLimit (NVML_PTR *nvml, int skip_warnings, nvmlDevice_t device, unsigned int *limit);
#endif // _NVML_H

View File

@ -3,7 +3,8 @@
* License.....: MIT * License.....: MIT
*/ */
#pragma once #ifndef _EXT_XNVCTRL_H
#define _EXT_XNVCTRL_H
/** /**
* Stuff from X11/Xlib.h * Stuff from X11/Xlib.h
@ -85,3 +86,5 @@ int set_fan_control (XNVCTRL_PTR *xnvctrl, int gpu, int val);
int get_fan_speed_current (XNVCTRL_PTR *xnvctrl, int gpu, int *val); int get_fan_speed_current (XNVCTRL_PTR *xnvctrl, int gpu, int *val);
int get_fan_speed_target (XNVCTRL_PTR *xnvctrl, int gpu, int *val); int get_fan_speed_target (XNVCTRL_PTR *xnvctrl, int gpu, int *val);
int set_fan_speed_target (XNVCTRL_PTR *xnvctrl, int gpu, int val); int set_fan_speed_target (XNVCTRL_PTR *xnvctrl, int gpu, int val);
#endif // _EXT_XNVCTRL_H

View File

@ -3,7 +3,8 @@
* License.....: MIT * License.....: MIT
*/ */
#pragma once #ifndef _HWMON_H
#define _HWMON_H
typedef struct typedef struct
{ {
@ -52,3 +53,5 @@ int hm_set_fanspeed_with_device_id_nvapi (const uint device_id, const int fa
int hm_set_fanspeed_with_device_id_xnvctrl (const uint device_id, const int fanspeed); int hm_set_fanspeed_with_device_id_xnvctrl (const uint device_id, const int fanspeed);
void hm_device_val_to_str (char *target_buf, int max_buf_size, char *suffix, int value); void hm_device_val_to_str (char *target_buf, int max_buf_size, char *suffix, int value);
#endif // _HWMON_H

View File

@ -3,7 +3,8 @@
* License.....: MIT * License.....: MIT
*/ */
#pragma once #ifndef _INTERFACE_H
#define _INTERFACE_H
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@ -1528,3 +1529,5 @@ void to_hccap_t (hccap_t *hccap, uint salt_pos, uint digest_pos);
void truecrypt_crc32 (const char *filename, u8 keytab[64]); void truecrypt_crc32 (const char *filename, u8 keytab[64]);
void ascii_digest (char *out_buf, uint salt_pos, uint digest_pos); void ascii_digest (char *out_buf, uint salt_pos, uint digest_pos);
#endif // _INTERFACE_H

View File

@ -3,7 +3,8 @@
* License.....: MIT * License.....: MIT
*/ */
#pragma once #ifndef _LOGFILE_H
#define _LOGFILE_H
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -14,3 +15,5 @@ char *logfile_generate_topid (void);
char *logfile_generate_subid (void); char *logfile_generate_subid (void);
void logfile_append (const char *fmt, ...); void logfile_append (const char *fmt, ...);
#endif // _LOGFILE_H

View File

@ -3,7 +3,8 @@
* License.....: MIT * License.....: MIT
*/ */
#pragma once #ifndef _LOGGING_H
#define _LOGGING_H
#include <stdio.h> #include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
@ -15,3 +16,5 @@ int log_error_nn (const char *fmt, ...);
int log_out (FILE *fp, const char *fmt, ...); int log_out (FILE *fp, const char *fmt, ...);
int log_info (const char *fmt, ...); int log_info (const char *fmt, ...);
int log_error (const char *fmt, ...); int log_error (const char *fmt, ...);
#endif // _LOGGING_H

View File

@ -3,7 +3,8 @@
* License.....: MIT * License.....: MIT
*/ */
#pragma once #ifndef _MEMORY_H
#define _MEMORY_H
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
@ -15,3 +16,5 @@ void myfree (void *ptr);
void *mymalloc (size_t size); void *mymalloc (size_t size);
void *myrealloc (void *ptr, size_t oldsz, size_t add); void *myrealloc (void *ptr, size_t oldsz, size_t add);
char *mystrdup (const char *s); char *mystrdup (const char *s);
#endif // _MEMORY_H

View File

@ -3,7 +3,8 @@
* License.....: MIT * License.....: MIT
*/ */
#pragma once #ifndef _MPSP_H
#define _MPSP_H
#include <stdio.h> #include <stdio.h>
#include <errno.h> #include <errno.h>
@ -48,3 +49,5 @@ void sp_setup_tbl (const char *install_dir, char *hcstat, uint disable, uint cla
void sp_tbl_to_css (hcstat_table_t *root_table_buf, hcstat_table_t *markov_table_buf, cs_t *root_css_buf, cs_t *markov_css_buf, uint threshold, uint uniq_tbls[SP_PW_MAX][CHARSIZ]); void sp_tbl_to_css (hcstat_table_t *root_table_buf, hcstat_table_t *markov_table_buf, cs_t *root_css_buf, cs_t *markov_css_buf, uint threshold, uint uniq_tbls[SP_PW_MAX][CHARSIZ]);
void sp_stretch_markov (hcstat_table_t *in, hcstat_table_t *out); void sp_stretch_markov (hcstat_table_t *in, hcstat_table_t *out);
void sp_stretch_root (hcstat_table_t *in, hcstat_table_t *out); void sp_stretch_root (hcstat_table_t *in, hcstat_table_t *out);
#endif // _MPSP_H

View File

@ -3,7 +3,8 @@
* License.....: MIT * License.....: MIT
*/ */
#pragma once #ifndef _RP_CPU_H
#define _RP_CPU_H
#include <string.h> #include <string.h>
@ -91,3 +92,5 @@ int kernel_rule_to_cpu_rule (char *rule_buf, kernel_rule_t *rule);
int generate_random_rule (char rule_buf[RP_RULE_BUFSIZ], u32 rp_gen_func_min, u32 rp_gen_func_max); int generate_random_rule (char rule_buf[RP_RULE_BUFSIZ], u32 rp_gen_func_min, u32 rp_gen_func_max);
int _old_apply_rule (char *rule, int rule_len, char in[BLOCK_SIZE], int in_len, char out[BLOCK_SIZE]); int _old_apply_rule (char *rule, int rule_len, char in[BLOCK_SIZE], int in_len, char out[BLOCK_SIZE]);
#endif // _RP_CPU_H

View File

@ -3,9 +3,12 @@
* License.....: MIT * License.....: MIT
*/ */
#pragma once #ifndef _RP_KERNEL_ON_CPU_H
#define _RP_KERNEL_ON_CPU_H
#define swap_workaround(n) __builtin_bswap32(n) #define swap_workaround(n) __builtin_bswap32(n)
u32 apply_rule (const u32 name, const u32 p0, const u32 p1, u32 buf0[4], u32 buf1[4], const u32 in_len); u32 apply_rule (const u32 name, const u32 p0, const u32 p1, u32 buf0[4], u32 buf1[4], const u32 in_len);
u32 apply_rules (u32 *cmds, u32 buf0[4], u32 buf1[4], const u32 len); u32 apply_rules (u32 *cmds, u32 buf0[4], u32 buf1[4], const u32 len);
#endif // _RP_KERNEL_ON_CPU_H

View File

@ -6,7 +6,8 @@
* License.....: MIT * License.....: MIT
*/ */
#pragma once #ifndef _SHARED_H
#define _SHARED_H
#include <errno.h> #include <errno.h>
#include <dirent.h> #include <dirent.h>
@ -241,3 +242,5 @@ void *thread_runtime (void *p);
void status_display (void); void status_display (void);
void status_display_machine_readable (void); void status_display_machine_readable (void);
#endif // _SHARED_H

View File

@ -3,7 +3,8 @@
* License.....: MIT * License.....: MIT
*/ */
#pragma once #ifndef _TERMINAL_H
#define _TERMINAL_H
#include <stdio.h> #include <stdio.h>
#include <sys/time.h> #include <sys/time.h>
@ -21,3 +22,5 @@
int tty_break(); int tty_break();
int tty_getchar(); int tty_getchar();
int tty_fix(); int tty_fix();
#endif // _TERMINAL_H

View File

@ -3,7 +3,8 @@
* License.....: MIT * License.....: MIT
*/ */
#pragma once #ifndef _THREAD_H
#define _THREAD_H
#ifdef _POSIX #ifdef _POSIX
#include <pthread.h> #include <pthread.h>
@ -44,3 +45,5 @@ typedef pthread_mutex_t hc_thread_mutex_t;
#define hc_thread_mutex_delete(m) pthread_mutex_destroy (&m) #define hc_thread_mutex_delete(m) pthread_mutex_destroy (&m)
#endif #endif
#endif // _THREAD_H

View File

@ -3,7 +3,8 @@
* License.....: MIT * License.....: MIT
*/ */
#pragma once #ifndef _TIMER_H
#define _TIMER_H
#ifdef _POSIX #ifdef _POSIX
#include <sys/time.h> #include <sys/time.h>
@ -27,3 +28,5 @@ typedef struct timeval hc_timer_t;
#define hc_timer_set(a) { gettimeofday ((a), NULL); } #define hc_timer_set(a) { gettimeofday ((a), NULL); }
#endif #endif
#endif // _TIMER_H

View File

@ -3,7 +3,8 @@
* License.....: MIT * License.....: MIT
*/ */
#pragma once #ifndef _TYPES_H
#define _TYPES_H
#include <stdio.h> #include <stdio.h>
#include <sys/types.h> #include <sys/types.h>
@ -544,3 +545,5 @@ struct __hc_device_param
}; };
typedef struct __hc_device_param hc_device_param_t; typedef struct __hc_device_param hc_device_param_t;
#endif // _TYPES_H

View File

@ -3,7 +3,8 @@
* License.....: MIT * License.....: MIT
*/ */
#pragma once #ifndef _TYPES_INT_H
#define _TYPES_INT_H
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
@ -29,3 +30,5 @@ typedef uint32_t u32;
typedef uint64_t u64; typedef uint64_t u64;
typedef uint32_t uint; // we need to get rid of this sooner or later, for consistency typedef uint32_t uint; // we need to get rid of this sooner or later, for consistency
#endif // _TYPES_INT_H

View File

@ -3,7 +3,10 @@
* License.....: MIT * License.....: MIT
*/ */
#pragma once #ifndef _USAGE_H
#define _USAGE_H
void usage_mini_print (const char *progname); void usage_mini_print (const char *progname);
void usage_big_print (const char *progname); void usage_big_print (const char *progname);
#endif // _USAGE_H