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

Disable Metal < 200, commented unused and deprecated code

This commit is contained in:
Gabriele Gristina 2022-12-08 18:59:34 +01:00
parent 0f63294b8a
commit 15d74b7c1c
4 changed files with 39 additions and 16 deletions

View File

@ -1640,8 +1640,8 @@ typedef struct hc_device_param
#if defined (__APPLE__) #if defined (__APPLE__)
int mtl_major; //int mtl_major;
int mtl_minor; //int mtl_minor;
int device_physical_location; int device_physical_location;
int device_location_number; int device_location_number;

View File

@ -4507,20 +4507,40 @@ int backend_ctx_init (hashcat_ctx_t *hashcat_ctx)
backend_ctx->metal_runtimeVersion = atoi (backend_ctx->metal_runtimeVersionStr); backend_ctx->metal_runtimeVersion = atoi (backend_ctx->metal_runtimeVersionStr);
if (user_options->force == false) // disable metal < 200
if (backend_ctx->metal_runtimeVersion < 200)
{ {
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;
backend_ctx->rc_metal_init = rc_metal_init;
backend_ctx->mtl = NULL;
mtl_close (hashcat_ctx);
}
else
{
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); // disable metal < 300
event_log_warning (hashcat_ctx, NULL);
rc_metal_init = -1; 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);
backend_ctx->rc_metal_init = rc_metal_init; rc_metal_init = -1;
backend_ctx->mtl = NULL; backend_ctx->rc_metal_init = rc_metal_init;
mtl_close (hashcat_ctx); backend_ctx->mtl = NULL;
mtl_close (hashcat_ctx);
}
} }
} }
} }
@ -5832,29 +5852,28 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
device_param->opencl_device_vendor = strdup ("Apple"); device_param->opencl_device_vendor = strdup ("Apple");
device_param->opencl_device_c_version = ""; device_param->opencl_device_c_version = "";
/* unused and deprecated
// sm_minor, sm_major // sm_minor, sm_major
int mtl_major = 0; int mtl_major = 0;
int mtl_minor = 0; int mtl_minor = 0;
/* unused and deprecated
if (hc_mtlDeviceGetAttribute (hashcat_ctx, &mtl_major, MTL_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR, metal_device) == -1) if (hc_mtlDeviceGetAttribute (hashcat_ctx, &mtl_major, MTL_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR, metal_device) == -1)
{ {
device_param->skipped = true; device_param->skipped = true;
continue; continue;
} }
*/
/* unused and deprecated
if (hc_mtlDeviceGetAttribute (hashcat_ctx, &mtl_minor, MTL_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR, metal_device) == -1) if (hc_mtlDeviceGetAttribute (hashcat_ctx, &mtl_minor, MTL_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR, metal_device) == -1)
{ {
device_param->skipped = true; device_param->skipped = true;
continue; continue;
} }
*/
device_param->mtl_major = mtl_major; device_param->mtl_major = mtl_major;
device_param->mtl_minor = mtl_minor; device_param->mtl_minor = mtl_minor;
*/
// device_name // device_name

View File

@ -16,6 +16,7 @@
#include <Foundation/Foundation.h> #include <Foundation/Foundation.h>
#include <Metal/Metal.h> #include <Metal/Metal.h>
/*
typedef NS_ENUM(NSUInteger, hc_mtlFeatureSet) typedef NS_ENUM(NSUInteger, hc_mtlFeatureSet)
{ {
MTL_FEATURESET_MACOS_GPUFAMILY_1_V1 = 10000, MTL_FEATURESET_MACOS_GPUFAMILY_1_V1 = 10000,
@ -25,6 +26,7 @@ typedef NS_ENUM(NSUInteger, hc_mtlFeatureSet)
MTL_FEATURESET_MACOS_GPUFAMILY_2_V1 = 10005, MTL_FEATURESET_MACOS_GPUFAMILY_2_V1 = 10005,
} metalDeviceFeatureSet_macOS_t; } metalDeviceFeatureSet_macOS_t;
*/
typedef NS_ENUM(NSUInteger, hc_mtlLanguageVersion) typedef NS_ENUM(NSUInteger, hc_mtlLanguageVersion)
{ {

View File

@ -1234,8 +1234,8 @@ void backend_info (hashcat_ctx_t *hashcat_ctx)
const hc_device_param_t *device_param = backend_ctx->devices_param + backend_devices_idx; const hc_device_param_t *device_param = backend_ctx->devices_param + backend_devices_idx;
int device_id = device_param->device_id; int device_id = device_param->device_id;
int device_mtl_maj = device_param->mtl_major; //int device_mtl_maj = device_param->mtl_major;
int device_mtl_min = device_param->mtl_minor; //int device_mtl_min = device_param->mtl_minor;
int device_max_transfer_rate = device_param->device_max_transfer_rate; int device_max_transfer_rate = device_param->device_max_transfer_rate;
int device_physical_location = device_param->device_physical_location; int device_physical_location = device_param->device_physical_location;
int device_location_number = device_param->device_location_number; int device_location_number = device_param->device_location_number;
@ -1285,6 +1285,7 @@ void backend_info (hashcat_ctx_t *hashcat_ctx)
default: event_log_info (hashcat_ctx, " Phys.Location..: N/A"); break; default: event_log_info (hashcat_ctx, " Phys.Location..: N/A"); break;
} }
/*
if (device_mtl_maj > 0 && device_mtl_min > 0) if (device_mtl_maj > 0 && device_mtl_min > 0)
{ {
event_log_info (hashcat_ctx, " Feature.Set....: macOS GPU Family %u v%u", device_mtl_maj, device_mtl_min); event_log_info (hashcat_ctx, " Feature.Set....: macOS GPU Family %u v%u", device_mtl_maj, device_mtl_min);
@ -1293,6 +1294,7 @@ void backend_info (hashcat_ctx_t *hashcat_ctx)
{ {
event_log_info (hashcat_ctx, " Feature.Set....: N/A"); event_log_info (hashcat_ctx, " Feature.Set....: N/A");
} }
*/
event_log_info (hashcat_ctx, " Registry.ID....: %u", device_registryID); event_log_info (hashcat_ctx, " Registry.ID....: %u", device_registryID);