DPP: Check own_bi/peer_bi pointers more consistently

This gets rid of smatch warnings about a dereference before check.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
Jouni Malinen 2018-11-30 17:57:35 +02:00 committed by Jouni Malinen
parent 3d1d469195
commit 810bedf23f

View file

@ -3457,7 +3457,7 @@ dpp_auth_resp_rx(struct dpp_authentication *auth, const u8 *hdr,
} }
#endif /* CONFIG_TESTING_OPTIONS */ #endif /* CONFIG_TESTING_OPTIONS */
if (!auth->initiator) { if (!auth->initiator || !auth->peer_bi) {
dpp_auth_fail(auth, "Unexpected Authentication Response"); dpp_auth_fail(auth, "Unexpected Authentication Response");
return NULL; return NULL;
} }
@ -3638,7 +3638,7 @@ dpp_auth_resp_rx(struct dpp_authentication *auth, const u8 *hdr,
goto fail; goto fail;
} }
if (auth->own_bi && auth->peer_bi) { if (auth->own_bi) {
/* Mutual authentication */ /* Mutual authentication */
if (dpp_auth_derive_l_initiator(auth) < 0) if (dpp_auth_derive_l_initiator(auth) < 0)
goto fail; goto fail;
@ -3846,7 +3846,7 @@ int dpp_auth_conf_rx(struct dpp_authentication *auth, const u8 *hdr,
} }
#endif /* CONFIG_TESTING_OPTIONS */ #endif /* CONFIG_TESTING_OPTIONS */
if (auth->initiator) { if (auth->initiator || !auth->own_bi) {
dpp_auth_fail(auth, "Unexpected Authentication Confirm"); dpp_auth_fail(auth, "Unexpected Authentication Confirm");
return -1; return -1;
} }
@ -3904,7 +3904,7 @@ int dpp_auth_conf_rx(struct dpp_authentication *auth, const u8 *hdr,
"Initiator Bootstrapping Key Hash mismatch"); "Initiator Bootstrapping Key Hash mismatch");
return -1; return -1;
} }
} else if (auth->own_bi && auth->peer_bi) { } else if (auth->peer_bi) {
/* Mutual authentication and peer did not include its /* Mutual authentication and peer did not include its
* Bootstrapping Key Hash attribute. */ * Bootstrapping Key Hash attribute. */
dpp_auth_fail(auth, dpp_auth_fail(auth,