utran: use new UTRAN encryption enum

Depends: libosmocore.git I4b9baff2c2fbd0e339fc769cc69cce58d3a72cdf
Change-Id: If6978d7ed1a78facc2591cfc30fda2721629bffa
changes/07/26107/3
Alexander Couzens 11 months ago committed by laforge
parent b7f97ea8a0
commit 8b7d78588a
  1. 9
      src/libmsc/gsm_04_08.c
  2. 3
      src/libmsc/msc_net_init.c
  3. 5
      src/libmsc/ran_msg_iu.c
  4. 12
      tests/msc_vlr/msc_vlr_test_umts_authen.c
  5. 1
      tests/msc_vlr/msc_vlr_tests.h

@ -51,6 +51,7 @@
#include <osmocom/core/fsm.h>
#include <osmocom/gsm/tlv.h>
#include <osmocom/crypt/auth.h>
#include <osmocom/crypt/utran_cipher.h>
#include <osmocom/msc/msub.h>
#include <osmocom/msc/msc_roles.h>
@ -414,7 +415,7 @@ static int mm_rx_loc_upd_req(struct msc_a *msc_a, struct msgb *msg)
net->vlr, msc_a, vlr_lu_type, tmsi, imsi,
&old_lai, &msc_a->via_cell.lai,
is_utran || net->authentication_required,
is_utran ? net->uea_encryption_mask > 0x01 : net->a5_encryption_mask > 0x01,
is_utran ? net->uea_encryption_mask > (1 << OSMO_UTRAN_UEA0) : net->a5_encryption_mask > 0x01,
lu->key_seq,
osmo_gsm48_classmark1_is_r99(&lu->classmark1),
is_utran,
@ -805,7 +806,7 @@ int gsm48_rx_mm_serv_req(struct msc_a *msc_a, struct msgb *msg)
req->cm_service_type,
&mi, &msc_a->via_cell.lai,
is_utran || net->authentication_required,
is_utran ? net->uea_encryption_mask > 0x01 : net->a5_encryption_mask > 0x01,
is_utran ? net->uea_encryption_mask > (1 << OSMO_UTRAN_UEA0) : net->a5_encryption_mask > 0x01,
req->cipher_key_seq,
osmo_gsm48_classmark2_is_r99(cm2, cm2_len),
is_utran);
@ -931,7 +932,7 @@ static int gsm48_rx_cm_reest_req(struct msc_a *msc_a, struct msgb *msg)
VLR_PR_ARQ_T_CM_RE_ESTABLISH_REQ, 0,
&mi, &msc_a->via_cell.lai,
is_utran || net->authentication_required,
is_utran ? net->uea_encryption_mask > 0x01 : net->a5_encryption_mask > 0x01,
is_utran ? net->uea_encryption_mask > (1 << OSMO_UTRAN_UEA0) : net->a5_encryption_mask > 0x01,
req->cipher_key_seq,
osmo_gsm48_classmark2_is_r99(cm2, cm2_len),
is_utran);
@ -1293,7 +1294,7 @@ static int gsm48_rx_rr_pag_resp(struct msc_a *msc_a, struct msgb *msg)
net->vlr, msc_a,
VLR_PR_ARQ_T_PAGING_RESP, 0, &mi, &msc_a->via_cell.lai,
is_utran || net->authentication_required,
is_utran ? net->uea_encryption_mask > 0x01 : net->a5_encryption_mask > 0x01,
is_utran ? net->uea_encryption_mask > (1 << OSMO_UTRAN_UEA0) : net->a5_encryption_mask > 0x01,
pr->key_seq,
osmo_gsm48_classmark2_is_r99(cm2, classmark2_len),
is_utran);

@ -24,6 +24,7 @@
#include "config.h"
#include <osmocom/core/tdef.h>
#include <osmocom/crypt/utran_cipher.h>
#include <osmocom/msc/gsm_data.h>
#include <osmocom/msc/vlr.h>
@ -68,7 +69,7 @@ struct gsm_network *gsm_network_init(void *ctx, mncc_recv_cb_t mncc_recv)
/* Permit a compile-time default of A5/3 and A5/1 */
net->a5_encryption_mask = (1 << 3) | (1 << 1);
/* Permit a compile-time default of UEA2 and UEA1 */
net->uea_encryption_mask = (1 << 2) | (1 << 1);
net->uea_encryption_mask = (1 << OSMO_UTRAN_UEA2) | (1 << OSMO_UTRAN_UEA1);
net->mncc_guard_timeout = 180;
net->ncss_guard_timeout = 30;

