changeset 221:e3059d58ec93

fc-simtool grcard2-set-ki command implemented
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 09 Mar 2021 02:23:00 +0000
parents e07de8a9cedf
children 8c151bb01d28
files simtool/dispatch.c simtool/grcard2.c
diffstat 2 files changed, 17 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/simtool/dispatch.c	Tue Mar 09 02:01:27 2021 +0000
+++ b/simtool/dispatch.c	Tue Mar 09 02:23:00 2021 +0000
@@ -35,6 +35,7 @@
 extern int cmd_grcard2_set_adm5();
 extern int cmd_grcard2_set_adm5_hex();
 extern int cmd_grcard2_set_comp128();
+extern int cmd_grcard2_set_ki();
 extern int cmd_grcard2_set_pin();
 extern int cmd_grcard2_set_puk();
 extern int cmd_grcard2_set_super();
@@ -166,6 +167,7 @@
 	{"grcard2-set-adm5", 1, 1, 0, cmd_grcard2_set_adm5},
 	{"grcard2-set-adm5-hex", 1, 1, 0, cmd_grcard2_set_adm5_hex},
 	{"grcard2-set-comp128", 1, 1, 0, cmd_grcard2_set_comp128},
+	{"grcard2-set-ki", 1, 1, 0, cmd_grcard2_set_ki},
 	{"grcard2-set-pin1", 1, 1, 0, cmd_grcard2_set_pin},
 	{"grcard2-set-pin2", 1, 1, 0, cmd_grcard2_set_pin},
 	{"grcard2-set-puk1", 1, 1, 0, cmd_grcard2_set_puk},
--- a/simtool/grcard2.c	Tue Mar 09 02:01:27 2021 +0000
+++ b/simtool/grcard2.c	Tue Mar 09 02:23:00 2021 +0000
@@ -229,3 +229,18 @@
 	magic_byte |= code;
 	return update_bin_op(2, &magic_byte, 1);
 }
+
+cmd_grcard2_set_ki(argc, argv)
+	char **argv;
+{
+	u_char ki[16];
+	int rc;
+
+	rc = decode_hex_data_from_string(argv[1], ki, 16, 16);
+	if (rc < 0)
+		return(rc);
+	rc = select_ef_weki();
+	if (rc < 0)
+		return(rc);
+	return update_bin_op(3, ki, 16);
+}