comparison uicc/select.c @ 135:51d6aaa43a7b

fc-uicc-tool: telecom-sum command implemented
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 04 Feb 2021 02:55:31 +0000
parents 69628bcfec17
children baf5bd698764
comparison
equal deleted inserted replaced
134:69628bcfec17 135:51d6aaa43a7b
221 } 221 }
222 if (lenp) 222 if (lenp)
223 *lenp = (tlv[2] << 8) | tlv[3]; 223 *lenp = (tlv[2] << 8) | tlv[3];
224 return(0); 224 return(0);
225 } 225 }
226
227 select_resp_get_linear_fixed(rec_len_ret, rec_count_ret)
228 unsigned *rec_len_ret, *rec_count_ret;
229 {
230 u_char *tlv;
231 unsigned reclen;
232
233 tlv = extract_select_resp_tag(0x82);
234 if (!tlv)
235 return(-1);
236 if (tlv[1] != 5) {
237 bad_file_desc: fprintf(stderr, "error: file type is not linear fixed EF\n");
238 return(-1);
239 }
240 if (tlv[2] & 0x80)
241 goto bad_file_desc;
242 if ((tlv[2] & 0x38) == 0x38)
243 goto bad_file_desc;
244 if ((tlv[2] & 0x07) != 0x02)
245 goto bad_file_desc;
246 reclen = (tlv[4] << 8) | tlv[5];
247 if (reclen < 1 || reclen > 255) {
248 fprintf(stderr,
249 "error: SELECT response gives invalid record length\n");
250 return(-1);
251 }
252 if (rec_len_ret)
253 *rec_len_ret = reclen;
254 if (rec_count_ret)
255 *rec_count_ret = tlv[6];
256 return(0);
257 }