pespin submitted this change.

View Change


Approvals: laforge: Looks good to me, but someone else must approve Jenkins Builder: Verified pespin: Looks good to me, approved
gmm: Introduce SIM_AUTH primitive to resolve authentication

New GMM-GMMREG-SIM_AUTH.ind/rsp primitives are added to allow GMM
resolving authentication request received from the network.
The user of the GMMREG SAP is responible for doing the resolution using
its SIM.

Depends: libosmocore.git Change-Id Id619459c17976b77cd2c7e4179123bb06807285c
Change-Id: I5c97642baac5ed29de63ae93fc7f0ecde5edf735
---
M include/osmocom/gprs/gmm/gmm_pdu.h
M include/osmocom/gprs/gmm/gmm_prim.h
M include/osmocom/gprs/gmm/gmm_private.h
M src/gmm/gmm.c
M src/gmm/gmm_pdu.c
M src/gmm/gmm_prim.c
M tests/gmm/gmm_prim_test.c
M tests/gmm/gmm_prim_test.err
M tests/gmm/gmm_prim_test.ok
9 files changed, 223 insertions(+), 31 deletions(-)

diff --git a/include/osmocom/gprs/gmm/gmm_pdu.h b/include/osmocom/gprs/gmm/gmm_pdu.h
index d005c0d..323b2c7 100644
--- a/include/osmocom/gprs/gmm/gmm_pdu.h
+++ b/include/osmocom/gprs/gmm/gmm_pdu.h
@@ -29,8 +29,8 @@
uint8_t mi_type,
struct msgb *msg);

-int gprs_gmm_build_ciph_auth_resp(struct gprs_gmm_entity *gmme, bool imeisv_requested,
- uint8_t ac_ref_nr, const uint8_t sres[4], struct msgb *msg);
+int gprs_gmm_build_ciph_auth_resp(const struct gprs_gmm_entity *gmme,
+ const uint8_t *sres, struct msgb *msg);

int gprs_gmm_build_detach_req(struct gprs_gmm_entity *gmme,
enum osmo_gprs_gmm_detach_ms_type detach_type,
diff --git a/include/osmocom/gprs/gmm/gmm_prim.h b/include/osmocom/gprs/gmm/gmm_prim.h
index 8a777e2..7e50c58 100644
--- a/include/osmocom/gprs/gmm/gmm_prim.h
+++ b/include/osmocom/gprs/gmm/gmm_prim.h
@@ -40,6 +40,7 @@
enum osmo_gprs_gmm_gmmreg_prim_type {
OSMO_GPRS_GMM_GMMREG_ATTACH, /* Req/Cnf/Rej */
OSMO_GPRS_GMM_GMMREG_DETACH, /* Req/Cnf/Ind */
+ OSMO_GPRS_GMM_GMMREG_SIM_AUTH, /* Ind/Rsp, Osmocom specific primitive */
};
extern const struct value_string osmo_gprs_gmm_gmmreg_prim_type_names[];
static inline const char *osmo_gprs_gmm_gmmreg_prim_type_name(enum osmo_gprs_gmm_gmmreg_prim_type val)
@@ -132,10 +133,24 @@
struct {
enum osmo_gprs_gmm_detach_ms_type detach_type;
} detach_cnf;
- /* OSMO_GPRS_GMM_GMMREG_DETACH | Ind, , 6.6.1.6 */
+ /* OSMO_GPRS_GMM_GMMREG_DETACH | Ind, 6.6.1.6 */
struct {
enum osmo_gprs_gmm_detach_ms_type detach_type;
} detach_ind;
+ /* OSMO_GPRS_GMM_GMMREG_SIM_AUTH | Ind, Osmocom specific */
+ struct {
+ uint8_t ac_ref_nr;
+ uint8_t key_seq;
+ uint8_t rand[16];
+ } sim_auth_ind;
+ /* OSMO_GPRS_GMM_GMMREG_SIM_AUTH | Rsp, Osmocom specific */
+ struct {
+ uint8_t ac_ref_nr; /* from ind originating rsp */
+ uint8_t key_seq; /* from ind originating rsp */
+ uint8_t rand[16]; /* from ind originating rsp */
+ uint8_t sres[4]; /* result */
+ uint8_t kc[16]; /* result */
+ } sim_auth_rsp;
};
};

