Files
proxmark3/include/iclass_cmd.h
T
Matt Moran 14b6580fcb Squashed commit of the following:
commit 8f77179a2f
Author: Philippe Teuwen <phil@teuwen.org>
Date:   Thu Jan 6 11:25:38 2022 +0100

    remove unused file

commit bcafc5d03c
Author: Philippe Teuwen <phil@teuwen.org>
Date:   Thu Jan 6 11:24:04 2022 +0100

    some historical copyright adjustments, thanks @iceman1001!

commit b703bb746b
Author: Philippe Teuwen <phil@teuwen.org>
Date:   Thu Jan 6 02:19:46 2022 +0100

    Adapting license headers, WIP

commit 8952a1f712
Author: Philippe Teuwen <phil@teuwen.org>
Date:   Thu Jan 6 00:37:34 2022 +0100

    adapt contributing text

commit cdfb83075f
Author: Philippe Teuwen <phil@teuwen.org>
Date:   Thu Jan 6 00:24:15 2022 +0100

    toc

commit 014817f854
Author: Philippe Teuwen <phil@teuwen.org>
Date:   Thu Jan 6 00:15:40 2022 +0100

    Adding AUTHORS and changing licensing terms from 'GPLv2 or later' to 'GPLv3 or later' to comply with components available only under 'GPLv3 or later'. Details:

    Initial releases by Jonathan Westhues in 2005-2007 were made under GPL
    "either version 2 of the License, or (at your option) any later version"

    Since then, a number of dependencies and files were integrated to the project, but under a "GPLv3 or later" license. These components are reveng, desfire_crypto and lrpcrypto. Note that compnents cryptorf, hitag2crack and fpga-xc3s100e are also under GPLv3+ but not bound to the firmware or client source code.

    Therefore, we must mechanically upgrade the license of the whole project to GPLv3+, as made possible by the initial licensing terms and as mandated by the inclusion of GPLv3+ code.

    Still to do: update each source file header:

        Copyright (C) Proxmark3 contributors. See AUTHORS.md for details.

        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.

        You should have received a copy of the GNU General Public License
        along with this program.  If not, see <http://www.gnu.org/licenses/>.

commit 5561466fe8
Author: Philippe Teuwen <phil@teuwen.org>
Date:   Wed Jan 5 18:56:56 2022 +0100

    make style

commit 2d1a1dc034
Author: Philippe Teuwen <phil@teuwen.org>
Date:   Wed Jan 5 17:57:49 2022 +0100

    make style doc/commands.json

commit fc53665e5c
Merge: a6d22ee43 c0cc09d86
Author: Philippe Teuwen <phil@teuwen.org>
Date:   Wed Jan 5 17:52:44 2022 +0100

    Merge pull request #1552 from joswr1ght/master

    Add --no-auth support for hf mfdes createapp

commit c0cc09d86b
Author: Joshua Wright <jwright@hasborg.com>
Date:   Wed Jan 5 07:12:20 2022 -0500

    Style consistency changes for hf mfdes createapp feature addition

commit f9c96f49da
Author: Joshua Wright <jwright@hasborg.com>
Date:   Tue Jan 4 17:01:10 2022 -0500

    Update CHANGELOG with MIFARE DESFire createapp --no-auth change

commit 859b55933d
Author: Joshua Wright <jwright@hasborg.com>
Date:   Tue Jan 4 15:55:26 2022 -0500

    Add --no-auth support for hf mfdes createapp
2022-01-07 01:08:55 +13:00

160 lines
4.0 KiB
C

