diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2009-10-05 13:25:06 +0200 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2009-10-06 04:34:25 +0200 |
commit | ea4088a7ea5ac3f25988acbafc0b9d49509ea8cb (patch) | |
tree | 9171544f10cf1bdbe26779c3ae72f20ecb70e43d /openbsc | |
parent | e2d82274990ddae78cabdb96087ed90ffd7a9d3a (diff) |
[gsm0408] Move encryption message creation to gsm_04_08_utils.c
Be able to use the cipher mode command message from the MSC code.
Diffstat (limited to 'openbsc')
-rw-r--r-- | openbsc/src/gsm_04_08.c | 24 | ||||
-rw-r--r-- | openbsc/src/gsm_04_08_utils.c | 25 |
2 files changed, 25 insertions, 24 deletions
diff --git a/openbsc/src/gsm_04_08.c b/openbsc/src/gsm_04_08.c index 9ad9e1539..9467d79a6 100644 --- a/openbsc/src/gsm_04_08.c +++ b/openbsc/src/gsm_04_08.c @@ -1644,30 +1644,6 @@ 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-2)<<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) { diff --git a/openbsc/src/gsm_04_08_utils.c b/openbsc/src/gsm_04_08_utils.c index 47ec8ab0e..88edc7dc0 100644 --- a/openbsc/src/gsm_04_08_utils.c +++ b/openbsc/src/gsm_04_08_utils.c @@ -457,3 +457,28 @@ int gsm48_handle_paging_resp(struct msgb *msg, struct gsm_subscriber *subscr) paging_request_stop(msg->trx->bts, subscr, msg->lchan); return 0; } + +/* 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-2)<<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); +} + |