bsc: add TC_ciph_mode_a5_2_1

Verify that A5/1 is preferred over A5/2. Add encr_exp_enc_alg to
MSC_ConnectionHandler:TestHdlrEncrParams, so the expected encryption
algorithm can be different from what the MSC tells the BSC about the
capabilities of MS.

Related: OS#4975
Change-Id: I688d056bcfe73f7846f908a28f4621f944cf2178
diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index 6bea49e..dac86ca 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -3351,6 +3351,22 @@
 	vc_conn.done;
 	f_shutdown_helper();
 }
+/* OS#4975: verify that A5/1 is preferred over A5/2 */
+testcase TC_ciph_mode_a5_2_1() runs on test_CT {
+	var MSC_ConnHdlr vc_conn;
+	var TestHdlrParams pars := f_gen_test_hdlr_pars();
+
+	pars.encr := valueof(t_EncrParams('06'O, f_rnd_octstring(8))); /* A5/1 and A5/2 (0x02|0x04)*/
+	pars.encr_exp_enc_alg := '02'O; /* A5/1 */
+
+	f_init(1, true);
+	f_vty_encryption_a5("1 2");
+	f_sleep(1.0);
+	vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars);
+	vc_conn.done;
+	f_vty_encryption_a5_reset();
+	f_shutdown_helper();
+}
 testcase TC_ciph_mode_a5_3() runs on test_CT {
 	var MSC_ConnHdlr vc_conn;
 	var TestHdlrParams pars := f_gen_test_hdlr_pars();
@@ -9228,6 +9244,7 @@
 	execute( TC_assignment_fr_a5_not_sup() );
 	execute( TC_ciph_mode_a5_0() );
 	execute( TC_ciph_mode_a5_1() );
+	execute( TC_ciph_mode_a5_2_1() );
 	execute( TC_ciph_mode_a5_3() );
 	execute( TC_ciph_mode_a5_4() );