From 766da8687741340135b637aa593886b7345b8ddc Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Fri, 6 May 2016 11:18:15 +0200 Subject: GSUP: Add support for RAND in SendAuthInfo.req In the autentication re-sync case, we need not only the AUTS from the MS/UE, but also the RAND that we sent as part of the failed authentication challenge. --- include/osmocom/gsm/gsup.h | 1 + src/gsm/gsup.c | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/include/osmocom/gsm/gsup.h b/include/osmocom/gsm/gsup.h index 523c15d4..660ffd48 100644 --- a/include/osmocom/gsm/gsup.h +++ b/include/osmocom/gsm/gsup.h @@ -138,6 +138,7 @@ struct osmo_gsup_message { const uint8_t *hlr_enc; size_t hlr_enc_len; const uint8_t *auts; + const uint8_t *rand; enum osmo_gsup_cn_domain cn_domain; }; diff --git a/src/gsm/gsup.c b/src/gsm/gsup.c index 244c5fa8..3697958b 100644 --- a/src/gsm/gsup.c +++ b/src/gsm/gsup.c @@ -236,7 +236,6 @@ int osmo_gsup_decode(const uint8_t *const_data, size_t data_len, case OSMO_GSUP_IMSI_IE: case OSMO_GSUP_PDP_TYPE_IE: case OSMO_GSUP_ACCESS_POINT_NAME_IE: - case OSMO_GSUP_RAND_IE: case OSMO_GSUP_SRES_IE: case OSMO_GSUP_KC_IE: LOGP(DLGSUP, LOGL_NOTICE, @@ -319,6 +318,15 @@ int osmo_gsup_decode(const uint8_t *const_data, size_t data_len, gsup_msg->auts = value; break; + case OSMO_GSUP_RAND_IE: + if (value_len != 16) { + LOGP(DLGSUP, LOGL_ERROR, + "RAND length != 16 received\n"); + return -GMM_CAUSE_COND_IE_ERR; + } + gsup_msg->rand = value; + break; + case OSMO_GSUP_MSISDN_IE: gsup_msg->msisdn_enc = value; gsup_msg->msisdn_enc_len = value_len; @@ -474,6 +482,9 @@ void osmo_gsup_encode(struct msgb *msg, const struct osmo_gsup_message *gsup_msg if (gsup_msg->auts) msgb_tlv_put(msg, OSMO_GSUP_AUTS_IE, 16, gsup_msg->auts); + if (gsup_msg->rand) + msgb_tlv_put(msg, OSMO_GSUP_RAND_IE, 16, gsup_msg->rand); + if (gsup_msg->cn_domain) { uint8_t dn = gsup_msg->cn_domain; msgb_tlv_put(msg, OSMO_GSUP_CN_DOMAIN_IE, 1, &dn); -- cgit v1.2.3