This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
osmith gerrit-no-reply at lists.osmocom.orgosmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/24898 ) Change subject: bsc: add TC_ciph_mode_a5_2_1 ...................................................................... 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 --- M bsc/BSC_Tests.ttcn M bsc/MSC_ConnectionHandler.ttcn M bsc/expected-results.xml 3 files changed, 36 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/98/24898/1 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() ); diff --git a/bsc/MSC_ConnectionHandler.ttcn b/bsc/MSC_ConnectionHandler.ttcn index 94ec2b9..fc12307 100644 --- a/bsc/MSC_ConnectionHandler.ttcn +++ b/bsc/MSC_ConnectionHandler.ttcn @@ -581,6 +581,7 @@ RSL_IE_Body expect_mr_conf_ie optional, /* typically present for AMR codecs */ bitstring expect_mr_s0_s7 optional, /* typically present for AMR codecs */ TestHdlrEncrParams encr optional, + OCT1 encr_exp_enc_alg optional, /* if set, expect a different enc_alg than encr.enc_alg */ TestHdlrParamsLcls lcls, SCCP_PAR_Address sccp_addr_msc optional, SCCP_PAR_Address sccp_addr_bsc optional, @@ -610,6 +611,7 @@ expect_mr_conf_ie := omit, expect_mr_s0_s7 := omit, encr := omit, + encr_exp_enc_alg := omit, lcls := { gcr := omit, cfg := omit, @@ -713,6 +715,19 @@ } } +function f_cipher_mode_bssmap_to_rsl_exp_enc_alg() runs on MSC_ConnHdlr return RSL_AlgId +{ + var OCT1 enc_alg; + + if (ispresent(g_pars.encr_exp_enc_alg)) { + enc_alg := g_pars.encr_exp_enc_alg; + } else { + enc_alg := g_pars.encr.enc_alg; + } + + return f_cipher_mode_bssmap_to_rsl(enc_alg); +} + function f_verify_encr_info(RSL_Message rsl) runs on MSC_ConnHdlr { var RSL_IE_Body encr_info; var RSL_AlgId alg_rsl; @@ -731,7 +746,7 @@ /* RSL uses a different representation of the encryption algorithm, * so we need to convert first */ - alg_rsl := f_cipher_mode_bssmap_to_rsl(g_pars.encr.enc_alg); + alg_rsl := f_cipher_mode_bssmap_to_rsl_exp_enc_alg(); if (alg_rsl == RSL_ALG_ID_A5_4 and ispresent(g_pars.encr.enc_kc128)) { expect_kc := g_pars.encr.enc_kc128; @@ -797,7 +812,7 @@ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unexpected Cipher Mode Complete"); } else { setverdict(pass); - var RSL_AlgId alg_rsl := f_cipher_mode_bssmap_to_rsl(g_pars.encr.enc_alg); + var RSL_AlgId alg_rsl := f_cipher_mode_bssmap_to_rsl_exp_enc_alg(); if (oct2int(bssap.pdu.bssmap.cipherModeComplete.chosenEncryptionAlgorithm.algorithmIdentifier) != enum2int(alg_rsl)) { setverdict(fail, "Unexpected Encryption Algorithm ID in BSSMAP Cipher Mode Complete"); } @@ -897,7 +912,7 @@ if (not f_rsl_find_ie(chan_act, RSL_IE_ENCR_INFO, encr_info)) { Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Missing Encryption IE in CHAN ACT"); } else { - var RSL_AlgId alg := f_cipher_mode_bssmap_to_rsl(g_pars.encr.enc_alg); + var RSL_AlgId alg := f_cipher_mode_bssmap_to_rsl_exp_enc_alg(); var octetstring expect_key; if (alg == RSL_ALG_ID_A5_4) { expect_key := g_pars.encr.enc_kc128; diff --git a/bsc/expected-results.xml b/bsc/expected-results.xml index d2052b8..793ca03 100644 --- a/bsc/expected-results.xml +++ b/bsc/expected-results.xml @@ -54,6 +54,7 @@ <testcase classname='BSC_Tests' name='TC_assignment_fr_a5_not_sup' time='MASKED'/> <testcase classname='BSC_Tests' name='TC_ciph_mode_a5_0' time='MASKED'/> <testcase classname='BSC_Tests' name='TC_ciph_mode_a5_1' time='MASKED'/> + <testcase classname='BSC_Tests' name='TC_ciph_mode_a5_2_1' time='MASKED'/> <testcase classname='BSC_Tests' name='TC_ciph_mode_a5_3' time='MASKED'/> <testcase classname='BSC_Tests' name='TC_ciph_mode_a5_4' time='MASKED'/> <testcase classname='BSC_Tests' name='TC_assignment_codec_fr' time='MASKED'/> -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/24898 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: I688d056bcfe73f7846f908a28f4621f944cf2178 Gerrit-Change-Number: 24898 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith at sysmocom.de> Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210709/7ae50849/attachment.htm>