@@ -254,6 +269,7 @@
/* Alloc primitive for GMMREG SAP: */
struct osmo_gprs_gmm_prim *osmo_gprs_gmm_prim_alloc_gmmreg_attach_req(void);
struct osmo_gprs_gmm_prim *osmo_gprs_gmm_prim_alloc_gmmreg_detach_req(void);
+struct osmo_gprs_gmm_prim *osmo_gprs_gmm_prim_alloc_gmmreg_sim_auth_rsp(void);

/* Alloc primitive for GMMRR SAP: */
struct osmo_gprs_gmm_prim *osmo_gprs_gmm_prim_alloc_gmmrr_page_ind(uint32_t tlli);
diff --git a/include/osmocom/gprs/gmm/gmm_private.h b/include/osmocom/gprs/gmm/gmm_private.h
index 0f2bd9f..942d074 100644
--- a/include/osmocom/gprs/gmm/gmm_private.h
+++ b/include/osmocom/gprs/gmm/gmm_private.h
@@ -65,8 +65,17 @@
uint8_t radio_prio; /* TS 24.008 10.5.7.2 */
struct gprs_ra_id ra; /* TS 24.008 10.5.5.15 (decoded) */

- uint8_t gea; /* GEA/0 = 0, GEA/1 = 1, ... */
- uint8_t kc[16]; /* max 16 * 8 = 128 bits */
+ struct {
+ /* Input params received from network: */
+ struct {
+ uint8_t ac_ref_nr;
+ uint8_t key_seq;
+ uint8_t rand[16]; /* max 16 * 8 = 128 bits */
+ bool imeisv_requested;
+ } req;
+ uint8_t gea; /* GEA/0 = 0, GEA/1 = 1, ... */
+ uint8_t kc[16]; /* max 16 * 8 = 128 bits */
+ } auth_ciph;

unsigned long t3302;
unsigned long t3346;
@@ -79,6 +88,7 @@

struct osmo_gprs_gmm_prim *gprs_gmm_prim_alloc_gmmreg_attach_cnf(void);
struct osmo_gprs_gmm_prim *gprs_gmm_prim_alloc_gmmreg_detach_cnf(void);
+struct osmo_gprs_gmm_prim *gprs_gmm_prim_alloc_gmmreg_sim_auth_ind(void);

struct osmo_gprs_gmm_prim *gprs_gmm_prim_alloc_gmmrr_assign_req(uint32_t old_tlli, uint32_t new_tlli);

@@ -101,9 +111,11 @@
int gprs_gmm_tx_detach_req(struct gprs_gmm_entity *gmme,
enum osmo_gprs_gmm_detach_ms_type detach_type,
enum osmo_gprs_gmm_detach_poweroff_type poweroff_type);
+int gprs_gmm_tx_ciph_auth_resp(const struct gprs_gmm_entity *gmme, const uint8_t *sres);

int gprs_gmm_submit_gmmreg_attach_cnf(struct gprs_gmm_entity *gmme, bool accepted, uint8_t cause);
int gprs_gmm_submit_gmmsm_establish_cnf(struct gprs_gmm_entity *gmme, uint32_t sess_id, bool accepted, uint8_t cause);
+int gprs_gmm_submit_llgmm_assing_req(const struct gprs_gmm_entity *gmme);