//-----------------------------------------------------------------------------
// (c) 2021 Iceman
//
// 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.
//-----------------------------------------------------------------------------
// iCLASS type prototyping
//-----------------------------------------------------------------------------
#ifndef _ICLASS_CMD_H_
#define _ICLASS_CMD_H_
#include "common.h"
//-----------------------------------------------------------------------------
// iCLASS / PICOPASS
//-----------------------------------------------------------------------------
// iCLASS reader flags
#define FLAG_ICLASS_READER_INIT 0x01
#define FLAG_ICLASS_READER_CLEARTRACE 0x02
//#define FLAG_ICLASS_READER_ONLY_ONCE 0x04
#define FLAG_ICLASS_READER_CREDITKEY 0x08
#define FLAG_ICLASS_READER_AIA 0x10
// iCLASS reader status flags
#define FLAG_ICLASS_NULL 0x00
#define FLAG_ICLASS_CSN 0x01
#define FLAG_ICLASS_CC 0x02
#define FLAG_ICLASS_CONF 0x04
#define FLAG_ICLASS_AIA 0x08
// iCLASS simulation modes
#define ICLASS_SIM_MODE_CSN 0
#define ICLASS_SIM_MODE_CSN_DEFAULT 1
#define ICLASS_SIM_MODE_READER_ATTACK 2
#define ICLASS_SIM_MODE_FULL 3
#define ICLASS_SIM_MODE_READER_ATTACK_KEYROLL 4
#define ICLASS_SIM_MODE_EXIT_AFTER_MAC 5 // note: device internal only
#define ICLASS_SIM_MODE_CONFIG_CARD 6
// iCLASS auth request data structure
// used with read block, dump, write block
typedef struct {
uint8_t key[8];
bool use_raw;
bool use_elite;
bool use_credit_key;
bool use_replay;
bool send_reply;
bool do_auth;
uint8_t blockno;
} PACKED iclass_auth_req_t;
// iCLASS read block response data structure
typedef struct {
bool isOK;
uint8_t div_key[8];
uint8_t mac[4];
uint8_t data[8];
} PACKED iclass_readblock_resp_t;
// iCLASS dump data structure
typedef struct {
iclass_auth_req_t req;
uint8_t start_block;
uint8_t end_block;
} PACKED iclass_dump_req_t;
// iCLASS write block request data structure
typedef struct {
iclass_auth_req_t req;
uint8_t data[8];
} PACKED iclass_writeblock_req_t;
// iCLASS dump data structure
typedef struct {
uint8_t blockno;
uint8_t data[8];
} PACKED iclass_restore_item_t;
typedef struct {
iclass_auth_req_t req;
uint8_t item_cnt;
iclass_restore_item_t blocks[];
} PACKED iclass_restore_req_t;
typedef struct iclass_premac {
uint8_t mac[4];
} PACKED iclass_premac_t;
typedef struct {
bool use_credit_key;
uint8_t count;
iclass_premac_t items[];
} PACKED iclass_chk_t;
typedef struct iclass_block {
uint8_t d[8];
} iclass_block_t;
typedef struct iclass_prekey {
uint8_t mac[4];
uint8_t key[8];
} iclass_prekey_t;
typedef struct {
char desc[70];
uint8_t data[16];
} iclass_config_card_item_t;
// iclass / picopass chip config structures and shared routines
typedef struct {
uint8_t app_limit; //[8]
uint8_t otp[2]; //[9-10]
uint8_t block_writelock;//[11]
uint8_t chip_config; //[12]
uint8_t mem_config; //[13]
uint8_t eas; //[14]
uint8_t fuses; //[15]
} PACKED picopass_conf_block_t;
// iCLASS secure mode memory mapping
typedef struct {
uint8_t csn[8];
picopass_conf_block_t conf;
uint8_t epurse[8];
uint8_t key_d[8];
uint8_t key_c[8];
uint8_t app_issuer_area[8];
} PACKED picopass_hdr_t;
// iCLASS non-secure mode memory mapping
typedef struct {
uint8_t csn[8];
picopass_conf_block_t conf;
uint8_t app_issuer_area[8];
} PACKED picopass_ns_hdr_t;
// reader flags
typedef struct {
uint8_t flags;
} PACKED iclass_card_select_t;
// reader flags
typedef struct {
uint8_t status;
union {
picopass_hdr_t hdr;
picopass_ns_hdr_t ns_hdr;
} header;
} PACKED iclass_card_select_resp_t;
#endif // _ICLASS_H_