2015-07-14 05:06:49 +08:00
|
|
|
//-----------------------------------------------------------------------------
|
2022-01-06 09:19:46 +08:00
|
|
|
// Copyright (C) Jonathan Westhues, Nov 2006
|
|
|
|
// Copyright (C) Gerhard de Koning Gans - May 2008
|
|
|
|
// Copyright (C) Proxmark3 contributors. See AUTHORS.md for details.
|
2015-07-14 05:06:49 +08:00
|
|
|
//
|
2022-01-06 09:19:46 +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.
|
2015-07-14 05:06:49 +08:00
|
|
|
//-----------------------------------------------------------------------------
|
2016-03-21 02:33:07 +08:00
|
|
|
// Routines to support ISO 14443 type B.
|
2015-07-14 05:06:49 +08:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#ifndef __ISO14443B_H
|
|
|
|
#define __ISO14443B_H
|
2016-03-21 02:33:07 +08:00
|
|
|
|
2019-08-08 22:57:33 +08:00
|
|
|
#include "common.h"
|
2017-01-25 07:33:03 +08:00
|
|
|
|
2020-10-02 20:31:52 +08:00
|
|
|
#include "iso14b.h"
|
2019-08-08 22:57:33 +08:00
|
|
|
#include "pm3_cmd.h"
|
2015-07-14 05:06:49 +08:00
|
|
|
|
2018-02-01 22:19:47 +08:00
|
|
|
#ifndef AddCrc14A
|
2019-03-10 03:34:41 +08:00
|
|
|
# define AddCrc14A(data, len) compute_crc(CRC_14443_A, (data), (len), (data)+(len), (data)+(len)+1)
|
2018-02-01 22:19:47 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef AddCrc14B
|
2019-03-10 03:34:41 +08:00
|
|
|
# define AddCrc14B(data, len) compute_crc(CRC_14443_B, (data), (len), (data)+(len), (data)+(len)+1)
|
2018-02-01 22:19:47 +08:00
|
|
|
#endif
|
|
|
|
|
2020-05-10 22:59:38 +08:00
|
|
|
void iso14443b_setup(void);
|
2020-10-04 01:08:27 +08:00
|
|
|
int iso14443b_apdu(uint8_t const *msg, size_t msg_len, bool send_chaining, void *rxdata, uint16_t rxmaxlen, uint8_t *res);
|
2020-08-17 03:13:10 +08:00
|
|
|
|
2020-07-04 03:33:17 +08:00
|
|
|
int iso14443b_select_card(iso14b_card_select_t *card);
|
2020-09-26 15:33:36 +08:00
|
|
|
int iso14443b_select_card_srx(iso14b_card_select_t *card);
|
2022-07-01 04:50:52 +08:00
|
|
|
int iso14443b_select_xrx_card(iso14b_card_select_t *card);
|
2016-03-21 02:33:07 +08:00
|
|
|
|
2023-08-15 13:16:11 +08:00
|
|
|
void SimulateIso14443bTag(const uint8_t *pupi);
|
2019-08-08 22:57:33 +08:00
|
|
|
void AcquireRawAdcSamplesIso14443b(uint32_t parameter);
|
2020-10-28 01:52:11 +08:00
|
|
|
void ReadSTBlock(uint8_t blocknr);
|
2020-08-17 04:47:45 +08:00
|
|
|
void SniffIso14443b(void);
|
2019-08-08 22:57:33 +08:00
|
|
|
void SendRawCommand14443B(uint32_t, uint32_t, uint8_t, uint8_t[]);
|
2021-05-07 18:27:13 +08:00
|
|
|
void SendRawCommand14443B_Ex(iso14b_raw_cmd_t *p);
|
2019-08-08 22:57:33 +08:00
|
|
|
|
2016-04-28 02:42:01 +08:00
|
|
|
// States for 14B SIM command
|
2019-03-10 03:34:41 +08:00
|
|
|
#define SIM_NOFIELD 0
|
|
|
|
#define SIM_IDLE 1
|
|
|
|
#define SIM_HALTED 2
|
|
|
|
#define SIM_SELECTING 3
|
|
|
|
#define SIM_HALTING 4
|
2016-04-28 01:53:21 +08:00
|
|
|
#define SIM_ACKNOWLEDGE 5
|
2019-03-10 03:34:41 +08:00
|
|
|
#define SIM_WORK 6
|
2015-07-14 05:06:49 +08:00
|
|
|
|
|
|
|
#endif /* __ISO14443B_H */
|