added define PACKED

This commit is contained in:
merlokk 2019-07-15 19:21:19 +03:00
parent d2a2acf69c
commit 84c09ce881
3 changed files with 10 additions and 4 deletions

View file

@ -10,8 +10,6 @@
#include "apduinfo.h"
#include "util.h"
const APDUCode APDUCodeTable[] = {
// ID Type Description
{"XXXX", APDUCODE_TYPE_NONE, ""}, // blank string

View file

@ -17,6 +17,8 @@
#include <stdbool.h>
#include <inttypes.h>
#include "util.h"
#define APDUCODE_TYPE_NONE 0
#define APDUCODE_TYPE_INFO 1
#define APDUCODE_TYPE_WARNING 2
@ -38,7 +40,7 @@ typedef struct {
uint8_t p1;
uint8_t p2;
uint8_t lc[3];
} __attribute__((packed)) ExtAPDUHeader;
} PACKED ExtAPDUHeader;
typedef struct {
uint8_t cla;
@ -50,7 +52,7 @@ typedef struct {
uint32_t le;
bool extended_apdu;
uint8_t case_type;
} __attribute__((packed)) APDUStruct;
} PACKED APDUStruct;
extern int APDUDecode(uint8_t *data, int len, APDUStruct *apdu);
extern int APDUEncode(APDUStruct *apdu, uint8_t *data, int *len);

View file

@ -21,6 +21,12 @@
#include "ui.h" // PrintAndLog
#include "commonutil.h"
#ifdef _MSC_VER
#define PACKED
#else
#define PACKED __attribute__((packed))
#endif
#ifdef ANDROID
#include <endian.h>
#endif