aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bsc/osmo_bsc_bssap.c
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2018-07-24 17:13:03 +0200
committerNeels Hofmeyr <neels@hofmeyr.de>2018-07-28 12:18:23 +0200
commit8757f42c8ef6c18ebb5884bfd3a44827af894c33 (patch)
tree7fa077bb81504fe6da8059aa96aaa91b6f0d2d91 /src/osmo-bsc/osmo_bsc_bssap.c
parenta07b6674531d201feeb628f0a51356eac9f11f0f (diff)
cosmetic: dissolve bsc_api.c
gsm0808_page() is just a thin wrapper for rsl_paging_cmd(), the only caller is page_ms() from paging.c. Directly call rsl_paging_cmd() instead. Move gsm0808_cipher_mode() to the only caller in osmo_bsc_bssap.c, make static. Change-Id: Ib7ce026b52d4ba3e53a8b2824e74ea92432c48c5
Diffstat (limited to 'src/osmo-bsc/osmo_bsc_bssap.c')
-rw-r--r--src/osmo-bsc/osmo_bsc_bssap.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/osmo-bsc/osmo_bsc_bssap.c b/src/osmo-bsc/osmo_bsc_bssap.c
index c6fbe23c8..95bad7b16 100644
--- a/src/osmo-bsc/osmo_bsc_bssap.c
+++ b/src/osmo-bsc/osmo_bsc_bssap.c
@@ -386,6 +386,34 @@ static int select_best_cipher(uint8_t msc_mask, uint8_t bsc_mask)
return -1;
}
+/*! We received a GSM 08.08 CIPHER MODE from the MSC */
+static int gsm0808_cipher_mode(struct gsm_subscriber_connection *conn, int cipher,
+ const uint8_t *key, int len, int include_imeisv)
+{
+ if (cipher > 0 && key == NULL) {
+ LOGP(DRSL, LOGL_ERROR, "%s: Need to have an encryption key.\n",
+ bsc_subscr_name(conn->bsub));
+ return -1;
+ }
+
+ if (len > MAX_A5_KEY_LEN) {
+ LOGP(DRSL, LOGL_ERROR, "%s: The key is too long: %d\n",
+ bsc_subscr_name(conn->bsub), len);
+ return -1;
+ }
+
+ LOGP(DRSL, LOGL_DEBUG, "(subscr %s) Cipher Mode: cipher=%d key=%s include_imeisv=%d\n",
+ bsc_subscr_name(conn->bsub), cipher, osmo_hexdump_nospc(key, len), include_imeisv);
+
+ conn->lchan->encr.alg_id = RSL_ENC_ALG_A5(cipher);
+ if (key) {
+ conn->lchan->encr.key_len = len;
+ memcpy(conn->lchan->encr.key, key, len);
+ }
+
+ return gsm48_send_rr_ciph_mode(conn->lchan, include_imeisv);
+}
+
/*
* GSM 08.08 ยง 3.4.7 cipher mode handling. We will have to pick
* the cipher to be used for this. In case we are already using