summaryrefslogtreecommitdiffstats
path: root/src/target/firmware/layer1
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2017-12-16 17:52:31 +0700
committerVadim Yanitskiy <axilirator@gmail.com>2018-03-14 22:22:39 +0700
commita4d255269a7d4e58d2ec0fbb42483495b8c247c9 (patch)
tree0f7100028dc7eadbcf465aad5131f8517c0f09ac /src/target/firmware/layer1
parent8b9d3170ff265c934f6271bd445ff5a6788ffffb (diff)
L1CTL/L1CTL_CRYPTO_REQ: add key length and channel info
Previously, the L1CTL_CRYPTO_REQ message contained only a ciphering algorithm and actual Kc key to be used. The key length was calculated manually using the MSGB API. Let's avoid manual calculations here, as it may cause unexpected behavior if the message structure is changed. Also, let's fill the UL header with minimal information about a channel, which is going to be encrypted. Change-Id: I5fab079907c5276322d3ec2b46cab81f10c7ed09
Diffstat (limited to 'src/target/firmware/layer1')
-rw-r--r--src/target/firmware/layer1/l23_api.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/target/firmware/layer1/l23_api.c b/src/target/firmware/layer1/l23_api.c
index 311ca6a2..e53b0c8f 100644
--- a/src/target/firmware/layer1/l23_api.c
+++ b/src/target/firmware/layer1/l23_api.c
@@ -301,11 +301,10 @@ static void l1ctl_rx_crypto_req(struct msgb *msg)
struct l1ctl_hdr *l1h = (struct l1ctl_hdr *) msg->data;
struct l1ctl_info_ul *ul = (struct l1ctl_info_ul *) l1h->data;
struct l1ctl_crypto_req *cr = (struct l1ctl_crypto_req *) ul->payload;
- uint8_t key_len = msg->len - sizeof(*l1h) - sizeof(*ul) - sizeof(*cr);
- printd("L1CTL_CRYPTO_REQ (algo=A5/%u, len=%u)\n", cr->algo, key_len);
+ printd("L1CTL_CRYPTO_REQ (algo=A5/%u, len=%u)\n", cr->algo, cr->key_len);
- if (cr->algo && key_len != 8) {
+ if (cr->algo && cr->key_len != 8) {
printd("L1CTL_CRYPTO_REQ -> Invalid key\n");
return;
}