RSL: Actually check if BSC-requested cipher is supported

This commit is contained in:
Harald Welte 2011-11-24 17:46:22 +01:00
parent 2660812084
commit fe4893e625
3 changed files with 10 additions and 2 deletions

View File

@ -45,6 +45,9 @@ struct gsm_bts_role_bts {
char *bsc_oml_host;
char *rtp_bind_host;
unsigned int rtp_jitter_buf_ms;
struct {
uint8_t ciphers;
} support;
};
#define bts_role_bts(x) ((struct gsm_bts_role_bts *)(x)->role)

View File

@ -568,6 +568,12 @@ static void copy_sacch_si_to_lchan(struct gsm_lchan *lchan)
static int encr_info2lchan(struct gsm_lchan *lchan,
const uint8_t *val, uint8_t len)
{
struct gsm_bts_role_bts *btsb = bts_role_bts(lchan->ts->trx->bts);
/* check if the encryption algorithm sent by BSC is supported! */
if (!((1 << *val) & btsb->support.ciphers))
return -ENOTSUP;
/* length can be '1' in case of no ciphering */
if (len < 1)
return -EINVAL;
@ -805,8 +811,6 @@ static int rsl_rx_encr_cmd(struct msgb *msg)
return rsl_tx_error_report(msg->trx, RSL_ERR_IE_CONTENT);
}
/* FIXME: check if the encryption algorithm sent by BSC is supported! */
/* 9.3.2 Link Identifier */
link_id = *TLVP_VAL(&tp, RSL_IE_LINK_IDENT);

View File

@ -210,6 +210,7 @@ int main(int argc, char **argv)
exit(1);
}
btsb = bts_role_bts(bts);
btsb->support.ciphers = (1 << 0) | (1 << 1) | (1 << 2);
handle_options(argc, argv);