#define LOGGMME(snme, level, fmt, args...) \
LOGGMM(level, "GMME(IMSI-%s:PTMSI-%08x:TLLI-%08x) " fmt, \
diff --git a/src/gmm/gmm.c b/src/gmm/gmm.c
index 1bbc027..8f54f04 100644
--- a/src/gmm/gmm.c
+++ b/src/gmm/gmm.c
@@ -152,6 +152,7 @@
gmme->ptmsi = ptmsi;
gmme->old_ptmsi = GSM_RESERVED_TMSI;
gmme->old_tlli = GPRS_GMM_TLLI_UNASSIGNED;
+ gmme->auth_ciph.req.ac_ref_nr = 0xff; /* invalid value */
OSMO_STRLCPY_ARRAY(gmme->imsi, imsi);

/* TS 24.008 4.7.1.4.1:
@@ -295,6 +296,21 @@
return rc;
}

+static int gprs_gmm_submit_gmmreg_sim_auth_ind(struct gprs_gmm_entity *gmme)
+{
+ struct osmo_gprs_gmm_prim *gmm_prim_tx;
+ int rc;
+
+ gmm_prim_tx = gprs_gmm_prim_alloc_gmmreg_sim_auth_ind();
+ gmm_prim_tx->gmmreg.sim_auth_ind.ac_ref_nr = gmme->auth_ciph.req.ac_ref_nr;
+ gmm_prim_tx->gmmreg.sim_auth_ind.key_seq = gmme->auth_ciph.req.key_seq;
+ memcpy(gmm_prim_tx->gmmreg.sim_auth_ind.rand, gmme->auth_ciph.req.rand,
+ sizeof(gmm_prim_tx->gmmreg.sim_auth_ind.rand));
+
+ rc = gprs_gmm_prim_call_up_cb(gmm_prim_tx);
+ return rc;
+}
+
int gprs_gmm_submit_gmmsm_establish_cnf(struct gprs_gmm_entity *gmme, uint32_t sess_id, bool accepted, uint8_t cause)
{
struct osmo_gprs_gmm_prim *gmm_prim_tx;
@@ -317,15 +333,15 @@
return rc;
}

-static int gprs_gmm_submit_llgmm_assing_req(struct gprs_gmm_entity *gmme)
+int gprs_gmm_submit_llgmm_assing_req(const struct gprs_gmm_entity *gmme)
{
struct osmo_gprs_llc_prim *llc_prim_tx;
int rc;

llc_prim_tx = osmo_gprs_llc_prim_alloc_llgm_assign_req(gmme->old_tlli);
llc_prim_tx->llgmm.assign_req.tlli_new = gmme->tlli;
- llc_prim_tx->llgmm.assign_req.gea = gmme->gea;
- memcpy(llc_prim_tx->llgmm.assign_req.kc, gmme->kc, ARRAY_SIZE(gmme->kc));
+ llc_prim_tx->llgmm.assign_req.gea = gmme->auth_ciph.gea;
+ memcpy(llc_prim_tx->llgmm.assign_req.kc, gmme->auth_ciph.kc, ARRAY_SIZE(gmme->auth_ciph.kc));

rc = gprs_gmm_prim_call_llc_down_cb(llc_prim_tx);
return rc;
@@ -365,8 +381,9 @@
return rc;
}

-/* Tx GMM Authentication and ciphering response, 9.4.10 */
-static int gprs_gmm_tx_ciph_auth_resp(struct gprs_gmm_entity *gmme, bool imeisv_requested, uint8_t ac_ref_nr, const uint8_t sres[4])
+/* Tx GMM Authentication and ciphering response, 9.4.10
+ * sres can be NULL if no authentication was requested. */
+int gprs_gmm_tx_ciph_auth_resp(const struct gprs_gmm_entity *gmme, const uint8_t *sres)
{
struct osmo_gprs_llc_prim *llc_prim;
int rc;
@@ -378,7 +395,7 @@
gmme->tlli, OSMO_GPRS_LLC_SAPI_GMM, NULL, GPRS_GMM_ALLOC_SIZE);
msg = llc_prim->oph.msg;
msg->l3h = msg->tail;
- rc = gprs_gmm_build_ciph_auth_resp(gmme, imeisv_requested, ac_ref_nr, sres, msg);
+ rc = gprs_gmm_build_ciph_auth_resp(gmme, sres, msg);
if (rc < 0) {
msgb_free(msg);
return -EBADMSG;
@@ -673,8 +690,8 @@
struct gsm48_auth_ciph_req *acreq;
struct tlv_parsed tp;
int rc;
- bool imeisv_requested = false;
- uint8_t sres[4] = {};
+ uint8_t *rand = NULL;
+ uint8_t cksn = 0xff;

if (len < sizeof(*gh) + sizeof(*acreq)) {
LOGGMME(gmme, LOGL_ERROR, "Rx GMM AUTHENTICATION AND CIPHERING REQUEST with wrong size %u\n", len);
@@ -691,17 +708,44 @@
LOGGMME(gmme, LOGL_ERROR, "Rx GMM AUTHENTICATION AND CIPHERING REQUEST: failed to parse TLVs %d\n", rc);
return -EINVAL;
}
- if (TLVP_PRESENT(&tp, GSM48_IE_GMM_IMEISV))
- imeisv_requested = !!*((uint8_t *)TLVP_VAL(&tp, GSM48_IE_GMM_IMEISV));
-
+ if (TLVP_PRESENT(&tp, GSM48_IE_GMM_AUTH_RAND)) {
+ rand = (uint8_t *)TLVP_VAL(&tp, GSM48_IE_GMM_AUTH_RAND);
+ if (TLVP_PRESENT(&tp, GSM48_IE_GMM_CIPH_CKSN)) {
+ cksn = *(uint8_t *)TLVP_VAL(&tp, GSM48_IE_GMM_CIPH_CKSN);
+ cksn &= 0x0f;
+ }
+ }
+ /* TODO: 9.4.9.3 Authentication Parameter AUTN */
+ /* TODO: 9.4.9.4 Replayed MS network capability */
+ /* TODO: 9.4.9.5 Integrity algorithm */
+ /* TODO: 9.4.9.6 Message authentication code */
+ /* TODO: 9.4.9.7 Replayed MS Radio Access Capability */
}

- rc = gprs_gmm_tx_ciph_auth_resp(gmme, imeisv_requested, acreq->ac_ref_nr, sres);
- if (rc < 0)
- return rc;
+ gmme->auth_ciph.gea = acreq->ciph_alg;
+ gmme->auth_ciph.req.ac_ref_nr = acreq->ac_ref_nr;
+ gmme->auth_ciph.req.imeisv_requested = acreq->imeisv_req;
+ gmme->auth_ciph.req.key_seq = cksn;
+ if (rand)
+ memcpy(gmme->auth_ciph.req.rand, rand, sizeof(gmme->auth_ciph.req.rand));

- /* Submit LLGMM-ASSIGN-REQ as per TS 24.007 Annex C.1 */
- rc = gprs_gmm_submit_llgmm_assing_req(gmme);
+ if (rand) {
+ /* SIM AUTH needed. Answer GMM req asynchronously in GMMREG-SIM_AUTH.rsp: */
+ rc = gprs_gmm_submit_gmmreg_sim_auth_ind(gmme);
+ /* TODO: if rc < 0, transmit AUTHENTICATION AND CIPHERING FAILURE (9.4.10a) */
+ } else {
+ /* Submit LLGMM-ASSIGN-REQ as per TS 24.007 Annex C.1 */
+ rc = gprs_gmm_submit_llgmm_assing_req(gmme);
+ if (rc < 0) {
+ /* TODO: if rc < 0, transmit AUTHENTICATION AND CIPHERING FAILURE (9.4.10a) */
+ /* invalidate active reference: */
+ gmme->auth_ciph.req.ac_ref_nr = 0xff;
+ return rc;
+ }
+ rc = gprs_gmm_tx_ciph_auth_resp(gmme, NULL);
+ /* invalidate active reference: */
+ gmme->auth_ciph.req.ac_ref_nr = 0xff;
+ }
return rc;
}

