mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-07-30 11:39:14 -07:00
fixes from #616
This commit is contained in:
parent
d2d126878e
commit
a2c7158f78
13 changed files with 25 additions and 30 deletions
|
@ -779,8 +779,10 @@ bool NestedCheckKey(uint64_t key, TAuthData *ad, uint8_t *cmd, uint8_t cmdsize,
|
|||
uint32_t ar1 = crypto1_word(pcs, 0, 0) ^ ad->ar_enc;
|
||||
uint32_t at1 = crypto1_word(pcs, 0, 0) ^ ad->at_enc;
|
||||
|
||||
if (!(ar == ar1 && at == at1 && NTParityChk(ad, nt1)))
|
||||
if (!(ar == ar1 && at == at1 && NTParityChk(ad, nt1))) {
|
||||
crypto1_destroy(pcs);
|
||||
return false;
|
||||
}
|
||||
|
||||
memcpy(buf, cmd, cmdsize);
|
||||
mf_crypto1_decrypt(pcs, buf, cmdsize, 0);
|
||||
|
|
|
@ -271,13 +271,11 @@ void GetKeySettings( uint8_t *aid){
|
|||
char *str = messStr;
|
||||
uint8_t isOK = 0;
|
||||
uint32_t options = NONE;
|
||||
UsbCommand c;
|
||||
UsbCommand c = {CMD_MIFARE_DESFIRE};
|
||||
UsbCommand resp;
|
||||
|
||||
//memset(messStr, 0x00, 512);
|
||||
|
||||
c.cmd = CMD_MIFARE_DESFIRE;
|
||||
|
||||
if ( aid == NULL ){
|
||||
PrintAndLogEx(NORMAL, " CMK - PICC, Card Master Key settings ");
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
|
|
|
@ -267,7 +267,6 @@ static void init_bitflip_bitarrays(void)
|
|||
if (bytesread != filesize) {
|
||||
PrintAndLogEx(WARNING, "File read error with %s. Aborting...\n", state_file_name);
|
||||
fclose(statesfile);
|
||||
inflateEnd(&compressed_stream);
|
||||
exit(5);
|
||||
}
|
||||
fclose(statesfile);
|
||||
|
|
|
@ -2322,7 +2322,7 @@ int CmdHF14AMfucSetPwd(const char *Cmd){
|
|||
//
|
||||
int CmdHF14AMfucSetUid(const char *Cmd){
|
||||
|
||||
UsbCommand c;
|
||||
UsbCommand c = {CMD_MIFAREU_READBL};
|
||||
UsbCommand resp;
|
||||
uint8_t uid[7] = {0x00};
|
||||
char cmdp = param_getchar(Cmd, 0);
|
||||
|
@ -2335,7 +2335,6 @@ int CmdHF14AMfucSetUid(const char *Cmd){
|
|||
}
|
||||
|
||||
// read block2.
|
||||
c.cmd = CMD_MIFAREU_READBL;
|
||||
c.arg[0] = 2;
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
|
|
|
@ -255,7 +255,7 @@ int CmdHIDClone(const char *Cmd) {
|
|||
|
||||
uint32_t hi2 = 0, hi = 0, lo = 0;
|
||||
uint32_t n = 0, i = 0;
|
||||
UsbCommand c;
|
||||
UsbCommand c = {CMD_HID_CLONE_TAG);
|
||||
|
||||
uint8_t ctmp = param_getchar(Cmd, 0);
|
||||
if ( strlen(Cmd) == 0 || ctmp == 'H' || ctmp == 'h' ) return usage_lf_hid_clone();
|
||||
|
@ -280,7 +280,6 @@ int CmdHIDClone(const char *Cmd) {
|
|||
c.d.asBytes[0] = 0;
|
||||
}
|
||||
|
||||
c.cmd = CMD_HID_CLONE_TAG;
|
||||
c.arg[0] = hi2;
|
||||
c.arg[1] = hi;
|
||||
c.arg[2] = lo;
|
||||
|
|
|
@ -182,8 +182,8 @@ int CmdLFHitagSim(const char *Cmd) {
|
|||
return 1;
|
||||
}
|
||||
tag_mem_supplied = true;
|
||||
size_t bytes_read = fread(c.d.asBytes, 48, 1, f);
|
||||
if ( bytes_read == 0) {
|
||||
size_t bytes_read = fread(c.d.asBytes, 1, 48, f);
|
||||
if ( bytes_read == 48) {
|
||||
PrintAndLogEx(WARNING, "Error: File reading error");
|
||||
fclose(f);
|
||||
return 1;
|
||||
|
@ -306,8 +306,8 @@ int CmdLFHitagSimS(const char *Cmd) {
|
|||
return 1;
|
||||
}
|
||||
tag_mem_supplied = true;
|
||||
size_t bytes_read = fread(c.d.asBytes, 4*64, 1, f);
|
||||
if ( bytes_read == 0) {
|
||||
size_t bytes_read = fread(c.d.asBytes, 1, 4*64, f);
|
||||
if ( bytes_read == 4*64) {
|
||||
PrintAndLogEx(WARNING, "Error: File reading error");
|
||||
fclose(f);
|
||||
return 1;
|
||||
|
@ -341,8 +341,8 @@ int CmdLFHitagCheckChallenges(const char *Cmd) {
|
|||
return 1;
|
||||
}
|
||||
file_given = true;
|
||||
size_t bytes_read = fread(c.d.asBytes, 8*60, 1, f);
|
||||
if ( bytes_read == 0) {
|
||||
size_t bytes_read = fread(c.d.asBytes, 1, 8*60, f);
|
||||
if ( bytes_read == 8*60) {
|
||||
PrintAndLogEx(WARNING, "Error: File reading error");
|
||||
fclose(f);
|
||||
return 1;
|
||||
|
|
|
@ -419,7 +419,7 @@ int CmdIndalaSim(const char *Cmd) {
|
|||
|
||||
// iceman - needs refactoring
|
||||
int CmdIndalaClone(const char *Cmd) {
|
||||
UsbCommand c;
|
||||
UsbCommand c = {0};
|
||||
uint32_t uid1, uid2, uid3, uid4, uid5, uid6, uid7;
|
||||
uid1 = uid2 = uid3 = uid4 = uid5 = uid6 = uid7 = 0;
|
||||
uint32_t n = 0, i = 0;
|
||||
|
|
|
@ -105,7 +105,7 @@ static struct crypto_pk *crypto_pk_polarssl_open_rsa(va_list vl)
|
|||
int res = rsa_check_pubkey(&cp->ctx);
|
||||
if(res != 0) {
|
||||
fprintf(stderr, "PolarSSL public key error res=%x exp=%d mod=%d.\n", res * -1, explen, modlen);
|
||||
|
||||
free(cp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -150,6 +150,7 @@ static struct crypto_pk *crypto_pk_polarssl_open_priv_rsa(va_list vl)
|
|||
int res = rsa_check_privkey(&cp->ctx);
|
||||
if(res != 0) {
|
||||
fprintf(stderr, "PolarSSL private key error res=%x exp=%d mod=%d.\n", res * -1, explen, modlen);
|
||||
free(cp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -184,6 +185,7 @@ static struct crypto_pk *crypto_pk_polarssl_genkey_rsa(va_list vl)
|
|||
int res = rsa_gen_key(&cp->ctx, &myrand, NULL, nbits, exp);
|
||||
if (res) {
|
||||
fprintf(stderr, "PolarSSL private key generation error res=%x exp=%d nbits=%d.\n", res * -1, exp, nbits);
|
||||
free(cp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -214,8 +216,9 @@ static unsigned char *crypto_pk_polarssl_encrypt(const struct crypto_pk *_cp, co
|
|||
}
|
||||
|
||||
res = rsa_public(&cp->ctx, buf, result);
|
||||
if(res) {
|
||||
if (res) {
|
||||
printf("RSA encrypt failed. Error: %x data len: %zu key len: %zu\n", res * -1, len, keylen);
|
||||
free(result);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -242,6 +245,7 @@ static unsigned char *crypto_pk_polarssl_decrypt(const struct crypto_pk *_cp, co
|
|||
res = rsa_private(&cp->ctx, buf, result); // CHECK???
|
||||
if(res) {
|
||||
printf("RSA decrypt failed. Error: %x data len: %zu key len: %zu\n", res * -1, len, keylen);
|
||||
free(result);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ int zlib_compress(FILE *infile[], uint8_t num_infiles, FILE *outfile, bool hardn
|
|||
|
||||
for(uint16_t j = 0; j < num_infiles; j++) {
|
||||
for(uint16_t k = 0; k < FPGA_INTERLEAVE_SIZE; k++) {
|
||||
c = fgetc(infile[j]);
|
||||
c = (uint8_t)fgetc(infile[j]);
|
||||
if (!feof(infile[j])) {
|
||||
fpga_config[i++] = c;
|
||||
} else if (num_infiles > 1) {
|
||||
|
|
|
@ -264,10 +264,8 @@ fail:
|
|||
// Get the state of the proxmark, backwards compatible
|
||||
static int get_proxmark_state(uint32_t *state)
|
||||
{
|
||||
UsbCommand c;
|
||||
c.cmd = CMD_DEVICE_INFO;
|
||||
UsbCommand c = {CMD_DEVICE_INFO};
|
||||
SendCommand(&c);
|
||||
|
||||
UsbCommand resp;
|
||||
ReceiveCommand(&resp);
|
||||
|
||||
|
|
|
@ -62,13 +62,9 @@ extern "C" void MainGraphics(void)
|
|||
extern "C" void InitGraphics(int argc, char **argv, char *script_cmds_file, char *script_cmd, bool usb_present)
|
||||
{
|
||||
#ifdef Q_WS_X11
|
||||
bool useGUI = getenv("DISPLAY") != 0;
|
||||
#else
|
||||
bool useGUI = true;
|
||||
#endif
|
||||
if (!useGUI)
|
||||
if (getenv("DISPLAY") == NULL)
|
||||
return;
|
||||
|
||||
#endif
|
||||
main_loop_thread = new WorkerThread(script_cmds_file, script_cmd, usb_present);
|
||||
gui = new ProxGuiQT(argc, argv, main_loop_thread);
|
||||
}
|
||||
|
|
|
@ -113,7 +113,7 @@ class ProxGuiQT : public QObject
|
|||
ProxWidget *plotwidget;
|
||||
int argc;
|
||||
char **argv;
|
||||
void (*main_func)(void);
|
||||
//void (*main_func)(void);
|
||||
WorkerThread *proxmarkThread;
|
||||
|
||||
public:
|
||||
|
|
|
@ -118,7 +118,7 @@ uint64_t msclock(void) {
|
|||
#include <sys/timeb.h>
|
||||
struct _timeb t;
|
||||
_ftime(&t);
|
||||
return 1000 * t.time + t.millitm;
|
||||
return 1000 * (uint64_t)t.time + t.millitm;
|
||||
|
||||
// NORMAL CODE (use _ftime_s)
|
||||
//struct _timeb t;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue