use more static and fix [-Wmissing-prototypes], ongoing...
This commit is contained in:
@@ -259,7 +259,7 @@ const APDUCode APDUCodeTable[] = {
|
||||
};
|
||||
const size_t APDUCodeTableLen = sizeof(APDUCodeTable) / sizeof(APDUCode);
|
||||
|
||||
int CodeCmp(const char *code1, const char *code2) {
|
||||
static int CodeCmp(const char *code1, const char *code2) {
|
||||
int xsymb = 0;
|
||||
int cmp = 0;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
static int CmdHelp(const char *Cmd);
|
||||
|
||||
#define TLV_ADD(tag, value)( tlvdb_change_or_add_node(tlvRoot, tag, sizeof(value) - 1, (const unsigned char *)value) )
|
||||
void ParamLoadDefaults(struct tlvdb *tlvRoot) {
|
||||
static void ParamLoadDefaults(struct tlvdb *tlvRoot) {
|
||||
//9F02:(Amount, authorized (Numeric)) len:6
|
||||
TLV_ADD(0x9F02, "\x00\x00\x00\x00\x01\x00");
|
||||
//9F1A:(Terminal Country Code) len:2
|
||||
@@ -43,7 +43,7 @@ void ParamLoadDefaults(struct tlvdb *tlvRoot) {
|
||||
TLV_ADD(0x95, "\x00\x00\x00\x00\x00");
|
||||
}
|
||||
|
||||
void PrintChannel(EMVCommandChannel channel) {
|
||||
static void PrintChannel(EMVCommandChannel channel) {
|
||||
switch (channel) {
|
||||
case ECC_CONTACTLESS:
|
||||
PrintAndLogEx(INFO, "Channel: CONTACTLESS");
|
||||
@@ -642,7 +642,7 @@ static int CmdEMVInternalAuthenticate(const char *Cmd) {
|
||||
|
||||
#define dreturn(n) {free(pdol_data_tlv); tlvdb_free(tlvSelect); tlvdb_free(tlvRoot); DropFieldEx( channel ); return n;}
|
||||
|
||||
void InitTransactionParameters(struct tlvdb *tlvRoot, bool paramLoadJSON, enum TransactionType TrType, bool GenACGPO) {
|
||||
static void InitTransactionParameters(struct tlvdb *tlvRoot, bool paramLoadJSON, enum TransactionType TrType, bool GenACGPO) {
|
||||
|
||||
ParamLoadDefaults(tlvRoot);
|
||||
|
||||
@@ -675,7 +675,7 @@ void InitTransactionParameters(struct tlvdb *tlvRoot, bool paramLoadJSON, enum T
|
||||
}
|
||||
}
|
||||
|
||||
void ProcessGPOResponseFormat1(struct tlvdb *tlvRoot, uint8_t *buf, size_t len, bool decodeTLV) {
|
||||
static void ProcessGPOResponseFormat1(struct tlvdb *tlvRoot, uint8_t *buf, size_t len, bool decodeTLV) {
|
||||
if (buf[0] == 0x80) {
|
||||
if (decodeTLV) {
|
||||
PrintAndLog("GPO response format1:");
|
||||
@@ -705,7 +705,7 @@ void ProcessGPOResponseFormat1(struct tlvdb *tlvRoot, uint8_t *buf, size_t len,
|
||||
}
|
||||
}
|
||||
|
||||
void ProcessACResponseFormat1(struct tlvdb *tlvRoot, uint8_t *buf, size_t len, bool decodeTLV) {
|
||||
static void ProcessACResponseFormat1(struct tlvdb *tlvRoot, uint8_t *buf, size_t len, bool decodeTLV) {
|
||||
if (buf[0] == 0x80) {
|
||||
if (decodeTLV) {
|
||||
PrintAndLog("GPO response format1:");
|
||||
|
||||
@@ -29,7 +29,7 @@ static uint8_t g_primes[ROCA_PRINTS_LENGTH] = {
|
||||
|
||||
mbedtls_mpi g_prints[ROCA_PRINTS_LENGTH];
|
||||
|
||||
void rocacheck_init(void) {
|
||||
static void rocacheck_init(void) {
|
||||
|
||||
for (int i = 0; i < ROCA_PRINTS_LENGTH; i++)
|
||||
mbedtls_mpi_init(&g_prints[i]);
|
||||
@@ -53,12 +53,12 @@ void rocacheck_init(void) {
|
||||
mbedtls_mpi_read_string(&g_prints[16], 10, "126304807362733370595828809000324029340048915994");
|
||||
}
|
||||
|
||||
void rocacheck_cleanup(void) {
|
||||
static void rocacheck_cleanup(void) {
|
||||
for (int i = 0; i < ROCA_PRINTS_LENGTH; i++)
|
||||
mbedtls_mpi_free(&g_prints[i]);
|
||||
}
|
||||
|
||||
int bitand_is_zero(mbedtls_mpi *a, mbedtls_mpi *b) {
|
||||
static int bitand_is_zero(mbedtls_mpi *a, mbedtls_mpi *b) {
|
||||
|
||||
for (int i = 0; i < mbedtls_mpi_bitlen(a); i++) {
|
||||
|
||||
@@ -69,7 +69,7 @@ int bitand_is_zero(mbedtls_mpi *a, mbedtls_mpi *b) {
|
||||
}
|
||||
|
||||
|
||||
mbedtls_mpi_uint mpi_get_uint(const mbedtls_mpi *X) {
|
||||
static mbedtls_mpi_uint mpi_get_uint(const mbedtls_mpi *X) {
|
||||
|
||||
if (X->n == 1 && X->s > 0) {
|
||||
return X->p[0];
|
||||
@@ -78,7 +78,8 @@ mbedtls_mpi_uint mpi_get_uint(const mbedtls_mpi *X) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void print_mpi(const char *msg, int radix, const mbedtls_mpi *X) {
|
||||
/*
|
||||
static void print_mpi(const char *msg, int radix, const mbedtls_mpi *X) {
|
||||
|
||||
char Xchar[400] = {0};
|
||||
size_t len = 0;
|
||||
@@ -86,7 +87,7 @@ void print_mpi(const char *msg, int radix, const mbedtls_mpi *X) {
|
||||
mbedtls_mpi_write_string(X, radix, Xchar, sizeof(Xchar), &len);
|
||||
printf("%s[%zu] %s\n", msg, len, Xchar);
|
||||
}
|
||||
|
||||
*/
|
||||
bool emv_rocacheck(const unsigned char *buf, size_t buflen, bool verbose) {
|
||||
|
||||
mbedtls_mpi t_modulus;
|
||||
|
||||
@@ -263,7 +263,7 @@ struct tlvdb *GetdCVVRawFromTrack2(const struct tlv *track2) {
|
||||
return tlvdb_fixed(0x02, dCVVlen, dCVV);
|
||||
}
|
||||
|
||||
int EMVExchangeEx(EMVCommandChannel channel, bool ActivateField, bool LeaveFieldON, sAPDU apdu, bool IncludeLe, uint8_t *Result, size_t MaxResultLen, size_t *ResultLen, uint16_t *sw, struct tlvdb *tlv) {
|
||||
static int EMVExchangeEx(EMVCommandChannel channel, bool ActivateField, bool LeaveFieldON, sAPDU apdu, bool IncludeLe, uint8_t *Result, size_t MaxResultLen, size_t *ResultLen, uint16_t *sw, struct tlvdb *tlv) {
|
||||
uint8_t data[APDU_RES_LEN] = {0};
|
||||
|
||||
*ResultLen = 0;
|
||||
@@ -366,7 +366,7 @@ int EMVSelectPSE(EMVCommandChannel channel, bool ActivateField, bool LeaveFieldO
|
||||
return res;
|
||||
}
|
||||
|
||||
int EMVSelectWithRetry(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) {
|
||||
static int EMVSelectWithRetry(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 retrycnt = 0;
|
||||
int res = 0;
|
||||
do {
|
||||
@@ -393,7 +393,7 @@ int EMVSelectWithRetry(EMVCommandChannel channel, bool ActivateField, bool Leave
|
||||
return res;
|
||||
}
|
||||
|
||||
int EMVCheckAID(EMVCommandChannel channel, bool decodeTLV, struct tlvdb *tlvdbelm, struct tlvdb *tlv) {
|
||||
static int EMVCheckAID(EMVCommandChannel channel, bool decodeTLV, struct tlvdb *tlvdbelm, struct tlvdb *tlv) {
|
||||
uint8_t data[APDU_RES_LEN] = {0};
|
||||
size_t datalen = 0;
|
||||
int res = 0;
|
||||
|
||||
@@ -239,7 +239,7 @@ int JsonSaveTLVTree(json_t *root, json_t *elm, const char *path, struct tlvdb *t
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool HexToBuffer(const char *errormsg, const char *hexvalue, uint8_t *buffer, size_t maxbufferlen, size_t *bufferlen) {
|
||||
static bool HexToBuffer(const char *errormsg, const char *hexvalue, uint8_t *buffer, size_t maxbufferlen, size_t *bufferlen) {
|
||||
int buflen = 0;
|
||||
|
||||
switch (param_gethex_to_eol(hexvalue, 0, buffer, maxbufferlen, &buflen)) {
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <inttypes.h>
|
||||
#include "crypto_test.h"
|
||||
|
||||
static int test_genkey(unsigned int keylength, unsigned char *msg, size_t msg_len, bool verbose) {
|
||||
int ret = 1;
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "sda_test.h"
|
||||
|
||||
struct emv_pk vsdc_01 = {
|
||||
.rid = { 0xa0, 0x00, 0x00, 0x00, 0x03, },
|
||||
|
||||
Reference in New Issue
Block a user