pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/44088?usp=email ) Change subject: libosmogsm: Use the subscriber's K length for TUAK AUTS ...................................................................... libosmogsm: Use the subscriber's K length for TUAK AUTS tuak_gen_vec_auts() passed sizeof(aud->u.umts.k), which is always 32, as the K length, so resync failed for every subscriber with a 128-bit K. Add TUAK resync cases with a 128-bit and a 256-bit K to the osmo-auc-gen test. Fixes: OS#7119 Change-Id: I82180dde388a81eed337c7f1d99f5979489b9cd7 --- M src/gsm/auth_tuak.c M tests/osmo-auc-gen/osmo-auc-gen_test.ok M tests/osmo-auc-gen/osmo-auc-gen_test.sh 3 files changed, 51 insertions(+), 1 deletion(-) Approvals: laforge: Looks good to me, but someone else must approve Jenkins Builder: Verified fixeria: Looks good to me, approved pespin: Looks good to me, but someone else must approve diff --git a/src/gsm/auth_tuak.c b/src/gsm/auth_tuak.c index 05fbf69..075d915 100644 --- a/src/gsm/auth_tuak.c +++ b/src/gsm/auth_tuak.c @@ -179,7 +179,7 @@ opc = gen_opc_if_needed(aud, gen_opc); - rc = tuak_auts(opc, aud->u.umts.k, sizeof(aud->u.umts.k), rand_auts, auts, sqn_out); + rc = tuak_auts(opc, aud->u.umts.k, aud->u.umts.k_len, rand_auts, auts, sqn_out); if (rc < 0) return rc; diff --git a/tests/osmo-auc-gen/osmo-auc-gen_test.ok b/tests/osmo-auc-gen/osmo-auc-gen_test.ok index 2da0b02..d18e57c 100644 --- a/tests/osmo-auc-gen/osmo-auc-gen_test.ok +++ b/tests/osmo-auc-gen/osmo-auc-gen_test.ok @@ -290,3 +290,39 @@ osmo-auc-gen (C) 2011-2023 by Harald Welte This is FREE SOFTWARE with ABSOLUTELY NO WARRANTY + + +> osmo-auc-gen -3 -a tuak -r 42424242424242424242424242424242 -k abababababababababababababababab -O 5555555555555555555555555555555555555555555555555555555555555555 -A e7af6b3d0e2f4f669592ff7d647d +osmo-auc-gen (C) 2011-2023 by Harald Welte +This is FREE SOFTWARE with ABSOLUTELY NO WARRANTY + +RAND: 42424242424242424242424242424242 +AUTN: aad217459a450000a629d0b8d090f68f +IK: 52c2ecdcb90878d9eaa7ae82add046c0 +CK: 144269a4bd882a02026ddbb13243404b +RES: 7abd06d3fff7f634 +IMS nonce: QkJCQkJCQkJCQkJCQkJCQqrSF0WaRQAApinQuNCQ9o8= +IMS res: er0G0//39jQ= +SRES: 854af0e7 +Kc: ae4af04b9b135450 +SQN: 32 +IND: 0 +SQN.MS: 23 + + +> osmo-auc-gen -3 -a tuak -r 0123456789abcdef0123456789abcdef -k fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0 -O 808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f -A f84eb338849bac1fbaf692a06dfb +osmo-auc-gen (C) 2011-2023 by Harald Welte +This is FREE SOFTWARE with ABSOLUTELY NO WARRANTY + +RAND: 0123456789abcdef0123456789abcdef +AUTN: 480a9345cc3e00009a4cacea6268825e +IK: 2274155ccf4199d5e2abcbf621907f90 +CK: a4cb6f6529ab17f8337f27baa8234d47 +RES: e9d749dc4eea0035 +IMS nonce: ASNFZ4mrze8BI0VniavN70gKk0XMPgAAmkys6mJogl4= +IMS res: 6ddJ3E7qADU= +SRES: a73d49e9 +Kc: 576b96756f59bcfa +SQN: 32 +IND: 0 +SQN.MS: 23 diff --git a/tests/osmo-auc-gen/osmo-auc-gen_test.sh b/tests/osmo-auc-gen/osmo-auc-gen_test.sh index 55b0757..5a301f9 100755 --- a/tests/osmo-auc-gen/osmo-auc-gen_test.sh +++ b/tests/osmo-auc-gen/osmo-auc-gen_test.sh @@ -60,3 +60,17 @@ invoke_err -3 -a milenage -r $rand -k $k -o $opc -A $auts --ind 42 invoke_err -3 -a milenage -r $rand -k $k -o $opc -A $auts --ind-len 0 --ind 1 + +# TUAK resync with a 128-bit and a 256-bit K, using the K, TOP and RAND of +# 3GPP TS 35.233 test sets 1 and 2 +k="abababababababababababababababab" +op="5555555555555555555555555555555555555555555555555555555555555555" +rand="42424242424242424242424242424242" +auts="e7af6b3d0e2f4f669592ff7d647d" # --> SQN.MS = 23 +invoke -3 -a tuak -r $rand -k $k -O $op -A $auts + +k="fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0" +op="808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f" +rand="0123456789abcdef0123456789abcdef" +auts="f84eb338849bac1fbaf692a06dfb" # --> SQN.MS = 23 +invoke -3 -a tuak -r $rand -k $k -O $op -A $auts -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/44088?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I82180dde388a81eed337c7f1d99f5979489b9cd7 Gerrit-Change-Number: 44088 Gerrit-PatchSet: 1 Gerrit-Owner: Josh Shilts <joshuashilts@gmail.com> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de> Gerrit-Reviewer: laforge <laforge@osmocom.org> Gerrit-Reviewer: pespin <pespin@sysmocom.de>