make style

This commit is contained in:
Philippe Teuwen 2022-01-09 14:10:26 +01:00
commit 5a4584358c
12 changed files with 88 additions and 96 deletions

View file

@ -152,9 +152,9 @@ static int authenticate(DesfireContext_t *ctx, bool verbose) {
int res = DesfireAuthenticate(ctx, DACEV1, false); int res = DesfireAuthenticate(ctx, DACEV1, false);
if (res != PM3_SUCCESS) { if (res != PM3_SUCCESS) {
PrintAndLogEx(ERR, "Desfire authenticate " _RED_("error") ". Result: [%d] %s", PrintAndLogEx(ERR, "Desfire authenticate " _RED_("error") ". Result: [%d] %s",
res, res,
DesfireAuthErrorToStr(res) DesfireAuthErrorToStr(res)
); );
return res; return res;
} }
@ -200,7 +200,7 @@ static bool aid_exists(DesfireContext_t *ctx, uint32_t aid, bool verbose) {
PrintAndLogEx(INFO, "AID %06X %s", PrintAndLogEx(INFO, "AID %06X %s",
aid, aid,
res == PM3_SUCCESS ? "exists" : "does not exist" res == PM3_SUCCESS ? "exists" : "does not exist"
); );
} }
return (res == PM3_SUCCESS); return (res == PM3_SUCCESS);
@ -273,9 +273,9 @@ static int hfgal_read_creds_app(DesfireContext_t *ctx, uint32_t aid, uint8_t *si
// Check file contained 16 bytes of data // Check file contained 16 bytes of data
if (read_len != 16) { if (read_len != 16) {
PM3_RET_ERR(PM3_EFAILED, "Failed reading file 0 in AID %06X, expected 16 bytes, got %zu bytes", PM3_RET_ERR(PM3_EFAILED, "Failed reading file 0 in AID %06X, expected 16 bytes, got %zu bytes",
aid, aid,
read_len read_len
); );
} }
// Check second half of file is the bitwise inverse of the first half // Check second half of file is the bitwise inverse of the first half
@ -285,9 +285,9 @@ static int hfgal_read_creds_app(DesfireContext_t *ctx, uint32_t aid, uint8_t *si
if (memcmp(buf, &buf[8], 8) != 0) { if (memcmp(buf, &buf[8], 8) != 0) {
PM3_RET_ERR(PM3_EFAILED, "Invalid cardholder data in file 0 in AID %06X. Received %s", PM3_RET_ERR(PM3_EFAILED, "Invalid cardholder data in file 0 in AID %06X. Received %s",
aid, aid,
sprint_hex_inrow(buf, 16) sprint_hex_inrow(buf, 16)
); );
} }
gallagher_decode_creds(buf, creds); gallagher_decode_creds(buf, creds);
@ -312,7 +312,7 @@ static int hfgal_create_creds_app(DesfireContext_t *ctx, uint8_t *site_key, uint
// UID is required for key diversification // UID is required for key diversification
if (ctx->uidlen == 0) if (ctx->uidlen == 0)
PM3_RET_ERR(PM3_EINVARG, "UID is required for key diversification. " PM3_RET_ERR(PM3_EINVARG, "UID is required for key diversification. "
"Please fetch it before calling `hfgal_create_creds_app`"); "Please fetch it before calling `hfgal_create_creds_app`");
// Create application // Create application
DesfireCryptoAlgorithm app_algo = T_AES; DesfireCryptoAlgorithm app_algo = T_AES;
@ -348,7 +348,7 @@ static int hfgal_create_creds_app(DesfireContext_t *ctx, uint8_t *site_key, uint
i, i,
aid, aid,
sprint_hex_inrow(buf, ARRAYLEN(buf)) sprint_hex_inrow(buf, ARRAYLEN(buf))
); );
// Authenticate // Authenticate
uint8_t blank_key[CRYPTO_AES128_KEY_SIZE] = {0}; uint8_t blank_key[CRYPTO_AES128_KEY_SIZE] = {0};
@ -437,7 +437,7 @@ static int hfgal_read_cad(DesfireContext_t *ctx, uint8_t *dest_buf,
PrintAndLogEx(ERR, "hfgal_read_cad destination buffer is incorrectly sized. Received len %d, must be at least %d", PrintAndLogEx(ERR, "hfgal_read_cad destination buffer is incorrectly sized. Received len %d, must be at least %d",
dest_buf_len, dest_buf_len,
3 * 36 3 * 36
); );
return PM3_EINVARG; return PM3_EINVARG;
} }
@ -477,9 +477,9 @@ static int hfgal_read_cad(DesfireContext_t *ctx, uint8_t *dest_buf,
PrintAndLogEx(SUCCESS, "Card Application Directory contains:" NOLF); PrintAndLogEx(SUCCESS, "Card Application Directory contains:" NOLF);
for (int i = 0; i < num_entries; i++) { for (int i = 0; i < num_entries; i++) {
PrintAndLogEx(NORMAL, "%s %06X" NOLF, PrintAndLogEx(NORMAL, "%s %06X" NOLF,
(i == 0) ? "" : ",", (i == 0) ? "" : ",",
cad_aid_byte_to_uint(&dest_buf[i * 6 + 3]) cad_aid_byte_to_uint(&dest_buf[i * 6 + 3])
); );
} }
PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "");
} }
@ -518,8 +518,8 @@ static int hfgal_create_cad(DesfireContext_t *ctx, uint8_t *site_key, bool verbo
if (verbose) { if (verbose) {
PrintAndLogEx(INFO, "Created Card Application Directory (AID " _YELLOW_("%06X") ", empty contents & blank keys)", PrintAndLogEx(INFO, "Created Card Application Directory (AID " _YELLOW_("%06X") ", empty contents & blank keys)",
CAD_AID CAD_AID
); );
} }
// Select application & authenticate // Select application & authenticate
@ -537,7 +537,7 @@ static int hfgal_create_cad(DesfireContext_t *ctx, uint8_t *site_key, bool verbo
PrintAndLogEx(INFO, "Diversified key " _YELLOW_("0") " for CAD (AID " _YELLOW_("%06X") "): " _GREEN_("%s"), PrintAndLogEx(INFO, "Diversified key " _YELLOW_("0") " for CAD (AID " _YELLOW_("%06X") "): " _GREEN_("%s"),
CAD_AID, CAD_AID,
sprint_hex_inrow(buf, ARRAYLEN(buf)) sprint_hex_inrow(buf, ARRAYLEN(buf))
); );
// Change key // Change key
DesfireSetCommMode(ctx, DCMEncryptedPlain); DesfireSetCommMode(ctx, DCMEncryptedPlain);
@ -594,8 +594,8 @@ static int hfgal_add_aid_to_cad(DesfireContext_t *ctx, uint8_t *site_key, uint32
for (uint8_t i = 0; i < ARRAYLEN(cad); i += 6) { for (uint8_t i = 0; i < ARRAYLEN(cad); i += 6) {
if (cad_facility_match(&cad[i], creds->region_code, creds->facility_code)) if (cad_facility_match(&cad[i], creds->region_code, creds->facility_code))
PM3_RET_ERR(PM3_EFATAL, "Facility already exists in CAD, delete or update AID %06X", PM3_RET_ERR(PM3_EFATAL, "Facility already exists in CAD, delete or update AID %06X",
cad_aid_byte_to_uint(&cad[i + 3]) cad_aid_byte_to_uint(&cad[i + 3])
); );
} }
// Create entry // Create entry
@ -610,7 +610,7 @@ static int hfgal_add_aid_to_cad(DesfireContext_t *ctx, uint8_t *site_key, uint32
entry_num, entry_num,
file_id, file_id,
sprint_hex_inrow(entry, 6) sprint_hex_inrow(entry, 6)
); );
} }
// Select application & authenticate // Select application & authenticate
@ -721,9 +721,9 @@ static int hfgal_remove_aid_from_cad(DesfireContext_t *ctx, uint8_t *site_key,
if (verbose) { if (verbose) {
PrintAndLogEx(INFO, "Deleted unnecessary file " _YELLOW_("%d") " from CAD (AID " _YELLOW_("%06X")")", PrintAndLogEx(INFO, "Deleted unnecessary file " _YELLOW_("%d") " from CAD (AID " _YELLOW_("%06X")")",
file_id, file_id,
CAD_AID CAD_AID
); );
} }
} }
@ -775,7 +775,7 @@ static int hfgal_read_card(uint32_t aid, uint8_t *site_key, bool verbose, bool q
current_aid, current_aid,
region_code, region_code,
facility_code facility_code
); );
} else { } else {
PrintAndLogEx(INFO, "Reading AID: " _YELLOW_("%06X"), current_aid); PrintAndLogEx(INFO, "Reading AID: " _YELLOW_("%06X"), current_aid);
} }
@ -795,7 +795,7 @@ static int hfgal_read_card(uint32_t aid, uint8_t *site_key, bool verbose, bool q
creds.facility_code, creds.facility_code,
creds.card_number, creds.card_number,
creds.issue_level creds.issue_level
); );
} }
return PM3_SUCCESS; return PM3_SUCCESS;
} }
@ -899,10 +899,10 @@ static int CmdGallagherClone(const char *cmd) {
CLIGetHexWithReturn(ctx, 3, key, &key_len); CLIGetHexWithReturn(ctx, 3, key, &key_len);
if (key_len && key_len != desfire_get_key_length(key_algo)) { if (key_len && key_len != desfire_get_key_length(key_algo)) {
PM3_RET_ERR_FREE(PM3_EINVARG, "%s key must have %d bytes length instead of %d", PM3_RET_ERR_FREE(PM3_EINVARG, "%s key must have %d bytes length instead of %d",
CLIGetOptionListStr(DesfireAlgoOpts, key_algo), CLIGetOptionListStr(DesfireAlgoOpts, key_algo),
desfire_get_key_length(key_algo), desfire_get_key_length(key_algo),
key_len key_len
); );
} }
if (key_len == 0) { if (key_len == 0) {
// Default to a key of all zeros // Default to a key of all zeros
@ -927,11 +927,11 @@ static int CmdGallagherClone(const char *cmd) {
// Check that the AID is in the expected range // Check that the AID is in the expected range
if ((memcmp(aid_buf, "\xF4\x81", 2) != 0) || if ((memcmp(aid_buf, "\xF4\x81", 2) != 0) ||
(aid_buf[2] < 0x20) || (aid_buf[2] < 0x20) ||
(aid_buf[2] > 0x2B)) { (aid_buf[2] > 0x2B)) {
// TODO: this should probably be a warning, but key diversification will throw an error later even if we don't // TODO: this should probably be a warning, but key diversification will throw an error later even if we don't
PM3_RET_ERR_FREE(PM3_EINVARG, "Invalid Gallagher AID %06X, expected 2?81F4, where 0 <= ? <= 0xB", aid); PM3_RET_ERR_FREE(PM3_EINVARG, "Invalid Gallagher AID %06X, expected 2?81F4, where 0 <= ? <= 0xB", aid);
} }
} }
int site_key_len = 0; int site_key_len = 0;
@ -1026,8 +1026,8 @@ static int CmdGallagherDelete(const char *cmd) {
// Check that the AID is in the expected range // Check that the AID is in the expected range
if ((memcmp(aid_buf, "\xF4\x81", 2) != 0) || if ((memcmp(aid_buf, "\xF4\x81", 2) != 0) ||
(aid_buf[2] < 0x20) || (aid_buf[2] < 0x20) ||
(aid_buf[2] > 0x2B)) { (aid_buf[2] > 0x2B)) {
// TODO: this should probably be a warning, but key diversification will throw an error later even if we don't // TODO: this should probably be a warning, but key diversification will throw an error later even if we don't
PM3_RET_ERR_FREE(PM3_EINVARG, "Invalid Gallagher AID %06X, expected 2?81F4, where 0 <= ? <= 0xB", aid); PM3_RET_ERR_FREE(PM3_EINVARG, "Invalid Gallagher AID %06X, expected 2?81F4, where 0 <= ? <= 0xB", aid);
} }
@ -1099,8 +1099,8 @@ static int CmdGallagherDiversify(const char *cmd) {
// Check that the AID is in the expected range // Check that the AID is in the expected range
if ((memcmp(aid_buf, "\xF4\x81", 2) != 0) || if ((memcmp(aid_buf, "\xF4\x81", 2) != 0) ||
(aid_buf[2] < 0x20) || (aid_buf[2] < 0x20) ||
(aid_buf[2] > 0x2B)) { (aid_buf[2] > 0x2B)) {
// TODO: this should probably be a warning, but key diversification will throw an error later even if we don't // TODO: this should probably be a warning, but key diversification will throw an error later even if we don't
PM3_RET_ERR_FREE(PM3_EINVARG, "Invalid Gallagher AID %06X, expected 2?81F4, where 0 <= ? <= 0xB", aid); PM3_RET_ERR_FREE(PM3_EINVARG, "Invalid Gallagher AID %06X, expected 2?81F4, where 0 <= ? <= 0xB", aid);
} }
@ -1152,7 +1152,7 @@ static int CmdGallagherDiversify(const char *cmd) {
aid, aid,
key_num, key_num,
key_str key_str
); );
} }
return PM3_SUCCESS; return PM3_SUCCESS;
} }

