aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2018-11-29 23:37:19 +0100
committerNeels Hofmeyr <neels@hofmeyr.de>2018-11-30 22:44:23 +0100
commitb0779bbcab69f4a42a9b8f522a3d2697cb9f44c7 (patch)
tree28a036708db0a98a1f8853ad927c1e4e722ea724
parentdbaab50da3a2d641b5b3d8d20c903ad1284af2a7 (diff)
populate gsm_subscriber_connection->encr during Ciph
The gsm_subscriber_connection->encr is never used. Use it. When sending the Ciphering Mode Command, populate the encryption key. When receivint the Ciphering Mode Complete, populate the chosen alg_id. Out of paranoia, store the enc key only if the size is large enough. Hence the vty_dump_one_conn() now reports the actually chosen A5 algorithm ID used. For 3G connections, though, this will still remain 0 in the VTY, since there is no explicit A5 algorithm negotiated on UTRAN. (Security Mode Command and Security Mode Complete instead of the GERAN Ciphering.) (Note, 'struct gsm_encr encr' will be renamed to 'struct geran_encr geran_encr' in Idc7ca9da1aa13ae16f5db2cb1024676cbc770820) Change-Id: Ice2c470c360612249f97301944c6fdf9443c7dce
-rw-r--r--src/libmsc/gsm_04_08.c7
-rw-r--r--src/libmsc/osmo_msc.c2
2 files changed, 9 insertions, 0 deletions
diff --git a/src/libmsc/gsm_04_08.c b/src/libmsc/gsm_04_08.c
index d5cc21267..7dd303f29 100644
--- a/src/libmsc/gsm_04_08.c
+++ b/src/libmsc/gsm_04_08.c
@@ -1663,6 +1663,13 @@ int msc_geran_set_cipher_mode(struct gsm_subscriber_connection *conn, bool umts_
memcpy(ei.key, tuple->vec.kc, sizeof(tuple->vec.kc));
ei.key_len = sizeof(tuple->vec.kc);
+ conn->encr = (struct gsm_encr){};
+ if (ei.key_len <= sizeof(conn->encr.key)) {
+ memcpy(conn->encr.key, ei.key, ei.key_len);
+ conn->encr.key_len = ei.key_len;
+ }
+ /* conn->encr.alg_id remains unknown until we receive a Cipher Mode Complete from the BSC */
+
return a_iface_tx_cipher_mode(conn, &ei, retrieve_imeisv);
}
diff --git a/src/libmsc/osmo_msc.c b/src/libmsc/osmo_msc.c
index f2c84e629..e3d7055bc 100644
--- a/src/libmsc/osmo_msc.c
+++ b/src/libmsc/osmo_msc.c
@@ -222,6 +222,8 @@ void msc_cipher_mode_compl(struct gsm_subscriber_connection *conn,
}
}
+ conn->encr.alg_id = alg_id;
+
ciph_res.cause = VLR_CIPH_COMPL;
vlr_subscr_rx_ciph_res(conn->vsub, &ciph_res);
}