changeset 122:c0cd0d4635bb

fc-simtool verify-sjs1-adm1 command implemented
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 20 Feb 2021 01:20:50 +0000
parents 8e70ee7c194f
children 09a66626647d
files simtool/dispatch.c simtool/sysmo.c
diffstat 2 files changed, 27 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/simtool/dispatch.c	Sat Feb 20 00:48:22 2021 +0000
+++ b/simtool/dispatch.c	Sat Feb 20 01:20:50 2021 +0000
@@ -80,6 +80,7 @@
 extern int cmd_verify_chv();
 extern int cmd_verify_ext();
 extern int cmd_verify_hex();
+extern int cmd_verify_sjs1_adm1();
 extern int cmd_write_iccid();
 extern int cmd_write_imsi();
 
@@ -187,6 +188,7 @@
 	{"verify-hex", 2, 2, 0, cmd_verify_hex},
 	{"verify-pin1", 1, 1, 0, cmd_verify_chv},
 	{"verify-pin2", 1, 1, 0, cmd_verify_chv},
+	{"verify-sjs1-adm1", 1, 1, 0, cmd_verify_sjs1_adm1},
 	{"write-iccid", 1, 1, 0, cmd_write_iccid},
 	{"write-imsi", 1, 1, 0, cmd_write_imsi},
 	{0, 0, 0, 0, 0}
--- a/simtool/sysmo.c	Sat Feb 20 00:48:22 2021 +0000
+++ b/simtool/sysmo.c	Sat Feb 20 01:20:50 2021 +0000
@@ -13,6 +13,31 @@
 #include "curfile.h"
 #include "file_id.h"
 
+cmd_verify_sjs1_adm1(argc, argv)
+	char **argv;
+{
+	u_char cmd[13];
+	int rc;
+
+	/* UICC-style VERIFY PIN command APDU */
+	cmd[0] = 0x00;
+	cmd[1] = 0x20;
+	cmd[2] = 0x00;
+	cmd[3] = 0x0A;
+	cmd[4] = 8;
+	rc = encode_pin_entry(argv[1], 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_fix_sysmo_msisdn()
 {
 	int rc;