Merge pull request #2616 from jmichelp/fix14b
[RRG-proxmark3.git] / armsrc / iso14443b.h
blob70455ac154dc1d0b6b26ce155e10c6b4481a492f
1 //-----------------------------------------------------------------------------
2 // Copyright (C) Jonathan Westhues, Nov 2006
3 // Copyright (C) Gerhard de Koning Gans - May 2008
4 // Copyright (C) Proxmark3 contributors. See AUTHORS.md for details.
5 //
6 // This program is free software: you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation, either version 3 of the License, or
9 // (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // See LICENSE.txt for the text of the license.
17 //-----------------------------------------------------------------------------
18 // Routines to support ISO 14443 type B.
19 //-----------------------------------------------------------------------------
21 #ifndef __ISO14443B_H
22 #define __ISO14443B_H
24 #include "common.h"
26 #include "iso14b.h"
27 #include "pm3_cmd.h"
29 #ifndef AddCrc14A
30 # define AddCrc14A(data, len) compute_crc(CRC_14443_A, (data), (len), (data)+(len), (data)+(len)+1)
31 #endif
33 #ifndef AddCrc14B
34 # define AddCrc14B(data, len) compute_crc(CRC_14443_B, (data), (len), (data)+(len), (data)+(len)+1)
35 #endif
37 #ifndef AddCrc15
38 #define AddCrc15(data, len) compute_crc(CRC_ICLASS, (data), (len), (data)+(len), (data)+(len)+1)
39 #endif
41 void iso14443b_setup(void);
42 int iso14443b_apdu(uint8_t const *msg, size_t msg_len, bool send_chaining, void *rxdata, uint16_t rxmaxlen, uint8_t *response_byte, uint16_t *responselen);
44 int iso14443b_select_card(iso14b_card_select_t *card);
46 void SimulateIso14443bTag(const uint8_t *pupi);
47 void read_14b_st_block(uint8_t blocknr);
48 void SniffIso14443b(void);
49 void SendRawCommand14443B(iso14b_raw_cmd_t *p);
51 // States for 14B SIM command
52 #define SIM_POWER_OFF 0
53 #define SIM_IDLE 1
54 #define SIM_READY 2
55 #define SIM_HALT 3
56 #define SIM_ACTIVE 4
58 #endif /* __ISO14443B_H */