comparison simtool/chvext.c @ 46:32d6186668cf

simtool code: chvext.c split from chv.c
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 13 Feb 2021 00:01:38 +0000
parents simtool/chv.c@e9e8ce12f5a5
children ae3342497fea
comparison
equal deleted inserted replaced
45:5bca197e7495 46:32d6186668cf
1 /*
2 * This module implements some commands for extended (non-standard)
3 * CHV-like operations which some cards use for ADM access control.
4 */
5
6 #include <sys/types.h>
7 #include <stdio.h>
8 #include "simresp.h"
9
10 cmd_verify_ext(argc, argv)
11 char **argv;
12 {
13 u_char cmd[13];
14 int rc;
15
16 /* VERIFY CHV command APDU */
17 cmd[0] = 0xA0;
18 cmd[1] = 0x20;
19 cmd[2] = 0x00;
20 cmd[3] = strtoul(argv[1], 0, 0);
21 cmd[4] = 8;
22 rc = encode_pin_entry(argv[2], cmd + 5);
23 if (rc < 0)
24 return(rc);
25 rc = apdu_exchange(cmd, 13);
26 if (rc < 0)
27 return(rc);
28 if (sim_resp_sw != 0x9000) {
29 fprintf(stderr, "bad SW response: %04X\n", sim_resp_sw);
30 return(-1);
31 }
32 return(0);
33 }