Cumulative patch from commit f95a4524c2c00476e46b7999426ffdcbc7cd538f
f95a452 nl80211: Improve debug output by printing SA and DA in frames
dedfa44 Print frame type name in debug output
57a8f8a nl80211: Use low-priority scan for OBSS scan
1b928f9 P2P: Allow passphrase length to be configured
e985246 eapol_test: Add PC/SC reader and PIN command line arguments
5a62060 Use pcsc_reader configuration in one for scard_init() call
f3c6b23 EAP-SIM': Fix AT_KDF parser to avoid infinite loop
79122f9 EAP-SIM/AKA: Remove unused RESULT_FAILURE state
Change-Id: I142bed35a75ed228e145e50c961dcde22a9815f7
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c
index 104f77b..d0191e7 100644
--- a/src/p2p/p2p.c
+++ b/src/p2p/p2p.c
@@ -1561,7 +1561,7 @@
int p2p_go_params(struct p2p_data *p2p, struct p2p_go_neg_results *params)
{
p2p_build_ssid(p2p, params->ssid, ¶ms->ssid_len);
- p2p_random(params->passphrase, 8);
+ p2p_random(params->passphrase, p2p->cfg->passphrase_len);
return 0;
}
@@ -1595,7 +1595,7 @@
p2p->op_channel);
os_memcpy(res.ssid, p2p->ssid, p2p->ssid_len);
res.ssid_len = p2p->ssid_len;
- p2p_random(res.passphrase, 8);
+ p2p_random(res.passphrase, p2p->cfg->passphrase_len);
} else {
res.freq = peer->oper_freq;
if (p2p->ssid_len) {
@@ -2388,7 +2388,8 @@
{
struct p2p_data *p2p;
- if (cfg->max_peers < 1)
+ if (cfg->max_peers < 1 ||
+ cfg->passphrase_len < 8 || cfg->passphrase_len > 63)
return NULL;
p2p = os_zalloc(sizeof(*p2p) + sizeof(*cfg));
@@ -4719,3 +4720,12 @@
}
#endif /* CONFIG_WPS_NFC */
+
+
+int p2p_set_passphrase_len(struct p2p_data *p2p, unsigned int len)
+{
+ if (len < 8 || len > 63)
+ return -1;
+ p2p->cfg->passphrase_len = len;
+ return 0;
+}