aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2009-10-31 08:05:45 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2009-11-20 17:35:45 +0100
commitea72b62cac3942f164f1a7d329b7c44435030168 (patch)
treed5cba4d0a3e93cff2d88702aadde78bb9b00f1ca
parent49a84ec6e9a8202d7bc0d6a9a5f22580d809710f (diff)
[bssmap] Unconditionally include the chosen encryption in cipher mode complete
-rw-r--r--openbsc/include/openbsc/bssap.h2
-rw-r--r--openbsc/src/bsc_msc_ip.c2
-rw-r--r--openbsc/src/bssap.c18
3 files changed, 9 insertions, 13 deletions
diff --git a/openbsc/include/openbsc/bssap.h b/openbsc/include/openbsc/bssap.h
index 1d0f69f20..7b9a8d1a0 100644
--- a/openbsc/include/openbsc/bssap.h
+++ b/openbsc/include/openbsc/bssap.h
@@ -309,7 +309,7 @@ int bssmap_rcvmsg_udt(struct gsm_network *net, struct msgb *msg, unsigned int le
struct msgb *bssmap_create_layer3(struct msgb *msg);
struct msgb *bssmap_create_reset(void);
struct msgb *bssmap_create_clear_complete(void);
-struct msgb *bssmap_create_cipher_complete(struct msgb *layer3, int bsc_enc_algo);
+struct msgb *bssmap_create_cipher_complete(struct msgb *layer3);
struct msgb *bssmap_create_cipher_reject(u_int8_t cause);
struct msgb *bssmap_create_sapi_reject(u_int8_t link_id);
struct msgb *bssmap_create_assignment_completed(struct gsm_lchan *lchan, u_int8_t rr_cause);
diff --git a/openbsc/src/bsc_msc_ip.c b/openbsc/src/bsc_msc_ip.c
index c0b887e42..7e810cf66 100644
--- a/openbsc/src/bsc_msc_ip.c
+++ b/openbsc/src/bsc_msc_ip.c
@@ -258,7 +258,7 @@ static int handle_cipher_m_complete(struct msgb *msg)
struct msgb *resp;
DEBUGP(DMSC, "CIPHER MODE COMPLETE from MS, forwarding to MSC\n");
- resp = bssmap_create_cipher_complete(msg, -1);
+ resp = bssmap_create_cipher_complete(msg);
if (!resp) {
DEBUGP(DMSC, "Creating MSC response failed.\n");
return -1;
diff --git a/openbsc/src/bssap.c b/openbsc/src/bssap.c
index ea27c3da9..cd65a735b 100644
--- a/openbsc/src/bssap.c
+++ b/openbsc/src/bssap.c
@@ -504,7 +504,7 @@ struct msgb *bssmap_create_clear_complete(void)
return msg;
}
-struct msgb *bssmap_create_cipher_complete(struct msgb *layer3, int bsc_enc_algo)
+struct msgb *bssmap_create_cipher_complete(struct msgb *layer3)
{
struct msgb *msg = msgb_alloc_headroom(BSSMAP_MSG_SIZE, BSSMAP_MSG_HEADROOM,
"cipher-complete");
@@ -514,13 +514,11 @@ struct msgb *bssmap_create_cipher_complete(struct msgb *layer3, int bsc_enc_algo
/* send response with BSS override for A5/1... cheating */
msg->l3h = msgb_put(msg, 3);
msg->l3h[0] = BSSAP_MSG_BSS_MANAGEMENT;
- msg->l3h[1] = 1;
+ msg->l3h[1] = 0xff;
msg->l3h[2] = BSS_MAP_MSG_CIPHER_MODE_COMPLETE;
/* include layer3 in case we have at least two octets */
if (layer3 && msgb_l3len(layer3) > 2) {
- msg->l3h[1] += msgb_l3len(layer3) + 2;
-
msg->l4h = msgb_put(msg, msgb_l3len(layer3) + 2);
msg->l4h[0] = GSM0808_IE_LAYER_3_MESSAGE_CONTENTS;
msg->l4h[1] = msgb_l3len(layer3);
@@ -528,14 +526,12 @@ struct msgb *bssmap_create_cipher_complete(struct msgb *layer3, int bsc_enc_algo
}
/* and the optional BSS message */
- if (bsc_enc_algo != -1) {
- msg->l3h[1] += 2;
-
- msg->l4h = msgb_put(msg, 2);
- msg->l4h[0] = GSM0808_IE_CHOSEN_ENCR_ALG;
- msg->l4h[1] = bsc_enc_algo;
- }
+ msg->l4h = msgb_put(msg, 2);
+ msg->l4h[0] = GSM0808_IE_CHOSEN_ENCR_ALG;
+ msg->l4h[1] = layer3->lchan->encr.alg_id;
+ /* update the size */
+ msg->l3h[1] = msgb_l3len(msg) - 2;
return msg;
}