-
Notifications
You must be signed in to change notification settings - Fork 36
/
mfc-spec.txt
98 lines (86 loc) · 2.29 KB
/
mfc-spec.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# Copyright (c) 2011 Anders Sundman <anders@4zm.org>
#
# This file is part of rkfterm.
#
# rkfterm 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.
#
# rkfterm 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 rkfterm. If not, see <http://www.gnu.org/licenses/>.
# About the specification language:
#
# The primitive types in the specification language are Byte and Bit
# and arrays of such. All other types need to be defined.
#
# Every specification must include the root type '.'
# The root type is specified by its type name '.'
. {
Sector0 sector_0 # The types usesed here are defined below
Sector1k[15] sectors_1k
Sector4k[12] sectors_4k
}
# The type Sector_0 represents the first sector.
Sector0 {
{ # This is an anonymous inner type. The type doesn't have a name.
Byte[4] uid # Unique ID
Byte cd # Check Byte; uid bytes xor:ed with cb should be 0
Bit[4] - # Not used. Use '-' as a name in theese cases
Bit[4] sak
Byte[2] atqa
Byte[8] manufacturer_data
} block_0
Block[2] blocks
SectorTrailer trailer
}
Sector1k {
Block[3] blocks
SectorTrailer trailer
}
Sector4k {
Block[15] blocks
SectorTrailer trailer
}
Block {
Byte[16] data
}
SectorTrailer {
Byte[6] key_a
ACL acl
Byte[1] - # Undefined
Byte[6] key_b
}
# See p.12 of Mifare MF1 IC S50 Functional Specification, rev. 4.0
# _b suffixed bits are inverted versions of non suffixed counterparts
ACL {
Bit c2x3_b # bit 7
Bit c2x2_b
Bit c2x1_b
Bit c2x0_b # bit 4
Bit c1x3_b # bit 3
Bit c1x2_b
Bit c1x1_b
Bit c1x0_b # bit 0
Bit c1x3 # bit 7
Bit c1x2
Bit c1x1
Bit c1x0 # bit 4
Bit c3x3_b # bit 3
Bit c3x2_b
Bit c3x1_b
Bit c3x0_b # bit 0
Bit c3x3 # bit 7
Bit c3x2
Bit c3x1
Bit c3x0 # bit 4
Bit c2x3 # bit 3
Bit c2x2
Bit c2x1
Bit c2x0 # bit 0
}