summaryrefslogtreecommitdiffstats
path: root/src/target
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2017-12-16 17:52:31 +0700
committerVadim Yanitskiy <axilirator@gmail.com>2017-12-18 06:04:29 +0700
commit255f25ef25c5ce1deefcfbe63844bc47d524c377 (patch)
tree7e76c2246eae0a583099a696d208293cc6513b84 /src/target
parent32c2a1d74c1bb3f1cfa9a56b2e15b93fa321f942 (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: I1813a188e755141241273479b17896415abcc3f1
Diffstat (limited to 'src/target')
-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;
}