FreeCalypso > hg > freecalypso-hwlab
diff simtool/grcard2.c @ 156:6d9d0cfc9ed8
fc-simtool: grcard2-set-adm command implemented
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 07 Feb 2021 02:40:28 +0000 |
parents | 804a5b0797c6 |
children | 239ebdb8f2af |
line wrap: on
line diff
--- a/simtool/grcard2.c Sun Feb 07 02:34:33 2021 +0000 +++ b/simtool/grcard2.c Sun Feb 07 02:40:28 2021 +0000 @@ -88,3 +88,28 @@ } return(0); } + +cmd_grcard2_set_adm(argc, argv) + char **argv; +{ + u_char cmd[13]; + int rc; + + /* Grcard2 proprietary command APDU */ + cmd[0] = 0xA0; + cmd[1] = 0xD4; + cmd[2] = 0x3A; + cmd[3] = 0x05; + cmd[4] = 8; + rc = encode_pin_entry(argv[1], cmd + 5); + if (rc < 0) + return(rc); + rc = apdu_exchange(cmd, 13); + if (rc < 0) + return(rc); + if (sim_resp_sw != 0x9000) { + fprintf(stderr, "bad SW response: %04X\n", sim_resp_sw); + return(-1); + } + return(0); +}