aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSabrina Dubroca <sd@queasysnail.net>2016-08-12 13:07:33 (GMT)
committerJouni Malinen <j@w1.fi>2016-08-28 17:47:25 (GMT)
commitcf375eb2da67d156b65f5d6556bf2f048fdf5c54 (patch)
tree0bbe9da86ff4c72d37c3f3f58be78c3de291c4ec
parent8b4a14884275418b561c30747e3831bcc185644a (diff)
downloadhostap-cf375eb2da67d156b65f5d6556bf2f048fdf5c54.zip
hostap-cf375eb2da67d156b65f5d6556bf2f048fdf5c54.tar.gz
hostap-cf375eb2da67d156b65f5d6556bf2f048fdf5c54.tar.bz2
mka: Simplify ieee802_1x_mka_encode_icv_body() memory copying
There is no need to maintain two os_memcpy() calls to cover different cmac lengths. Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
-rw-r--r--src/pae/ieee802_1x_kay.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/pae/ieee802_1x_kay.c b/src/pae/ieee802_1x_kay.c
index 3a93323..fe442d5 100644
--- a/src/pae/ieee802_1x_kay.c
+++ b/src/pae/ieee802_1x_kay.c
@@ -1756,12 +1756,9 @@ ieee802_1x_mka_encode_icv_body(struct ieee802_1x_mka_participant *participant,
return -1;
}
- if (length != DEFAULT_ICV_LEN) {
- os_memcpy(wpabuf_put(buf, length - MKA_HDR_LEN), cmac,
- length - MKA_HDR_LEN);
- } else {
- os_memcpy(wpabuf_put(buf, length), cmac, length);
- }
+ if (length != DEFAULT_ICV_LEN)
+ length -= MKA_HDR_LEN;
+ os_memcpy(wpabuf_put(buf, length), cmac, length);
return 0;
}