pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/44227?usp=email ) Change subject: 5gc: Fix milenage K and OPC swapped ...................................................................... 5gc: Fix milenage K and OPC swapped The call to f_milenage_check() was passing K and OPC params swapped. This worked because in turn also the mp_usim_key and mp_usim_opc were being set swapped in relation to what was configured at the open5gs DB, hence double swap ended up passing the correct values. Take the chance to also fix a couple typos around related code, which also helps in quickly spotting the swap when reading the patch. Related: OS#7154 Change-Id: I052d45d5e1fb66ea5063435446ce796a65d30fc2 --- M 5gc/C5G_Tests.cfg M 5gc/C5G_Tests.ttcn M 5gc/ConnHdlr.ttcn M library/milenage/Milenage_Functions.ttcn 4 files changed, 9 insertions(+), 9 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/27/44227/1 diff --git a/5gc/C5G_Tests.cfg b/5gc/C5G_Tests.cfg index 9d4439c..a0c1c06 100644 --- a/5gc/C5G_Tests.cfg +++ b/5gc/C5G_Tests.cfg @@ -17,8 +17,8 @@ C5G_Tests.mp_local_ngap_ip := "127.0.0.202"; C5G_Tests.mp_local_ngap_port := 50000; C5G_Tests.mp_imsi := '999700000000000'H; -C5G_Tests.mp_usim_key := '762a2206fe0b4151ace403c86a11e479'O; -C5G_Tests.mp_usim_opc := '3c6e0b8a9c15224a8228b9a98ca1531d'O; +C5G_Tests.mp_usim_key := '3c6e0b8a9c15224a8228b9a98ca1531d'O; +C5G_Tests.mp_usim_opc := '762a2206fe0b4151ace403c86a11e479'O; C5G_Tests.mp_run_prog_log_path := "./run_prog" C5G_Tests.mp_run_prog_as_user := "osmocom" # testenv.sh sets this to $USER C5G_Tests.mp_ping_hostname := "10.45.0.1"; diff --git a/5gc/C5G_Tests.ttcn b/5gc/C5G_Tests.ttcn index 89c8988..66ba83a 100644 --- a/5gc/C5G_Tests.ttcn +++ b/5gc/C5G_Tests.ttcn @@ -65,8 +65,8 @@ GsmMcc mp_mcc := '999'H; GsmMnc mp_mnc := '70'H; HEX15n mp_imsi := '999700000000000'H; - octetstring mp_usim_key := '762a2206fe0b4151ace403c86a11e479'O; - octetstring mp_usim_opc := '3c6e0b8a9c15224a8228b9a98ca1531d'O; + octetstring mp_usim_key := '3c6e0b8a9c15224a8228b9a98ca1531d'O; + octetstring mp_usim_opc := '762a2206fe0b4151ace403c86a11e479'O; uint24_t mp_tac := 1; charstring mp_apn := "internet"; charstring mp_local_gtpu_ip := "127.0.0.20"; diff --git a/5gc/ConnHdlr.ttcn b/5gc/ConnHdlr.ttcn index e6a9879..7f986bd 100644 --- a/5gc/ConnHdlr.ttcn +++ b/5gc/ConnHdlr.ttcn @@ -285,18 +285,18 @@ g_pars.kset_id := rx_nas.authentication_Request.ngNasKeySetId; - ret := f_milenage_check(g_pars.ue_pars.usim_key, - g_pars.ue_pars.usim_opc, + ret := f_milenage_check(g_pars.ue_pars.usim_opc, + g_pars.ue_pars.usim_key, int2oct(my_sqn, 8), rand, autn, ik, ck, res, auts); if (ret == -1) { Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, - log2str("fx_milenage_check() failed! -1")); + log2str("f_milenage_check() failed! -1")); } if (ret == -2) { if (not allow_resync) { Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, - log2str("fx_milenage_check() unexpected Resync!")); + log2str("f_milenage_check() unexpected Resync!")); } log("Milenage: RX-SQN differs from SIM SQN: Re-Sync! AUTS=", auts); /* 3GPP TS 24.501 5.4.1.3.6 d) */ diff --git a/library/milenage/Milenage_Functions.ttcn b/library/milenage/Milenage_Functions.ttcn index 8fb9b04..91ea108 100644 --- a/library/milenage/Milenage_Functions.ttcn +++ b/library/milenage/Milenage_Functions.ttcn @@ -15,7 +15,7 @@ import from General_Types all; /* 3GPP TS 33.102 Figure 9, 3GPP TS 35.206 Annex 3 */ -external function f_milenage_check(OCT16 opc,OCT16 k, +external function f_milenage_check(OCT16 opc, OCT16 k, OCT8 sqn, OCT16 rand, OCT16 autn, out OCT16 ik, out OCT16 ck, out OCT8 res, out OCT14 auts) return integer; -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/44227?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: I052d45d5e1fb66ea5063435446ce796a65d30fc2 Gerrit-Change-Number: 44227 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin@sysmocom.de>