unleashed-firmware/applications/main/nfc/api/gallagher/gallagher_util.h
Nick Mooney f6eb79e1e5
NFC: Add support for Gallagher access control (MIFARE Classic only) (#3306)
* Merge remote-tracking branch 'origin/dev' into dev
* Add basic API interface (inspired by advanced plugins example), modify NfcSupportedCardsLoadContext to contain a pointer to a resolver
* WIP: API resolver implemented / passed to plugin via context, still having resolution issues
* Attempt to add constants to the nfc_app_api_table list
* WIP: We're defining the constants directly in nfc_app_api.c to see if this fixes our woes, which it does not.
* WIP: Remove furi_assert(false) (lmao)
* Working implementation of Gallagher decoding via exposed plugin API
* lib: api_hashtable: change log level for symbol not found message
* nfc app: alloc composite resolver along with supported cards
* nfc app: rework nfc api structure
* nfc app: fix memory leakage in supported cards

Co-authored-by: gornekich <n.gorbadey@gmail.com>
2024-02-09 15:00:17 +07:00

33 lines
No EOL
754 B
C

/* gallagher_util.h - Utilities for parsing Gallagher cards (New Zealand).
* Author: Nick Mooney (nick@mooney.nz)
*
* Reference: https://github.com/megabug/gallagher-research
*/
#pragma once
#include <lib/nfc/protocols/mf_classic/mf_classic.h>
#define GALLAGHER_CREDENTIAL_SECTOR 15
#ifdef __cplusplus
extern "C" {
#endif
extern const uint8_t GALLAGHER_DECODE_TABLE[256];
extern const uint8_t GALLAGHER_CARDAX_ASCII[MF_CLASSIC_BLOCK_SIZE];
typedef struct GallagherCredential {
uint8_t region;
uint8_t issue;
uint16_t facility;
uint32_t card;
} GallagherCredential;
void gallagher_deobfuscate_and_parse_credential(
GallagherCredential* credential,
const uint8_t* cardholder_data_obfuscated);
#ifdef __cplusplus
}
#endif