ADD: 'script list' - now sorts the scripts in alphabetic order. It needs the extra define, in order to scandir and alphasort to work.

and this made our own version of le32toh function complain.  So this is removed from util.c and where it was used a new define replaced it (LE32TOH)
This commit is contained in:
iceman1001
2017-07-23 10:24:30 +02:00
parent db34c61aa0
commit 6c4d1560e9
5 changed files with 31 additions and 33 deletions

View File

@@ -11,6 +11,9 @@
//-----------------------------------------------------------------------------
#include "nonce2key.h"
// called with a uint8_t *x array
#define LE32TOH(x) (uint32_t)( ( (x)[3]<<24) | ( (x)[2]<<16) | ( (x)[1]<<8) | (x)[0]);
int nonce2key(uint32_t uid, uint32_t nt, uint32_t nr, uint64_t par_info, uint64_t ks_info, uint64_t * key) {
struct Crypto1State *state;
uint32_t i, pos, rr = 0, nr_diff;
@@ -241,7 +244,7 @@ bool tryMfk32_moebius(nonces_t data, uint64_t *outputkey, bool verbose) {
uint32_t nt0 = data.nonce; // first tag challenge (nonce)
uint32_t nr0_enc = data.nr; // first encrypted reader challenge
uint32_t ar0_enc = data.ar; // first encrypted reader response
//uint32_t uid1 = le32toh(data+16);
//uint32_t uid1 = LE32TOH(data+16);
uint32_t nt1 = data.nonce2; // second tag challenge (nonce)
uint32_t nr1_enc = data.nr2; // second encrypted reader challenge
uint32_t ar1_enc = data.ar2; // second encrypted reader response
@@ -294,11 +297,11 @@ bool tryMfk32_moebius(nonces_t data, uint64_t *outputkey, bool verbose) {
}
int tryMfk64_ex(uint8_t *data, uint64_t *outputkey){
uint32_t uid = le32toh(data);
uint32_t nt = le32toh(data+4); // tag challenge
uint32_t nr_enc = le32toh(data+8); // encrypted reader challenge
uint32_t ar_enc = le32toh(data+12); // encrypted reader response
uint32_t at_enc = le32toh(data+16); // encrypted tag response
uint32_t uid = LE32TOH(data);
uint32_t nt = LE32TOH(data+4); // tag challenge
uint32_t nr_enc = LE32TOH(data+8); // encrypted reader challenge
uint32_t ar_enc = LE32TOH(data+12); // encrypted reader response
uint32_t at_enc = LE32TOH(data+16); // encrypted tag response
return tryMfk64(uid, nt, nr_enc, ar_enc, at_enc, outputkey);
}

View File

@@ -20,7 +20,6 @@
#include "common.h"
#include "mifare.h" // nonces_t struct
#include "ui.h" // PrintAndLog
#include "util.h" // FALSE / TRUE
#include "proxmark3.h"
#include "mifarehost.h"