aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Couzens <lynxis@fe80.eu>2021-11-26 23:57:10 +0100
committerfixeria <vyanitskiy@sysmocom.de>2021-12-09 13:42:28 +0000
commite400b1161d2a00082dd0b0e543f3bb84a6efefe5 (patch)
tree7c13f7872139b31a37a6a98187bc9afe14310434
parentc44342b88c3d768966895622d9acb3e0cc45fcf4 (diff)
ran_msg_iu: do not pass UEA0 to ranap_new_msg_sec_mod_cmd2()
On the protocol level, it's impossible to indicate UEA0 together with the other algorithms. The encryption is either a) disabled, so the Encryption Information IE is not present, or b) enabled, so the Encryption Information IE indicates UEA1 and/or UEA2. Because of that, the ranap_new_msg_sec_mod_cmd2() would fail to generate the RANAP PDU if the given bitmask has the UEA0 bit set. Fixes: 505a94a610fc ("Make UTRAN encryption algorithms configurable") Change-Id: I3271d27c09fc8d70a912bce998ceffbce64dd95e
-rw-r--r--src/libmsc/ran_msg_iu.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/libmsc/ran_msg_iu.c b/src/libmsc/ran_msg_iu.c
index cf57d350b..b894df2a0 100644
--- a/src/libmsc/ran_msg_iu.c
+++ b/src/libmsc/ran_msg_iu.c
@@ -377,7 +377,8 @@ static struct msgb *ran_iu_make_security_mode_command(struct osmo_fsm_inst *call
{
/* TODO: make the choice of available UIA algorithms configurable */
const uint8_t uia_mask = (1 << OSMO_UTRAN_UIA1) | (1 << OSMO_UTRAN_UIA2);
- bool use_encryption = cm->utran.uea_encryption_mask > (1 << OSMO_UTRAN_UEA0);
+ const uint8_t uea_mask = cm->utran.uea_encryption_mask & ~(1 << OSMO_UTRAN_UEA0);
+ bool use_encryption = uea_mask != 0x00;
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),
@@ -388,7 +389,7 @@ static struct msgb *ran_iu_make_security_mode_command(struct osmo_fsm_inst *call
use_encryption ? cm->vec->ck : NULL,
RANAP_KeyStatus_new,
(uia_mask << 1), /* API treats LSB as UIA0 */
- cm->utran.uea_encryption_mask);
+ uea_mask);
}