WPS: Use generic MAC Address attribute builder
Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
8e80dd5b0c
commit
aaecb69d87
4 changed files with 14 additions and 24 deletions
|
@ -417,3 +417,14 @@ struct wpabuf * wps_ie_encapsulate(struct wpabuf *data)
|
||||||
|
|
||||||
return ie;
|
return ie;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int wps_build_mac_addr(struct wpabuf *msg, const u8 *addr)
|
||||||
|
{
|
||||||
|
wpa_printf(MSG_DEBUG, "WPS: * MAC Address (" MACSTR ")",
|
||||||
|
MAC2STR(addr));
|
||||||
|
wpabuf_put_be16(msg, ATTR_MAC_ADDR);
|
||||||
|
wpabuf_put_be16(msg, ETH_ALEN);
|
||||||
|
wpabuf_put_data(msg, addr, ETH_ALEN);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
|
@ -16,16 +16,6 @@
|
||||||
#include "wps_dev_attr.h"
|
#include "wps_dev_attr.h"
|
||||||
|
|
||||||
|
|
||||||
static int wps_build_mac_addr(struct wps_data *wps, struct wpabuf *msg)
|
|
||||||
{
|
|
||||||
wpa_printf(MSG_DEBUG, "WPS: * MAC Address");
|
|
||||||
wpabuf_put_be16(msg, ATTR_MAC_ADDR);
|
|
||||||
wpabuf_put_be16(msg, ETH_ALEN);
|
|
||||||
wpabuf_put_data(msg, wps->mac_addr_e, ETH_ALEN);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int wps_build_wps_state(struct wps_data *wps, struct wpabuf *msg)
|
static int wps_build_wps_state(struct wps_data *wps, struct wpabuf *msg)
|
||||||
{
|
{
|
||||||
u8 state;
|
u8 state;
|
||||||
|
@ -149,7 +139,7 @@ static struct wpabuf * wps_build_m1(struct wps_data *wps)
|
||||||
if (wps_build_version(msg) ||
|
if (wps_build_version(msg) ||
|
||||||
wps_build_msg_type(msg, WPS_M1) ||
|
wps_build_msg_type(msg, WPS_M1) ||
|
||||||
wps_build_uuid_e(msg, wps->uuid_e) ||
|
wps_build_uuid_e(msg, wps->uuid_e) ||
|
||||||
wps_build_mac_addr(wps, msg) ||
|
wps_build_mac_addr(msg, wps->mac_addr_e) ||
|
||||||
wps_build_enrollee_nonce(wps, msg) ||
|
wps_build_enrollee_nonce(wps, msg) ||
|
||||||
wps_build_public_key(wps, msg) ||
|
wps_build_public_key(wps, msg) ||
|
||||||
wps_build_auth_type_flags(wps, msg) ||
|
wps_build_auth_type_flags(wps, msg) ||
|
||||||
|
|
|
@ -169,6 +169,7 @@ int wps_build_oob_dev_pw(struct wpabuf *msg, u16 dev_pw_id,
|
||||||
const struct wpabuf *pubkey, const u8 *dev_pw,
|
const struct wpabuf *pubkey, const u8 *dev_pw,
|
||||||
size_t dev_pw_len);
|
size_t dev_pw_len);
|
||||||
struct wpabuf * wps_ie_encapsulate(struct wpabuf *data);
|
struct wpabuf * wps_ie_encapsulate(struct wpabuf *data);
|
||||||
|
int wps_build_mac_addr(struct wpabuf *msg, const u8 *addr);
|
||||||
|
|
||||||
/* wps_attr_process.c */
|
/* wps_attr_process.c */
|
||||||
int wps_process_authenticator(struct wps_data *wps, const u8 *authenticator,
|
int wps_process_authenticator(struct wps_data *wps, const u8 *authenticator,
|
||||||
|
|
|
@ -1526,18 +1526,6 @@ static int wps_build_cred_network_key(struct wpabuf *msg,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int wps_build_cred_mac_addr(struct wpabuf *msg,
|
|
||||||
const struct wps_credential *cred)
|
|
||||||
{
|
|
||||||
wpa_printf(MSG_DEBUG, "WPS: * MAC Address (" MACSTR ")",
|
|
||||||
MAC2STR(cred->mac_addr));
|
|
||||||
wpabuf_put_be16(msg, ATTR_MAC_ADDR);
|
|
||||||
wpabuf_put_be16(msg, ETH_ALEN);
|
|
||||||
wpabuf_put_data(msg, cred->mac_addr, ETH_ALEN);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int wps_build_credential(struct wpabuf *msg,
|
static int wps_build_credential(struct wpabuf *msg,
|
||||||
const struct wps_credential *cred)
|
const struct wps_credential *cred)
|
||||||
{
|
{
|
||||||
|
@ -1546,7 +1534,7 @@ static int wps_build_credential(struct wpabuf *msg,
|
||||||
wps_build_cred_auth_type(msg, cred) ||
|
wps_build_cred_auth_type(msg, cred) ||
|
||||||
wps_build_cred_encr_type(msg, cred) ||
|
wps_build_cred_encr_type(msg, cred) ||
|
||||||
wps_build_cred_network_key(msg, cred) ||
|
wps_build_cred_network_key(msg, cred) ||
|
||||||
wps_build_cred_mac_addr(msg, cred))
|
wps_build_mac_addr(msg, cred->mac_addr))
|
||||||
return -1;
|
return -1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue