From f5aaf523c58dd7bc2f57f840b717da359d08bb5c Mon Sep 17 00:00:00 2001 From: Andreas Eversberg Date: Thu, 20 Jun 2013 20:10:46 +0200 Subject: [PATCH] TRX: If no cipher algorithm is given, or if it is a5/0, reset cipher state --- src/osmo-bts-trx/scheduler.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/osmo-bts-trx/scheduler.c b/src/osmo-bts-trx/scheduler.c index 9aa05390b..5a22c5c31 100644 --- a/src/osmo-bts-trx/scheduler.c +++ b/src/osmo-bts-trx/scheduler.c @@ -2573,7 +2573,10 @@ int trx_sched_set_cipher(struct trx_l1h *l1h, uint8_t chan_nr, int downlink, int rc = -EINVAL; struct trx_chan_state *chan_state; - if (algo < 0 || key_len > 8 || (algo && key_len != 8)) { + /* no algorithm given means a5/0 */ + if (algo <= 0) + algo = 0; + else if (key_len != 8) { LOGP(DL1C, LOGL_ERROR, "Algo A5/%d not supported with given " "key len=%d\n", algo, key_len); return -ENOTSUP;