[S] Change in libosmocore[master]: libosmogsm: Avoid executing MILENAGE crypto twice (for UMTS and GSM)
laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/33093 ) ( 4 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: libosmogsm: Avoid executing MILENAGE crypto twice (for UMTS and GSM) ...................................................................... libosmogsm: Avoid executing MILENAGE crypto twice (for UMTS and GSM) So far, we were executing the cryptographic functions to generate MILENAGE authentication tuples *twice* for every call to milenage_gen_vec: Once for UMTS, and another time for GSM. Let's do this properly: Execute once for UMTS, an then call the computationally much simpler C2 and C3 functions to compute the SRES and Kc values from RES, and CK+IK, respectively. Change-Id: I20ecf6d32974c1ba196bf56deba5b2cd971eaffb --- M src/gsm/auth_milenage.c 1 file changed, 19 insertions(+), 4 deletions(-) Approvals: fixeria: Looks good to me, approved pespin: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/src/gsm/auth_milenage.c b/src/gsm/auth_milenage.c index a439b15..2bd05a6 100644 --- a/src/gsm/auth_milenage.c +++ b/src/gsm/auth_milenage.c @@ -54,7 +54,6 @@ uint8_t sqn[6]; uint64_t ind_mask; uint64_t seq_1; - int rc; OSMO_ASSERT(aud->algo == OSMO_AUTH_ALG_MILENAGE); @@ -138,9 +137,8 @@ sqn, _rand, vec->autn, vec->ik, vec->ck, vec->res, &res_len); - rc = gsm_milenage(opc, aud->u.umts.k, _rand, vec->sres, vec->kc); - if (rc < 0) - return rc; + osmo_auth_c3(vec->kc, vec->ck, vec->ik); + osmo_auth_c2(vec->sres, vec->res, vec->res_len, 1); vec->auth_types = OSMO_AUTH_TYPE_UMTS | OSMO_AUTH_TYPE_GSM; -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/33093 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I20ecf6d32974c1ba196bf56deba5b2cd971eaffb Gerrit-Change-Number: 33093 Gerrit-PatchSet: 6 Gerrit-Owner: laforge <laforge@osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de> Gerrit-Reviewer: laforge <laforge@osmocom.org> Gerrit-Reviewer: pespin <pespin@sysmocom.de> Gerrit-MessageType: merged
participants (1)
-
laforge