From 98d940874625b246803d790985520afccb377ec2 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Sat, 6 Apr 2019 00:52:55 +0200 Subject: [PATCH] make style --- client/cliparser/cliparser.h | 14 +-- client/cmdlft55xx.h | 30 +++--- client/crypto/asn1dump.h | 2 +- client/crypto/libpcrypto.h | 24 ++--- client/emv/apduinfo.h | 4 +- client/emv/cmdemv.h | 14 +-- client/emv/emv_pki.h | 2 +- client/emv/emv_roca.h | 4 +- client/emv/emvcore.h | 48 ++++----- client/emv/emvjson.h | 28 ++--- client/emv/test/cda_test.h | 2 +- client/emv/test/crypto_test.h | 2 +- client/emv/test/cryptotest.h | 2 +- client/emv/test/dda_test.h | 2 +- client/emv/test/sda_test.h | 2 +- client/fido/cbortools.h | 22 ++-- client/fido/cose.h | 10 +- client/fido/fidocore.h | 30 +++--- client/hardnested/hardnested_bf_core.h | 8 +- client/hardnested/hardnested_bitarray_core.h | 26 ++--- client/hardnested/hardnested_bruteforce.h | 10 +- client/loclass/fileutils.h | 14 +-- client/loclass/hash1_brute.h | 2 +- client/mifare/mad.h | 8 +- client/mifare/mfkey.h | 12 +-- client/mifare/mifare4.h | 30 +++--- client/mifare/mifarehost.h | 50 ++++----- client/mifare/ndef.h | 2 +- client/proxgui.h | 2 +- client/reveng/reveng.h | 108 +++++++++---------- 30 files changed, 257 insertions(+), 257 deletions(-) diff --git a/client/cliparser/cliparser.h b/client/cliparser/cliparser.h index d42cd50b6..7dd3584bc 100644 --- a/client/cliparser/cliparser.h +++ b/client/cliparser/cliparser.h @@ -31,11 +31,11 @@ #define CLIGetHexWithReturn(paramnum, data, datalen) if (CLIParamHexToBuf(arg_get_str(paramnum), data, sizeof(data), datalen)) {CLIParserFree();return 1;} #define CLIGetStrWithReturn(paramnum, data, datalen) if (CLIParamStrToBuf(arg_get_str(paramnum), data, sizeof(data), datalen)) {CLIParserFree();return 1;} -extern int CLIParserInit(char *vprogramName, char *vprogramHint, char *vprogramHelp); -extern int CLIParserParseString(const char *str, void *argtable[], size_t vargtableLen, bool allowEmptyExec); -extern int CLIParserParseStringEx(const char *str, void *vargtable[], size_t vargtableLen, bool allowEmptyExec, bool clueData); -extern int CLIParserParseArg(int argc, char **argv, void *argtable[], size_t vargtableLen, bool allowEmptyExec); -extern void CLIParserFree(); +int CLIParserInit(char *vprogramName, char *vprogramHint, char *vprogramHelp); +int CLIParserParseString(const char *str, void *argtable[], size_t vargtableLen, bool allowEmptyExec); +int CLIParserParseStringEx(const char *str, void *vargtable[], size_t vargtableLen, bool allowEmptyExec, bool clueData); +int CLIParserParseArg(int argc, char **argv, void *argtable[], size_t vargtableLen, bool allowEmptyExec); +void CLIParserFree(); -extern int CLIParamHexToBuf(struct arg_str *argstr, uint8_t *data, int maxdatalen, int *datalen); -extern int CLIParamStrToBuf(struct arg_str *argstr, uint8_t *data, int maxdatalen, int *datalen); +int CLIParamHexToBuf(struct arg_str *argstr, uint8_t *data, int maxdatalen, int *datalen); +int CLIParamStrToBuf(struct arg_str *argstr, uint8_t *data, int maxdatalen, int *datalen); diff --git a/client/cmdlft55xx.h b/client/cmdlft55xx.h index ce990bebd..dca8c6f39 100644 --- a/client/cmdlft55xx.h +++ b/client/cmdlft55xx.h @@ -137,17 +137,17 @@ typedef struct { t55xx_conf_block_t Get_t55xx_Config(void); void Set_t55xx_Config(t55xx_conf_block_t conf); -extern int CmdLFT55XX(const char *Cmd); -extern int CmdT55xxChk(const char *Cmd); -extern int CmdT55xxBruteForce(const char *Cmd); -extern int CmdT55xxSetConfig(const char *Cmd); -extern int CmdT55xxReadBlock(const char *Cmd); -extern int CmdT55xxWriteBlock(const char *Cmd); -extern int CmdT55xxReadTrace(const char *Cmd); -extern int CmdT55xxInfo(const char *Cmd); -extern int CmdT55xxDetect(const char *Cmd); -extern int CmdResetRead(const char *Cmd); -extern int CmdT55xxWipe(const char *Cmd); +int CmdLFT55XX(const char *Cmd); +int CmdT55xxChk(const char *Cmd); +int CmdT55xxBruteForce(const char *Cmd); +int CmdT55xxSetConfig(const char *Cmd); +int CmdT55xxReadBlock(const char *Cmd); +int CmdT55xxWriteBlock(const char *Cmd); +int CmdT55xxReadTrace(const char *Cmd); +int CmdT55xxInfo(const char *Cmd); +int CmdT55xxDetect(const char *Cmd); +int CmdResetRead(const char *Cmd); +int CmdT55xxWipe(const char *Cmd); char *GetPskCfStr(uint32_t id, bool q5); char *GetBitRateStr(uint32_t id, bool xmode); @@ -160,16 +160,16 @@ void printT5xxHeader(uint8_t page); void printT55xxBlock(const char *demodStr); int printConfiguration(t55xx_conf_block_t b); -extern int T55xxReadBlock(uint8_t block, bool page1, bool usepwd, bool override, uint32_t password); +int T55xxReadBlock(uint8_t block, bool page1, bool usepwd, bool override, uint32_t password); bool GetT55xxBlockData(uint32_t *blockdata); bool DecodeT55xxBlock(void); -extern bool tryDetectModulation(void); +bool tryDetectModulation(void); bool testKnownConfigBlock(uint32_t block0); -extern bool tryDetectP1(bool getData); +bool tryDetectP1(bool getData); bool test(uint8_t mode, uint8_t *offset, int *fndBitRate, uint8_t clk, bool *Q5); int special(const char *Cmd); -extern bool AquireData(uint8_t page, uint8_t block, bool pwdmode, uint32_t password); +bool AquireData(uint8_t page, uint8_t block, bool pwdmode, uint32_t password); int tryOnePassword(uint32_t password); void printT55x7Trace(t55x7_tracedata_t data, uint8_t repeat); diff --git a/client/crypto/asn1dump.h b/client/crypto/asn1dump.h index 1aadf487c..c7aef7e39 100644 --- a/client/crypto/asn1dump.h +++ b/client/crypto/asn1dump.h @@ -16,6 +16,6 @@ #include #include "emv/tlv.h" -extern bool asn1_tag_dump(const struct tlv *tlv, FILE *f, int level, bool *candump); +bool asn1_tag_dump(const struct tlv *tlv, FILE *f, int level, bool *candump); #endif /* asn1utils.h */ diff --git a/client/crypto/libpcrypto.h b/client/crypto/libpcrypto.h index 2cb4644a8..38d37b66a 100644 --- a/client/crypto/libpcrypto.h +++ b/client/crypto/libpcrypto.h @@ -16,20 +16,20 @@ #include #include -extern int aes_encode(uint8_t *iv, uint8_t *key, uint8_t *input, uint8_t *output, int length); -extern int aes_decode(uint8_t *iv, uint8_t *key, uint8_t *input, uint8_t *output, int length); -extern int aes_cmac(uint8_t *iv, uint8_t *key, uint8_t *input, uint8_t *mac, int length); -extern int aes_cmac8(uint8_t *iv, uint8_t *key, uint8_t *input, uint8_t *mac, int length); +int aes_encode(uint8_t *iv, uint8_t *key, uint8_t *input, uint8_t *output, int length); +int aes_decode(uint8_t *iv, uint8_t *key, uint8_t *input, uint8_t *output, int length); +int aes_cmac(uint8_t *iv, uint8_t *key, uint8_t *input, uint8_t *mac, int length); +int aes_cmac8(uint8_t *iv, uint8_t *key, uint8_t *input, uint8_t *mac, int length); -extern int sha256hash(uint8_t *input, int length, uint8_t *hash); -extern int sha512hash(uint8_t *input, int length, uint8_t *hash); +int sha256hash(uint8_t *input, int length, uint8_t *hash); +int sha512hash(uint8_t *input, int length, uint8_t *hash); -extern int ecdsa_key_create(uint8_t *key_d, uint8_t *key_xy); -extern int ecdsa_public_key_from_pk(mbedtls_pk_context *pk, uint8_t *key, size_t keylen); -extern int ecdsa_signature_create(uint8_t *key_d, uint8_t *key_xy, uint8_t *input, int length, uint8_t *signature, size_t *signaturelen); -extern int ecdsa_signature_verify(uint8_t *key_xy, uint8_t *input, int length, uint8_t *signature, size_t signaturelen); -extern char *ecdsa_get_error(int ret); +int ecdsa_key_create(uint8_t *key_d, uint8_t *key_xy); +int ecdsa_public_key_from_pk(mbedtls_pk_context *pk, uint8_t *key, size_t keylen); +int ecdsa_signature_create(uint8_t *key_d, uint8_t *key_xy, uint8_t *input, int length, uint8_t *signature, size_t *signaturelen); +int ecdsa_signature_verify(uint8_t *key_xy, uint8_t *input, int length, uint8_t *signature, size_t signaturelen); +char *ecdsa_get_error(int ret); -extern int ecdsa_nist_test(bool verbose); +int ecdsa_nist_test(bool verbose); #endif /* libpcrypto.h */ diff --git a/client/emv/apduinfo.h b/client/emv/apduinfo.h index 054aeec91..d7811dbc6 100644 --- a/client/emv/apduinfo.h +++ b/client/emv/apduinfo.h @@ -28,7 +28,7 @@ typedef struct { const char *Description; } APDUCode; -extern const APDUCode *const GetAPDUCode(uint8_t sw1, uint8_t sw2); -extern const char *GetAPDUCodeDescription(uint8_t sw1, uint8_t sw2); +const APDUCode *const GetAPDUCode(uint8_t sw1, uint8_t sw2); +const char *GetAPDUCodeDescription(uint8_t sw1, uint8_t sw2); #endif diff --git a/client/emv/cmdemv.h b/client/emv/cmdemv.h index c91f75606..739909215 100644 --- a/client/emv/cmdemv.h +++ b/client/emv/cmdemv.h @@ -29,12 +29,12 @@ int CmdEMV(const char *Cmd); -extern int CmdEMVSelect(const char *cmd); -extern int CmdEMVSearch(const char *cmd); -extern int CmdEMVPPSE(const char *cmd); -extern int CmdEMVExec(const char *cmd); -extern int CmdEMVGetrng(const char *Cmd); -extern int CmdEMVList(const char *Cmd); -extern int CmdEMVRoca(const char *Cmd); +int CmdEMVSelect(const char *cmd); +int CmdEMVSearch(const char *cmd); +int CmdEMVPPSE(const char *cmd); +int CmdEMVExec(const char *cmd); +int CmdEMVGetrng(const char *Cmd); +int CmdEMVList(const char *Cmd); +int CmdEMVRoca(const char *Cmd); #endif diff --git a/client/emv/emv_pki.h b/client/emv/emv_pki.h index 6cc4a97d1..0b80f2665 100644 --- a/client/emv/emv_pki.h +++ b/client/emv/emv_pki.h @@ -21,7 +21,7 @@ #include -extern void PKISetStrictExecution(bool se); +void PKISetStrictExecution(bool se); unsigned char *emv_pki_sdatl_fill(const struct tlvdb *db, size_t *sdatl_len); struct emv_pk *emv_pki_recover_issuer_cert(const struct emv_pk *pk, struct tlvdb *db); diff --git a/client/emv/emv_roca.h b/client/emv/emv_roca.h index 2830ce9c5..6663ce710 100644 --- a/client/emv/emv_roca.h +++ b/client/emv/emv_roca.h @@ -31,8 +31,8 @@ #define ROCA_PRINTS_LENGTH 17 -extern bool emv_rocacheck(const unsigned char *buf, size_t buflen, bool verbose); -extern int roca_self_test(void); +bool emv_rocacheck(const unsigned char *buf, size_t buflen, bool verbose); +int roca_self_test(void); #endif diff --git a/client/emv/emvcore.h b/client/emv/emvcore.h index 7e9afabf7..806a9366f 100644 --- a/client/emv/emvcore.h +++ b/client/emv/emvcore.h @@ -63,46 +63,46 @@ enum CardPSVendor { CV_CB, CV_OTHER, }; -extern enum CardPSVendor GetCardPSVendor(uint8_t *AID, size_t AIDlen); +enum CardPSVendor GetCardPSVendor(uint8_t *AID, size_t AIDlen); -extern bool TLVPrintFromBuffer(uint8_t *data, int datalen); -extern void TLVPrintFromTLV(struct tlvdb *tlv); -extern void TLVPrintFromTLVLev(struct tlvdb *tlv, int level); -extern void TLVPrintAIDlistFromSelectTLV(struct tlvdb *tlv); +bool TLVPrintFromBuffer(uint8_t *data, int datalen); +void TLVPrintFromTLV(struct tlvdb *tlv); +void TLVPrintFromTLVLev(struct tlvdb *tlv, int level); +void TLVPrintAIDlistFromSelectTLV(struct tlvdb *tlv); -extern struct tlvdb *GetPANFromTrack2(const struct tlv *track2); -extern struct tlvdb *GetdCVVRawFromTrack2(const struct tlv *track2); +struct tlvdb *GetPANFromTrack2(const struct tlv *track2); +struct tlvdb *GetdCVVRawFromTrack2(const struct tlv *track2); -extern void SetAPDULogging(bool logging); +void SetAPDULogging(bool logging); // exchange -extern int EMVExchange(EMVCommandChannel channel, bool LeaveFieldON, sAPDU apdu, uint8_t *Result, size_t MaxResultLen, size_t *ResultLen, uint16_t *sw, struct tlvdb *tlv); +int EMVExchange(EMVCommandChannel channel, bool LeaveFieldON, sAPDU apdu, uint8_t *Result, size_t MaxResultLen, size_t *ResultLen, uint16_t *sw, struct tlvdb *tlv); // search application -extern int EMVSearchPSE(EMVCommandChannel channel, bool ActivateField, bool LeaveFieldON, uint8_t PSENum, bool decodeTLV, struct tlvdb *tlv); -extern int EMVSearch(EMVCommandChannel channel, bool ActivateField, bool LeaveFieldON, bool decodeTLV, struct tlvdb *tlv); -extern int EMVSelectPSE(EMVCommandChannel channel, bool ActivateField, bool LeaveFieldON, uint8_t PSENum, uint8_t *Result, size_t MaxResultLen, size_t *ResultLen, uint16_t *sw); -extern int EMVSelect(EMVCommandChannel channel, bool ActivateField, bool LeaveFieldON, uint8_t *AID, size_t AIDLen, uint8_t *Result, size_t MaxResultLen, size_t *ResultLen, uint16_t *sw, struct tlvdb *tlv); +int EMVSearchPSE(EMVCommandChannel channel, bool ActivateField, bool LeaveFieldON, uint8_t PSENum, bool decodeTLV, struct tlvdb *tlv); +int EMVSearch(EMVCommandChannel channel, bool ActivateField, bool LeaveFieldON, bool decodeTLV, struct tlvdb *tlv); +int EMVSelectPSE(EMVCommandChannel channel, bool ActivateField, bool LeaveFieldON, uint8_t PSENum, uint8_t *Result, size_t MaxResultLen, size_t *ResultLen, uint16_t *sw); +int EMVSelect(EMVCommandChannel channel, bool ActivateField, bool LeaveFieldON, uint8_t *AID, size_t AIDLen, uint8_t *Result, size_t MaxResultLen, size_t *ResultLen, uint16_t *sw, struct tlvdb *tlv); // select application -extern int EMVSelectApplication(struct tlvdb *tlv, uint8_t *AID, size_t *AIDlen); +int EMVSelectApplication(struct tlvdb *tlv, uint8_t *AID, size_t *AIDlen); // Get Processing Options -extern int EMVGPO(EMVCommandChannel channel, bool LeaveFieldON, uint8_t *PDOL, size_t PDOLLen, uint8_t *Result, size_t MaxResultLen, size_t *ResultLen, uint16_t *sw, struct tlvdb *tlv); -extern int EMVReadRecord(EMVCommandChannel channel, bool LeaveFieldON, uint8_t SFI, uint8_t SFIrec, uint8_t *Result, size_t MaxResultLen, size_t *ResultLen, uint16_t *sw, struct tlvdb *tlv); +int EMVGPO(EMVCommandChannel channel, bool LeaveFieldON, uint8_t *PDOL, size_t PDOLLen, uint8_t *Result, size_t MaxResultLen, size_t *ResultLen, uint16_t *sw, struct tlvdb *tlv); +int EMVReadRecord(EMVCommandChannel channel, bool LeaveFieldON, uint8_t SFI, uint8_t SFIrec, uint8_t *Result, size_t MaxResultLen, size_t *ResultLen, uint16_t *sw, struct tlvdb *tlv); // AC -extern int EMVGenerateChallenge(EMVCommandChannel channel, bool LeaveFieldON, uint8_t *Result, size_t MaxResultLen, size_t *ResultLen, uint16_t *sw, struct tlvdb *tlv); -extern int EMVAC(EMVCommandChannel channel, bool LeaveFieldON, uint8_t RefControl, uint8_t *CDOL, size_t CDOLLen, uint8_t *Result, size_t MaxResultLen, size_t *ResultLen, uint16_t *sw, struct tlvdb *tlv); +int EMVGenerateChallenge(EMVCommandChannel channel, bool LeaveFieldON, uint8_t *Result, size_t MaxResultLen, size_t *ResultLen, uint16_t *sw, struct tlvdb *tlv); +int EMVAC(EMVCommandChannel channel, bool LeaveFieldON, uint8_t RefControl, uint8_t *CDOL, size_t CDOLLen, uint8_t *Result, size_t MaxResultLen, size_t *ResultLen, uint16_t *sw, struct tlvdb *tlv); // DDA -extern int EMVInternalAuthenticate(EMVCommandChannel channel, bool LeaveFieldON, uint8_t *DDOL, size_t DDOLLen, uint8_t *Result, size_t MaxResultLen, size_t *ResultLen, uint16_t *sw, struct tlvdb *tlv); +int EMVInternalAuthenticate(EMVCommandChannel channel, bool LeaveFieldON, uint8_t *DDOL, size_t DDOLLen, uint8_t *Result, size_t MaxResultLen, size_t *ResultLen, uint16_t *sw, struct tlvdb *tlv); // Mastercard int MSCComputeCryptoChecksum(EMVCommandChannel channel, bool LeaveFieldON, uint8_t *UDOL, uint8_t UDOLlen, uint8_t *Result, size_t MaxResultLen, size_t *ResultLen, uint16_t *sw, struct tlvdb *tlv); // Auth -extern int trSDA(struct tlvdb *tlv); -extern int trDDA(EMVCommandChannel channel, bool decodeTLV, struct tlvdb *tlv); -extern int trCDA(struct tlvdb *tlv, struct tlvdb *ac_tlv, struct tlv *pdol_data_tlv, struct tlv *ac_data_tlv); +int trSDA(struct tlvdb *tlv); +int trDDA(EMVCommandChannel channel, bool decodeTLV, struct tlvdb *tlv); +int trCDA(struct tlvdb *tlv, struct tlvdb *ac_tlv, struct tlv *pdol_data_tlv, struct tlv *ac_data_tlv); -extern int RecoveryCertificates(struct tlvdb *tlvRoot, json_t *root); +int RecoveryCertificates(struct tlvdb *tlvRoot, json_t *root); -extern struct emv_pk *get_ca_pk(struct tlvdb *db); +struct emv_pk *get_ca_pk(struct tlvdb *db); #endif diff --git a/client/emv/emvjson.h b/client/emv/emvjson.h index 18326083f..23cfba545 100644 --- a/client/emv/emvjson.h +++ b/client/emv/emvjson.h @@ -18,24 +18,24 @@ typedef struct { char *Name; } ApplicationDataElm; -extern char *GetApplicationDataName(tlv_tag_t tag); +char *GetApplicationDataName(tlv_tag_t tag); -extern int JsonSaveJsonObject(json_t *root, char *path, json_t *value); -extern int JsonSaveStr(json_t *root, char *path, char *value); -extern int JsonSaveInt(json_t *root, char *path, int value); -extern int JsonSaveBufAsHexCompact(json_t *elm, char *path, uint8_t *data, size_t datalen); -extern int JsonSaveBufAsHex(json_t *elm, char *path, uint8_t *data, size_t datalen); -extern int JsonSaveHex(json_t *elm, char *path, uint64_t data, int datalen); +int JsonSaveJsonObject(json_t *root, char *path, json_t *value); +int JsonSaveStr(json_t *root, char *path, char *value); +int JsonSaveInt(json_t *root, char *path, int value); +int JsonSaveBufAsHexCompact(json_t *elm, char *path, uint8_t *data, size_t datalen); +int JsonSaveBufAsHex(json_t *elm, char *path, uint8_t *data, size_t datalen); +int JsonSaveHex(json_t *elm, char *path, uint64_t data, int datalen); -extern int JsonSaveTLVValue(json_t *root, char *path, struct tlvdb *tlvdbelm); -extern int JsonSaveTLVElm(json_t *elm, char *path, struct tlv *tlvelm, bool saveName, bool saveValue, bool saveAppDataLink); -extern int JsonSaveTLVTreeElm(json_t *elm, char *path, struct tlvdb *tlvdbelm, bool saveName, bool saveValue, bool saveAppDataLink); +int JsonSaveTLVValue(json_t *root, char *path, struct tlvdb *tlvdbelm); +int JsonSaveTLVElm(json_t *elm, char *path, struct tlv *tlvelm, bool saveName, bool saveValue, bool saveAppDataLink); +int JsonSaveTLVTreeElm(json_t *elm, char *path, struct tlvdb *tlvdbelm, bool saveName, bool saveValue, bool saveAppDataLink); -extern int JsonSaveTLVTree(json_t *root, json_t *elm, char *path, struct tlvdb *tlvdbelm); +int JsonSaveTLVTree(json_t *root, json_t *elm, char *path, struct tlvdb *tlvdbelm); -extern int JsonLoadStr(json_t *root, char *path, char *value); -extern int JsonLoadBufAsHex(json_t *elm, char *path, uint8_t *data, size_t maxbufferlen, size_t *datalen); +int JsonLoadStr(json_t *root, char *path, char *value); +int JsonLoadBufAsHex(json_t *elm, char *path, uint8_t *data, size_t maxbufferlen, size_t *datalen); -extern bool ParamLoadFromJson(struct tlvdb *tlv); +bool ParamLoadFromJson(struct tlvdb *tlv); #endif diff --git a/client/emv/test/cda_test.h b/client/emv/test/cda_test.h index 8d80043cd..e535c2eee 100644 --- a/client/emv/test/cda_test.h +++ b/client/emv/test/cda_test.h @@ -15,4 +15,4 @@ #include -extern int exec_cda_test(bool verbose); +int exec_cda_test(bool verbose); diff --git a/client/emv/test/crypto_test.h b/client/emv/test/crypto_test.h index 04159c4f0..afc8a1515 100644 --- a/client/emv/test/crypto_test.h +++ b/client/emv/test/crypto_test.h @@ -15,4 +15,4 @@ #include -extern int exec_crypto_test(bool verbose); +int exec_crypto_test(bool verbose); diff --git a/client/emv/test/cryptotest.h b/client/emv/test/cryptotest.h index 5c6aaae2d..671de244e 100644 --- a/client/emv/test/cryptotest.h +++ b/client/emv/test/cryptotest.h @@ -10,4 +10,4 @@ #include -extern int ExecuteCryptoTests(bool verbose); +int ExecuteCryptoTests(bool verbose); diff --git a/client/emv/test/dda_test.h b/client/emv/test/dda_test.h index 1ae1a0660..34381938a 100644 --- a/client/emv/test/dda_test.h +++ b/client/emv/test/dda_test.h @@ -15,4 +15,4 @@ #include -extern int exec_dda_test(bool verbose); +int exec_dda_test(bool verbose); diff --git a/client/emv/test/sda_test.h b/client/emv/test/sda_test.h index 8d47aa9b3..696a17f9b 100644 --- a/client/emv/test/sda_test.h +++ b/client/emv/test/sda_test.h @@ -13,4 +13,4 @@ * Lesser General Public License for more details. */ -extern int exec_sda_test(bool verbose); +int exec_sda_test(bool verbose); diff --git a/client/fido/cbortools.h b/client/fido/cbortools.h index 1e3fa8c0f..d42506658 100644 --- a/client/fido/cbortools.h +++ b/client/fido/cbortools.h @@ -21,18 +21,18 @@ #define cbor_check_if(r) if ((r) != CborNoError) {return r;} else #define cbor_check(r) if ((r) != CborNoError) return r; -extern int TinyCborPrintFIDOPackage(uint8_t cmdCode, bool isResponse, uint8_t *data, size_t length); -extern int JsonToCbor(json_t *elm, CborEncoder *encoder); +int TinyCborPrintFIDOPackage(uint8_t cmdCode, bool isResponse, uint8_t *data, size_t length); +int JsonToCbor(json_t *elm, CborEncoder *encoder); -extern int CborMapGetKeyById(CborParser *parser, CborValue *map, uint8_t *data, size_t dataLen, int key); -extern CborError CborGetArrayBinStringValue(CborValue *elm, uint8_t *data, size_t maxdatalen, size_t *datalen); -extern CborError CborGetArrayBinStringValueEx(CborValue *elm, uint8_t *data, size_t maxdatalen, size_t *datalen, uint8_t *delimeter, size_t delimeterlen); -extern CborError CborGetBinStringValue(CborValue *elm, uint8_t *data, size_t maxdatalen, size_t *datalen); -extern CborError CborGetArrayStringValue(CborValue *elm, char *data, size_t maxdatalen, size_t *datalen, char *delimeter); -extern CborError CborGetStringValue(CborValue *elm, char *data, size_t maxdatalen, size_t *datalen); -extern CborError CborGetStringValueBuf(CborValue *elm); +int CborMapGetKeyById(CborParser *parser, CborValue *map, uint8_t *data, size_t dataLen, int key); +CborError CborGetArrayBinStringValue(CborValue *elm, uint8_t *data, size_t maxdatalen, size_t *datalen); +CborError CborGetArrayBinStringValueEx(CborValue *elm, uint8_t *data, size_t maxdatalen, size_t *datalen, uint8_t *delimeter, size_t delimeterlen); +CborError CborGetBinStringValue(CborValue *elm, uint8_t *data, size_t maxdatalen, size_t *datalen); +CborError CborGetArrayStringValue(CborValue *elm, char *data, size_t maxdatalen, size_t *datalen, char *delimeter); +CborError CborGetStringValue(CborValue *elm, char *data, size_t maxdatalen, size_t *datalen); +CborError CborGetStringValueBuf(CborValue *elm); -extern int CBOREncodeElm(json_t *root, char *rootElmId, CborEncoder *encoder); -extern CborError CBOREncodeClientDataHash(json_t *root, CborEncoder *encoder); +int CBOREncodeElm(json_t *root, char *rootElmId, CborEncoder *encoder); +CborError CBOREncodeClientDataHash(json_t *root, CborEncoder *encoder); #endif /* __CBORTOOLS_H__ */ diff --git a/client/fido/cose.h b/client/fido/cose.h index 850652fc4..f8f28aabf 100644 --- a/client/fido/cose.h +++ b/client/fido/cose.h @@ -17,11 +17,11 @@ #include #include -extern const char *GetCOSEAlgName(int id); -extern const char *GetCOSEAlgDescription(int id); -extern const char *GetCOSEktyDescription(int id); -extern const char *GetCOSECurveDescription(int id); +const char *GetCOSEAlgName(int id); +const char *GetCOSEAlgDescription(int id); +const char *GetCOSEktyDescription(int id); +const char *GetCOSECurveDescription(int id); -extern int COSEGetECDSAKey(uint8_t *data, size_t datalen, bool verbose, uint8_t *public_key); +int COSEGetECDSAKey(uint8_t *data, size_t datalen, bool verbose, uint8_t *public_key); #endif /* __COSE_H__ */ diff --git a/client/fido/fidocore.h b/client/fido/fidocore.h index 60923a44b..676dd2646 100644 --- a/client/fido/fidocore.h +++ b/client/fido/fidocore.h @@ -35,23 +35,23 @@ typedef enum { ptResponse, } fido2PacketType; -extern int FIDOSelect(bool ActivateField, bool LeaveFieldON, uint8_t *Result, size_t MaxResultLen, size_t *ResultLen, uint16_t *sw); -extern int FIDOExchange(sAPDU apdu, uint8_t *Result, size_t MaxResultLen, size_t *ResultLen, uint16_t *sw); -extern int FIDORegister(uint8_t *params, uint8_t *Result, size_t MaxResultLen, size_t *ResultLen, uint16_t *sw); -extern int FIDOAuthentication(uint8_t *params, uint8_t paramslen, uint8_t controlb, uint8_t *Result, size_t MaxResultLen, size_t *ResultLen, uint16_t *sw); -extern int FIDO2GetInfo(uint8_t *Result, size_t MaxResultLen, size_t *ResultLen, uint16_t *sw); -extern int FIDO2MakeCredential(uint8_t *params, uint8_t paramslen, uint8_t *Result, size_t MaxResultLen, size_t *ResultLen, uint16_t *sw); -extern int FIDO2GetAssertion(uint8_t *params, uint8_t paramslen, uint8_t *Result, size_t MaxResultLen, size_t *ResultLen, uint16_t *sw); +int FIDOSelect(bool ActivateField, bool LeaveFieldON, uint8_t *Result, size_t MaxResultLen, size_t *ResultLen, uint16_t *sw); +int FIDOExchange(sAPDU apdu, uint8_t *Result, size_t MaxResultLen, size_t *ResultLen, uint16_t *sw); +int FIDORegister(uint8_t *params, uint8_t *Result, size_t MaxResultLen, size_t *ResultLen, uint16_t *sw); +int FIDOAuthentication(uint8_t *params, uint8_t paramslen, uint8_t controlb, uint8_t *Result, size_t MaxResultLen, size_t *ResultLen, uint16_t *sw); +int FIDO2GetInfo(uint8_t *Result, size_t MaxResultLen, size_t *ResultLen, uint16_t *sw); +int FIDO2MakeCredential(uint8_t *params, uint8_t paramslen, uint8_t *Result, size_t MaxResultLen, size_t *ResultLen, uint16_t *sw); +int FIDO2GetAssertion(uint8_t *params, uint8_t paramslen, uint8_t *Result, size_t MaxResultLen, size_t *ResultLen, uint16_t *sw); -extern int FIDOCheckDERAndGetKey(uint8_t *der, size_t derLen, bool verbose, uint8_t *publicKey, size_t publicKeyMaxLen); +int FIDOCheckDERAndGetKey(uint8_t *der, size_t derLen, bool verbose, uint8_t *publicKey, size_t publicKeyMaxLen); -extern char *fido2GetCmdMemberDescription(uint8_t cmdCode, bool isResponse, int memberNum); -extern char *fido2GetCmdErrorDescription(uint8_t errorCode); +char *fido2GetCmdMemberDescription(uint8_t cmdCode, bool isResponse, int memberNum); +char *fido2GetCmdErrorDescription(uint8_t errorCode); -extern bool CheckrpIdHash(json_t *json, uint8_t *hash); -extern int FIDO2CreateMakeCredentionalReq(json_t *root, uint8_t *data, size_t maxdatalen, size_t *datalen); -extern int FIDO2MakeCredentionalParseRes(json_t *root, uint8_t *data, size_t dataLen, bool verbose, bool verbose2, bool showCBOR, bool showDERTLV); -extern int FIDO2CreateGetAssertionReq(json_t *root, uint8_t *data, size_t maxdatalen, size_t *datalen, bool createAllowList); -extern int FIDO2GetAssertionParseRes(json_t *root, uint8_t *data, size_t dataLen, bool verbose, bool verbose2, bool showCBOR); +bool CheckrpIdHash(json_t *json, uint8_t *hash); +int FIDO2CreateMakeCredentionalReq(json_t *root, uint8_t *data, size_t maxdatalen, size_t *datalen); +int FIDO2MakeCredentionalParseRes(json_t *root, uint8_t *data, size_t dataLen, bool verbose, bool verbose2, bool showCBOR, bool showDERTLV); +int FIDO2CreateGetAssertionReq(json_t *root, uint8_t *data, size_t maxdatalen, size_t *datalen, bool createAllowList); +int FIDO2GetAssertionParseRes(json_t *root, uint8_t *data, size_t dataLen, bool verbose, bool verbose2, bool showCBOR); #endif /* __FIDOCORE_H__ */ diff --git a/client/hardnested/hardnested_bf_core.h b/client/hardnested/hardnested_bf_core.h index bd0e83c68..4f481cbc8 100644 --- a/client/hardnested/hardnested_bf_core.h +++ b/client/hardnested/hardnested_bf_core.h @@ -61,10 +61,10 @@ typedef enum { SIMD_MMX, SIMD_NONE, } SIMDExecInstr; -extern void SetSIMDInstr(SIMDExecInstr instr); -extern SIMDExecInstr GetSIMDInstrAuto(); +void SetSIMDInstr(SIMDExecInstr instr); +SIMDExecInstr GetSIMDInstrAuto(); -extern const uint64_t crack_states_bitsliced(uint32_t cuid, uint8_t *best_first_bytes, statelist_t *p, uint32_t *keys_found, uint64_t *num_keys_tested, uint32_t nonces_to_bruteforce, uint8_t *bf_test_nonces_2nd_byte, noncelist_t *nonces); -extern void bitslice_test_nonces(uint32_t nonces_to_bruteforce, uint32_t *bf_test_nonces, uint8_t *bf_test_nonce_par); +const uint64_t crack_states_bitsliced(uint32_t cuid, uint8_t *best_first_bytes, statelist_t *p, uint32_t *keys_found, uint64_t *num_keys_tested, uint32_t nonces_to_bruteforce, uint8_t *bf_test_nonces_2nd_byte, noncelist_t *nonces); +void bitslice_test_nonces(uint32_t nonces_to_bruteforce, uint32_t *bf_test_nonces, uint8_t *bf_test_nonce_par); #endif diff --git a/client/hardnested/hardnested_bitarray_core.h b/client/hardnested/hardnested_bitarray_core.h index b12fcf89d..91515b57f 100644 --- a/client/hardnested/hardnested_bitarray_core.h +++ b/client/hardnested/hardnested_bitarray_core.h @@ -52,18 +52,18 @@ THE SOFTWARE. #include -extern uint32_t *malloc_bitarray(uint32_t x); -extern void free_bitarray(uint32_t *x); -extern uint32_t bitcount(uint32_t a); -extern uint32_t count_states(uint32_t *A); -extern void bitarray_AND(uint32_t *A, uint32_t *B); -extern void bitarray_low20_AND(uint32_t *A, uint32_t *B); -extern uint32_t count_bitarray_AND(uint32_t *A, uint32_t *B); -extern uint32_t count_bitarray_low20_AND(uint32_t *A, uint32_t *B); -extern void bitarray_AND4(uint32_t *A, uint32_t *B, uint32_t *C, uint32_t *D); -extern void bitarray_OR(uint32_t *A, uint32_t *B); -extern uint32_t count_bitarray_AND2(uint32_t *A, uint32_t *B); -extern uint32_t count_bitarray_AND3(uint32_t *A, uint32_t *B, uint32_t *C); -extern uint32_t count_bitarray_AND4(uint32_t *A, uint32_t *B, uint32_t *C, uint32_t *D); +uint32_t *malloc_bitarray(uint32_t x); +void free_bitarray(uint32_t *x); +uint32_t bitcount(uint32_t a); +uint32_t count_states(uint32_t *A); +void bitarray_AND(uint32_t *A, uint32_t *B); +void bitarray_low20_AND(uint32_t *A, uint32_t *B); +uint32_t count_bitarray_AND(uint32_t *A, uint32_t *B); +uint32_t count_bitarray_low20_AND(uint32_t *A, uint32_t *B); +void bitarray_AND4(uint32_t *A, uint32_t *B, uint32_t *C, uint32_t *D); +void bitarray_OR(uint32_t *A, uint32_t *B); +uint32_t count_bitarray_AND2(uint32_t *A, uint32_t *B); +uint32_t count_bitarray_AND3(uint32_t *A, uint32_t *B, uint32_t *C); +uint32_t count_bitarray_AND4(uint32_t *A, uint32_t *B, uint32_t *C, uint32_t *D); #endif diff --git a/client/hardnested/hardnested_bruteforce.h b/client/hardnested/hardnested_bruteforce.h index c104e69ac..180e537d8 100644 --- a/client/hardnested/hardnested_bruteforce.h +++ b/client/hardnested/hardnested_bruteforce.h @@ -27,10 +27,10 @@ typedef struct { void *next; } statelist_t; -extern void prepare_bf_test_nonces(noncelist_t *nonces, uint8_t best_first_byte); -extern bool brute_force_bs(float *bf_rate, statelist_t *candidates, uint32_t cuid, uint32_t num_acquired_nonces, uint64_t maximum_states, noncelist_t *nonces, uint8_t *best_first_bytes, uint64_t *found_key); -extern float brute_force_benchmark(); -extern uint8_t trailing_zeros(uint8_t byte); -extern bool verify_key(uint32_t cuid, noncelist_t *nonces, uint8_t *best_first_bytes, uint32_t odd, uint32_t even); +void prepare_bf_test_nonces(noncelist_t *nonces, uint8_t best_first_byte); +bool brute_force_bs(float *bf_rate, statelist_t *candidates, uint32_t cuid, uint32_t num_acquired_nonces, uint64_t maximum_states, noncelist_t *nonces, uint8_t *best_first_bytes, uint64_t *found_key); +float brute_force_benchmark(); +uint8_t trailing_zeros(uint8_t byte); +bool verify_key(uint32_t cuid, noncelist_t *nonces, uint8_t *best_first_bytes, uint32_t odd, uint32_t even); #endif diff --git a/client/loclass/fileutils.h b/client/loclass/fileutils.h index 7b358331a..ddc906725 100644 --- a/client/loclass/fileutils.h +++ b/client/loclass/fileutils.h @@ -75,7 +75,7 @@ int fileExists(const char *filename); * @param datalen the length of the data * @return 0 for ok, 1 for failz */ -extern int saveFile(const char *preferredName, const char *suffix, const void *data, size_t datalen); +int saveFile(const char *preferredName, const char *suffix, const void *data, size_t datalen); /** * @brief Utility function to save data to a textfile (EML). This method takes a preferred name, but if that @@ -89,7 +89,7 @@ extern int saveFile(const char *preferredName, const char *suffix, const void *d * @param blocksize the length of one row * @return 0 for ok, 1 for failz */ -extern int saveFileEML(const char *preferredName, const char *suffix, uint8_t *data, size_t datalen, size_t blocksize); +int saveFileEML(const char *preferredName, const char *suffix, uint8_t *data, size_t datalen, size_t blocksize); /** STUB * @brief Utility function to save JSON data to a file. This method takes a preferred name, but if that @@ -103,7 +103,7 @@ extern int saveFileEML(const char *preferredName, const char *suffix, uint8_t *d * @param datalen the length of the data * @return 0 for ok, 1 for failz */ -extern int saveFileJSON(const char *preferredName, const char *suffix, JSONFileType ftype, uint8_t *data, size_t datalen); +int saveFileJSON(const char *preferredName, const char *suffix, JSONFileType ftype, uint8_t *data, size_t datalen); /** STUB * @brief Utility function to load data from a binary file. This method takes a preferred name. @@ -116,7 +116,7 @@ extern int saveFileJSON(const char *preferredName, const char *suffix, JSONFileT * @param datalen the number of bytes loaded from file * @return 0 for ok, 1 for failz */ -extern int loadFile(const char *preferredName, const char *suffix, void *data, size_t maxdatalen, size_t *datalen); +int loadFile(const char *preferredName, const char *suffix, void *data, size_t maxdatalen, size_t *datalen); /** * @brief Utility function to load data from a textfile (EML). This method takes a preferred name. @@ -128,7 +128,7 @@ extern int loadFile(const char *preferredName, const char *suffix, void *data, s * @param datalen the number of bytes loaded from file * @return 0 for ok, 1 for failz */ -extern int loadFileEML(const char *preferredName, const char *suffix, void *data, size_t *datalen); +int loadFileEML(const char *preferredName, const char *suffix, void *data, size_t *datalen); /** * @brief Utility function to load data from a JSON textfile. This method takes a preferred name. @@ -141,7 +141,7 @@ extern int loadFileEML(const char *preferredName, const char *suffix, void *data * @param datalen the number of bytes loaded from file * @return 0 for ok, 1 for failz */ -extern int loadFileJSON(const char *preferredName, const char *suffix, void *data, size_t maxdatalen, size_t *datalen); +int loadFileJSON(const char *preferredName, const char *suffix, void *data, size_t maxdatalen, size_t *datalen); /** @@ -156,7 +156,7 @@ extern int loadFileJSON(const char *preferredName, const char *suffix, void *dat * @param keylen the number of bytes a key per row is * @return 0 for ok, 1 for failz */ -extern int loadFileDICTIONARY(const char *preferredName, const char *suffix, void *data, size_t *datalen, uint8_t keylen, uint16_t *keycnt); +int loadFileDICTIONARY(const char *preferredName, const char *suffix, void *data, size_t *datalen, uint8_t keylen, uint16_t *keycnt); #define PrintAndLogDevice(level, format, args...) PrintAndLogEx(level, format , ## args) #else diff --git a/client/loclass/hash1_brute.h b/client/loclass/hash1_brute.h index 4debebd0d..b26ad96d1 100644 --- a/client/loclass/hash1_brute.h +++ b/client/loclass/hash1_brute.h @@ -1,5 +1,5 @@ #ifndef HASH1_BRUTE_H #define HASH1_BRUTE_H -extern void brute_hash1(); +void brute_hash1(); #endif // HASH1_BRUTE_H diff --git a/client/mifare/mad.h b/client/mifare/mad.h index 89fcd795c..d1028e06a 100644 --- a/client/mifare/mad.h +++ b/client/mifare/mad.h @@ -20,10 +20,10 @@ typedef struct { const char *Description; } madAIDDescr; -extern int MADCheck(uint8_t *sector0, uint8_t *sector10, bool verbose, bool *haveMAD2); -extern int MADDecode(uint8_t *sector0, uint8_t *sector10, uint16_t *mad, size_t *madlen); -extern int MAD1DecodeAndPrint(uint8_t *sector, bool verbose, bool *haveMAD2); -extern int MAD2DecodeAndPrint(uint8_t *sector, bool verbose); +int MADCheck(uint8_t *sector0, uint8_t *sector10, bool verbose, bool *haveMAD2); +int MADDecode(uint8_t *sector0, uint8_t *sector10, uint16_t *mad, size_t *madlen); +int MAD1DecodeAndPrint(uint8_t *sector, bool verbose, bool *haveMAD2); +int MAD2DecodeAndPrint(uint8_t *sector, bool verbose); #endif // _MAD_H_ diff --git a/client/mifare/mfkey.h b/client/mifare/mfkey.h index 0f8ba8069..4af5175a1 100644 --- a/client/mifare/mfkey.h +++ b/client/mifare/mfkey.h @@ -19,12 +19,12 @@ #include "mifare.h" #include "crapto1/crapto1.h" -extern uint32_t nonce2key(uint32_t uid, uint32_t nt, uint32_t nr, uint32_t ar, uint64_t par_info, uint64_t ks_info, uint64_t **keys); -extern bool mfkey32(nonces_t data, uint64_t *outputkey); -extern bool mfkey32_moebius(nonces_t data, uint64_t *outputkey); -extern int mfkey64(nonces_t data, uint64_t *outputkey); +uint32_t nonce2key(uint32_t uid, uint32_t nt, uint32_t nr, uint32_t ar, uint64_t par_info, uint64_t ks_info, uint64_t **keys); +bool mfkey32(nonces_t data, uint64_t *outputkey); +bool mfkey32_moebius(nonces_t data, uint64_t *outputkey); +int mfkey64(nonces_t data, uint64_t *outputkey); -extern int compare_uint64(const void *a, const void *b); -extern uint32_t intersection(uint64_t *listA, uint64_t *listB); +int compare_uint64(const void *a, const void *b); +uint32_t intersection(uint64_t *listA, uint64_t *listB); #endif diff --git a/client/mifare/mifare4.h b/client/mifare/mifare4.h index e33e69fd2..d403bdd94 100644 --- a/client/mifare/mifare4.h +++ b/client/mifare/mifare4.h @@ -43,25 +43,25 @@ typedef struct { char *description; } AccessConditions_t; -extern void mfpSetVerboseMode(bool verbose); -extern const char *mfpGetErrorDescription(uint8_t errorCode); +void mfpSetVerboseMode(bool verbose); +const char *mfpGetErrorDescription(uint8_t errorCode); -extern int CalculateMAC(mf4Session *session, MACType_t mtype, uint8_t blockNum, uint8_t blockCount, uint8_t *data, int datalen, uint8_t *mac, bool verbose); -extern int MifareAuth4(mf4Session *session, uint8_t *keyn, uint8_t *key, bool activateField, bool leaveSignalON, bool verbose); +int CalculateMAC(mf4Session *session, MACType_t mtype, uint8_t blockNum, uint8_t blockCount, uint8_t *data, int datalen, uint8_t *mac, bool verbose); +int MifareAuth4(mf4Session *session, uint8_t *keyn, uint8_t *key, bool activateField, bool leaveSignalON, bool verbose); -extern int MFPWritePerso(uint8_t *keyNum, uint8_t *key, bool activateField, bool leaveSignalON, uint8_t *dataout, int maxdataoutlen, int *dataoutlen); -extern int MFPCommitPerso(bool activateField, bool leaveSignalON, uint8_t *dataout, int maxdataoutlen, int *dataoutlen); -extern int MFPReadBlock(mf4Session *session, bool plain, uint8_t blockNum, uint8_t blockCount, bool activateField, bool leaveSignalON, uint8_t *dataout, int maxdataoutlen, int *dataoutlen, uint8_t *mac); -extern int MFPWriteBlock(mf4Session *session, uint8_t blockNum, uint8_t *data, bool activateField, bool leaveSignalON, uint8_t *dataout, int maxdataoutlen, int *dataoutlen, uint8_t *mac); -extern int mfpReadSector(uint8_t sectorNo, uint8_t keyType, uint8_t *key, uint8_t *dataout, bool verbose); +int MFPWritePerso(uint8_t *keyNum, uint8_t *key, bool activateField, bool leaveSignalON, uint8_t *dataout, int maxdataoutlen, int *dataoutlen); +int MFPCommitPerso(bool activateField, bool leaveSignalON, uint8_t *dataout, int maxdataoutlen, int *dataoutlen); +int MFPReadBlock(mf4Session *session, bool plain, uint8_t blockNum, uint8_t blockCount, bool activateField, bool leaveSignalON, uint8_t *dataout, int maxdataoutlen, int *dataoutlen, uint8_t *mac); +int MFPWriteBlock(mf4Session *session, uint8_t blockNum, uint8_t *data, bool activateField, bool leaveSignalON, uint8_t *dataout, int maxdataoutlen, int *dataoutlen, uint8_t *mac); +int mfpReadSector(uint8_t sectorNo, uint8_t keyType, uint8_t *key, uint8_t *dataout, bool verbose); -extern char *mfGetAccessConditionsDesc(uint8_t blockn, uint8_t *data); +char *mfGetAccessConditionsDesc(uint8_t blockn, uint8_t *data); -extern uint8_t mfNumBlocksPerSector(uint8_t sectorNo); -extern uint8_t mfFirstBlockOfSector(uint8_t sectorNo); -extern uint8_t mfSectorTrailer(uint8_t blockNo); -extern bool mfIsSectorTrailer(uint8_t blockNo); -extern uint8_t mfSectorNum(uint8_t blockNo); +uint8_t mfNumBlocksPerSector(uint8_t sectorNo); +uint8_t mfFirstBlockOfSector(uint8_t sectorNo); +uint8_t mfSectorTrailer(uint8_t blockNo); +bool mfIsSectorTrailer(uint8_t blockNo); +uint8_t mfSectorNum(uint8_t blockNo); #endif // mifare4.h diff --git a/client/mifare/mifarehost.h b/client/mifare/mifarehost.h index 7481647ad..81e0e8f03 100644 --- a/client/mifare/mifarehost.h +++ b/client/mifare/mifarehost.h @@ -69,35 +69,35 @@ typedef struct { extern char logHexFileName[FILE_PATH_SIZE]; -extern int mfDarkside(uint8_t blockno, uint8_t key_type, uint64_t *key); -extern int mfnested(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_t trgBlockNo, uint8_t trgKeyType, uint8_t *resultKeys, bool calibrate); -extern int mfCheckKeys(uint8_t blockNo, uint8_t keyType, bool clear_trace, uint8_t keycnt, uint8_t *keyBlock, uint64_t *key); -extern int mfCheckKeys_fast(uint8_t sectorsCnt, uint8_t firstChunk, uint8_t lastChunk, - uint8_t strategy, uint32_t size, uint8_t *keyBlock, sector_t *e_sector, bool use_flashmemory); -extern int mfKeyBrute(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint64_t *resultkey); +int mfDarkside(uint8_t blockno, uint8_t key_type, uint64_t *key); +int mfnested(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_t trgBlockNo, uint8_t trgKeyType, uint8_t *resultKeys, bool calibrate); +int mfCheckKeys(uint8_t blockNo, uint8_t keyType, bool clear_trace, uint8_t keycnt, uint8_t *keyBlock, uint64_t *key); +int mfCheckKeys_fast(uint8_t sectorsCnt, uint8_t firstChunk, uint8_t lastChunk, + uint8_t strategy, uint32_t size, uint8_t *keyBlock, sector_t *e_sector, bool use_flashmemory); +int mfKeyBrute(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint64_t *resultkey); -extern int mfReadSector(uint8_t sectorNo, uint8_t keyType, uint8_t *key, uint8_t *data); +int mfReadSector(uint8_t sectorNo, uint8_t keyType, uint8_t *key, uint8_t *data); -extern int mfEmlGetMem(uint8_t *data, int blockNum, int blocksCount); -extern int mfEmlSetMem(uint8_t *data, int blockNum, int blocksCount); -extern int mfEmlSetMem_xt(uint8_t *data, int blockNum, int blocksCount, int blockBtWidth); +int mfEmlGetMem(uint8_t *data, int blockNum, int blocksCount); +int mfEmlSetMem(uint8_t *data, int blockNum, int blocksCount); +int mfEmlSetMem_xt(uint8_t *data, int blockNum, int blocksCount, int blockBtWidth); -extern int mfCSetUID(uint8_t *uid, uint8_t *atqa, uint8_t *sak, uint8_t *oldUID, uint8_t wipecard); -extern int mfCSetBlock(uint8_t blockNo, uint8_t *data, uint8_t *uid, uint8_t params); -extern int mfCGetBlock(uint8_t blockNo, uint8_t *data, uint8_t params); +int mfCSetUID(uint8_t *uid, uint8_t *atqa, uint8_t *sak, uint8_t *oldUID, uint8_t wipecard); +int mfCSetBlock(uint8_t blockNo, uint8_t *data, uint8_t *uid, uint8_t params); +int mfCGetBlock(uint8_t blockNo, uint8_t *data, uint8_t params); -extern int mfTraceInit(uint8_t *tuid, uint8_t uidlen, uint8_t *atqa, uint8_t sak, bool wantSaveToEmlFile); -extern int mfTraceDecode(uint8_t *data_src, int len, bool wantSaveToEmlFile); +int mfTraceInit(uint8_t *tuid, uint8_t uidlen, uint8_t *atqa, uint8_t sak, bool wantSaveToEmlFile); +int mfTraceDecode(uint8_t *data_src, int len, bool wantSaveToEmlFile); -extern int isTraceCardEmpty(void); -extern int isBlockEmpty(int blockN); -extern int isBlockTrailer(int blockN); -extern int loadTraceCard(uint8_t *tuid, uint8_t uidlen); -extern int saveTraceCard(void); -extern int tryDecryptWord(uint32_t nt, uint32_t ar_enc, uint32_t at_enc, uint8_t *data, int len); +int isTraceCardEmpty(void); +int isBlockEmpty(int blockN); +int isBlockTrailer(int blockN); +int loadTraceCard(uint8_t *tuid, uint8_t uidlen); +int saveTraceCard(void); +int tryDecryptWord(uint32_t nt, uint32_t ar_enc, uint32_t at_enc, uint8_t *data, int len); -extern int detect_classic_prng(void); -extern int detect_classic_nackbug(bool verbose); -extern void detect_classic_magic(void); -extern void mf_crypto1_decrypt(struct Crypto1State *pcs, uint8_t *data, int len, bool isEncrypted); +int detect_classic_prng(void); +int detect_classic_nackbug(bool verbose); +void detect_classic_magic(void); +void mf_crypto1_decrypt(struct Crypto1State *pcs, uint8_t *data, int len, bool isEncrypted); #endif diff --git a/client/mifare/ndef.h b/client/mifare/ndef.h index 1130ebba7..1737a6082 100644 --- a/client/mifare/ndef.h +++ b/client/mifare/ndef.h @@ -57,6 +57,6 @@ typedef struct { uint8_t *ID; } NDEFHeader_t; -extern int NDEFDecodeAndPrint(uint8_t *ndef, size_t ndefLen, bool verbose); +int NDEFDecodeAndPrint(uint8_t *ndef, size_t ndefLen, bool verbose); #endif // _NDEF_H_ diff --git a/client/proxgui.h b/client/proxgui.h index ada09d838..0d43e7823 100644 --- a/client/proxgui.h +++ b/client/proxgui.h @@ -35,7 +35,7 @@ extern int offline; extern bool GridLocked; //Operations defined in data_operations -//extern int autoCorr(const int* in, int *out, size_t len, int window); +//int autoCorr(const int* in, int *out, size_t len, int window); int AskEdgeDetect(const int *in, int *out, int len, int threshold); int AutoCorrelate(const int *in, int *out, size_t len, int window, bool SaveGrph, bool verbose); int directionalThreshold(const int *in, int *out, size_t len, int8_t up, int8_t down); diff --git a/client/reveng/reveng.h b/client/reveng/reveng.h index 110b3f620..59a5f901a 100644 --- a/client/reveng/reveng.h +++ b/client/reveng/reveng.h @@ -99,7 +99,7 @@ typedef BMP_T bmp_t; extern int bmpbit, bmpsub; -extern void setbmp(void); +void setbmp(void); /* poly.c */ #define P_REFIN 1 @@ -139,41 +139,41 @@ typedef struct { /* left-justified in each word */ } poly_t; -extern poly_t filtop(FILE *input, unsigned long length, int flags, int bperhx); -extern poly_t strtop(const char *string, int flags, int bperhx); -extern char *ptostr(const poly_t poly, int flags, int bperhx); -extern char *pxsubs(const poly_t poly, int flags, int bperhx, unsigned long start, unsigned long end); -extern poly_t pclone(const poly_t poly); -extern void pcpy(poly_t *dest, const poly_t src); -extern void pcanon(poly_t *poly); -extern void pnorm(poly_t *poly); -extern void psnorm(poly_t *poly); -extern void pchop(poly_t *poly); -extern void pkchop(poly_t *poly); -extern unsigned long plen(const poly_t poly); -extern int pcmp(const poly_t *a, const poly_t *b); -extern int psncmp(const poly_t *a, const poly_t *b); -extern int ptst(const poly_t poly); -extern unsigned long pfirst(const poly_t poly); -extern unsigned long plast(const poly_t poly); -extern poly_t psubs(const poly_t src, unsigned long head, unsigned long start, unsigned long end, unsigned long tail); -extern void pright(poly_t *poly, unsigned long length); -extern void pshift(poly_t *dest, const poly_t src, unsigned long head, unsigned long start, unsigned long end, unsigned long tail); -extern void ppaste(poly_t *dest, const poly_t src, unsigned long skip, unsigned long seek, unsigned long end, unsigned long fulllength); -extern void pdiff(poly_t *dest, const poly_t src, unsigned long ofs); -extern void psum(poly_t *dest, const poly_t src, unsigned long ofs); -extern void prev(poly_t *poly); -extern void prevch(poly_t *poly, int bperhx); -extern void prcp(poly_t *poly); -extern void pinv(poly_t *poly); -extern poly_t pmod(const poly_t dividend, const poly_t divisor); -extern poly_t pcrc(const poly_t message, const poly_t divisor, const poly_t init, const poly_t xorout, int flags); -extern int piter(poly_t *poly); -extern void palloc(poly_t *poly, unsigned long length); -extern void pfree(poly_t *poly); -extern void praloc(poly_t *poly, unsigned long length); -extern int pmpar(const poly_t poly, const poly_t mask); -extern int pident(const poly_t a, const poly_t b); +poly_t filtop(FILE *input, unsigned long length, int flags, int bperhx); +poly_t strtop(const char *string, int flags, int bperhx); +char *ptostr(const poly_t poly, int flags, int bperhx); +char *pxsubs(const poly_t poly, int flags, int bperhx, unsigned long start, unsigned long end); +poly_t pclone(const poly_t poly); +void pcpy(poly_t *dest, const poly_t src); +void pcanon(poly_t *poly); +void pnorm(poly_t *poly); +void psnorm(poly_t *poly); +void pchop(poly_t *poly); +void pkchop(poly_t *poly); +unsigned long plen(const poly_t poly); +int pcmp(const poly_t *a, const poly_t *b); +int psncmp(const poly_t *a, const poly_t *b); +int ptst(const poly_t poly); +unsigned long pfirst(const poly_t poly); +unsigned long plast(const poly_t poly); +poly_t psubs(const poly_t src, unsigned long head, unsigned long start, unsigned long end, unsigned long tail); +void pright(poly_t *poly, unsigned long length); +void pshift(poly_t *dest, const poly_t src, unsigned long head, unsigned long start, unsigned long end, unsigned long tail); +void ppaste(poly_t *dest, const poly_t src, unsigned long skip, unsigned long seek, unsigned long end, unsigned long fulllength); +void pdiff(poly_t *dest, const poly_t src, unsigned long ofs); +void psum(poly_t *dest, const poly_t src, unsigned long ofs); +void prev(poly_t *poly); +void prevch(poly_t *poly, int bperhx); +void prcp(poly_t *poly); +void pinv(poly_t *poly); +poly_t pmod(const poly_t dividend, const poly_t divisor); +poly_t pcrc(const poly_t message, const poly_t divisor, const poly_t init, const poly_t xorout, int flags); +int piter(poly_t *poly); +void palloc(poly_t *poly, unsigned long length); +void pfree(poly_t *poly); +void praloc(poly_t *poly, unsigned long length); +int pmpar(const poly_t poly, const poly_t mask); +int pident(const poly_t a, const poly_t b); /* model.c */ @@ -190,23 +190,23 @@ typedef struct { const char *name; /* optional canonical name of the model */ } model_t; -extern void mcpy(model_t *dest, const model_t *src); -extern void mfree(model_t *model); -extern int mcmp(const model_t *a, const model_t *b); -extern char *mtostr(const model_t *model); -extern void mcanon(model_t *model); -extern void mcheck(model_t *model); -extern void mrev(model_t *model); -extern void mnovel(model_t *model); +void mcpy(model_t *dest, const model_t *src); +void mfree(model_t *model); +int mcmp(const model_t *a, const model_t *b); +char *mtostr(const model_t *model); +void mcanon(model_t *model); +void mcheck(model_t *model); +void mrev(model_t *model); +void mnovel(model_t *model); /* preset.c */ #define M_OVERWR 1 -extern int mbynam(model_t *dest, const char *key); -extern void mbynum(model_t *dest, int num); -extern int mcount(void); -extern char *mnames(void); -extern void mmatch(model_t *model, int flags); +int mbynam(model_t *dest, const char *key); +void mbynum(model_t *dest, int num); +int mcount(void); +char *mnames(void); +void mmatch(model_t *model, int flags); /* reveng.c */ #define R_HAVEP 1 @@ -218,7 +218,7 @@ extern void mmatch(model_t *model, int flags); #define R_SPMASK 0x7FFFFFFUL -extern model_t *reveng(const model_t *guess, const poly_t qpoly, int rflags, int args, const poly_t *argpolys); +model_t *reveng(const model_t *guess, const poly_t qpoly, int rflags, int args, const poly_t *argpolys); /* cli.c */ #define C_INFILE 1 @@ -228,9 +228,9 @@ extern model_t *reveng(const model_t *guess, const poly_t qpoly, int rflags, int #define BUFFER 32768 -extern int reveng_main(int argc, char *argv[]); -extern void ufound(const model_t *model); -extern void uerror(const char *msg); -extern void uprog(const poly_t gpoly, int flags, unsigned long seq); +int reveng_main(int argc, char *argv[]); +void ufound(const model_t *model); +void uerror(const char *msg); +void uprog(const poly_t gpoly, int flags, unsigned long seq); #endif /* REVENG_H */