View file

@ -367,7 +367,7 @@ static int CmdHF14AMfDarkside(const char *Cmd) {
PrintAndLogEx(SUCCESS, "found valid key: "_GREEN_("%012" PRIx64), key); PrintAndLogEx(SUCCESS, "found valid key: "_GREEN_("%012" PRIx64), key);
break; break;
} }
PrintAndLogEx(SUCCESS, "time in darkside " _YELLOW_("%.0f") " seconds\n",(float)t1 / 1000.0); PrintAndLogEx(SUCCESS, "time in darkside " _YELLOW_("%.0f") " seconds\n", (float)t1 / 1000.0);
return PM3_SUCCESS; return PM3_SUCCESS;
} }

View file

@ -1,17 +1,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Copyright (C) Proxmark3 contributors. See AUTHORS.md for details. // Copyright (C) 2021 <iceman>
// //
// This program is free software: you can redistribute it and/or modify // This code is licensed to you under the terms of the GNU GPL, version 2 or,
// it under the terms of the GNU General Public License as published by // at your option, any later version. See the LICENSE.txt file for the text of
// the Free Software Foundation, either version 3 of the License, or // the license.
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// See LICENSE.txt for the text of the license.
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// readline auto complete utilities // readline auto complete utilities
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View file

@ -1422,7 +1422,7 @@ int HIDFindCardFormat(const char *format) {
bool HIDPack(int format_idx, wiegand_card_t *card, wiegand_message_t *packed, bool preamble) { bool HIDPack(int format_idx, wiegand_card_t *card, wiegand_message_t *packed, bool preamble) {
memset(packed, 0, sizeof(wiegand_message_t)); memset(packed, 0, sizeof(wiegand_message_t));
if ((format_idx < 0) || (format_idx >= ARRAYLEN(FormatTable) - 1) ) if ((format_idx < 0) || (format_idx >= ARRAYLEN(FormatTable) - 1))
return false; return false;
return FormatTable[format_idx].Pack(card, packed, preamble); return FormatTable[format_idx].Pack(card, packed, preamble);

View file

@ -2322,30 +2322,30 @@
}, },
"hf gallagher clone": { "hf gallagher clone": {
"command": "hf gallagher clone", "command": "hf gallagher clone",
"description": "clone gallagher credentials to a writable desfire card", "description": "clone gallagher credentials to a writable desfire card specify site key is required if using non-default key key, lengths for the different crypto: des 8 bytes 2tdea or aes 16 bytes 3tdea 24 bytes aid id, default finds lowest available in range 0x2?81f4, where 0 <= ? <= 0xb.",
"notes": [ "notes": [
"hf gallagher clone --rc 1 --fc 22 --cn 3333 --il 4 --sitekey 00112233445566778899aabbccddeeff" "hf gallagher clone --rc 1 --fc 22 --cn 3333 --il 4 --sitekey 00112233445566778899aabbccddeeff"
], ],
"offline": false, "offline": false,
"options": [ "options": [
"-h, --help this help", "-h, --help this help",
"-n, --keynum <decimal> key number [default=0]", "-n, --keynum <dec> key number [default = 0]",
"-t, --algo <des/2tdea/3tdea/aes> crypt algo: des, 2tdea, 3tdea, aes", "-t, --algo <des|2tdea|3tdea|aes> crypt algo: des, 2tdea, 3tdea, aes",
"-k, --key <hex> key for authentication to the picc (hex 8(des), 16(2tdea or aes) or 24(3tdea) bytes)", "-k, --key <hex> key for authentication to the picc",
"--rc <decimal> region code. 4 bits max", "--rc <dec> region code. 4 bits max",
"--fc <decimal> facility code. 2 bytes max", "--fc <dec> facility code. 2 bytes max",
"--cn <decimal> card number. 3 bytes max", "--cn <dec> card number. 3 bytes max",
"--il <decimal> issue level. 4 bits max", "--il <dec> issue level. 4 bits max",
"--aid <hex> application id to write (3 bytes) [default finds lowest available in range 0x2?81f4, where 0 <= ? <= 0xb]", "--aid <hex> application id to write (3 bytes)",
"--sitekey <hex> mifare site key to compute diversified keys (16 bytes, required if using non-default key)", "--sitekey <hex> site key to compute diversified keys (16 bytes)",
"--apdu show apdu requests and responses", "--apdu show apdu requests and responses",
"-v, --verbose verbose mode" "-v, --verbose verbose mode"
], ],
"usage": "hf gallagher clone [-hv] [-n <decimal>] [-t <des/2tdea/3tdea/aes>] [-k <hex>] --rc <decimal> --fc <decimal> --cn <decimal> --il <decimal> [--aid <hex>] [--sitekey <hex>] [--apdu]" "usage": "hf gallagher clone [-hv] [-n <dec>] [-t <des|2tdea|3tdea|aes>] [-k <hex>] --rc <dec> --fc <dec> --cn <dec> --il <dec> [--aid <hex>] [--sitekey <hex>] [--apdu]"
}, },
"hf gallagher delete": { "hf gallagher delete": {
"command": "hf gallagher delete", "command": "hf gallagher delete",
"description": "delete gallagher application from a desfire card", "description": "delete gallagher application from a desfire card specify site key is required if using non-default key",
"notes": [ "notes": [
"hf gallagher delete --aid 2081f4 --sitekey 00112233445566778899aabbccddeeff" "hf gallagher delete --aid 2081f4 --sitekey 00112233445566778899aabbccddeeff"
], ],
@ -2353,7 +2353,7 @@
"options": [ "options": [
"-h, --help this help", "-h, --help this help",
"--aid <hex> application id to delete (3 bytes)", "--aid <hex> application id to delete (3 bytes)",
"--sitekey <hex> mifare site key to compute diversified keys (16 bytes, required if using non-default key)", "--sitekey <hex> site key to compute diversified keys (16 bytes)",
"--apdu show apdu requests and responses", "--apdu show apdu requests and responses",
"-v, --verbose verbose mode" "-v, --verbose verbose mode"
], ],
@ -2361,7 +2361,7 @@
}, },
"hf gallagher diversifykey": { "hf gallagher diversifykey": {
"command": "hf gallagher diversifykey", "command": "hf gallagher diversifykey",
"description": "diversify gallagher key", "description": "diversify gallagher key specify site key is required if using non-default key",
"notes": [ "notes": [
"hf gallagher diversify --uid 11223344556677 --aid 2081f4" "hf gallagher diversify --uid 11223344556677 --aid 2081f4"
], ],
@ -2369,25 +2369,25 @@
"options": [ "options": [
"-h, --help this help", "-h, --help this help",
"--aid <hex> application id for diversification (3 bytes)", "--aid <hex> application id for diversification (3 bytes)",
"--keynum <decimal> key number [default=0]", "--keynum <dec> key number [default = 0]",
"--uid <hex> card uid to delete (4 or 7 bytes)", "--uid <hex> card uid to delete (4 or 7 bytes)",
"--sitekey <hex> mifare site key to compute diversified keys (16 bytes, required if using non-default key)", "--sitekey <hex> site key to compute diversified keys (16 bytes)",
"--apdu show apdu requests and responses" "--apdu show apdu requests and responses"
], ],
"usage": "hf gallagher diversify [-h] --aid <hex> [--keynum <decimal>] [--uid <hex>] [--sitekey <hex>] [--apdu]" "usage": "hf gallagher diversify [-h] --aid <hex> [--keynum <dec>] [--uid <hex>] [--sitekey <hex>] [--apdu]"
}, },
"hf gallagher help": { "hf gallagher help": {
"command": "hf gallagher help", "command": "hf gallagher help",
"description": "help this help diversifykey diversify gallagher key --------------------------------------------------------------------------------------- hf gallagher reader available offline: no read a gallagher desfire tag", "description": "help this help diversifykey diversify gallagher key --------------------------------------------------------------------------------------- hf gallagher reader available offline: no read a gallagher desfire tag from the card application directory, cad specify site key is required if using non-default key",
"notes": [ "notes": [
"hf gallagher reader --aid 2081f4 --sitekey 00112233445566778899aabbccddeeff -> act as a reader that skips reading the card application directory and uses a non-default site key", "hf gallagher reader -@ -> continuous reader mode",
"hf gallagher reader -@ -> continuous reader mode" "hf gallagher reader --aid 2081f4 --sitekey 00112233445566778899aabbccddeeff -> skip cad"
], ],
"offline": true, "offline": true,
"options": [ "options": [
"-h, --help this help", "-h, --help this help",
"--aid <hex> application id to read (3 bytes). if specified, then the card application directory is not used", "--aid <hex> application id to read (3 bytes). if specified, the cad is not used",
"--sitekey <hex> mifare site key to compute diversified keys (16 bytes, required if using non-default key)", "--sitekey <hex> site key to compute diversified keys (16 bytes)",
"-@, --continuous continuous reader mode", "-@, --continuous continuous reader mode",
"--apdu show apdu requests and responses", "--apdu show apdu requests and responses",
"-v, --verbose verbose mode" "-v, --verbose verbose mode"
@ -7194,7 +7194,7 @@
}, },
"lf gproxii clone": { "lf gproxii clone": {
"command": "lf gproxii clone", "command": "lf gproxii clone",
"description": "clone a guardall tag to a t55x7, q5/t5555 or em4305/4469 tag. the facility-code is 8-bit and the card number is 16-bit. larger values are truncated. currently work only on 26bit", "description": "clone a guardall tag to a t55x7, q5/t5555 or em4305/4469 tag. the facility-code is 8-bit and the card number is 20-bit. larger values are truncated. currently work only on 26 | 36 bit format",
"notes": [ "notes": [
"lf gproxii clone --fmt 26 --fc 123 --cn 1337", "lf gproxii clone --fmt 26 --fc 123 --cn 1337",
"lf gproxii clone --q5 --fmt 26 --fc 123 --cn 1337 -> encode for q5/t5555 tag", "lf gproxii clone --q5 --fmt 26 --fc 123 --cn 1337 -> encode for q5/t5555 tag",
@ -7240,7 +7240,7 @@
}, },
"lf gproxii sim": { "lf gproxii sim": {
"command": "lf gproxii sim", "command": "lf gproxii sim",
"description": "enables simulation of guardall card with specified card number. simulation runs until the button is pressed or another usb command is issued. the facility-code is 8-bit and the card number is 16-bit. larger values are truncated. currently work only on 26bit", "description": "enables simulation of guardall card with specified card number. simulation runs until the button is pressed or another usb command is issued. the facility-code is 8-bit and the card number is 16-bit. larger values are truncated. currently work only on 26 | 36 bit format",
"notes": [ "notes": [
"lf gproxii sim --fmt 26 --fc 123 --cn 1337" "lf gproxii sim --fmt 26 --fc 123 --cn 1337"
], ],
@ -10237,6 +10237,6 @@
"metadata": { "metadata": {
"commands_extracted": 601, "commands_extracted": 601,
"extracted_by": "PM3Help2JSON v1.00", "extracted_by": "PM3Help2JSON v1.00",
"extracted_on": "2022-01-06T19:05:01" "extracted_on": "2022-01-09T13:10:14"
} }
} }

View file

@ -94,8 +94,8 @@ static uint64_t expand(uint64_t mask, uint64_t value) {
static void bitslice(const uint64_t value, bitslice_t *restrict bitsliced_value) { static void bitslice(const uint64_t value, bitslice_t *restrict bitsliced_value) {
// set constants // set constants
bitslice_t bs_zeroes, bs_ones; bitslice_t bs_zeroes, bs_ones;
memset((uint8_t*)&bs_ones, 0xff, VECTOR_SIZE); memset((uint8_t *)&bs_ones, 0xff, VECTOR_SIZE);
memset((uint8_t*)&bs_zeroes, 0x00, VECTOR_SIZE); memset((uint8_t *)&bs_zeroes, 0x00, VECTOR_SIZE);
for (size_t bit_idx = 0; bit_idx < 32; bit_idx++) { for (size_t bit_idx = 0; bit_idx < 32; bit_idx++) {
const bool bit = get_bit(32 - 1 - bit_idx, value); const bool bit = get_bit(32 - 1 - bit_idx, value);

View file

@ -69,10 +69,10 @@ unsigned int get_smallest_profile(compute_platform_ctx_t *cd_ctx, size_t ocl_pla
} }
int discoverDevices(unsigned int profile_selected, uint32_t device_types_selected, int discoverDevices(unsigned int profile_selected, uint32_t device_types_selected,
cl_uint *platform_detected_cnt, size_t *selected_platforms_cnt, cl_uint *platform_detected_cnt, size_t *selected_platforms_cnt,
size_t *selected_devices_cnt, compute_platform_ctx_t **cd_ctx, size_t *selected_devices_cnt, compute_platform_ctx_t **cd_ctx,
unsigned int *plat_sel, unsigned int plat_cnt, unsigned int *dev_sel, unsigned int *plat_sel, unsigned int plat_cnt, unsigned int *dev_sel,
unsigned int dev_cnt, bool verbose, bool show) { unsigned int dev_cnt, bool verbose, bool show) {
int err = 0; int err = 0;
unsigned int ocl_platform_max = MAX_OPENCL_DEVICES; // 16 unsigned int ocl_platform_max = MAX_OPENCL_DEVICES; // 16
cl_uint ocl_platform_cnt; cl_uint ocl_platform_cnt;