FreeCalypso > hg > fc-pcsc-tools
view simtool/pbupd_imm.c @ 74:8562d8508cf2
grcard2-set-{adm,super}-hex commands implemented
It appears that GrcardSIM2 cards allow arbitrary 64-bit keys
for ADM and SUPER ADM, not necessarily consisting of ASCII digits
like the specs require for standard PIN and PUK, and pySim-prog.py
in fact sets the ADM key to 4444444444444444 in hex by default,
which is not an ASCII digit string. If the cards allow such keys,
we need to support them too.
| author | Mychaela Falconia <falcon@freecalypso.org> |
|---|---|
| date | Tue, 16 Feb 2021 04:10:36 +0000 |
| parents | 52ec2d3eb851 |
| children |
line wrap: on
line source
/* * This module implements the pb-update-imm command. */ #include <sys/types.h> #include <string.h> #include <strings.h> #include <stdio.h> #include <stdlib.h> #include "curfile.h" cmd_pb_update_imm(argc, argv) char **argv; { int rc; unsigned recno; u_char record[255], *fixp; rc = phonebook_op_common(argv[1]); if (rc < 0) return(rc); recno = strtoul(argv[2], 0, 0); if (recno < 1 || recno > curfile_record_count) { fprintf(stderr, "error: specified record number is invalid\n"); return(-1); } memset(record, 0xFF, curfile_record_len); fixp = record + curfile_record_len - 14; rc = encode_phone_number_arg(argv[3], fixp, 0); if (rc < 0) return(rc); if (argv[4]) { rc = qstring_arg_to_gsm7(argv[4], record, curfile_record_len - 14); if (rc < 0) return(rc); } return update_rec_op(recno, 0x04, record, curfile_record_len); }
