mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 13:53:55 -07:00
Legic: Moved card simulator into separate file & cleaned interface.
Reader and card simulation have almost no common code. Moreover the sim uses an SSP Clock at 212kHz for all timings to prevent any drifting from the PRNG. This clock speed is not available in reader simulation mode (SSP runs at up to 3.4MHz, and changes speed between TX and RX). For these reasons having the code in separate files makes it significantly cleaner.
This commit is contained in:
parent
e472a21194
commit
61e4eac2b2
7 changed files with 176 additions and 24 deletions
|
@ -1,7 +1,7 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// (c) 2009 Henryk Plötz <henryk@ploetzli.ch>
|
||||
// 2016 Iceman
|
||||
// 2018 AntiCat (rwd rewritten)
|
||||
// 2018 AntiCat
|
||||
//
|
||||
// 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
|
||||
|
@ -16,7 +16,7 @@
|
|||
#include "legic_prng.h" /* legic PRNG impl */
|
||||
#include "legic.h" /* legic_card_select_t struct */
|
||||
|
||||
static uint8_t* legic_mem; /* card memory, used for read, write and sim */
|
||||
static uint8_t* legic_mem; /* card memory, used for read, write */
|
||||
static legic_card_select_t card;/* metadata of currently selected card */
|
||||
static crc_t legic_crc;
|
||||
|
||||
|
@ -179,7 +179,7 @@ static uint32_t rx_frame(uint8_t len) {
|
|||
uint32_t last_frame_start = last_frame_end;
|
||||
|
||||
uint32_t frame = 0;
|
||||
for(uint8_t i = 0; i < len; i++) {
|
||||
for(uint8_t i = 0; i < len; ++i) {
|
||||
frame |= (rx_bit() ^ legic_prng_get_bit()) << i;
|
||||
legic_prng_forward(1);
|
||||
|
||||
|
@ -235,7 +235,7 @@ static bool rx_ack() {
|
|||
// Legic Reader
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
int init_card(uint8_t cardtype, legic_card_select_t *p_card) {
|
||||
static int init_card(uint8_t cardtype, legic_card_select_t *p_card) {
|
||||
p_card->tagtype = cardtype;
|
||||
|
||||
switch(p_card->tagtype) {
|
||||
|
@ -314,7 +314,7 @@ static uint32_t setup_phase_reader(uint8_t iv) {
|
|||
legic_prng_init(0);
|
||||
tx_frame(iv, 7);
|
||||
|
||||
// configure iv
|
||||
// configure prng
|
||||
legic_prng_init(iv);
|
||||
legic_prng_forward(2);
|
||||
|
||||
|
@ -501,7 +501,3 @@ OUT:
|
|||
switch_off();
|
||||
StopTicks();
|
||||
}
|
||||
|
||||
void LegicRfSimulate(int phase, int frame, int reqresp) {
|
||||
cmd_send(CMD_ACK, 0, 0, 0, 0, 0); //TODO Implement
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue