aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/gsm_04_08.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2009-08-30 15:37:11 +0900
committerHarald Welte <laforge@gnumonks.org>2009-08-30 15:37:11 +0900
commit08d91a5b26f0a81d6c5ba6f2c03a465108a3f189 (patch)
treea4405408aa97d963d7732a21b9d7cd1abe927348 /openbsc/src/gsm_04_08.c
parent196d0528ff8a4a887168efe436ddf059e5b9561e (diff)
A5 support for RSL and 04.08 (not used yet)
This just adds the 04.08 and RSL bits for A5, but not the logic for performing authentication. The caller would first set lchan->encr and then call gsm48_send_rr_ciph_mode(lchan), which encapsulates the 04.08 CIPHERING MODE COMMAND into a RSL ENCRYPTION COMMAND and sends it to the BTS for execution + forwarding.
Diffstat (limited to 'openbsc/src/gsm_04_08.c')
-rw-r--r--openbsc/src/gsm_04_08.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/openbsc/src/gsm_04_08.c b/openbsc/src/gsm_04_08.c
index eeabc0fce..30c2db39d 100644
--- a/openbsc/src/gsm_04_08.c
+++ b/openbsc/src/gsm_04_08.c
@@ -1672,6 +1672,10 @@ static int gsm0408_rcv_rr(struct msgb *msg)
case GSM48_MT_RR_APP_INFO:
rc = gsm48_rx_rr_app_info(msg);
break;
+ case GSM48_MT_RR_CIPH_M_COMPL:
+ DEBUGP(DRR, "CIPHERING MODE COMPLETE\n");
+ /* FIXME: check for MI (if any) */
+ break;
default:
fprintf(stderr, "Unimplemented GSM 04.08 RR msg type 0x%02x\n",
gh->msg_type);
@@ -1681,6 +1685,29 @@ static int gsm0408_rcv_rr(struct msgb *msg)
return rc;
}
+/* Chapter 9.1.9: Ciphering Mode Command */
+int gsm48_send_rr_ciph_mode(struct gsm_lchan *lchan)
+{
+ struct msgb *msg = gsm48_msgb_alloc();
+ struct gsm48_hdr *gh;
+ u_int8_t ciph_mod_set;
+
+ msg->lchan = lchan;
+
+ DEBUGP(DRR, "TX CIPHERING MODE CMD\n");
+
+ if (lchan->encr.alg_id <= RSL_ENC_ALG_A5(0))
+ ciph_mod_set = 0;
+ else
+ ciph_mod_set = (lchan->encr.alg_id-1)<<1 | 1;
+
+ gh = (struct gsm48_hdr *) msgb_put(msg, sizeof(*gh) + 1);
+ gh->proto_discr = GSM48_PDISC_RR;
+ gh->msg_type = GSM48_MT_RR_CIPH_M_CMD;
+ gh->data[0] = 0x10 | (ciph_mod_set & 0xf);
+
+ return rsl_encryption_cmd(msg);
+}
int gsm48_send_rr_app_info(struct gsm_lchan *lchan, u_int8_t apdu_id,
u_int8_t apdu_len, u_int8_t *apdu)