aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmsc/msc_a.c
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2022-10-10 23:35:47 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2022-10-27 23:54:00 +0200
commit2ea7264b86b7518d59efecb1609119ffb0c6eb16 (patch)
tree4b043860421f856ed79315aa57b1e2faaaedb8b0 /src/libmsc/msc_a.c
parentd99a607ac97c0c678a6328fc1a7abfadd8fc76f2 (diff)
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
Diffstat (limited to 'src/libmsc/msc_a.c')
-rw-r--r--src/libmsc/msc_a.c12
1 files changed, 12 insertions, 0 deletions
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;