@ -27,6 +27,7 @@
#include <osmocom/core/prim.h>
#include <osmocom/core/byteswap.h>
#include <osmocom/crypt/auth.h>
#include <osmocom/crypt/utran_cipher.h>
#include <osmocom/gsm/gsm48.h>
#include <osmocom/ranap/ranap_common_cn.h>
@ -377,10 +378,10 @@ static struct msgb *ran_iu_make_security_mode_command(struct osmo_fsm_inst *call
LOG_RAN_IU_ENC(caller_fi, LOGL_DEBUG, "Tx RANAP SECURITY MODE COMMAND to RNC, IK=%s, CK=%s\n",
osmo_hexdump_nospc(cm->vec->ik, 16),
cm->utran.uea_encryption_mask > 0x01 ? osmo_hexdump_nospc(cm->vec->ck, 16) : "NONE");
cm->utran.uea_encryption_mask > (1 << OSMO_UTRAN_UEA0) ? osmo_hexdump_nospc(cm->vec->ck, 16) : "NONE");
/* TODO: Do we need to check if the UE supports all of the algorithms and build an intersection like
* in the case of A5? */
return ranap_new_msg_sec_mod_cmd2(cm->vec->ik, cm->utran.uea_encryption_mask > 0x01 ? cm->vec->ck : NULL,
return ranap_new_msg_sec_mod_cmd2(cm->vec->ik, cm->utran.uea_encryption_mask > (1 << OSMO_UTRAN_UEA0) ? cm->vec->ck : NULL,
RANAP_KeyStatus_new, 0x06, cm->utran.uea_encryption_mask);
}

@ -50,7 +50,7 @@ static void _test_umts_authen(enum osmo_rat_type via_ran)
"d3d36ff71c949e83c22072799e9687c5ec32a81d96afcbf4b4fb"
"0c7ac3e9e9b7db05";
bool encryption = (via_ran == OSMO_RAT_GERAN_A && net->a5_encryption_mask > 0x1)
|| (via_ran == OSMO_RAT_UTRAN_IU && net->uea_encryption_mask > 0x1);
|| (via_ran == OSMO_RAT_UTRAN_IU && net->uea_encryption_mask > (1 << OSMO_UTRAN_UEA0));
net->authentication_required = true;
net->vlr->cfg.assign_tmsi = true;
@ -333,7 +333,7 @@ static void test_umts_authen_geran()
static void test_umts_authen_utran()
{
comment_start();
net->uea_encryption_mask = 0x01;
net->uea_encryption_mask = (1 << OSMO_UTRAN_UEA0);
_test_umts_authen(OSMO_RAT_UTRAN_IU);
comment_end();
}
@ -341,7 +341,7 @@ static void test_umts_authen_utran()
static void test_umts_auth_ciph_utran()
{
comment_start();
net->uea_encryption_mask = 0x06;
net->uea_encryption_mask = (1 << OSMO_UTRAN_UEA1) | (1 << OSMO_UTRAN_UEA2);
_test_umts_authen(OSMO_RAT_UTRAN_IU);
comment_end();
}
@ -361,7 +361,7 @@ static void _test_umts_authen_resync(enum osmo_rat_type via_ran)
struct vlr_subscr *vsub;
const char *imsi = "901700000010650";
bool encryption = (via_ran == OSMO_RAT_GERAN_A && net->a5_encryption_mask > 0x1)
|| (via_ran == OSMO_RAT_UTRAN_IU && net->uea_encryption_mask > 0x1);
|| (via_ran == OSMO_RAT_UTRAN_IU && net->uea_encryption_mask > (1 << OSMO_UTRAN_UEA0));
net->authentication_required = true;
net->vlr->cfg.assign_tmsi = true;
@ -588,7 +588,7 @@ static void test_umts_authen_resync_geran()
static void test_umts_authen_resync_utran()
{
comment_start();
net->uea_encryption_mask = 0x01;
net->uea_encryption_mask = (1 << OSMO_UTRAN_UEA0);
_test_umts_authen_resync(OSMO_RAT_UTRAN_IU);
comment_end();
}
@ -596,7 +596,7 @@ static void test_umts_authen_resync_utran()
static void test_umts_auth_ciph_resync_utran()
{
comment_start();
net->uea_encryption_mask = 0x06;
net->uea_encryption_mask = (1 << OSMO_UTRAN_UEA1) | (1 << OSMO_UTRAN_UEA2);
_test_umts_authen_resync(OSMO_RAT_UTRAN_IU);
comment_end();
}

@ -26,6 +26,7 @@
#include <stdbool.h>
#include <stdio.h>
#include <osmocom/crypt/utran_cipher.h>
#include <osmocom/msc/gsm_data.h>
#include <osmocom/msc/vlr.h>
#include <osmocom/msc/msub.h>

Loading…
Cancel
Save