FreeCalypso > hg > fc-sim-tools
annotate utils/sim-iccid-mkfull.c @ 99:97ba63d9361a
scripts/fcsim1-sst: turn off STK & OTA services
In the initial unprogrammed state of the cards from Grcard, SST has
services 25 through 29 set to allocated and activated. However,
these cards appear to not actually support OTA, ENVELOPE commands
do nothing (just return SW 9000), and they were never observed
issuing any proactive SIM commands, even after a feature-generous
TERMINAL PROFILE. Therefore, let's list these STK & OTA services
as allocated, but not activated in our FCSIM1 SST.
| author | Mychaela Falconia <falcon@freecalypso.org> |
|---|---|
| date | Wed, 05 May 2021 04:26:07 +0000 |
| parents | 372ecc4aa2c4 |
| children |
| rev | line source |
|---|---|
|
17
372ecc4aa2c4
off-line utils ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
|
372ecc4aa2c4
off-line utils ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * This program is a special utility for constructing ICCIDs |
|
372ecc4aa2c4
off-line utils ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * following the 18+1 convention. The argument is an 18-digit ICCID |
|
372ecc4aa2c4
off-line utils ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 * base, usually entered in shorthand, and the output is the full |
|
372ecc4aa2c4
off-line utils ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 * 19-digit ICCID. |
|
372ecc4aa2c4
off-line utils ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 */ |
|
372ecc4aa2c4
off-line utils ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 |
|
372ecc4aa2c4
off-line utils ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 #include <sys/types.h> |
|
372ecc4aa2c4
off-line utils ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 #include <stdio.h> |
|
372ecc4aa2c4
off-line utils ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 #include <stdlib.h> |
|
372ecc4aa2c4
off-line utils ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 |
|
372ecc4aa2c4
off-line utils ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 main(argc, argv) |
|
372ecc4aa2c4
off-line utils ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 char **argv; |
|
372ecc4aa2c4
off-line utils ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 { |
|
372ecc4aa2c4
off-line utils ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 u_char digits[19]; |
|
372ecc4aa2c4
off-line utils ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 char asc[20]; |
|
372ecc4aa2c4
off-line utils ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 int rc; |
|
372ecc4aa2c4
off-line utils ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 |
|
372ecc4aa2c4
off-line utils ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 if (argc != 2) { |
|
372ecc4aa2c4
off-line utils ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 fprintf(stderr, "usage: %s shorthand-iccid\n", argv[0]); |
|
372ecc4aa2c4
off-line utils ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 exit(1); |
|
372ecc4aa2c4
off-line utils ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 } |
|
372ecc4aa2c4
off-line utils ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 rc = parse_decimal_shorthand(argv[1], digits, 18); |
|
372ecc4aa2c4
off-line utils ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 if (rc < 0) |
|
372ecc4aa2c4
off-line utils ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 exit(1); /* error msg already printed */ |
|
372ecc4aa2c4
off-line utils ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 digits[18] = compute_iccid_luhn(digits); |
|
372ecc4aa2c4
off-line utils ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 nibbles_to_ascii(digits, 19, asc); |
|
372ecc4aa2c4
off-line utils ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 puts(asc); |
|
372ecc4aa2c4
off-line utils ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 exit(0); |
|
372ecc4aa2c4
off-line utils ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 } |
