2020-01-02 18:42:57 +08:00
|
|
|
//-----------------------------------------------------------------------------
|
2022-01-07 08:58:03 +08:00
|
|
|
// Copyright (C) Proxmark3 contributors. See AUTHORS.md for details.
|
2020-01-02 18:42:57 +08:00
|
|
|
//
|
2022-01-07 08:58:03 +08:00
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// See LICENSE.txt for the text of the license.
|
2020-01-02 18:42:57 +08:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Generator commands
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#ifndef GENERATOR_H__
|
|
|
|
#define GENERATOR_H__
|
|
|
|
|
|
|
|
#include "common.h"
|
|
|
|
|
2022-01-07 05:08:28 +08:00
|
|
|
uint32_t ul_ev1_pwdgen_def(const uint8_t *uid);
|
2022-01-07 04:53:39 +08:00
|
|
|
uint32_t ul_ev1_pwdgenA(const uint8_t *uid);
|
|
|
|
uint32_t ul_ev1_pwdgenB(const uint8_t *uid);
|
2022-01-07 05:08:28 +08:00
|
|
|
uint32_t ul_ev1_pwdgenC(const uint8_t *uid);
|
2022-01-07 04:53:39 +08:00
|
|
|
uint32_t ul_ev1_pwdgenD(const uint8_t *uid);
|
2022-01-23 08:32:14 +08:00
|
|
|
uint32_t ul_ev1_pwdgenE(const uint8_t *uid);
|
2022-01-29 23:57:31 +08:00
|
|
|
uint32_t ul_ev1_pwdgenF(const uint8_t *uid);
|
2020-01-02 18:42:57 +08:00
|
|
|
|
2022-01-07 06:07:47 +08:00
|
|
|
uint16_t ul_ev1_packgen_def(const uint8_t *uid);
|
2022-01-07 04:53:39 +08:00
|
|
|
uint16_t ul_ev1_packgenA(const uint8_t *uid);
|
2022-01-07 06:07:47 +08:00
|
|
|
uint16_t ul_ev1_packgenB(const uint8_t *uid);
|
|
|
|
uint16_t ul_ev1_packgenC(const uint8_t *uid);
|
2022-01-07 04:53:39 +08:00
|
|
|
uint16_t ul_ev1_packgenD(const uint8_t *uid);
|
2022-01-23 21:38:42 +08:00
|
|
|
uint16_t ul_ev1_packgenE(const uint8_t *uid);
|
2020-01-02 18:42:57 +08:00
|
|
|
|
2020-01-10 05:58:12 +08:00
|
|
|
int mfc_algo_ving_one(uint8_t *uid, uint8_t sector, uint8_t keytype, uint64_t *key);
|
2020-01-02 22:29:15 +08:00
|
|
|
int mfc_algo_ving_all(uint8_t *uid, uint8_t *keys);
|
2020-01-02 18:42:57 +08:00
|
|
|
|
2020-01-10 05:58:12 +08:00
|
|
|
int mfc_algo_yale_one(uint8_t *uid, uint8_t sector, uint8_t keytype, uint64_t *key);
|
2020-01-02 22:29:15 +08:00
|
|
|
int mfc_algo_yale_all(uint8_t *uid, uint8_t *keys);
|
2020-01-02 18:42:57 +08:00
|
|
|
|
2020-01-10 05:58:12 +08:00
|
|
|
int mfc_algo_saflok_one(uint8_t *uid, uint8_t sector, uint8_t keytype, uint64_t *key);
|
2020-01-02 22:29:15 +08:00
|
|
|
int mfc_algo_saflok_all(uint8_t *uid, uint8_t *keys);
|
2020-01-02 18:42:57 +08:00
|
|
|
|
2022-01-07 04:53:39 +08:00
|
|
|
int mfc_algo_mizip_one(const uint8_t *uid, uint8_t sector, uint8_t keytype, uint64_t *key);
|
2020-01-02 22:29:15 +08:00
|
|
|
int mfc_algo_mizip_all(uint8_t *uid, uint8_t *keys);
|
2020-01-02 18:42:57 +08:00
|
|
|
|
2020-01-10 05:58:12 +08:00
|
|
|
int mfc_algo_di_one(uint8_t *uid, uint8_t sector, uint8_t keytype, uint64_t *key);
|
2020-01-02 22:29:15 +08:00
|
|
|
int mfc_algo_di_all(uint8_t *uid, uint8_t *keys);
|
2020-01-02 18:42:57 +08:00
|
|
|
|
2020-01-10 05:58:12 +08:00
|
|
|
int mfc_algo_sky_one(uint8_t *uid, uint8_t sector, uint8_t keytype, uint64_t *key);
|
2020-01-02 22:29:15 +08:00
|
|
|
int mfc_algo_sky_all(uint8_t *uid, uint8_t *keys);
|
2020-01-02 18:42:57 +08:00
|
|
|
|
2021-01-09 18:43:49 +08:00
|
|
|
int mfc_generate4b_nuid(uint8_t *uid, uint8_t *nuid);
|
|
|
|
|
2021-02-05 05:02:07 +08:00
|
|
|
int mfc_algo_touch_one(uint8_t *uid, uint8_t sector, uint8_t keytype, uint64_t *key);
|
|
|
|
|
2020-09-19 17:08:01 +08:00
|
|
|
uint32_t lf_t55xx_white_pwdgen(uint32_t id);
|
|
|
|
|
Gallagher key checking is now supported on MIFARE Desfire
Both `hf mfdes auth` and `hf mfdes chk` now support Key Diversification for
AN10922 and as special treat, Gallagher issued cards.
For `hf mfdes auth`:
```
-d, --kdf <kdf> Key Derivation Function (KDF) (0=None, 1=AN10922, 2=Gallagher)
-i, --kdfi <kdfi> KDF input (HEX 1-31 bytes)
```
And for `hf mfdes chk`:
```
-f, --kdf <kdf> Key Derivation Function (KDF) (0=None, 1=AN10922, Gallagher)
-i, --kdfi <kdfi> KDF input (HEX 1-31 bytes)
```
Examples:
- `hf mfdes auth -a 2081f4 -m 3 -t 4 -d 2 -n 2 -k 00112233445566778899aabbccddeeff`
Will diversify the key for key `2` on AID `2081F4` for Gallagher issued cards
- `hf mfdes chk -f 1 -i 00112233 -d mfdes_default_keys`
Will read in all the default keys from the dictionary, and diversify them
using AN10922 with the input data `00112233`
- `hf mfdes chk -f 2 -d mfdes_default_keys`
Will read in all the default keys from the dictionary, and diversify them
using AN10922 but with input data generated from the card's UID, AID and
key number.
2020-11-01 20:22:19 +08:00
|
|
|
int mfdes_kdf_input_gallagher(uint8_t *uid, uint8_t uidLen, uint8_t keyNo, uint32_t aid, uint8_t *kdfInputOut, uint8_t *kdfInputLen);
|
|
|
|
|
2020-05-03 06:33:28 +08:00
|
|
|
int generator_selftest(void);
|
2020-01-02 18:42:57 +08:00
|
|
|
#endif
|