diff --git a/src/gmm/gmm_pdu.c b/src/gmm/gmm_pdu.c
index efdca48..785932c 100644
--- a/src/gmm/gmm_pdu.c
+++ b/src/gmm/gmm_pdu.c
@@ -317,8 +317,7 @@
}

/* Tx GMM Authentication and ciphering response, 9.4.10 */
-int gprs_gmm_build_ciph_auth_resp(struct gprs_gmm_entity *gmme, bool imeisv_requested,
- uint8_t ac_ref_nr, const uint8_t sres[4], struct msgb *msg)
+int gprs_gmm_build_ciph_auth_resp(const struct gprs_gmm_entity *gmme, const uint8_t *sres, struct msgb *msg)
{
struct gsm48_hdr *gh;
struct gsm48_auth_ciph_resp *acr;
@@ -329,14 +328,28 @@
gh->msg_type = GSM48_MT_GMM_AUTH_CIPH_RESP;

acr = (struct gsm48_auth_ciph_resp *) msgb_put(msg, sizeof(*acr));
- acr->ac_ref_nr = ac_ref_nr;
+ acr->ac_ref_nr = gmme->auth_ciph.req.ac_ref_nr;

- if (imeisv_requested) {
- (void)imeisv_requested;
- /* TODO: IMEISV IE */
+ /* Authentication parameter Response, 10.5.3.2 */
+ if (sres)
+ msgb_tv_fixed_put(msg, GSM48_IE_GMM_AUTH_SRES, 4, sres);
+
+ /* IMEISV, 10.5.1.4 */
+ if (gmme->auth_ciph.req.imeisv_requested) {
+ uint8_t *l;
+ struct osmo_mobile_identity mi = (struct osmo_mobile_identity){
+ .type = GSM_MI_TYPE_IMEISV,
+ };
+ OSMO_STRLCPY_ARRAY(mi.imeisv, gmme->imeisv);
+ l = msgb_tl_put(msg, GSM48_IE_GMM_IMEISV);
+ rc = osmo_mobile_identity_encode_msgb(msg, &mi, false);
+ if (rc < 0)
+ return -EINVAL;
+ *l = rc;
}

- /* TODO: Optional IEs, eg Authentication parameter */
+ /* TODO: Authentication Response parameter (extension) */
+ /* TODO: Message authentication code */
return rc;
}

diff --git a/src/gmm/gmm_prim.c b/src/gmm/gmm_prim.c
index e3e6fa6..bbae06a 100644
--- a/src/gmm/gmm_prim.c
+++ b/src/gmm/gmm_prim.c
@@ -49,6 +49,7 @@
const struct value_string osmo_gprs_gmm_gmmreg_prim_type_names[] = {
{ OSMO_GPRS_GMM_GMMREG_ATTACH, "ATTACH" },
{ OSMO_GPRS_GMM_GMMREG_DETACH, "DETACH" },
+ { OSMO_GPRS_GMM_GMMREG_SIM_AUTH, "SIM_AUTH" },
{ 0, NULL }
};

@@ -226,7 +227,7 @@
return gmm_prim;
}

