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: 505a94a610 ("Make UTRAN encryption algorithms configurable")
Change-Id: I3271d27c09fc8d70a912bce998ceffbce64dd95e
This commit is contained in:
Alexander Couzens 2021-11-26 23:57:10 +01:00 committed by fixeria
parent c44342b88c
commit e400b1161d
1 changed files with 3 additions and 2 deletions

View File

@ -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);
}