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