aboutsummaryrefslogtreecommitdiffstats
path: root/src/libvlr/vlr.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2017-12-23 18:51:48 +0100
committerHarald Welte <laforge@gnumonks.org>2018-01-28 00:09:41 +0000
commit71c51df07dfbc60cb41cb43385576a9d89c0c269 (patch)
treef072cda567e76232653a32e1ff781b917f8ea4ef /src/libvlr/vlr.c
parent14e051776fe07cbc7f9c5775ea62f04fe79bd357 (diff)
Shift ciphering algorithm selection from VLR to MSC
The VLR code seems to have the assumption that there is one particular algorithm to be used, as opposed to one of a set of algorithms. What's missing is basically to decide when/where to pick the best algorithm within the capabilities of the phone (classmark) and the network configuration (net->a5_encryption_mask). So far, libvlr has no notion of classmark. Rather, libmsc has. Why does the VLR care about the particular algorithm at all? The VLR should probably simply decide if it should use encryption or not, and if so, the MSC will figure which algorithm to use. Change-Id: I5ed80ca2086560a5975a758ec568a034a9a8ab89
Diffstat (limited to 'src/libvlr/vlr.c')
-rw-r--r--src/libvlr/vlr.c26
1 files changed, 4 insertions, 22 deletions
diff --git a/src/libvlr/vlr.c b/src/libvlr/vlr.c
index 21ef0821f..6750a46f6 100644
--- a/src/libvlr/vlr.c
+++ b/src/libvlr/vlr.c
@@ -1105,33 +1105,15 @@ void vlr_subscr_rx_ciph_res(struct vlr_subscr *vsub, struct vlr_ciph_result *res
int vlr_set_ciph_mode(struct vlr_instance *vlr,
struct osmo_fsm_inst *fi,
void *msc_conn_ref,
- enum vlr_ciph ciph_mode,
+ bool ciph_required,
bool umts_aka,
bool retrieve_imeisv)
{
- switch (ciph_mode) {
- case VLR_CIPH_NONE:
+ if (!ciph_required)
return 0;
- case VLR_CIPH_A5_1:
- case VLR_CIPH_A5_3:
- LOGPFSML(fi, LOGL_DEBUG, "Set Ciphering Mode: %d=%s\n",
- ciph_mode, vlr_ciph_name(ciph_mode));
- return vlr->ops.set_ciph_mode(msc_conn_ref,
- ciph_mode,
- umts_aka,
- retrieve_imeisv);
-
- case VLR_CIPH_A5_2:
- /* TODO policy by user config? */
- LOGPFSML(fi, LOGL_ERROR, "A5/2 ciphering is not allowed\n");
- return -EINVAL;
-
- default:
- LOGPFSML(fi, LOGL_ERROR, "unknown ciphering value: %d\n",
- ciph_mode);
- return -EINVAL;
- }
+ LOGPFSML(fi, LOGL_DEBUG, "Set Ciphering Mode\n");
+ return vlr->ops.set_ciph_mode(msc_conn_ref, umts_aka, retrieve_imeisv);
}
/* Decide whether UMTS AKA should be used.