proxmark3/common/generator.h
NZSmartie c9a10631de
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-02 01:41:48 +13:00

49 lines
1.9 KiB
C

//-----------------------------------------------------------------------------
// Copyright (C) 2019 iceman <iceman at iuse.se>
//
// This code is licensed to you under the terms of the GNU GPL, version 2 or,
// at your option, any later version. See the LICENSE.txt file for the text of
// the license.
//-----------------------------------------------------------------------------
// Generator commands
//-----------------------------------------------------------------------------
#ifndef GENERATOR_H__
#define GENERATOR_H__
#include "common.h"
uint32_t ul_ev1_pwdgenA(uint8_t *uid);
uint32_t ul_ev1_pwdgenB(uint8_t *uid);
uint32_t ul_ev1_pwdgenC(uint8_t *uid);
uint32_t ul_ev1_pwdgenD(uint8_t *uid);
uint16_t ul_ev1_packgenA(uint8_t *uid);
uint16_t ul_ev1_packgenB(uint8_t *uid);
uint16_t ul_ev1_packgenC(uint8_t *uid);
uint16_t ul_ev1_packgenD(uint8_t *uid);
int mfc_algo_ving_one(uint8_t *uid, uint8_t sector, uint8_t keytype, uint64_t *key);
int mfc_algo_ving_all(uint8_t *uid, uint8_t *keys);
int mfc_algo_yale_one(uint8_t *uid, uint8_t sector, uint8_t keytype, uint64_t *key);
int mfc_algo_yale_all(uint8_t *uid, uint8_t *keys);
int mfc_algo_saflok_one(uint8_t *uid, uint8_t sector, uint8_t keytype, uint64_t *key);
int mfc_algo_saflok_all(uint8_t *uid, uint8_t *keys);
int mfc_algo_mizip_one(uint8_t *uid, uint8_t sector, uint8_t keytype, uint64_t *key);
int mfc_algo_mizip_all(uint8_t *uid, uint8_t *keys);
int mfc_algo_di_one(uint8_t *uid, uint8_t sector, uint8_t keytype, uint64_t *key);
int mfc_algo_di_all(uint8_t *uid, uint8_t *keys);
int mfc_algo_sky_one(uint8_t *uid, uint8_t sector, uint8_t keytype, uint64_t *key);
int mfc_algo_sky_all(uint8_t *uid, uint8_t *keys);
uint32_t lf_t55xx_white_pwdgen(uint32_t id);
int mfdes_kdf_input_gallagher(uint8_t *uid, uint8_t uidLen, uint8_t keyNo, uint32_t aid, uint8_t *kdfInputOut, uint8_t *kdfInputLen);
int generator_selftest(void);
#endif