changeset 32:d0be3802410a

fc-simtool sws-auth-pin[12] implemented
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 17 Mar 2021 00:49:50 +0000
parents cca7d0528f89
children c83ec3bd9d67
files simtool/cmdtab.c simtool/sws.c
diffstat 2 files changed, 34 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/simtool/cmdtab.c	Wed Mar 17 00:42:47 2021 +0000
+++ b/simtool/cmdtab.c	Wed Mar 17 00:49:50 2021 +0000
@@ -90,6 +90,8 @@
 extern int cmd_spn();
 extern int cmd_sst();
 extern int cmd_sws_auth_adm1();
+extern int cmd_sws_auth_pin1();
+extern int cmd_sws_auth_pin2();
 extern int cmd_sws_lookup();
 extern int cmd_telecom_sum();
 extern int cmd_terminal_profile();
@@ -219,6 +221,8 @@
 	{"spn", 0, 0, 1, cmd_spn},
 	{"sst", 0, 0, 1, cmd_sst},
 	{"sws-auth-adm1", 0, 0, 0, cmd_sws_auth_adm1},
+	{"sws-auth-pin1", 0, 0, 0, cmd_sws_auth_pin1},
+	{"sws-auth-pin2", 0, 0, 0, cmd_sws_auth_pin2},
 	{"sws-lookup", 1, 18, 1, cmd_sws_lookup},
 	{"telecom-sum", 0, 0, 0, cmd_telecom_sum},
 	{"terminal-profile", 1, 1, 0, cmd_terminal_profile},
--- a/simtool/sws.c	Wed Mar 17 00:42:47 2021 +0000
+++ b/simtool/sws.c	Wed Mar 17 00:49:50 2021 +0000
@@ -62,3 +62,33 @@
 		return(-1);
 	return verify_chv_func(0x0A, pin);
 }
+
+cmd_sws_auth_pin1()
+{
+	int rc;
+	struct dbread_state dbs;
+	char *pin;
+
+	rc = lookup_sws_card(&dbs);
+	if (rc < 0)
+		return(rc);
+	pin = dbread_find_key_req(&dbs, "PIN1");
+	if (!pin)
+		return(-1);
+	return verify_chv_func(0x01, pin);
+}
+
+cmd_sws_auth_pin2()
+{
+	int rc;
+	struct dbread_state dbs;
+	char *pin;
+
+	rc = lookup_sws_card(&dbs);
+	if (rc < 0)
+		return(rc);
+	pin = dbread_find_key_req(&dbs, "PIN2");
+	if (!pin)
+		return(-1);
+	return verify_chv_func(0x02, pin);
+}