-/* TS 24.007 6.6.1.6 GMMREG-DETACH.cnf */
+/* TS 24.007 6.6.1.6 GMMREG-DETACH.ind */
struct osmo_gprs_gmm_prim *osmo_gprs_gmm_prim_alloc_gmmreg_detach_ind(void)
{
struct osmo_gprs_gmm_prim *gmm_prim;
@@ -234,6 +235,22 @@
return gmm_prim;
}

+/* Osmocom specific: GMMREG-SIM_AUTH.ind */
+struct osmo_gprs_gmm_prim *gprs_gmm_prim_alloc_gmmreg_sim_auth_ind(void)
+{
+ struct osmo_gprs_gmm_prim *gmm_prim;
+ gmm_prim = gmm_prim_gmmreg_alloc(OSMO_GPRS_GMM_GMMREG_SIM_AUTH, PRIM_OP_INDICATION, 0);
+ return gmm_prim;
+}
+
+/* Osmocom specific: GMMREG-SIM_AUTH.rsp */
+struct osmo_gprs_gmm_prim *osmo_gprs_gmm_prim_alloc_gmmreg_sim_auth_rsp(void)
+{
+ struct osmo_gprs_gmm_prim *gmm_prim;
+ gmm_prim = gmm_prim_gmmreg_alloc(OSMO_GPRS_GMM_GMMREG_SIM_AUTH, PRIM_OP_RESPONSE, 0);
+ return gmm_prim;
+}
+
/*** GMMRR ***/

static inline struct osmo_gprs_gmm_prim *gmm_prim_gmmrr_alloc(enum osmo_gprs_gmm_gmmrr_prim_type type,
@@ -394,6 +411,51 @@
return rc;
}

