comparison simtool/chvext.c @ 47:ae3342497fea

fc-simtool verify-hex command added
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 13 Feb 2021 00:57:57 +0000
parents 32d6186668cf
children
comparison
equal deleted inserted replaced
46:32d6186668cf 47:ae3342497fea
29 fprintf(stderr, "bad SW response: %04X\n", sim_resp_sw); 29 fprintf(stderr, "bad SW response: %04X\n", sim_resp_sw);
30 return(-1); 30 return(-1);
31 } 31 }
32 return(0); 32 return(0);
33 } 33 }
34
35 cmd_verify_hex(argc, argv)
36 char **argv;
37 {
38 u_char cmd[13];
39 int rc;
40
41 /* VERIFY CHV command APDU */
42 cmd[0] = 0xA0;
43 cmd[1] = 0x20;
44 cmd[2] = 0x00;
45 cmd[3] = strtoul(argv[1], 0, 0);
46 cmd[4] = 8;
47 rc = decode_hex_data_from_string(argv[2], cmd + 5, 8, 8);
48 if (rc < 0)
49 return(rc);
50 rc = apdu_exchange(cmd, 13);
51 if (rc < 0)
52 return(rc);
53 if (sim_resp_sw != 0x9000) {
54 fprintf(stderr, "bad SW response: %04X\n", sim_resp_sw);
55 return(-1);
56 }
57 return(0);
58 }