MERGED: @holimans changes

MERGED: @piwi changes
MERGED: @marshmellows changes.

I'm not even gonna try write up all that stuff..

ADD: changed some commands inside the "Hf 14a sim" on deviceside.
ADD: @mobeius "two nonce" version for mfkey32.   It is also inside the "hf 14a sim" with the "x" parameter.
This commit is contained in:
iceman1001
2015-07-22 23:00:52 +02:00
parent f445df401e
commit 7838f4beba
37 changed files with 488 additions and 105 deletions

View File

@@ -6,7 +6,7 @@
// ISO14443 CRC calculation code.
//-----------------------------------------------------------------------------
#include "../common/iso14443crc.h"
#include "iso14443crc.h"
static unsigned short UpdateCrc14443(unsigned char ch, unsigned short *lpwCrc)
{

View File

@@ -8,7 +8,7 @@
#ifndef __ISO14443CRC_H
#define __ISO14443CRC_H
#include "../include/common.h"
#include "common.h"
//-----------------------------------------------------------------------------
// Routines to compute the CRCs (two different flavours, just for confusion)

View File

@@ -7,7 +7,7 @@
//-----------------------------------------------------------------------------
#include "../include/proxmark3.h"
#include "proxmark3.h"
#include <stdint.h>
#include <stdlib.h>
//#include "iso15693tools.h"

View File

@@ -6,7 +6,7 @@
// LEFIC's obfuscation function
//-----------------------------------------------------------------------------
#include "../include/legic_prng.h"
#include "legic_prng.h"
struct lfsr {
uint8_t a;

View File

@@ -293,6 +293,22 @@ bool usb_poll()
return (pUdp->UDP_CSR[AT91C_EP_OUT] & btReceiveBank);
}
/**
In github PR #129, some users appears to get a false positive from
usb_poll, which returns true, but the usb_read operation
still returns 0.
This check is basically the same as above, but also checks
that the length available to read is non-zero, thus hopefully fixes the
bug.
**/
bool usb_poll_validate_length()
{
if (!usb_check()) return false;
if (!(pUdp->UDP_CSR[AT91C_EP_OUT] & btReceiveBank)) return false;
return (pUdp->UDP_CSR[AT91C_EP_OUT] >> 16) > 0;
}
//*----------------------------------------------------------------------------
//* \fn usb_read
//* \brief Read available data from Endpoint OUT

View File

@@ -41,6 +41,7 @@ void usb_disable();
void usb_enable();
bool usb_check();
bool usb_poll();
bool usb_poll_validate_length();
uint32_t usb_read(byte_t* data, size_t len);
uint32_t usb_write(const byte_t* data, const size_t len);