FreeCalypso > hg > freecalypso-hwlab
annotate simtool/dumpdir.c @ 145:14dee03e9675
fc-uicc-tool: low-level write commands ported over
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 06 Feb 2021 02:17:51 +0000 |
parents | 431194b772e1 |
children |
rev | line source |
---|---|
143
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * This module implements the dump of EF_DIR. |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 */ |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 #include <sys/types.h> |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 #include <stdio.h> |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 #include <stdlib.h> |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 #include <pcsclite.h> |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 #include <winscard.h> |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 #include "globals.h" |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 #include "file_id.h" |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 static |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 check_all_blank() |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 { |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 u_char *dp, *endp; |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 dp = sim_resp_data; |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 endp = sim_resp_data + sim_resp_data_len; |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 while (dp < endp) |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 if (*dp++ != 0xFF) |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 return(0); |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 return(1); |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 } |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 static void |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 dump_aid(tlv) |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 u_char *tlv; |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 { |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 unsigned reclen, n; |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 reclen = tlv[1]; |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 printf(" AID:"); |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 for (n = 0; n < reclen; n++) |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 printf(" %02X", tlv[n+2]); |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 putchar('\n'); |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 } |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 static void |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 dump_label(tlv) |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 u_char *tlv; |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 { |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 int rc; |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 unsigned textlen; |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 printf(" Label: "); |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 rc = validate_alpha_field(tlv + 2, tlv[1], &textlen); |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 if (rc < 0) { |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 printf("malformed\n"); |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 return; |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 } |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 print_alpha_field(tlv + 2, textlen, stdout); |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 putchar('\n'); |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 } |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 static void |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 dump_unknown_tlv(tlv) |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 u_char *tlv; |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 { |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 unsigned reclen, n; |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 reclen = tlv[1] + 2; |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 printf(" TLV:"); |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 for (n = 0; n < reclen; n++) |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 printf(" %02X", tlv[n]); |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 putchar('\n'); |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 } |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
69 static void |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
70 dump_record(recno) |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
71 unsigned recno; |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
72 { |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
73 unsigned totlen, reclen; |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
74 u_char *dp, *endp; |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
75 |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
76 printf("Record #%u:\n", recno); |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
77 if (sim_resp_data[0] != 0x61) { |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
78 printf(" bad: first byte != 0x61\n"); |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
79 return; |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
80 } |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
81 totlen = sim_resp_data[1]; |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
82 if (totlen < 3 || totlen > 0x7F) { |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
83 printf(" bad: global length byte 0x%02X is invalid\n", totlen); |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
84 return; |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
85 } |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
86 if (totlen + 2 > sim_resp_data_len) { |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
87 printf(" bad: TLV global length exceeds EF record length\n"); |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
88 return; |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
89 } |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
90 dp = sim_resp_data + 2; |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
91 endp = sim_resp_data + 2 + totlen; |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
92 while (dp < endp) { |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
93 if (endp - dp < 2) { |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
94 trunc_error: printf(" bad: truncated TLV record\n"); |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
95 return; |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
96 } |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
97 if ((dp[0] & 0x1F) == 0x1F) { |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
98 printf(" bad: extended tag not supported\n"); |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
99 return; |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
100 } |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
101 if (dp[1] & 0x80) { |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
102 printf(" bad: extended length not supported\n"); |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
103 return; |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
104 } |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
105 reclen = dp[1] + 2; |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
106 if (endp - dp < reclen) |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
107 goto trunc_error; |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
108 switch (dp[0]) { |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
109 case 0x4F: |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
110 dump_aid(dp); |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
111 break; |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
112 case 0x50: |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
113 dump_label(dp); |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
114 break; |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
115 default: |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
116 dump_unknown_tlv(dp); |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
117 } |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
118 dp += reclen; |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
119 } |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
120 } |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
121 |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
122 cmd_uicc_dir() |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
123 { |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
124 int rc; |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
125 unsigned recno; |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
126 |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
127 rc = select_op(FILEID_MF); |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
128 if (rc < 0) |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
129 return(rc); |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
130 rc = select_op(EF_DIR); |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
131 if (rc < 0) |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
132 return(rc); |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
133 rc = parse_ef_select_response(); |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
134 if (rc < 0) |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
135 return(rc); |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
136 if (curfile_structure != 0x01) { |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
137 fprintf(stderr, "error: EF_DIR is not linear fixed\n"); |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
138 return(-1); |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
139 } |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
140 if (curfile_record_len < 5) { |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
141 fprintf(stderr, "error: EF_DIR record length is too short\n"); |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
142 return(-1); |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
143 } |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
144 for (recno = 1; recno <= curfile_record_count; recno++) { |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
145 rc = readrec_op(recno, 0x04, curfile_record_len); |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
146 if (rc < 0) |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
147 return(rc); |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
148 if (check_all_blank()) |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
149 continue; |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
150 dump_record(recno); |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
151 } |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
152 return(0); |
431194b772e1
fc-simtool: uicc-dump command ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
153 } |