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/.
Neels Hofmeyr gerrit-no-reply at lists.osmocom.orgReview at https://gerrit.osmocom.org/5470 fix GSM-Milenage in presence of 2G keys In case of UMTS AKA, the Kc for ciphering must be derived from the 3G auth tokens. tuple->vec.kc was calculated from the GSM algorithm and is not necessarily a match for the UMTS AKA tokens. So far we were always sending the Kc retrieved from osmo-hlr. If the 2G auth algo is set to milenage, the 2G Kc coincides with the one derived from 3G tokens, but if 2G is set to a different algorithm, the Kc received from the osmo-hlr is not usable for ciphering when UMTS AKA was used for authentication (on R99 capable GERAN and MS). Implementation: To decide whether to use UMTS AKA derived Kc or the Kc from the auth vector, use the umts_aka flag added to set_ciph_mode() in a previous patch. Use osmo_auth_c3() to derive the GSM AKA Kc from the UMTS AKA CK and KI. Related: OS#2745 Requires: I85a1d6ae95ad9e5ce9524ef7fc06414848afc2aa (libosmocore) Change-Id: If04e405426c55a81341747a9b450a69188525d5c --- M src/libmsc/gsm_04_08.c 1 file changed, 13 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/70/5470/1 diff --git a/src/libmsc/gsm_04_08.c b/src/libmsc/gsm_04_08.c index a4fdfa2..a917ebd 100644 --- a/src/libmsc/gsm_04_08.c +++ b/src/libmsc/gsm_04_08.c @@ -3390,6 +3390,8 @@ struct gsm_subscriber_connection *conn = msc_conn_ref; struct vlr_subscr *vsub; struct gsm_auth_tuple *tuple; + uint8_t umts_kc[sizeof(tuple->vec.kc)]; + uint8_t *use_kc; if (!conn || !conn->vsub) { LOGP(DMM, LOGL_ERROR, "Cannot send Ciphering Mode Command to" @@ -3411,6 +3413,16 @@ case RAN_GERAN_A: DEBUGP(DMM, "-> CIPHER MODE COMMAND %s\n", vlr_subscr_name(conn->vsub)); + + /* In case of UMTS AKA, the Kc for ciphering must be derived from the 3G auth tokens. + * tuple->vec.kc was calculated from the GSM algorithm and is not necessarily a match for + * the UMTS AKA tokens. */ + if (umts_aka) { + osmo_auth_c3(umts_kc, tuple->vec.ck, tuple->vec.ik); + use_kc = umts_kc; + } else + use_kc = tuple->vec.kc; + { struct gsm0808_encrypt_info ei; @@ -3418,7 +3430,7 @@ ei.perm_algo_len = 1; OSMO_ASSERT(sizeof(ei.key) >= sizeof(tuple->vec.kc)); - memcpy(ei.key, tuple->vec.kc, sizeof(tuple->vec.kc)); + memcpy(ei.key, use_kc, sizeof(tuple->vec.kc)); ei.key_len = sizeof(tuple->vec.kc); return a_iface_tx_cipher_mode(conn, &ei, retrieve_imeisv); -- To view, visit https://gerrit.osmocom.org/5470 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If04e405426c55a81341747a9b450a69188525d5c Gerrit-PatchSet: 1 Gerrit-Project: osmo-msc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>