# HG changeset patch # User Mychaela Falconia # Date 1618987233 0 # Node ID c06c0e2da24cdaebae9af2217db65f483b1e23fc # Parent 3d9c50880ae702270f6db8d13fede04b3fbb56a1 fc-simtool terminal-resp command implemented diff -r 3d9c50880ae7 -r c06c0e2da24c simtool/cmdtab.c --- a/simtool/cmdtab.c Wed Apr 21 05:50:45 2021 +0000 +++ b/simtool/cmdtab.c Wed Apr 21 06:40:33 2021 +0000 @@ -99,6 +99,7 @@ extern int cmd_sws_pin1_enable(); extern int cmd_telecom_sum(); extern int cmd_terminal_profile(); +extern int cmd_terminal_resp(); extern int cmd_uicc_dir(); extern int cmd_unblock_chv(); extern int cmd_update_bin(); @@ -234,6 +235,7 @@ {"sws-pin1-enable", 0, 0, 0, cmd_sws_pin1_enable}, {"telecom-sum", 0, 0, 0, cmd_telecom_sum}, {"terminal-profile", 1, 1, 0, cmd_terminal_profile}, + {"terminal-resp", 1, 1, 0, cmd_terminal_resp}, {"uicc-dir", 0, 0, 1, cmd_uicc_dir}, {"unblock-chv1", 2, 2, 0, cmd_unblock_chv}, {"unblock-chv2", 2, 2, 0, cmd_unblock_chv}, diff -r 3d9c50880ae7 -r c06c0e2da24c simtool/stktest.c --- a/simtool/stktest.c Wed Apr 21 05:50:45 2021 +0000 +++ b/simtool/stktest.c Wed Apr 21 06:40:33 2021 +0000 @@ -110,3 +110,27 @@ display_sim_resp_in_hex(outf); return(0); } + +cmd_terminal_resp(argc, argv) + char **argv; +{ + u_char cmd[260]; + int rc; + unsigned len; + + rc = decode_hex_data_from_string(argv[1], cmd + 5, 1, 255); + if (rc < 0) + return(rc); + len = rc; + /* TERMINAL RESPONSE command APDU */ + cmd[0] = 0xA0; + cmd[1] = 0x14; + cmd[2] = 0; + cmd[3] = 0; + cmd[4] = len; + rc = apdu_exchange(cmd, len + 5); + if (rc < 0) + return(rc); + printf("%04X\n", sim_resp_sw); + return(0); +}