fix one too small
[RRG-proxmark3.git] / client / src / cmdhfgallagher.h
blobc6e9a8fb35df6327bde156e270b2b888158e1002
1 //-----------------------------------------------------------------------------
2 // Copyright (C) Proxmark3 contributors. See AUTHORS.md for details.
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // See LICENSE.txt for the text of the license.
15 //-----------------------------------------------------------------------------
16 // High frequency GALLAGHER tag commands.
17 // MIFARE DESFire, AIDs 2081F4-2F81F4
18 //-----------------------------------------------------------------------------
20 #ifndef CMDHFGALLAGHER_H__
21 #define CMDHFGALLAGHER_H__
23 #include "common.h"
24 #include <stdint.h>
26 int CmdHFGallagher(const char *cmd);
28 /**
29 * @brief Create Gallagher Application Master Key by diversifying
30 * the MIFARE Site Key with card UID, key number, and application ID.
32 * @param sitekey MIFARE Site Key (16 bytes).
33 * @param uid Card unique ID (4 or 7 bytes).
34 * @param uidLen Length of UID.
35 * @param keyNum Key number (0 <= keyNum <= 2).
36 * @param aid Application ID (0x2?81F4 where 0 <= ? <= B).
37 * @param keyOut Buffer to copy the diversified key into (must be 16 bytes).
38 * @return PM3_SUCCESS if successful, PM3_EINVARG if an argument is invalid.
40 int hfgal_diversify_key(uint8_t *site_key, uint8_t *uid, uint8_t uid_len,
41 uint8_t key_num, uint32_t aid, uint8_t *key_output);
43 // The response code when an invalid key is used for authentication
44 // Returned in /client/src/mifare/desfirecore.c, line 1185 (if DesfireExchangeEx fails)
45 #define HFGAL_AUTH_FAIL 7
47 #endif