summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2017-09-22 21:29:10 -0700
committerDavid S. Miller <davem@davemloft.net>2017-09-22 21:29:10 -0700
commit3fb5ec06578e4c85d3486b6a73cbeb07960a51ce (patch)
treea63dd50c1e159a2b51bc03e1ad9ead79e536e452 /net
parentcddd95231f9a769fbf905d4f43fbad3a607044c3 (diff)
parentd5dd29e4dafef4baad7bf529ad73cafeb13e1aa8 (diff)
downloadlinux-3fb5ec06578e4c85d3486b6a73cbeb07960a51ce.tar.bz2
Merge branch 'ieee802154-for-davem-2017-09-20' of git://git.kernel.org/pub/scm/linux/kernel/git/sschmidt/wpan-next
Stefan Schmidt says: ==================== pull-request: ieee802154 2017-09-20 Here comes a pull request for ieee802154 changes I have queued up for this merge window. Normally these have been coming through the bluetooth tree but as this three have been falling through the cracks so far and I have to review and ack all of them anyway I think it makes sense if I save the bluetooth people some work and handle them directly. Its the first pull request I send to you so please let me know if I did something wrong or if you prefer a different format. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/mac802154/llsec.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/net/mac802154/llsec.c b/net/mac802154/llsec.c
index 1e1c9b20bab7..2fb703d70803 100644
--- a/net/mac802154/llsec.c
+++ b/net/mac802154/llsec.c
@@ -623,13 +623,18 @@ llsec_do_encrypt_unauth(struct sk_buff *skb, const struct mac802154_llsec *sec,
u8 iv[16];
struct scatterlist src;
SKCIPHER_REQUEST_ON_STACK(req, key->tfm0);
- int err;
+ int err, datalen;
+ unsigned char *data;
llsec_geniv(iv, sec->params.hwaddr, &hdr->sec);
- sg_init_one(&src, skb->data, skb->len);
+ /* Compute data payload offset and data length */
+ data = skb_mac_header(skb) + skb->mac_len;
+ datalen = skb_tail_pointer(skb) - data;
+ sg_init_one(&src, data, datalen);
+
skcipher_request_set_tfm(req, key->tfm0);
skcipher_request_set_callback(req, 0, NULL, NULL);
- skcipher_request_set_crypt(req, &src, &src, skb->len, iv);
+ skcipher_request_set_crypt(req, &src, &src, datalen, iv);
err = crypto_skcipher_encrypt(req);
skcipher_request_zero(req);
return err;
@@ -713,7 +718,8 @@ int mac802154_llsec_encrypt(struct mac802154_llsec *sec, struct sk_buff *skb)
if (hlen < 0 || hdr.fc.type != IEEE802154_FC_TYPE_DATA)
return -EINVAL;
- if (!hdr.fc.security_enabled || hdr.sec.level == 0) {
+ if (!hdr.fc.security_enabled ||
+ (hdr.sec.level == IEEE802154_SCF_SECLEVEL_NONE)) {
skb_push(skb, hlen);
return 0;
}