mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-22 06:13:51 -07:00
refactoring
This commit is contained in:
parent
41907800c4
commit
d80a3fb6e9
2 changed files with 18 additions and 11 deletions
|
@ -688,7 +688,7 @@ int DesfireSelectAIDHex(DesfireContext *ctx, uint32_t aid1, bool select_two, uin
|
|||
return DesfireSelectAID(ctx, data, (select_two) ? &data[3] : NULL);
|
||||
}
|
||||
|
||||
int DesfireSelectAndAuthenticate(DesfireContext *dctx, DesfireSecureChannel secureChannel, uint32_t aid, bool verbose) {
|
||||
int DesfireSelectAndAuthenticateEx(DesfireContext *dctx, DesfireSecureChannel secureChannel, uint32_t aid, bool noauth, bool verbose) {
|
||||
if (verbose)
|
||||
DesfirePrintContext(dctx);
|
||||
|
||||
|
@ -700,22 +700,28 @@ int DesfireSelectAndAuthenticate(DesfireContext *dctx, DesfireSecureChannel secu
|
|||
if (verbose)
|
||||
PrintAndLogEx(INFO, "App %06x " _GREEN_("selected"), aid);
|
||||
|
||||
res = DesfireAuthenticate(dctx, secureChannel, verbose);
|
||||
if (res != PM3_SUCCESS) {
|
||||
PrintAndLogEx(ERR, "Desfire authenticate " _RED_("error") ". Result: %d", res);
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
if (!noauth) {
|
||||
res = DesfireAuthenticate(dctx, secureChannel, verbose);
|
||||
if (res != PM3_SUCCESS) {
|
||||
PrintAndLogEx(ERR, "Desfire authenticate " _RED_("error") ". Result: %d", res);
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
|
||||
if (DesfireIsAuthenticated(dctx)) {
|
||||
if (verbose)
|
||||
PrintAndLogEx(INFO, "Desfire " _GREEN_("authenticated"));
|
||||
} else {
|
||||
return PM3_ESOFT;
|
||||
if (DesfireIsAuthenticated(dctx)) {
|
||||
if (verbose)
|
||||
PrintAndLogEx(INFO, "Desfire " _GREEN_("authenticated"));
|
||||
} else {
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
}
|
||||
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
int DesfireSelectAndAuthenticate(DesfireContext *dctx, DesfireSecureChannel secureChannel, uint32_t aid, bool verbose) {
|
||||
return DesfireSelectAndAuthenticateEx(dctx, secureChannel, aid, false, verbose);
|
||||
}
|
||||
|
||||
int DesfireAuthenticate(DesfireContext *dctx, DesfireSecureChannel secureChannel, bool verbose) {
|
||||
// 3 different way to authenticate AUTH (CRC16) , AUTH_ISO (CRC32) , AUTH_AES (CRC32)
|
||||
// 4 different crypto arg1 DES, 3DES, 3K3DES, AES
|
||||
|
|
|
@ -106,6 +106,7 @@ int DesfireSelectAID(DesfireContext *ctx, uint8_t *aid1, uint8_t *aid2);
|
|||
int DesfireSelectAIDHex(DesfireContext *ctx, uint32_t aid1, bool select_two, uint32_t aid2);
|
||||
|
||||
int DesfireSelectAndAuthenticate(DesfireContext *dctx, DesfireSecureChannel secureChannel, uint32_t aid, bool verbose);
|
||||
int DesfireSelectAndAuthenticateEx(DesfireContext *dctx, DesfireSecureChannel secureChannel, uint32_t aid, bool noauth, bool verbose);
|
||||
int DesfireAuthenticate(DesfireContext *dctx, DesfireSecureChannel secureChannel, bool verbose);
|
||||
|
||||
int DesfireFormatPICC(DesfireContext *dctx);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue