# HG changeset patch # User Mychaela Falconia # Date 1613177877 0 # Node ID ae3342497fea350c6fc94a0c73343d0318c4119d # Parent 32d6186668cfdc69dadbf7d47fe124cb00f7fd2e fc-simtool verify-hex command added diff -r 32d6186668cf -r ae3342497fea simtool/chvext.c --- a/simtool/chvext.c Sat Feb 13 00:01:38 2021 +0000 +++ b/simtool/chvext.c Sat Feb 13 00:57:57 2021 +0000 @@ -31,3 +31,28 @@ } return(0); } + +cmd_verify_hex(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 = decode_hex_data_from_string(argv[2], cmd + 5, 8, 8); + 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); +} diff -r 32d6186668cf -r ae3342497fea simtool/dispatch.c --- a/simtool/dispatch.c Sat Feb 13 00:01:38 2021 +0000 +++ b/simtool/dispatch.c Sat Feb 13 00:57:57 2021 +0000 @@ -57,6 +57,7 @@ extern int cmd_update_rec(); extern int cmd_verify_chv(); extern int cmd_verify_ext(); +extern int cmd_verify_hex(); extern int display_sim_resp_in_hex(); extern int good_exit(); @@ -134,6 +135,7 @@ {"verify-chv1", 1, 1, cmd_verify_chv}, {"verify-chv2", 1, 1, cmd_verify_chv}, {"verify-ext", 2, 2, cmd_verify_ext}, + {"verify-hex", 2, 2, cmd_verify_hex}, {"verify-pin1", 1, 1, cmd_verify_chv}, {"verify-pin2", 1, 1, cmd_verify_chv}, {0, 0, 0, 0}