summaryrefslogtreecommitdiff
path: root/src/wps/wps_registrar.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2015-09-07 22:56:40 +0300
committerJouni Malinen <j@w1.fi>2015-09-07 23:02:19 +0300
commit4b9a395e29878a739d8d21b4383268d83fc7710d (patch)
treefeb4d7d666380b7b064f83f7c2f8bcd77f6d4d96 /src/wps/wps_registrar.c
parentb664ef1c0d97dbf8b127408b4b63eb35e36aa5bb (diff)
downloadhostap-4b9a395e29878a739d8d21b4383268d83fc7710d.tar.gz
WPS: Reduce struct wps_parse_attr size
Use shorter variables for storing the attribute lengths and group these variables together to allow compiler to pack them more efficiently. This reduces the struct size from 960 bytes to 760 bytes in 64-bit builds. This reduces stack use in number of functions. Signed-off-by: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'src/wps/wps_registrar.c')
-rw-r--r--src/wps/wps_registrar.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/wps/wps_registrar.c b/src/wps/wps_registrar.c
index 8bcf2b34f..4ca3a42d4 100644
--- a/src/wps/wps_registrar.c
+++ b/src/wps/wps_registrar.c
@@ -2605,13 +2605,16 @@ static enum wps_process_res wps_process_m1(struct wps_data *wps,
token = wps_get_nfc_pw_token(
&wps->wps->registrar->nfc_pw_tokens, wps->dev_pw_id);
if (token && token->peer_pk_hash_known) {
+ size_t len;
+
wpa_printf(MSG_DEBUG, "WPS: Found matching NFC "
"Password Token");
dl_list_del(&token->list);
wps->nfc_pw_token = token;
addr[0] = attr->public_key;
- sha256_vector(1, addr, &attr->public_key_len, hash);
+ len = attr->public_key_len;
+ sha256_vector(1, addr, &len, hash);
if (os_memcmp_const(hash,
wps->nfc_pw_token->pubkey_hash,
WPS_OOB_PUBKEY_HASH_LEN) != 0) {