From 4b9a395e29878a739d8d21b4383268d83fc7710d Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Mon, 7 Sep 2015 22:56:40 +0300 Subject: 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 --- src/wps/wps_registrar.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/wps/wps_registrar.c') 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) { -- cgit v1.2.1