mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2024-09-20 23:36:31 +08:00
Merge pull request #251 from merlokk/reorg_includes
added PACKED attribute for structures and reorganize include folder
This commit is contained in:
commit
ed4289d462
|
@ -8,14 +8,16 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// main code for HF standalone mode Mifare /sniff/emulation by Craig Young
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "hf_young.h"
|
||||
#include "common.h"
|
||||
|
||||
typedef struct {
|
||||
uint8_t uid[10];
|
||||
uint8_t uidlen;
|
||||
uint8_t atqa[2];
|
||||
uint8_t sak;
|
||||
} __attribute__((__packed__)) card_clone_t;
|
||||
} PACKED card_clone_t;
|
||||
|
||||
|
||||
void ModInfo(void) {
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include <inttypes.h>
|
||||
#include "usb_cdc.h"
|
||||
#include "proxmark3.h"
|
||||
#include "pmflash.h"
|
||||
#include "apps.h"
|
||||
#include "fpga.h"
|
||||
#include "util.h"
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "flashmem.h"
|
||||
#include "pmflash.h"
|
||||
|
||||
/* here: use NCPS2 @ PA10: */
|
||||
#define SPI_CSR_NUM 2
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "protocols.h"
|
||||
#include "usb_cdc.h" // for usb_poll_validate_length
|
||||
#include "common.h"
|
||||
#include "pmflash.h"
|
||||
#include "flashmem.h" // persistence on mem
|
||||
|
||||
//#define START_GAP 31*8 // was 250 // SPEC: 1*8 to 50*8 - typ 15*8 (15fc)
|
||||
|
|
|
@ -14,8 +14,11 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "mifarecmd.h"
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "pmflash.h"
|
||||
|
||||
#ifndef HARDNESTED_AUTHENTICATION_TIMEOUT
|
||||
# define HARDNESTED_AUTHENTICATION_TIMEOUT 848 // card times out 1ms after wrong authentication (according to NXP documentation)
|
||||
#endif
|
||||
|
|
|
@ -15,10 +15,11 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include "pmflash.h"
|
||||
#include "common.h"
|
||||
#include "proxmark3.h"
|
||||
#include "ui.h"
|
||||
#include "cmdparser.h"
|
||||
#include "common.h"
|
||||
#include "util.h"
|
||||
#include "util_posix.h" // msclock
|
||||
#include "loclass/fileutils.h" //saveFile
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
#ifndef __ELF_H__
|
||||
#define __ELF_H__
|
||||
|
||||
#include "proxmark3.h"
|
||||
|
||||
typedef struct {
|
||||
uint32_t p_type;
|
||||
uint32_t p_offset;
|
||||
|
@ -18,7 +20,7 @@ typedef struct {
|
|||
uint32_t p_memsz;
|
||||
uint32_t p_flags;
|
||||
uint32_t p_align;
|
||||
} __attribute__((__packed__)) Elf32_Phdr;
|
||||
} PACKED Elf32_Phdr;
|
||||
|
||||
#define EI_NIDENT 16
|
||||
|
||||
|
@ -37,7 +39,7 @@ typedef struct {
|
|||
uint16_t e_shentsize;
|
||||
uint16_t e_shnum;
|
||||
uint16_t e_shtrndx;
|
||||
} __attribute__((__packed__)) Elf32_Ehdr;
|
||||
} PACKED Elf32_Ehdr;
|
||||
|
||||
#define PT_NULL 0
|
||||
#define PT_LOAD 1
|
||||
|
|
|
@ -14,4 +14,16 @@
|
|||
|
||||
#define PROXPROMPT "proxmark3> "
|
||||
|
||||
#ifdef _MSC_VER
|
||||
typedef DWORD uint32_t;
|
||||
typedef BYTE uint8_t;
|
||||
#define PACKED
|
||||
// stuff
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#define PACKED __attribute__((packed))
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -12,16 +12,8 @@
|
|||
|
||||
#ifndef __USB_CMD_H
|
||||
#define __USB_CMD_H
|
||||
#ifdef _MSC_VER
|
||||
typedef DWORD uint32_t;
|
||||
typedef BYTE uint8_t;
|
||||
#define PACKED
|
||||
// stuff
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#define PACKED __attribute__((packed))
|
||||
#endif
|
||||
|
||||
#include "proxmark3.h"
|
||||
|
||||
typedef struct {
|
||||
uint32_t cmd;
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
#ifndef __ELF_H__
|
||||
#define __ELF_H__
|
||||
|
||||
#include "common.h"
|
||||
|
||||
typedef struct {
|
||||
uint32_t p_type;
|
||||
uint32_t p_offset;
|
||||
|
@ -18,7 +20,7 @@ typedef struct {
|
|||
uint32_t p_memsz;
|
||||
uint32_t p_flags;
|
||||
uint32_t p_align;
|
||||
} __attribute__((__packed__)) Elf32_Phdr;
|
||||
} PACKED Elf32_Phdr;
|
||||
|
||||
#define EI_NIDENT 16
|
||||
|
||||
|
@ -37,7 +39,7 @@ typedef struct {
|
|||
uint16_t e_shentsize;
|
||||
uint16_t e_shnum;
|
||||
uint16_t e_shtrndx;
|
||||
} __attribute__((__packed__)) Elf32_Ehdr;
|
||||
} PACKED Elf32_Ehdr;
|
||||
|
||||
#define PT_NULL 0
|
||||
#define PT_LOAD 1
|
||||
|
|
|
@ -60,7 +60,7 @@ local function parse14443a(data)
|
|||
uint8_t sak;
|
||||
uint8_t ats_len;
|
||||
uint8_t ats[256];
|
||||
} __attribute__((__packed__)) iso14a_card_select_t;
|
||||
} PACKED iso14a_card_select_t;
|
||||
--]]
|
||||
|
||||
local count, uid, uidlen, atqa, sak, ats_len, ats = bin.unpack('H10CH2CCH', data)
|
||||
|
|
|
@ -39,7 +39,7 @@ local function parse1443b(data)
|
|||
uint8_t atqb[7];
|
||||
uint8_t chipid;
|
||||
uint8_t cid;
|
||||
} __attribute__((__packed__)) iso14b_card_select_t;
|
||||
} PACKED iso14b_card_select_t;
|
||||
|
||||
--]]
|
||||
|
||||
|
|
|
@ -20,100 +20,12 @@
|
|||
#include <time.h>
|
||||
#include "ui.h" // PrintAndLog
|
||||
#include "commonutil.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define PACKED
|
||||
#else
|
||||
#define PACKED __attribute__((packed))
|
||||
#endif
|
||||
#include "common.h"
|
||||
|
||||
#ifdef ANDROID
|
||||
#include <endian.h>
|
||||
#endif
|
||||
|
||||
#ifndef ROTR
|
||||
# define ROTR(x,n) (((uintmax_t)(x) >> (n)) | ((uintmax_t)(x) << ((sizeof(x) * 8) - (n))))
|
||||
#endif
|
||||
#ifndef ROTL
|
||||
# define ROTL(x,n) (((uintmax_t)(x) << (n)) | ((uintmax_t)(x) >> ((sizeof(x) * 8) - (n))))
|
||||
#endif
|
||||
|
||||
#ifndef MIN
|
||||
# define MIN(a, b) (((a) < (b)) ? (a) : (b))
|
||||
#endif
|
||||
#ifndef MAX
|
||||
# define MAX(a, b) (((a) > (b)) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
// endian change for 64bit
|
||||
#ifdef __GNUC__
|
||||
#ifndef BSWAP_64
|
||||
#define BSWAP_64(x) __builtin_bswap64(x)
|
||||
#endif
|
||||
#else
|
||||
#ifdef _MSC_VER
|
||||
#ifndef BSWAP_64
|
||||
#define BSWAP_64(x) _byteswap_uint64(x)
|
||||
#endif
|
||||
#else
|
||||
#ifndef BSWAP_64
|
||||
#define BSWAP_64(x) \
|
||||
(((uint64_t)(x) << 56) | \
|
||||
(((uint64_t)(x) << 40) & 0xff000000000000ULL) | \
|
||||
(((uint64_t)(x) << 24) & 0xff0000000000ULL) | \
|
||||
(((uint64_t)(x) << 8) & 0xff00000000ULL) | \
|
||||
(((uint64_t)(x) >> 8) & 0xff000000ULL) | \
|
||||
(((uint64_t)(x) >> 24) & 0xff0000ULL) | \
|
||||
(((uint64_t)(x) >> 40) & 0xff00ULL) | \
|
||||
((uint64_t)(x) >> 56))
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// endian change for 32bit
|
||||
#ifdef __GNUC__
|
||||
#ifndef BSWAP_32
|
||||
#define BSWAP_32(x) __builtin_bswap32(x)
|
||||
#endif
|
||||
#else
|
||||
#ifdef _MSC_VER
|
||||
#ifndef BSWAP_32
|
||||
#define BSWAP_32(x) _byteswap_ulong(x)
|
||||
#endif
|
||||
#else
|
||||
#ifndef BSWAP_32
|
||||
# define BSWAP_32(x) \
|
||||
((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) | \
|
||||
(((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24))
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define EVEN 0
|
||||
#define ODD 1
|
||||
|
||||
// Nibble logic
|
||||
#ifndef NIBBLE_HIGH
|
||||
# define NIBBLE_HIGH(b) ( (b & 0xF0) >> 4 )
|
||||
#endif
|
||||
#ifndef NIBBLE_LOW
|
||||
# define NIBBLE_LOW(b) ( b & 0x0F )
|
||||
#endif
|
||||
#ifndef CRUMB
|
||||
# define CRUMB(b,p) (((b & (0x3 << p) ) >> p ) & 0xF)
|
||||
#endif
|
||||
#ifndef SWAP_NIBBLE
|
||||
# define SWAP_NIBBLE(b) ( (NIBBLE_LOW(b)<< 4) | NIBBLE_HIGH(b))
|
||||
#endif
|
||||
|
||||
// Binary Encoded Digit
|
||||
#ifndef BCD2DEC
|
||||
# define BCD2DEC(bcd) HornerScheme(bcd, 0x10, 10)
|
||||
#endif
|
||||
#ifndef DEC2BCD
|
||||
# define DEC2BCD(dec) HornerScheme(dec, 10, 0x10)
|
||||
#endif
|
||||
|
||||
// used for save/load files
|
||||
#ifndef FILE_PATH_SIZE
|
||||
# define FILE_PATH_SIZE 1000
|
||||
|
|
125
include/common.h
125
include/common.h
|
@ -19,9 +19,20 @@ extern "C" {
|
|||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <at91sam7s512.h>
|
||||
|
||||
typedef unsigned char byte_t;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
typedef DWORD uint32_t;
|
||||
typedef BYTE uint8_t;
|
||||
#define PACKED
|
||||
// stuff
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#define PACKED __attribute__((packed))
|
||||
#endif
|
||||
|
||||
// debug
|
||||
#define DBG_NONE 0 // no messages
|
||||
#define DBG_ERROR 1 // errors only
|
||||
|
@ -30,9 +41,6 @@ typedef unsigned char byte_t;
|
|||
#define DBG_EXTENDED 4 // errors + info + debug + breaking debug messages
|
||||
extern int DBGLEVEL;
|
||||
|
||||
// Flashmem spi baudrate
|
||||
extern uint32_t FLASHMEM_SPIBAUDRATE;
|
||||
|
||||
// reader voltage field detector
|
||||
#define MF_MINFIELDV 4000
|
||||
|
||||
|
@ -49,74 +57,87 @@ extern uint32_t FLASHMEM_SPIBAUDRATE;
|
|||
#endif
|
||||
#define RAMFUNC __attribute((long_call, section(".ramfunc")))
|
||||
|
||||
// RDV40 Section
|
||||
// 256kb divided into 4k sectors.
|
||||
//
|
||||
// 0x3F000 - 1 4kb sector = signature
|
||||
// 0x3E000 - 1 4kb sector = settings
|
||||
// 0x3D000 - 1 4kb sector = default T55XX keys dictionary
|
||||
// 0x3B000 - 1 4kb sector = default ICLASS keys dictionary
|
||||
// 0x39000 - 2 4kb sectors = default MFC keys dictionary
|
||||
//
|
||||
#ifndef FLASH_MEM_BLOCK_SIZE
|
||||
# define FLASH_MEM_BLOCK_SIZE 256
|
||||
#ifndef ROTR
|
||||
# define ROTR(x,n) (((uintmax_t)(x) >> (n)) | ((uintmax_t)(x) << ((sizeof(x) * 8) - (n))))
|
||||
#endif
|
||||
|
||||
#ifndef FLASH_MEM_MAX_SIZE
|
||||
# define FLASH_MEM_MAX_SIZE 0x40000 // (262144)
|
||||
#ifndef ROTL
|
||||
# define ROTL(x,n) (((uintmax_t)(x) << (n)) | ((uintmax_t)(x) >> ((sizeof(x) * 8) - (n))))
|
||||
#endif
|
||||
|
||||
#ifndef FLASH_MEM_MAX_4K_SECTOR
|
||||
# define FLASH_MEM_MAX_4K_SECTOR 0x3F000
|
||||
// endian change for 64bit
|
||||
#ifdef __GNUC__
|
||||
#ifndef BSWAP_64
|
||||
#define BSWAP_64(x) __builtin_bswap64(x)
|
||||
#endif
|
||||
#else
|
||||
#ifdef _MSC_VER
|
||||
#ifndef BSWAP_64
|
||||
#define BSWAP_64(x) _byteswap_uint64(x)
|
||||
#endif
|
||||
#else
|
||||
#ifndef BSWAP_64
|
||||
#define BSWAP_64(x) \
|
||||
(((uint64_t)(x) << 56) | \
|
||||
(((uint64_t)(x) << 40) & 0xff000000000000ULL) | \
|
||||
(((uint64_t)(x) << 24) & 0xff0000000000ULL) | \
|
||||
(((uint64_t)(x) << 8) & 0xff00000000ULL) | \
|
||||
(((uint64_t)(x) >> 8) & 0xff000000ULL) | \
|
||||
(((uint64_t)(x) >> 24) & 0xff0000ULL) | \
|
||||
(((uint64_t)(x) >> 40) & 0xff00ULL) | \
|
||||
((uint64_t)(x) >> 56))
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef FLASH_MEM_ID_LEN
|
||||
# define FLASH_MEM_ID_LEN 8
|
||||
// endian change for 32bit
|
||||
#ifdef __GNUC__
|
||||
#ifndef BSWAP_32
|
||||
#define BSWAP_32(x) __builtin_bswap32(x)
|
||||
#endif
|
||||
#else
|
||||
#ifdef _MSC_VER
|
||||
#ifndef BSWAP_32
|
||||
#define BSWAP_32(x) _byteswap_ulong(x)
|
||||
#endif
|
||||
#else
|
||||
#ifndef BSWAP_32
|
||||
# define BSWAP_32(x) \
|
||||
((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) | \
|
||||
(((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24))
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef FLASH_MEM_SIGNATURE_LEN
|
||||
# define FLASH_MEM_SIGNATURE_LEN 128
|
||||
#define EVEN 0
|
||||
#define ODD 1
|
||||
|
||||
// Nibble logic
|
||||
#ifndef NIBBLE_HIGH
|
||||
# define NIBBLE_HIGH(b) ( (b & 0xF0) >> 4 )
|
||||
#endif
|
||||
|
||||
#ifndef FLASH_MEM_SIGNATURE_OFFSET
|
||||
// -1 for historical compatibility with already released Proxmark3 RDV4.0 devices
|
||||
# define FLASH_MEM_SIGNATURE_OFFSET (FLASH_MEM_MAX_SIZE - FLASH_MEM_SIGNATURE_LEN - 1)
|
||||
#ifndef NIBBLE_LOW
|
||||
# define NIBBLE_LOW(b) ( b & 0x0F )
|
||||
#endif
|
||||
|
||||
#ifndef T55XX_CONFIG_LEN
|
||||
# define T55XX_CONFIG_LEN sizeof( t55xx_config )
|
||||
#ifndef CRUMB
|
||||
# define CRUMB(b,p) (((b & (0x3 << p) ) >> p ) & 0xF)
|
||||
#endif
|
||||
|
||||
#ifndef T55XX_CONFIG_OFFSET
|
||||
# define T55XX_CONFIG_OFFSET (FLASH_MEM_MAX_4K_SECTOR - 0x2000)
|
||||
#ifndef SWAP_NIBBLE
|
||||
# define SWAP_NIBBLE(b) ( (NIBBLE_LOW(b)<< 4) | NIBBLE_HIGH(b))
|
||||
#endif
|
||||
|
||||
// Reserved space for T55XX PWD = 4 kb
|
||||
#ifndef DEFAULT_T55XX_KEYS_OFFSET
|
||||
# define DEFAULT_T55XX_KEYS_OFFSET (FLASH_MEM_MAX_4K_SECTOR - 0x3000)
|
||||
// Binary Encoded Digit
|
||||
#ifndef BCD2DEC
|
||||
# define BCD2DEC(bcd) HornerScheme(bcd, 0x10, 10)
|
||||
#endif
|
||||
|
||||
// Reserved space for iClass keys = 4 kb
|
||||
#ifndef DEFAULT_ICLASS_KEYS_OFFSET
|
||||
# define DEFAULT_ICLASS_KEYS_OFFSET (FLASH_MEM_MAX_4K_SECTOR - 0x4000)
|
||||
#ifndef DEC2BCD
|
||||
# define DEC2BCD(dec) HornerScheme(dec, 10, 0x10)
|
||||
#endif
|
||||
|
||||
// Reserved space for MIFARE Keys = 8 kb
|
||||
#ifndef DEFAULT_MF_KEYS_OFFSET
|
||||
# define DEFAULT_MF_KEYS_OFFSET (FLASH_MEM_MAX_4K_SECTOR - 0x6000)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
// RDV40, validation structure to help identifying that client/firmware is talking with RDV40
|
||||
typedef struct {
|
||||
uint8_t magic[4];
|
||||
uint8_t flashid[FLASH_MEM_ID_LEN];
|
||||
uint8_t signature[FLASH_MEM_SIGNATURE_LEN];
|
||||
} __attribute__((__packed__)) rdv40_validation_t;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -14,11 +14,7 @@
|
|||
#ifndef HITAG_H__
|
||||
#define HITAG_H__
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define PACKED
|
||||
#else
|
||||
#define PACKED __attribute__((packed))
|
||||
#endif
|
||||
#include "common.h"
|
||||
|
||||
typedef enum {
|
||||
RHTSF_CHALLENGE = 01,
|
||||
|
|
|
@ -46,7 +46,7 @@ typedef struct {
|
|||
uint8_t sak;
|
||||
uint8_t ats_len;
|
||||
uint8_t ats[256];
|
||||
} __attribute__((__packed__)) iso14a_card_select_t;
|
||||
} PACKED iso14a_card_select_t;
|
||||
|
||||
typedef enum ISO14A_COMMAND {
|
||||
ISO14A_CONNECT = (1 << 0),
|
||||
|
@ -129,7 +129,7 @@ typedef struct {
|
|||
typedef struct {
|
||||
uint8_t atr_len;
|
||||
uint8_t atr[30];
|
||||
} __attribute__((__packed__)) smart_card_atr_t;
|
||||
} PACKED smart_card_atr_t;
|
||||
|
||||
typedef enum SMARTCARD_COMMAND {
|
||||
SC_CONNECT = (1 << 0),
|
||||
|
@ -167,7 +167,7 @@ typedef struct {
|
|||
uint8_t iccode[2];
|
||||
uint8_t mrt[6];
|
||||
uint8_t servicecode[2];
|
||||
} __attribute__((__packed__)) felica_card_select_t;
|
||||
} PACKED felica_card_select_t;
|
||||
|
||||
typedef enum FELICA_COMMAND {
|
||||
FELICA_CONNECT = (1 << 0),
|
||||
|
|
|
@ -13,20 +13,11 @@
|
|||
#ifndef __PM3_CMD_H
|
||||
#define __PM3_CMD_H
|
||||
|
||||
#include "common.h"
|
||||
|
||||
// Use it e.g. when using slow links such as BT
|
||||
#define USART_SLOW_LINK
|
||||
|
||||
#ifdef _MSC_VER
|
||||
typedef DWORD uint32_t;
|
||||
typedef BYTE uint8_t;
|
||||
#define PACKED
|
||||
// stuff
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#define PACKED __attribute__((packed))
|
||||
#endif
|
||||
|
||||
#define PM3_CMD_DATA_SIZE 512
|
||||
#define PM3_CMD_DATA_SIZE_MIX ( PM3_CMD_DATA_SIZE - 3 * sizeof(uint64_t) )
|
||||
|
||||
|
|
97
include/pmflash.h
Normal file
97
include/pmflash.h
Normal file
|
@ -0,0 +1,97 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// (c) RFID Research Group - 2019
|
||||
//
|
||||
// This code is licensed to you under the terms of the GNU GPL, version 2 or,
|
||||
// at your option, any later version. See the LICENSE.txt file for the text of
|
||||
// the license.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
// RDV4 flash constants
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef __PMFLASH_H
|
||||
#define __PMFLASH_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "common.h"
|
||||
|
||||
// Flashmem spi baudrate
|
||||
extern uint32_t FLASHMEM_SPIBAUDRATE;
|
||||
|
||||
// RDV40 Section
|
||||
// 256kb divided into 4k sectors.
|
||||
//
|
||||
// 0x3F000 - 1 4kb sector = signature
|
||||
// 0x3E000 - 1 4kb sector = settings
|
||||
// 0x3D000 - 1 4kb sector = default T55XX keys dictionary
|
||||
// 0x3B000 - 1 4kb sector = default ICLASS keys dictionary
|
||||
// 0x39000 - 2 4kb sectors = default MFC keys dictionary
|
||||
//
|
||||
#ifndef FLASH_MEM_BLOCK_SIZE
|
||||
# define FLASH_MEM_BLOCK_SIZE 256
|
||||
#endif
|
||||
|
||||
#ifndef FLASH_MEM_MAX_SIZE
|
||||
# define FLASH_MEM_MAX_SIZE 0x40000 // (262144)
|
||||
#endif
|
||||
|
||||
#ifndef FLASH_MEM_MAX_4K_SECTOR
|
||||
# define FLASH_MEM_MAX_4K_SECTOR 0x3F000
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef FLASH_MEM_ID_LEN
|
||||
# define FLASH_MEM_ID_LEN 8
|
||||
#endif
|
||||
|
||||
#ifndef FLASH_MEM_SIGNATURE_LEN
|
||||
# define FLASH_MEM_SIGNATURE_LEN 128
|
||||
#endif
|
||||
|
||||
#ifndef FLASH_MEM_SIGNATURE_OFFSET
|
||||
// -1 for historical compatibility with already released Proxmark3 RDV4.0 devices
|
||||
# define FLASH_MEM_SIGNATURE_OFFSET (FLASH_MEM_MAX_SIZE - FLASH_MEM_SIGNATURE_LEN - 1)
|
||||
#endif
|
||||
|
||||
#ifndef T55XX_CONFIG_LEN
|
||||
# define T55XX_CONFIG_LEN sizeof( t55xx_config )
|
||||
#endif
|
||||
|
||||
#ifndef T55XX_CONFIG_OFFSET
|
||||
# define T55XX_CONFIG_OFFSET (FLASH_MEM_MAX_4K_SECTOR - 0x2000)
|
||||
#endif
|
||||
|
||||
// Reserved space for T55XX PWD = 4 kb
|
||||
#ifndef DEFAULT_T55XX_KEYS_OFFSET
|
||||
# define DEFAULT_T55XX_KEYS_OFFSET (FLASH_MEM_MAX_4K_SECTOR - 0x3000)
|
||||
#endif
|
||||
|
||||
// Reserved space for iClass keys = 4 kb
|
||||
#ifndef DEFAULT_ICLASS_KEYS_OFFSET
|
||||
# define DEFAULT_ICLASS_KEYS_OFFSET (FLASH_MEM_MAX_4K_SECTOR - 0x4000)
|
||||
#endif
|
||||
|
||||
// Reserved space for MIFARE Keys = 8 kb
|
||||
#ifndef DEFAULT_MF_KEYS_OFFSET
|
||||
# define DEFAULT_MF_KEYS_OFFSET (FLASH_MEM_MAX_4K_SECTOR - 0x6000)
|
||||
#endif
|
||||
|
||||
// RDV40, validation structure to help identifying that client/firmware is talking with RDV40
|
||||
typedef struct {
|
||||
uint8_t magic[4];
|
||||
uint8_t flashid[FLASH_MEM_ID_LEN];
|
||||
uint8_t signature[FLASH_MEM_SIGNATURE_LEN];
|
||||
} PACKED rdv40_validation_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // __PMFLASH_H
|
|
@ -15,6 +15,7 @@
|
|||
#include "at91sam7s512.h"
|
||||
#include "config_gpio.h"
|
||||
#include "pm3_cmd.h"
|
||||
#include "common.h"
|
||||
|
||||
#define WDT_HIT() AT91C_BASE_WDTC->WDTC_WDCR = 0xa5000001
|
||||
|
||||
|
@ -71,8 +72,6 @@
|
|||
#define COTAG_BITS 264
|
||||
#endif
|
||||
|
||||
//#define PACKED __attribute__((__packed__))
|
||||
|
||||
#define LED_A_ON() HIGH(GPIO_LED_A)
|
||||
#define LED_A_OFF() LOW(GPIO_LED_A)
|
||||
#define LED_A_INV() INVBIT(GPIO_LED_A)
|
||||
|
@ -116,7 +115,7 @@ struct version_information {
|
|||
char clean; /* 1: Tree was clean, no local changes. 0: Tree was unclean. 2: Couldn't be determined */
|
||||
char gitversion[50]; /* String with the git revision */
|
||||
char buildtime[30]; /* string with the build time */
|
||||
} __attribute__((packed));
|
||||
} PACKED;
|
||||
|
||||
#define COMMON_AREA_MAGIC 0x43334d50 // "PM3C"
|
||||
#define COMMON_AREA_COMMAND_NONE 0
|
||||
|
@ -129,8 +128,8 @@ struct common_area {
|
|||
unsigned int bootrom_present: 1; /* Set when a bootrom that is capable of parsing the common area is present */
|
||||
unsigned int osimage_present: 1; /* Set when a osimage that is capable of parsing the common area is present */
|
||||
unsigned int button_pressed: 1;
|
||||
} __attribute__((packed)) flags;
|
||||
} PACKED flags;
|
||||
int arg1, arg2;
|
||||
} __attribute__((packed));
|
||||
} PACKED;
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue