From 3fe84604945b12d8c97e6bace3117d2a35f103f0 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Mon, 21 Jun 2021 05:37:29 +0200 Subject: [PATCH] bsc: also allow empty key for A5/0 Change-Id: Id54abc09dd62d7247a970a03ed8c2209b641f511 --- bsc/MSC_ConnectionHandler.ttcn | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bsc/MSC_ConnectionHandler.ttcn b/bsc/MSC_ConnectionHandler.ttcn index 12712db55..9b6f8b117 100644 --- a/bsc/MSC_ConnectionHandler.ttcn +++ b/bsc/MSC_ConnectionHandler.ttcn @@ -718,7 +718,7 @@ runs on MSC_ConnHdlr { var PDU_BSSAP bssap; var RSL_Message rsl; var RSL_AlgId alg_rsl; - var octetstring expect_kc; + var template octetstring expect_kc; if (isvalue(enc.enc_kc128)) { BSSAP.send(ts_BSSMAP_CipherModeCmdKc128(enc.enc_alg, enc.enc_key, valueof(enc.enc_kc128))); @@ -732,6 +732,13 @@ runs on MSC_ConnHdlr { if (alg_rsl == RSL_ALG_ID_A5_4 and ispresent(enc.enc_kc128)) { expect_kc := enc.enc_kc128; + } else if (alg_rsl == RSL_ALG_ID_A5_0) { + /* When A5/0 is chosen, no encryption is active, so technically, no key is needed. However, 3GPP TS + * 48.058 9.3.7 Encryption Information stays quite silent about presence or absence of a key for A5/0. + * The only thing specified is how to indicate the length of the key; the possibility that the key may + * be zero length is not explicitly mentioned. So it seems that we should always send the key along, + * even for A5/0. Still, let's also allow a zero length key for A5/0. */ + expect_kc := (enc.enc_key, ''O); } else { expect_kc := enc.enc_key; }