DPP: Use helper functions to build Bootstrap Key Hash attributes
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
parent
acdf703d50
commit
9efa531499
1 changed files with 32 additions and 34 deletions
|
@ -1446,6 +1446,30 @@ static void dpp_build_attr_status(struct wpabuf *msg,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void dpp_build_attr_r_bootstrap_key_hash(struct wpabuf *msg,
|
||||||
|
const u8 *hash)
|
||||||
|
{
|
||||||
|
if (hash) {
|
||||||
|
wpa_printf(MSG_DEBUG, "DPP: R-Bootstrap Key Hash");
|
||||||
|
wpabuf_put_le16(msg, DPP_ATTR_R_BOOTSTRAP_KEY_HASH);
|
||||||
|
wpabuf_put_le16(msg, SHA256_MAC_LEN);
|
||||||
|
wpabuf_put_data(msg, hash, SHA256_MAC_LEN);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void dpp_build_attr_i_bootstrap_key_hash(struct wpabuf *msg,
|
||||||
|
const u8 *hash)
|
||||||
|
{
|
||||||
|
if (hash) {
|
||||||
|
wpa_printf(MSG_DEBUG, "DPP: I-Bootstrap Key Hash");
|
||||||
|
wpabuf_put_le16(msg, DPP_ATTR_I_BOOTSTRAP_KEY_HASH);
|
||||||
|
wpabuf_put_le16(msg, SHA256_MAC_LEN);
|
||||||
|
wpabuf_put_data(msg, hash, SHA256_MAC_LEN);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static struct wpabuf * dpp_auth_build_req(struct dpp_authentication *auth,
|
static struct wpabuf * dpp_auth_build_req(struct dpp_authentication *auth,
|
||||||
const struct wpabuf *pi,
|
const struct wpabuf *pi,
|
||||||
size_t nonce_len,
|
size_t nonce_len,
|
||||||
|
@ -1477,18 +1501,10 @@ static struct wpabuf * dpp_auth_build_req(struct dpp_authentication *auth,
|
||||||
attr_start = wpabuf_put(msg, 0);
|
attr_start = wpabuf_put(msg, 0);
|
||||||
|
|
||||||
/* Responder Bootstrapping Key Hash */
|
/* Responder Bootstrapping Key Hash */
|
||||||
if (r_pubkey_hash) {
|
dpp_build_attr_r_bootstrap_key_hash(msg, r_pubkey_hash);
|
||||||
wpabuf_put_le16(msg, DPP_ATTR_R_BOOTSTRAP_KEY_HASH);
|
|
||||||
wpabuf_put_le16(msg, SHA256_MAC_LEN);
|
|
||||||
wpabuf_put_data(msg, r_pubkey_hash, SHA256_MAC_LEN);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Initiator Bootstrapping Key Hash */
|
/* Initiator Bootstrapping Key Hash */
|
||||||
if (i_pubkey_hash) {
|
dpp_build_attr_i_bootstrap_key_hash(msg, i_pubkey_hash);
|
||||||
wpabuf_put_le16(msg, DPP_ATTR_I_BOOTSTRAP_KEY_HASH);
|
|
||||||
wpabuf_put_le16(msg, SHA256_MAC_LEN);
|
|
||||||
wpabuf_put_data(msg, i_pubkey_hash, SHA256_MAC_LEN);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Initiator Protocol Key */
|
/* Initiator Protocol Key */
|
||||||
if (pi) {
|
if (pi) {
|
||||||
|
@ -1647,19 +1663,10 @@ static struct wpabuf * dpp_auth_build_resp(struct dpp_authentication *auth,
|
||||||
dpp_build_attr_status(msg, status);
|
dpp_build_attr_status(msg, status);
|
||||||
|
|
||||||
/* Responder Bootstrapping Key Hash */
|
/* Responder Bootstrapping Key Hash */
|
||||||
if (r_pubkey_hash) {
|
dpp_build_attr_r_bootstrap_key_hash(msg, r_pubkey_hash);
|
||||||
wpabuf_put_le16(msg, DPP_ATTR_R_BOOTSTRAP_KEY_HASH);
|
|
||||||
wpabuf_put_le16(msg, SHA256_MAC_LEN);
|
|
||||||
wpabuf_put_data(msg, r_pubkey_hash, SHA256_MAC_LEN);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Initiator Bootstrapping Key Hash */
|
/* Initiator Bootstrapping Key Hash (mutual authentication) */
|
||||||
if (i_pubkey_hash) {
|
dpp_build_attr_i_bootstrap_key_hash(msg, i_pubkey_hash);
|
||||||
/* Mutual authentication */
|
|
||||||
wpabuf_put_le16(msg, DPP_ATTR_I_BOOTSTRAP_KEY_HASH);
|
|
||||||
wpabuf_put_le16(msg, SHA256_MAC_LEN);
|
|
||||||
wpabuf_put_data(msg, i_pubkey_hash, SHA256_MAC_LEN);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Responder Protocol Key */
|
/* Responder Protocol Key */
|
||||||
if (pr) {
|
if (pr) {
|
||||||
|
@ -3052,19 +3059,10 @@ skip_status:
|
||||||
#endif /* CONFIG_TESTING_OPTIONS */
|
#endif /* CONFIG_TESTING_OPTIONS */
|
||||||
|
|
||||||
/* Responder Bootstrapping Key Hash */
|
/* Responder Bootstrapping Key Hash */
|
||||||
if (r_pubkey_hash) {
|
dpp_build_attr_r_bootstrap_key_hash(msg, r_pubkey_hash);
|
||||||
wpabuf_put_le16(msg, DPP_ATTR_R_BOOTSTRAP_KEY_HASH);
|
|
||||||
wpabuf_put_le16(msg, SHA256_MAC_LEN);
|
|
||||||
wpabuf_put_data(msg, r_pubkey_hash, SHA256_MAC_LEN);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i_pubkey_hash) {
|
/* Initiator Bootstrapping Key Hash (mutual authentication) */
|
||||||
/* Mutual authentication */
|
dpp_build_attr_i_bootstrap_key_hash(msg, i_pubkey_hash);
|
||||||
/* Initiator Bootstrapping Key Hash */
|
|
||||||
wpabuf_put_le16(msg, DPP_ATTR_I_BOOTSTRAP_KEY_HASH);
|
|
||||||
wpabuf_put_le16(msg, SHA256_MAC_LEN);
|
|
||||||
wpabuf_put_data(msg, i_pubkey_hash, SHA256_MAC_LEN);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef CONFIG_TESTING_OPTIONS
|
#ifdef CONFIG_TESTING_OPTIONS
|
||||||
if (dpp_test == DPP_TEST_NO_WRAPPED_DATA_AUTH_CONF)
|
if (dpp_test == DPP_TEST_NO_WRAPPED_DATA_AUTH_CONF)
|
||||||
|
|
Loading…
Reference in a new issue