[1/1] MKA: fix basic set body encoding

Message ID 1502999221-11842-1-git-send-email-michael-dev@fami-braun.de
State New
Headers show

Commit Message

michael-dev@fami-braun.de Aug. 17, 2017, 7:47 p.m.
From: Michael Braun <michael.braun@fem.tu-ilmenau.de>

IEEE 802.1X-2010 Figure 11-7 explaines that
"Parameter set body length" is exclusive
of the suffix padding.

This fixes variable length encoding when
ckn length is not a multiple of 4 bytes.

Signed-off-by: Michael Braun <michael-dev@fami-braun.de>
---
 src/pae/ieee802_1x_kay.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Patch

diff --git a/src/pae/ieee802_1x_kay.c b/src/pae/ieee802_1x_kay.c
index ff55f88..20451bf 100644
--- a/src/pae/ieee802_1x_kay.c
+++ b/src/pae/ieee802_1x_kay.c
@@ -694,7 +694,8 @@  ieee802_1x_mka_encode_basic_body(
 {
 	struct ieee802_1x_mka_basic_body *body;
 	struct ieee802_1x_kay *kay = participant->kay;
-	unsigned int length = ieee802_1x_mka_basic_body_length(participant);
+	unsigned int length = sizeof(struct ieee802_1x_mka_basic_body);
+	length += participant->ckn.len;
 
 	body = wpabuf_put(buf, length);