From 2ea7264b86b7518d59efecb1609119ffb0c6eb16 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Mon, 10 Oct 2022 23:35:47 +0200 Subject: msc_a,vlr: add is_ciphering_required (accurately named) For establishing Layer 3, pass a flag from msc_a to VLR that indicates to fail if encryption is not possible. An earlier patch [1] renamed a previously existing flag require_ciphering to is_ciphering_to_be_attempted, because the naming was not accurate. This new flag now indicates what its name suggests. This new flag is needed for upcoming patch [2] to distinguish between optional and mandatory encryption. [1] Ia55085e3b36feb275bcf92fc91a4be7d1c24a6b9 [2] I5feda196fa481dd8a46b0e4721c64b7c6600f0d1 Related: OS#4830 Change-Id: I52090c5f5db997030da7c2ed9beca9c51f55f4cf --- src/libmsc/msc_a.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/libmsc/msc_a.c') diff --git a/src/libmsc/msc_a.c b/src/libmsc/msc_a.c index 5d4468612..d7e97cd71 100644 --- a/src/libmsc/msc_a.c +++ b/src/libmsc/msc_a.c @@ -116,6 +116,18 @@ bool msc_a_is_ciphering_to_be_attempted(const struct msc_a *msc_a) return net->a5_encryption_mask > 0x1; } +bool msc_a_is_ciphering_required(const struct msc_a *msc_a) +{ + struct gsm_network *net = msc_a_net(msc_a); + bool is_utran = (msc_a->c.ran->type == OSMO_RAT_UTRAN_IU); + if (is_utran) + return net->uea_encryption_mask + && ((net->uea_encryption_mask & (1 << OSMO_UTRAN_UEA0)) == 0); + else + return net->a5_encryption_mask + && ((net->a5_encryption_mask & 0x1) == 0); +} + static void update_counters(struct osmo_fsm_inst *fi, bool conn_accepted) { struct msc_a *msc_a = fi->priv; -- cgit v1.2.3