# HG changeset patch # User Mychaela Falconia # Date 1612285937 0 # Node ID 2adb802b2a98d9c8fc01d8401389946b22d5efce # Parent 95c2a67e1219d2487d3739637c24be63c680b5fb fc-simtool: verify-ext command implemented diff -r 95c2a67e1219 -r 2adb802b2a98 simtool/chv.c --- a/simtool/chv.c Tue Feb 02 04:32:42 2021 +0000 +++ b/simtool/chv.c Tue Feb 02 17:12:17 2021 +0000 @@ -72,6 +72,31 @@ return(0); } +cmd_verify_ext(argc, argv) + char **argv; +{ + u_char cmd[13]; + int rc; + + /* VERIFY CHV command APDU */ + cmd[0] = 0xA0; + cmd[1] = 0x20; + cmd[2] = 0x00; + cmd[3] = strtoul(argv[1], 0, 0); + cmd[4] = 8; + rc = encode_pin_entry(argv[2], 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); +} + cmd_change_chv(argc, argv) char **argv; { diff -r 95c2a67e1219 -r 2adb802b2a98 simtool/dispatch.c --- a/simtool/dispatch.c Tue Feb 02 04:32:42 2021 +0000 +++ b/simtool/dispatch.c Tue Feb 02 17:12:17 2021 +0000 @@ -38,6 +38,7 @@ extern int cmd_update_bin_imm(); extern int cmd_update_rec(); extern int cmd_verify_chv(); +extern int cmd_verify_ext(); extern int display_sim_resp_in_hex(); extern int good_exit(); @@ -90,6 +91,7 @@ {"update-rec", 2, 2, cmd_update_rec}, {"verify-chv1", 1, 1, cmd_verify_chv}, {"verify-chv2", 1, 1, cmd_verify_chv}, + {"verify-ext", 2, 2, cmd_verify_ext}, {"verify-pin1", 1, 1, cmd_verify_chv}, {"verify-pin2", 1, 1, cmd_verify_chv}, {0, 0, 0, 0}