1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-22 08:08:10 +00:00

Allow using Metal < 300 with --force

This commit is contained in:
Gabriele Gristina 2022-12-08 17:37:50 +01:00
parent 8a81f6143a
commit 0f63294b8a
3 changed files with 16 additions and 18 deletions

View File

@ -12,7 +12,7 @@
#define IS_CUDA
#elif defined __HIPCC__
#define IS_HIP
#elif defined __METAL__
#elif defined __METAL__ || defined __METAL_MACOS__
#define IS_METAL
#else
#define IS_OPENCL

View File

@ -4505,18 +4505,23 @@ int backend_ctx_init (hashcat_ctx_t *hashcat_ctx)
if (hc_mtlRuntimeGetVersionString (hashcat_ctx, backend_ctx->metal_runtimeVersionStr, &version_len) == -1) return -1;
if (atoi (backend_ctx->metal_runtimeVersionStr) < 300)
backend_ctx->metal_runtimeVersion = atoi (backend_ctx->metal_runtimeVersionStr);
if (user_options->force == false)
{
event_log_warning (hashcat_ctx, "Unsupported Apple Metal runtime version '%s' detected! Falling back to OpenCL...", backend_ctx->metal_runtimeVersionStr);
event_log_warning (hashcat_ctx, NULL);
if (backend_ctx->metal_runtimeVersion < 300)
{
event_log_warning (hashcat_ctx, "Unsupported Apple Metal runtime version '%s' detected! Falling back to OpenCL...", backend_ctx->metal_runtimeVersionStr);
event_log_warning (hashcat_ctx, NULL);
rc_metal_init = -1;
rc_metal_init = -1;
backend_ctx->rc_metal_init = rc_metal_init;
backend_ctx->rc_metal_init = rc_metal_init;
backend_ctx->mtl = NULL;
backend_ctx->mtl = NULL;
mtl_close (hashcat_ctx);
mtl_close (hashcat_ctx);
}
}
}
else

View File

@ -1221,18 +1221,10 @@ void backend_info (hashcat_ctx_t *hashcat_ctx)
event_log_info (hashcat_ctx, NULL);
int metal_devices_cnt = backend_ctx->metal_devices_cnt;
int metal_runtimeVersion = backend_ctx->metal_runtimeVersion;
char *metal_runtimeVersionStr = backend_ctx->metal_runtimeVersionStr;
if (metal_runtimeVersionStr != NULL)
{
event_log_info (hashcat_ctx, "Metal.Version.: %s", metal_runtimeVersionStr);
}
else
{
event_log_info (hashcat_ctx, "Metal.Version.: %u", metal_runtimeVersion);
}
event_log_info (hashcat_ctx, "Metal.Version.: %s", metal_runtimeVersionStr);
event_log_info (hashcat_ctx, NULL);
for (int metal_devices_idx = 0; metal_devices_idx < metal_devices_cnt; metal_devices_idx++)
@ -1542,6 +1534,7 @@ void backend_info_compact (hashcat_ctx_t *hashcat_ctx)
if (backend_ctx->mtl)
{
int metal_devices_cnt = backend_ctx->metal_devices_cnt;
char *metal_runtimeVersionStr = backend_ctx->metal_runtimeVersionStr;
size_t len = event_log_info (hashcat_ctx, "METAL API (Metal %s)", metal_runtimeVersionStr);