+/* Osmocom specific: GMMREG-SIM_AUTH.response:*/
+static int gprs_gmm_prim_handle_gmmreg_sim_auth_resp(struct osmo_gprs_gmm_prim *gmm_prim)
+{
+ int rc;
+ struct gprs_gmm_entity *gmme;
+ bool found = false;
+
+ llist_for_each_entry(gmme, &g_gmm_ctx->gmme_list, list) {
+ if (gmme->auth_ciph.req.ac_ref_nr != gmm_prim->gmmreg.sim_auth_rsp.ac_ref_nr)
+ continue;
+ if (gmme->auth_ciph.req.key_seq != gmm_prim->gmmreg.sim_auth_rsp.key_seq)
+ continue;
+ if (memcmp(gmme->auth_ciph.req.rand, gmm_prim->gmmreg.sim_auth_rsp.rand,
+ sizeof(gmme->auth_ciph.req.rand)) != 0)
+ continue;
+ found = true;
+ break;
+ }
+
+ if (!found) {
+ LOGGMM(LOGL_ERROR, "Rx GMMREG-SIM_AUTH.rsp for unknown request ac_ref_nr=%u key_seq=%u rand=%s\n",
+ gmm_prim->gmmreg.sim_auth_rsp.ac_ref_nr,
+ gmm_prim->gmmreg.sim_auth_rsp.key_seq,
+ osmo_hexdump(gmm_prim->gmmreg.sim_auth_rsp.rand,
+ sizeof(gmm_prim->gmmreg.sim_auth_rsp.rand)));
+ return -EINVAL;
+ }
+
+ /* Copy over Kc: */
+ memcpy(gmme->auth_ciph.kc, gmm_prim->gmmreg.sim_auth_rsp.kc, sizeof(gmme->auth_ciph.kc));
+
+ rc = gprs_gmm_submit_llgmm_assing_req(gmme);
+ if (rc < 0) {
+ /* TODO: if rc < 0, transmit AUTHENTICATION AND CIPHERING FAILURE (9.4.10a) */
+ /* invalidate active reference: */
+ gmme->auth_ciph.req.ac_ref_nr = 0xff;
+ return rc;
+ }
+
+ rc = gprs_gmm_tx_ciph_auth_resp(gmme, gmm_prim->gmmreg.sim_auth_rsp.sres);
+ /* invalidate active reference: */
+ gmme->auth_ciph.req.ac_ref_nr = 0xff;
+ return rc;
+}
+
static int gprs_gmm_prim_handle_gmmreg(struct osmo_gprs_gmm_prim *gmm_prim)
{
int rc;
@@ -405,6 +467,9 @@
case OSMO_PRIM(OSMO_GPRS_GMM_GMMREG_DETACH, PRIM_OP_REQUEST):
rc = gprs_gmm_prim_handle_gmmreg_detach_req(gmm_prim);
break;
+ case OSMO_PRIM(OSMO_GPRS_GMM_GMMREG_SIM_AUTH, PRIM_OP_RESPONSE):
+ rc = gprs_gmm_prim_handle_gmmreg_sim_auth_resp(gmm_prim);
+ break;
default:
rc = gprs_gmm_prim_handle_unsupported(gmm_prim);
}
diff --git a/tests/gmm/gmm_prim_test.c b/tests/gmm/gmm_prim_test.c
index b260f54..acf1e22 100644
--- a/tests/gmm/gmm_prim_test.c
+++ b/tests/gmm/gmm_prim_test.c
@@ -149,6 +149,8 @@
int test_gmm_prim_up_cb(struct osmo_gprs_gmm_prim *gmm_prim, void *user_data)
{
const char *pdu_name = osmo_gprs_gmm_prim_name(gmm_prim);
+ struct osmo_gprs_gmm_prim *gmm_prim_tx;
+ int rc;

switch (gmm_prim->oph.sap) {
case OSMO_GPRS_GMM_SAP_GMMREG:
@@ -168,6 +170,27 @@
printf("%s(): Rx %s detach_type='%s'\n", __func__, pdu_name,
osmo_gprs_gmm_detach_ms_type_name(gmm_prim->gmmreg.detach_cnf.detach_type));
break;
+ case OSMO_PRIM(OSMO_GPRS_GMM_GMMREG_SIM_AUTH, PRIM_OP_INDICATION):
+ printf("%s(): Rx %s ac_ref_nr=%u key_seq=%u rand=%s\n",
+ __func__, pdu_name,
+ gmm_prim->gmmreg.sim_auth_ind.ac_ref_nr,
+ gmm_prim->gmmreg.sim_auth_ind.key_seq,
+ osmo_hexdump(gmm_prim->gmmreg.sim_auth_ind.rand,
+ sizeof(gmm_prim->gmmreg.sim_auth_ind.rand)));
+ /* Emulate SIM, asnwer SRES=0xacacacac, Kc=bdbdbd... */
+ gmm_prim_tx = osmo_gprs_gmm_prim_alloc_gmmreg_sim_auth_rsp();
+ OSMO_ASSERT(gmm_prim_tx);
+ gmm_prim_tx->gmmreg.sim_auth_rsp.ac_ref_nr = gmm_prim->gmmreg.sim_auth_ind.ac_ref_nr;
+ gmm_prim_tx->gmmreg.sim_auth_rsp.key_seq = gmm_prim->gmmreg.sim_auth_ind.key_seq;
+ memcpy(gmm_prim_tx->gmmreg.sim_auth_rsp.rand, gmm_prim->gmmreg.sim_auth_ind.rand,
+ sizeof(gmm_prim_tx->gmmreg.sim_auth_rsp.rand));
+ memset(gmm_prim_tx->gmmreg.sim_auth_rsp.sres, 0xac,
+ sizeof(gmm_prim_tx->gmmreg.sim_auth_rsp.sres));
+ memset(gmm_prim_tx->gmmreg.sim_auth_rsp.kc, 0xbd,
+ sizeof(gmm_prim_tx->gmmreg.sim_auth_rsp.kc));
+ rc = osmo_gprs_gmm_prim_upper_down(gmm_prim_tx);
+ OSMO_ASSERT(rc == 0);
+ break;
default:
printf("%s(): Unexpected Rx %s\n", __func__, pdu_name);
OSMO_ASSERT(0)
diff --git a/tests/gmm/gmm_prim_test.err b/tests/gmm/gmm_prim_test.err
index 92f0c51..d589876 100644
--- a/tests/gmm/gmm_prim_test.err
+++ b/tests/gmm/gmm_prim_test.err
@@ -10,6 +10,7 @@
DLGLOBAL INFO GMME(IMSI-1234567890:PTMSI-00001234:TLLI-80001234) Tx GMM IDENTITY RESPONSE
DLGLOBAL INFO Rx from lower layers: LL-UNITDATA.indication
DLGLOBAL INFO GMME(IMSI-1234567890:PTMSI-00001234:TLLI-80001234) Rx GMM AUTHENTICATION AND CIPHERING REQUEST
+DLGLOBAL INFO Rx from upper layers: GMMREG-SIM_AUTH.response
DLGLOBAL INFO GMME(IMSI-1234567890:PTMSI-00001234:TLLI-80001234) Tx GMM GMM AUTHENTICATION AND CIPHERING RESPONSE
DLGLOBAL INFO Rx from lower layers: LL-UNITDATA.indication
DLGLOBAL INFO GMME(IMSI-1234567890:PTMSI-00001234:TLLI-80001234) Rx GMM ATTACH ACCEPT
@@ -38,6 +39,7 @@
DLGLOBAL INFO GMME(IMSI-1234567890:PTMSI-00001234:TLLI-80001234) Tx GMM IDENTITY RESPONSE
DLGLOBAL INFO Rx from lower layers: LL-UNITDATA.indication
DLGLOBAL INFO GMME(IMSI-1234567890:PTMSI-00001234:TLLI-80001234) Rx GMM AUTHENTICATION AND CIPHERING REQUEST
+DLGLOBAL INFO Rx from upper layers: GMMREG-SIM_AUTH.response
DLGLOBAL INFO GMME(IMSI-1234567890:PTMSI-00001234:TLLI-80001234) Tx GMM GMM AUTHENTICATION AND CIPHERING RESPONSE
DLGLOBAL INFO Rx from lower layers: LL-UNITDATA.indication
DLGLOBAL INFO GMME(IMSI-1234567890:PTMSI-00001234:TLLI-80001234) Rx GMM ATTACH ACCEPT
diff --git a/tests/gmm/gmm_prim_test.ok b/tests/gmm/gmm_prim_test.ok
index e371b93..156a282 100644
--- a/tests/gmm/gmm_prim_test.ok
+++ b/tests/gmm/gmm_prim_test.ok
@@ -1,8 +1,9 @@
==== test_gmm_prim_ms_gmmreg() [start] ====
test_gmm_prim_llc_down_cb(): Rx LL-UNITDATA.request TLLI=0x80001234 SAPI=GMM l3=[08 01 04 97 07 00 00 01 0a 00 05 f4 00 00 12 34 00 f0 00 00 00 00 00 e1 ]
test_gmm_prim_llc_down_cb(): Rx LL-UNITDATA.request TLLI=0x80001234 SAPI=GMM l3=[08 16 08 42 32 24 43 32 24 43 f2 ]
-test_gmm_prim_llc_down_cb(): Rx LL-UNITDATA.request TLLI=0x80001234 SAPI=GMM l3=[08 13 02 ]
+test_gmm_prim_up_cb(): Rx GMMREG-SIM_AUTH.indication ac_ref_nr=2 key_seq=0 rand=e2 a6 f3 f8 bb 9e a7 01 e0 ce 4f 33 64 a9 91 75
test_gmm_prim_llc_down_cb(): Rx LLGMM-ASSIGN.request old_TLLI=0xffffffff new_TLLI=0x80001234
+test_gmm_prim_llc_down_cb(): Rx LL-UNITDATA.request TLLI=0x80001234 SAPI=GMM l3=[08 13 02 22 ac ac ac ac 23 09 43 32 24 43 32 24 43 72 f5 ]
test_gmm_prim_llc_down_cb(): Rx LLGMM-ASSIGN.request old_TLLI=0x80001234 new_TLLI=0xea711b41
test_gmm_prim_down_cb(): Rx GMRR-ASSIGN.request old_tlli=0x80001234 new_tlli=0xea711b41
test_gmm_prim_llc_down_cb(): Rx LL-UNITDATA.request TLLI=0xea711b41 SAPI=GMM l3=[08 03 ]
@@ -14,8 +15,9 @@
==== test_gmm_prim_ms_gmmsm() [start] ====
test_gmm_prim_llc_down_cb(): Rx LL-UNITDATA.request TLLI=0x80001234 SAPI=GMM l3=[08 01 04 97 07 00 00 01 0a 00 05 f4 00 00 12 34 00 f0 00 00 00 00 00 e1 ]
test_gmm_prim_llc_down_cb(): Rx LL-UNITDATA.request TLLI=0x80001234 SAPI=GMM l3=[08 16 08 42 32 24 43 32 24 43 f2 ]
-test_gmm_prim_llc_down_cb(): Rx LL-UNITDATA.request TLLI=0x80001234 SAPI=GMM l3=[08 13 02 ]
+test_gmm_prim_up_cb(): Rx GMMREG-SIM_AUTH.indication ac_ref_nr=2 key_seq=0 rand=e2 a6 f3 f8 bb 9e a7 01 e0 ce 4f 33 64 a9 91 75
test_gmm_prim_llc_down_cb(): Rx LLGMM-ASSIGN.request old_TLLI=0xffffffff new_TLLI=0x80001234
+test_gmm_prim_llc_down_cb(): Rx LL-UNITDATA.request TLLI=0x80001234 SAPI=GMM l3=[08 13 02 22 ac ac ac ac 23 09 43 32 24 43 32 24 43 72 f5 ]
test_gmm_prim_llc_down_cb(): Rx LLGMM-ASSIGN.request old_TLLI=0x80001234 new_TLLI=0xea711b41
test_gmm_prim_down_cb(): Rx GMRR-ASSIGN.request old_tlli=0x80001234 new_tlli=0xea711b41
test_gmm_prim_llc_down_cb(): Rx LL-UNITDATA.request TLLI=0xea711b41 SAPI=GMM l3=[08 03 ]

To view, visit change 32550. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: libosmo-gprs
Gerrit-Branch: master
Gerrit-Change-Id: I5c97642baac5ed29de63ae93fc7f0ecde5edf735
Gerrit-Change-Number: 32550
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge@osmocom.org>
Gerrit-Reviewer: pespin <pespin@sysmocom.de>
Gerrit-MessageType: merged