aboutsummaryrefslogtreecommitdiffstats
path: root/src/sgsn/gprs_llc.c
diff options
context:
space:
mode:
authorEric <ewild@sysmocom.de>2021-05-19 18:57:50 +0200
committerEric <ewild@sysmocom.de>2021-06-16 16:43:23 +0200
commit2f898265d0feb26363960de98929e4819dda546c (patch)
tree92acf6bf1d04123a87e8b286d9b5c9f09b6aac62 /src/sgsn/gprs_llc.c
parenta33f00637e5a116fedcea2e89a609be76207b360 (diff)
add support for multiple encryption algorithms and a5/4
Diffstat (limited to 'src/sgsn/gprs_llc.c')
-rw-r--r--src/sgsn/gprs_llc.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/sgsn/gprs_llc.c b/src/sgsn/gprs_llc.c
index 4fbf211d4..eea1cecfa 100644
--- a/src/sgsn/gprs_llc.c
+++ b/src/sgsn/gprs_llc.c
@@ -42,6 +42,8 @@
#include <osmocom/sgsn/gprs_sndcp_comp.h>
#include <osmocom/sgsn/gprs_sndcp.h>
+#include <osmocom/crypt/kdf.h>
+
const struct value_string gprs_llc_llme_state_names[] = {
{ GPRS_LLMS_UNASSIGNED, "UNASSIGNED" },
{ GPRS_LLMS_ASSIGNED, "ASSIGNED" },
@@ -1042,8 +1044,13 @@ void gprs_llme_copy_key(struct sgsn_mm_ctx *mm, struct gprs_llc_llme *llme)
llme->algo = mm->ciph_algo;
if (llme->cksn != mm->auth_triplet.key_seq &&
mm->auth_triplet.key_seq != GSM_KEY_SEQ_INVAL) {
- memcpy(llme->kc, mm->auth_triplet.vec.kc,
- gprs_cipher_key_length(mm->ciph_algo));
+
+ /* gea4 needs kc128 */
+ if (mm->ciph_algo == GPRS_ALGO_GEA4)
+ osmo_kdf_kc128(mm->auth_triplet.vec.ck, mm->auth_triplet.vec.ik, llme->kc);
+ else
+ memcpy(llme->kc, mm->auth_triplet.vec.kc, gprs_cipher_key_length(mm->ciph_algo));
+
llme->cksn = mm->auth_triplet.key_seq;
}
} else