This commit is contained in:
iceman1001 2024-09-14 15:03:29 +02:00
commit 20a0bc3a81
12 changed files with 56 additions and 48 deletions

View file

@ -792,7 +792,7 @@ static int CmdEM410xClone(const char *Cmd) {
}
packet.cmd = WHTSF_82xx;
memcpy(packet.pwd, (uint8_t[]){0xBB, 0xDD, 0x33, 0x99}, 4);
memcpy(packet.pwd, (uint8_t[]) {0xBB, 0xDD, 0x33, 0x99}, 4);
SendCommandNG(CMD_LF_HITAGS_WRITE, (uint8_t *)&packet, sizeof(packet));
if (WaitForResponseTimeout(CMD_LF_HITAGS_WRITE, &resp, 4000) == false) {
PrintAndLogEx(WARNING, "timeout while waiting for reply.");

View file

@ -107,7 +107,7 @@ static int CmdLFHitagSRead(const char *Cmd) {
use_crypto = true;
}
if ((key_len == 0) && use_82xx) {
memcpy(key, (uint8_t[]){0xBB, 0xDD, 0x33, 0x99}, 4);
memcpy(key, (uint8_t[]) {0xBB, 0xDD, 0x33, 0x99}, 4);
key_len = 4;
}
if ((key_len == 0) && use_crypto) {
@ -266,7 +266,7 @@ static int CmdLFHitagSWrite(const char *Cmd) {
use_crypto = true;
}
if ((key_len == 0) && use_82xx) {
memcpy(key, (uint8_t[]){0xBB, 0xDD, 0x33, 0x99}, 4);
memcpy(key, (uint8_t[]) {0xBB, 0xDD, 0x33, 0x99}, 4);
key_len = 4;
}
if ((key_len == 0) && use_crypto) {

View file

@ -448,9 +448,12 @@ static struct emv_pk *emv_pk_get_ca_pk_from_file(const char *fname,
return NULL;
}
// not used
/*
char *emv_pk_get_ca_pk_file(const char *dirname, const unsigned char *rid, unsigned char idx) {
if (!dirname)
if (dirname == NULL) {
dirname = ".";//openemv_config_get_str("capk.dir", NULL);
}
char *filename;
int ret = asprintf(&filename, "%s/%02hhx%02hhx%02hhx%02hhx%02hhx_%02hhx.0",
@ -462,15 +465,17 @@ char *emv_pk_get_ca_pk_file(const char *dirname, const unsigned char *rid, unsig
rid[4],
idx);
if (ret <= 0)
if (ret <= 0) {
return NULL;
}
return filename;
}
char *emv_pk_get_ca_pk_rid_file(const char *dirname, const unsigned char *rid) {
if (!dirname)
if (dirname == NULL) {
dirname = "."; //openemv_config_get_str("capk.dir", NULL);
}
char *filename;
int ret = asprintf(&filename, "%s/%02hhx%02hhx%02hhx%02hhx%02hhx.pks",
@ -481,11 +486,13 @@ char *emv_pk_get_ca_pk_rid_file(const char *dirname, const unsigned char *rid) {
rid[3],
rid[4]);
if (ret <= 0)
if (ret <= 0) {
return NULL;
}
return filename;
}
*/
struct emv_pk *emv_pk_get_ca_pk(const unsigned char *rid, unsigned char idx) {
struct emv_pk *pk = NULL;

View file

@ -22,6 +22,7 @@
#define EMV_PK_H
#include "common.h"
#include <stdbool.h>
struct emv_pk {
unsigned char rid[5];
@ -46,7 +47,7 @@ void emv_pk_free(struct emv_pk *pk);
char *emv_pk_dump_pk(const struct emv_pk *pk);
bool emv_pk_verify(const struct emv_pk *pk);
char *emv_pk_get_ca_pk_file(const char *dirname, const unsigned char *rid, unsigned char idx);
char *emv_pk_get_ca_pk_rid_file(const char *dirname, const unsigned char *rid);
// char *emv_pk_get_ca_pk_file(const char *dirname, const unsigned char *rid, unsigned char idx);
// char *emv_pk_get_ca_pk_rid_file(const char *dirname, const unsigned char *rid);
struct emv_pk *emv_pk_get_ca_pk(const unsigned char *rid, unsigned char idx);
#endif

View file

@ -52,7 +52,7 @@ int mfDarkside(uint8_t blockno, uint8_t key_type, uint64_t *key) {
bool first_run = true;
// message
PrintAndLogEx(INFO, "Expected execution time is about 25seconds on average");
PrintAndLogEx(INFO, "Expected execution time is about " _YELLOW_("25") " seconds on average");
PrintAndLogEx(INFO, "Press " _GREEN_("pm3 button") " to abort");
while (true) {