summer restructuring:

* .h include only the strict minimum for their own parsing
  * this forces all files to include explicitment their needs and not count on far streched dependencies
  * this helps Makefile to rebuild only the minimum
  * according to this rule, most standalone .h are now gone
  * big app.h is gone
  * remove seldom __cplusplus, if c++ happens, everything will have to be done properly anyway
* all unrequired include were removed
* split common/ into common/ (client+arm) and common_arm/ (os+bootloader)
  * bring zlib to common/
  * bring stuff not really/not yet used in common back to armsrc/ or client/
  * bring liblua into client/
  * bring uart into client/
  * move some portions of code around (dbprint, protocols,...)
* rename unused files into *_disabled.[ch] to make it explicit
* rename soft Uarts between 14a, 14b and iclass, so a standalone could use several without clash
* remove PrintAndLogDevice
* move deprecated-hid-flasher from client to tools
* Makefiles
  * treat deps in armsrc/ as in client/
  * client: stop on warning (-Werror), same as for armsrc/

Tested on:

* all standalone modes
* Linux
This commit is contained in:
Philippe Teuwen
2019-08-08 16:57:33 +02:00
parent b7d412d27b
commit d19754567d
447 changed files with 2553 additions and 2599 deletions

View File

@@ -10,6 +10,13 @@
#include "apduinfo.h"
#include <string.h> // memmove
#include <stdio.h>
#include "ui.h" // Print...
#include "util.h"
#include "commonutil.h" // ARRAYLEN
const APDUCode APDUCodeTable[] = {
// ID Type Description
{"XXXX", APDUCODE_TYPE_NONE, ""}, // blank string

View File

@@ -11,13 +11,7 @@
#ifndef APDUINFO_H__
#define APDUINFO_H__
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
#include <inttypes.h>
#include "util.h"
#include "common.h"
#define APDUCODE_TYPE_NONE 0
#define APDUCODE_TYPE_INFO 1

View File

@@ -8,14 +8,24 @@
// EMV commands
//-----------------------------------------------------------------------------
#include <ctype.h>
#include "mifare.h"
#include "cmdemv.h"
#include <string.h>
#include "comms.h" // DropField
#include "cmdsmartcard.h" // smart_select
#include "cmdtrace.h"
#include "emvjson.h"
#include "emv_pki.h"
#include "test/cryptotest.h"
#include "cliparser/cliparser.h"
#include <jansson.h>
#include "cmdparser.h"
#include "proxmark3.h"
#include "emv_roca.h"
#include "emvcore.h"
#include "cmdhf14a.h"
#include "dol.h"
#include "ui.h"
#include "emv_tags.h"
static int CmdHelp(const char *Cmd);

View File

@@ -11,21 +11,7 @@
#ifndef CMDEMV_H__
#define CMDEMV_H__
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <string.h>
#include <ctype.h>
#include "proxmark3.h"
#include "ui.h"
#include "cmdparser.h"
#include "common.h"
#include "util.h"
#include "util_posix.h"
#include "cmdmain.h"
#include "emvcore.h"
#include "apduinfo.h"
#include "emv_roca.h"
int CmdEMV(const char *Cmd);

View File

@@ -20,8 +20,6 @@
#include "crypto.h"
#include "crypto_backend.h"
#include <string.h>
static struct crypto_backend *crypto_backend;
static bool crypto_init(void) {

View File

@@ -16,8 +16,7 @@
#ifndef CRYPTO_H
#define CRYPTO_H
#include <stdbool.h>
#include <stddef.h>
#include "common.h"
enum crypto_algo_hash {
HASH_INVALID,

View File

@@ -18,8 +18,7 @@
#include "crypto.h"
#include <stddef.h>
#include <stdarg.h>
#include <stdarg.h> // va_list
struct crypto_hash {
enum crypto_algo_hash algo;

View File

@@ -18,11 +18,8 @@
#include <config.h>
#endif
#include "crypto.h"
#include "crypto_backend.h"
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

View File

@@ -17,7 +17,6 @@
#define DOL_H
#include "emv/tlv.h"
#include <stddef.h>
struct tlv *dol_process(const struct tlv *tlv, const struct tlvdb *tlvdb, tlv_tag_t tag);
struct tlvdb *dol_parse(const struct tlv *tlv, const unsigned char *data, size_t data_len);

View File

@@ -16,9 +16,9 @@
#ifndef DUMP_H
#define DUMP_H
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include "common.h"
#include <stdio.h> // FILE
void dump_buffer_simple(const unsigned char *ptr, size_t len, FILE *f);
void dump_buffer(const unsigned char *ptr, size_t len, FILE *f, int level);

View File

@@ -19,16 +19,16 @@
/* For asprintf */
#define _GNU_SOURCE
#include <stdio.h>
#include "emv_pk.h"
#include "crypto.h"
#include "proxmark3.h"
#include "util.h"
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
#include "ui.h"
#include "crypto.h"
#include "proxmark3.h"
#define BCD(c) (((c) >= '0' && (c) <= '9') ? ((c) - '0') : \
-1)

View File

@@ -16,8 +16,7 @@
#ifndef EMV_PK_H
#define EMV_PK_H
#include <stdbool.h>
#include <stddef.h>
#include "common.h"
struct emv_pk {
unsigned char rid[5];

View File

@@ -18,15 +18,15 @@
#endif
#include "emv_pki.h"
#include "crypto.h"
#include "dump.h"
#include "util.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include "crypto.h"
#include "dump.h"
#include "util.h"
static bool strictExecution = true;
void PKISetStrictExecution(bool se) {
strictExecution = se;

View File

@@ -19,8 +19,6 @@
#include "emv_pk.h"
#include "tlv.h"
#include <stddef.h>
void PKISetStrictExecution(bool se);
unsigned char *emv_pki_sdatl_fill(const struct tlvdb *db, size_t *sdatl_len);

View File

@@ -18,7 +18,6 @@
#endif
#include "emv_pki_priv.h"
#include "crypto.h"
#include <stdlib.h>
#include <string.h>

View File

@@ -16,12 +16,12 @@
#ifndef EMV_PKI_PRIV_H
#define EMV_PKI_PRIV_H
#include "common.h"
#include "crypto.h"
#include "emv_pk.h"
#include "tlv.h"
#include <stddef.h>
struct emv_pk *emv_pki_make_ca(const struct crypto_pk *cp,
const unsigned char *rid, unsigned char index,
unsigned int expire, enum crypto_algo_hash hash_algo);

View File

@@ -23,6 +23,9 @@
#include "emv_roca.h"
#include "ui.h" // Print...
#include "mbedtls/bignum.h"
static uint8_t g_primes[ROCA_PRINTS_LENGTH] = {
11, 13, 17, 19, 37, 53, 61, 71, 73, 79, 97, 103, 107, 109, 127, 151, 157
};

View File

@@ -24,10 +24,7 @@
#ifndef EMV_ROCA_H__
#define EMV_ROCA_H__
#include <stdbool.h>
#include <string.h>
#include "mbedtls/bignum.h"
#include "util.h"
#include "common.h"
#define ROCA_PRINTS_LENGTH 17

View File

@@ -17,13 +17,13 @@
#include <config.h>
#endif
#include "commonutil.h"
#include "tlv.h"
#include "emv_tags.h"
#include <stdlib.h>
#include <string.h>
#include "commonutil.h"
#ifndef PRINT_INDENT
# define PRINT_INDENT(level) {for (int myi = 0; myi < (level); myi++) fprintf(f, " ");}
#endif

View File

@@ -17,7 +17,7 @@
#define TAGS_H
#include "tlv.h"
#include <stdio.h>
#include <stdio.h> // FILE
// AC
# define EMVAC_AC_MASK 0xC0

View File

@@ -9,6 +9,18 @@
//-----------------------------------------------------------------------------
#include "emvcore.h"
#include <string.h>
#include "commonutil.h" // ARRAYLEN
#include "comms.h" // DropField
#include "cmdparser.h"
#include "cmdsmartcard.h" // ExchangeAPDUSC
#include "ui.h"
#include "cmdhf14a.h"
#include "dol.h"
#include "dump.h"
#include "emv_tags.h"
#include "emvjson.h"
#include "util_posix.h"

View File

@@ -11,22 +11,12 @@
#ifndef EMVCORE_H__
#define EMVCORE_H__
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <inttypes.h>
#include <string.h>
#include <jansson.h>
#include "util.h"
#include "common.h"
#include "ui.h"
#include "cmdhf14a.h"
#include <inttypes.h>
#include <jansson.h>
#include "apduinfo.h"
#include "tlv.h"
#include "dol.h"
#include "dump.h"
#include "emv_tags.h"
#include "emv_pk.h"
#include "emv_pki.h"
#define APDU_RES_LEN 260

View File

@@ -9,12 +9,12 @@
//-----------------------------------------------------------------------------
#include "emvjson.h"
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <string.h>
#include "commonutil.h" // ARRAYLEN
#include "ui.h"
#include "util.h"
#include "proxmark3.h"
#include "emv_tags.h"

View File

@@ -10,6 +10,8 @@
#ifndef EMVJSON_H__
#define EMVJSON_H__
#include "common.h"
#include <jansson.h>
#include "tlv.h"

View File

@@ -17,10 +17,11 @@
#include <config.h>
#endif
#include "commonutil.h" // ARRAYLEN
#include "../crypto.h"
#include "../dump.h"
#include "util_posix.h"
#include "commonutil.h"
#include <stdlib.h>
#include <string.h>

View File

@@ -22,8 +22,6 @@
#include "tlv.h"
#include <string.h>
#include <stdint.h>
#include <stddef.h>
#include <stdlib.h>
#define TLV_TAG_CLASS_MASK 0xc0

View File

@@ -18,9 +18,7 @@
#ifndef TLV_H
#define TLV_H
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include "common.h"
typedef uint32_t tlv_tag_t;