mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 21:33:47 -07:00
Major update to EM4x70 support:
1. Rework how communications with tag occur. a. bitstream to be sent to the tag is now fully pre-generated. b. bits sent and received are logged with start / end times. 2. Support built-in `hw dbg` for controlling verbosity of debug output The new bitstream generation and logging has exposed a surprising legacy behavior ... each of the command that sent additional data (beyond the command) were: * inserting an extra RM zero bit * force-enabling command parity is used This was not expected. However, this PR maintains the behavior of the existing code. TODO: Root-cause why the third RM bit is needed. Fix code to remove that hack. TODO: change the arm/client interface to ONLY use arrays of bytes, with well-defined content endianness, to avoid this problem.
This commit is contained in:
parent
f31ee2633f
commit
21ad101ff5
6 changed files with 2653 additions and 243 deletions
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <assert.h>
|
||||
|
||||
#define EM4X70_NUM_BLOCKS 16
|
||||
|
||||
|
@ -28,24 +29,36 @@
|
|||
#define EM4X70_PIN_WORD_LOWER 10
|
||||
#define EM4X70_PIN_WORD_UPPER 11
|
||||
|
||||
/// @brief Command transport structure for EM4x70 commands.
|
||||
/// @details
|
||||
/// This structure is used to transport data from the PC
|
||||
/// to the proxmark3, and contain all data needed for
|
||||
/// a given `lf em 4x70 ...` command to be processed
|
||||
/// on the proxmark3.
|
||||
/// The only requirement is that this structure remain
|
||||
/// smaller than the NG buffer size (256 bytes).
|
||||
typedef struct {
|
||||
// ISSUE: `bool` type does not have a standard-defined size.
|
||||
// therefore, compatibility between architectures /
|
||||
// compilers is not guaranteed.
|
||||
// ISSUE: C99 has no _Static_assert() ... was added in C11
|
||||
// TODO: add _Static_assert(sizeof(bool)==1);
|
||||
// TODO: add _Static_assert(sizeof(em4x70_data_t)==36);
|
||||
bool parity;
|
||||
|
||||
// Used for writing address
|
||||
uint8_t address;
|
||||
// ISSUE: Presumes target is little-endian
|
||||
// BUGBUG: Non-portable ... presumes stored in little-endian form!
|
||||
uint16_t word;
|
||||
|
||||
// PIN to unlock
|
||||
// BUGBUG: Non-portable ... presumes stored in little-endian form!
|
||||
uint32_t pin;
|
||||
|
||||
// Used for authentication
|
||||
//
|
||||
// IoT safe subset of C++ would be helpful here,
|
||||
// to support variable-bit-length integer types
|
||||
// as integral integer types.
|
||||
//
|
||||
// Even C23 would work for this (GCC14+, Clang15+):
|
||||
// _BitInt(56) rnd;
|
||||
// _BitInt(28) frnd;
|
||||
// _BitInt(20) grnd;
|
||||
uint8_t frnd[4];
|
||||
uint8_t grnd[3];
|
||||
uint8_t rnd[7];
|
||||
|
@ -54,9 +67,20 @@ typedef struct {
|
|||
uint8_t crypt_key[12];
|
||||
|
||||
// used for bruteforce the partial key
|
||||
// ISSUE: Presumes target is little-endian
|
||||
// BUGBUG: Non-portable ... presumes stored in little-endian form!
|
||||
uint16_t start_key;
|
||||
|
||||
} em4x70_data_t;
|
||||
//_Static_assert(sizeof(em4x70_data_t) == 36);
|
||||
|
||||
// ISSUE: `bool` type does not have a standard-defined size.
|
||||
// therefore, compatibility between architectures /
|
||||
// compilers is not guaranteed.
|
||||
// TODO: verify alignof(bool) == 1
|
||||
//_Static_assert(sizeof(bool) == 1, "bool size mismatch");
|
||||
typedef union {
|
||||
uint8_t data[32];
|
||||
} em4x70_tag_t;
|
||||
//_Static_assert(sizeof(em4x70_tag_t) == 32, "em4x70_tag_t size mismatch");
|
||||
|
||||
#endif /* EM4X70_H__ */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue