All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v0 1/2] mac802154: fix header and payload encrypted
@ 2017-08-07 17:22 Diogenes Pereira
  2017-08-07 17:22 ` [PATCH v0 2/2] mac802154: replace hardcoded value with macro Diogenes Pereira
  2017-08-09 10:52 ` [PATCH v0 1/2] mac802154: fix header and payload encrypted Stefan Schmidt
  0 siblings, 2 replies; 14+ messages in thread
From: Diogenes Pereira @ 2017-08-07 17:22 UTC (permalink / raw)
  To: linux-wpan; +Cc: aar, stefan, Diogenes Pereira

According to 802.15.4-2015 specification (section 9.2.1 Outgoing frame
security procedure) just the outgoing payload is encrypted. The header
carries security parameters to destination address, so is not encrypted.

Signed-off-by: Diogenes Pereira <dvnp@cesar.org.br>
---
 net/mac802154/llsec.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/net/mac802154/llsec.c b/net/mac802154/llsec.c
index 1e1c9b2..3c8ae3f 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);
+
+	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;
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2017-09-20 12:31 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-07 17:22 [PATCH v0 1/2] mac802154: fix header and payload encrypted Diogenes Pereira
2017-08-07 17:22 ` [PATCH v0 2/2] mac802154: replace hardcoded value with macro Diogenes Pereira
2017-08-09 10:47   ` Stefan Schmidt
     [not found]     ` <CAC9NHkm=SknMqkY8MuaOuJsnnBWauFAzU_cjYttMxRh6N0MQuA@mail.gmail.com>
2017-08-09 11:17       ` Stefan Schmidt
2017-08-09 16:19   ` [PATCH v1] " Diogenes Pereira
2017-08-21 14:46     ` Stefan Schmidt
2017-09-20 12:31     ` Stefan Schmidt
2017-08-09 10:52 ` [PATCH v0 1/2] mac802154: fix header and payload encrypted Stefan Schmidt
     [not found]   ` <CAC9NHkkHZJLk7_shZ37jFqp06Gu9Qg1Eu=sGi_259GjhkpSftg@mail.gmail.com>
2017-08-09 13:26     ` Stefan Schmidt
2017-09-05 12:18     ` [PATCH v1 1/2] mac802154: Fix MAC " Diogenes Pereira
2017-09-11 11:21       ` Stefan Schmidt
     [not found]         ` <CAC9NHknYZ7=FqwkXSHpXKQKBD74b7ddaDA=q=O5j-wkXhpMSJw@mail.gmail.com>
2017-09-14 13:35           ` Stefan Schmidt
2017-09-14 13:39       ` Stefan Schmidt
2017-09-20 12:31       ` Stefan Schmidt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.