mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-22 06:13:51 -07:00
Remove ARRAY_LENGTH, we've already ARRAYLEN
This commit is contained in:
parent
5a4584358c
commit
2269ad6914
3 changed files with 10 additions and 12 deletions
|
@ -50,7 +50,7 @@ const CLIParserOption DesfireAlgoOpts[] = {
|
||||||
{T_AES, "aes"},
|
{T_AES, "aes"},
|
||||||
{0, NULL},
|
{0, NULL},
|
||||||
};
|
};
|
||||||
const size_t DesfireAlgoOptsLen = ARRAY_LENGTH(DesfireAlgoOpts);
|
const size_t DesfireAlgoOptsLen = ARRAYLEN(DesfireAlgoOpts);
|
||||||
|
|
||||||
const CLIParserOption DesfireKDFAlgoOpts[] = {
|
const CLIParserOption DesfireKDFAlgoOpts[] = {
|
||||||
{MFDES_KDF_ALGO_NONE, "none"},
|
{MFDES_KDF_ALGO_NONE, "none"},
|
||||||
|
@ -58,7 +58,7 @@ const CLIParserOption DesfireKDFAlgoOpts[] = {
|
||||||
{MFDES_KDF_ALGO_GALLAGHER, "gallagher"},
|
{MFDES_KDF_ALGO_GALLAGHER, "gallagher"},
|
||||||
{0, NULL},
|
{0, NULL},
|
||||||
};
|
};
|
||||||
const size_t DesfireKDFAlgoOptsLen = ARRAY_LENGTH(DesfireKDFAlgoOpts);
|
const size_t DesfireKDFAlgoOptsLen = ARRAYLEN(DesfireKDFAlgoOpts);
|
||||||
|
|
||||||
const CLIParserOption DesfireCommunicationModeOpts[] = {
|
const CLIParserOption DesfireCommunicationModeOpts[] = {
|
||||||
{DCMPlain, "plain"},
|
{DCMPlain, "plain"},
|
||||||
|
@ -66,7 +66,7 @@ const CLIParserOption DesfireCommunicationModeOpts[] = {
|
||||||
{DCMEncrypted, "encrypt"},
|
{DCMEncrypted, "encrypt"},
|
||||||
{0, NULL},
|
{0, NULL},
|
||||||
};
|
};
|
||||||
const size_t DesfireCommunicationModeOptsLen = ARRAY_LENGTH(DesfireCommunicationModeOpts);
|
const size_t DesfireCommunicationModeOptsLen = ARRAYLEN(DesfireCommunicationModeOpts);
|
||||||
|
|
||||||
const CLIParserOption DesfireCommandSetOpts[] = {
|
const CLIParserOption DesfireCommandSetOpts[] = {
|
||||||
{DCCNative, "native"},
|
{DCCNative, "native"},
|
||||||
|
@ -74,7 +74,7 @@ const CLIParserOption DesfireCommandSetOpts[] = {
|
||||||
{DCCISO, "iso"},
|
{DCCISO, "iso"},
|
||||||
{0, NULL},
|
{0, NULL},
|
||||||
};
|
};
|
||||||
const size_t DesfireCommandSetOptsLen = ARRAY_LENGTH(DesfireCommandSetOpts);
|
const size_t DesfireCommandSetOptsLen = ARRAYLEN(DesfireCommandSetOpts);
|
||||||
|
|
||||||
const CLIParserOption DesfireSecureChannelOpts[] = {
|
const CLIParserOption DesfireSecureChannelOpts[] = {
|
||||||
{DACd40, "d40"},
|
{DACd40, "d40"},
|
||||||
|
@ -83,7 +83,7 @@ const CLIParserOption DesfireSecureChannelOpts[] = {
|
||||||
{DACLRP, "lrp"},
|
{DACLRP, "lrp"},
|
||||||
{0, NULL},
|
{0, NULL},
|
||||||
};
|
};
|
||||||
const size_t DesfireSecureChannelOptsLen = ARRAY_LENGTH(DesfireSecureChannelOpts);
|
const size_t DesfireSecureChannelOptsLen = ARRAYLEN(DesfireSecureChannelOpts);
|
||||||
|
|
||||||
const CLIParserOption DesfireFileAccessModeOpts[] = {
|
const CLIParserOption DesfireFileAccessModeOpts[] = {
|
||||||
{0x00, "key0"},
|
{0x00, "key0"},
|
||||||
|
|
|
@ -205,7 +205,7 @@ static const CmdHeaderLengths_t CmdHeaderLengths[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static uint8_t DesfireGetCmdHeaderLen(uint8_t cmd) {
|
static uint8_t DesfireGetCmdHeaderLen(uint8_t cmd) {
|
||||||
for (int i = 0; i < ARRAY_LENGTH(CmdHeaderLengths); i++)
|
for (int i = 0; i < ARRAYLEN(CmdHeaderLengths); i++)
|
||||||
if (CmdHeaderLengths[i].cmd == cmd)
|
if (CmdHeaderLengths[i].cmd == cmd)
|
||||||
return CmdHeaderLengths[i].len;
|
return CmdHeaderLengths[i].len;
|
||||||
|
|
||||||
|
@ -229,7 +229,7 @@ static bool DesfireEV1D40TransmitMAC(DesfireContext_t *ctx, uint8_t cmd) {
|
||||||
if (ctx->secureChannel != DACd40 && ctx->secureChannel != DACEV1)
|
if (ctx->secureChannel != DACd40 && ctx->secureChannel != DACEV1)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
for (int i = 0; i < ARRAY_LENGTH(EV1D40TransmitMAC); i++)
|
for (int i = 0; i < ARRAYLEN(EV1D40TransmitMAC); i++)
|
||||||
if (EV1D40TransmitMAC[i] == cmd)
|
if (EV1D40TransmitMAC[i] == cmd)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -248,7 +248,7 @@ static bool DesfireEV1D40ReceiveMAC(DesfireContext_t *ctx, uint8_t cmd) {
|
||||||
if (ctx->secureChannel != DACd40)
|
if (ctx->secureChannel != DACd40)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
for (int i = 0; i < ARRAY_LENGTH(D40ReceiveMAC); i++)
|
for (int i = 0; i < ARRAYLEN(D40ReceiveMAC); i++)
|
||||||
if (D40ReceiveMAC[i] == cmd)
|
if (D40ReceiveMAC[i] == cmd)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -267,7 +267,7 @@ static const uint8_t ISOChannelValidCmd[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool DesfireISOChannelValidCmd(uint8_t cmd) {
|
static bool DesfireISOChannelValidCmd(uint8_t cmd) {
|
||||||
for (int i = 0; i < ARRAY_LENGTH(ISOChannelValidCmd); i++)
|
for (int i = 0; i < ARRAYLEN(ISOChannelValidCmd); i++)
|
||||||
if (ISOChannelValidCmd[i] == cmd)
|
if (ISOChannelValidCmd[i] == cmd)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -828,7 +828,7 @@ bool PrintChannelModeWarning(uint8_t cmd, DesfireSecureChannel secureChannel, De
|
||||||
}
|
}
|
||||||
|
|
||||||
bool found = false;
|
bool found = false;
|
||||||
for (int i = 0; i < ARRAY_LENGTH(AllowedChannelModes); i++)
|
for (int i = 0; i < ARRAYLEN(AllowedChannelModes); i++)
|
||||||
if (AllowedChannelModes[i].cmd == cmd) {
|
if (AllowedChannelModes[i].cmd == cmd) {
|
||||||
// full compare
|
// full compare
|
||||||
if (AllowedChannelModes[i].secureChannel == secureChannel &&
|
if (AllowedChannelModes[i].secureChannel == secureChannel &&
|
||||||
|
|
|
@ -24,8 +24,6 @@
|
||||||
#include <endian.h>
|
#include <endian.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define ARRAY_LENGTH( array ) ( sizeof( array ) / sizeof( *( array ) ) )
|
|
||||||
|
|
||||||
// used for save/load files
|
// used for save/load files
|
||||||
#ifndef FILE_PATH_SIZE
|
#ifndef FILE_PATH_SIZE
|
||||||
# define FILE_PATH_SIZE 1000
|
# define FILE_PATH_SIZE 1000
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue