diff --git a/src/pae/ieee802_1x_kay.c b/src/pae/ieee802_1x_kay.c index 88fb9cec5..f030c3be7 100644 --- a/src/pae/ieee802_1x_kay.c +++ b/src/pae/ieee802_1x_kay.c @@ -2944,21 +2944,19 @@ static int ieee802_1x_kay_mkpdu_sanity_check(struct ieee802_1x_kay *kay, wpa_printf(MSG_ERROR, "KaY: omac1_aes_128 failed"); return -1; } + msg_icv = ieee802_1x_mka_decode_icv_body(participant, (u8 *) mka_hdr, mka_msg_len); - - if (msg_icv) { - if (os_memcmp_const(msg_icv, icv, - mka_alg_tbl[kay->mka_algindex].icv_len) != - 0) { - wpa_printf(MSG_ERROR, - "KaY: Computed ICV is not equal to Received ICV"); - return -1; - } - } else { + if (!msg_icv) { wpa_printf(MSG_ERROR, "KaY: No ICV"); return -1; } + if (os_memcmp_const(msg_icv, icv, + mka_alg_tbl[kay->mka_algindex].icv_len) != 0) { + wpa_printf(MSG_ERROR, + "KaY: Computed ICV is not equal to Received ICV"); + return -1; + } return 0; }