FreeCalypso > hg > fc-sim-tools
view simtool/a38.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 | ddd767f6e15b |
children |
line wrap: on
line source
/* * This module implements the a38 command for exercising * the SIM's RUN GSM ALGORITHM operation. */ #include <sys/types.h> #include <ctype.h> #include <stdio.h> #include <stdlib.h> #include "simresp.h" cmd_a38(argc, argv, outf) char **argv; FILE *outf; { u_char cmd[21]; int rc; /* RUN GSM ALGORITHM command APDU */ cmd[0] = 0xA0; cmd[1] = 0x88; cmd[2] = 0; cmd[3] = 0; cmd[4] = 16; rc = decode_hex_data_from_string(argv[1], cmd + 5, 16, 16); if (rc < 0) return(rc); rc = apdu_exchange(cmd, 21); if (rc < 0) return(rc); if (sim_resp_sw != 0x9F0C) { fprintf(stderr, "error or unexpected SW response to RUN GSM ALGO: %04X\n", sim_resp_sw); return(-1); } /* GET RESPONSE follow-up */ cmd[1] = 0xC0; cmd[4] = 12; rc = apdu_exchange(cmd, 5); if (rc < 0) return(rc); if (sim_resp_sw != 0x9000) { fprintf(stderr, "bad SW resp to GET RESPONSE: %04X\n", sim_resp_sw); return(-1); } if (sim_resp_data_len != 12) { fprintf(stderr, "error: GET RESPONSE returned %u bytes, expected 12\n", sim_resp_data_len); return(-1); } fprintf(outf, "SRES: %02X %02X %02X %02X\n", sim_resp_data[0], sim_resp_data[1], sim_resp_data[2], sim_resp_data[3]); fprintf(outf, "Kc: %02X %02X %02X %02X %02X %02X %02X %02X\n", sim_resp_data[4], sim_resp_data[5], sim_resp_data[6], sim_resp_data[7], sim_resp_data[8], sim_resp_data[9], sim_resp_data[10], sim_resp_data[11]); return(0); }