From aa84b71f0fe014156e90dde2f0c44694368dc034 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Mon, 18 Dec 2017 03:12:01 +0100 Subject: add osmo_auth_c3() (separate from gsm_milenage()) To send a Ciphering Mode Command, we may need to derive a Kc from UMTS AKA tokens. gsm_milenage() derives Kc from 3G tokens, but also derives an SRES. For SRES, it requires an OPC, which may need to be derived from OP first. All we need is a Kc, so we could feed a zero OPC ... but to simplify the function call for cases where just a Kc is required, separate the c3 function out from gsm_milenage(), as osmo_auth_c3(). Obviously call osmo_auth_c3() from gsm_milenage() (meaning that osmo-hlr's 55.205 derived auc tests still cover exactly that implementation). Prepares: If04e405426c55a81341747a9b450a69188525d5c (osmo-msc) Related: OS#2745 Change-Id: I85a1d6ae95ad9e5ce9524ef7fc06414848afc2aa --- src/gsm/milenage/milenage.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/gsm/milenage') diff --git a/src/gsm/milenage/milenage.c b/src/gsm/milenage/milenage.c index 7cf33122..3c14ab96 100644 --- a/src/gsm/milenage/milenage.c +++ b/src/gsm/milenage/milenage.c @@ -29,7 +29,7 @@ #include "common.h" #include "aes_wrap.h" #include "milenage.h" - +#include /** * milenage_f1 - Milenage f1 and f1* algorithms @@ -249,8 +249,7 @@ int gsm_milenage(const u8 *opc, const u8 *k, const u8 *_rand, u8 *sres, u8 *kc) if (milenage_f2345(opc, k, _rand, res, ck, ik, NULL, NULL)) return -1; - for (i = 0; i < 8; i++) - kc[i] = ck[i] ^ ck[i + 8] ^ ik[i] ^ ik[i + 8]; + osmo_auth_c3(kc, ck, ik); #ifdef GSM_MILENAGE_ALT_SRES os_memcpy(sres, res, 4); -- cgit v1.2.3