#endif /* CONFIG_TESTING_OPTIONS */
#endif /* CONFIG_PASN */
+
+
+int p2p_get_dira_info(struct p2p_data *p2p, char *buf, size_t buflen)
+{
+ int res;
+ char *pos, *end;
+ struct p2p_id_key *dev_ik;
+
+ if (!p2p->pairing_info ||
+ !p2p->cfg->pairing_config.pairing_capable ||
+ !p2p->cfg->pairing_config.enable_pairing_cache)
+ return 0;
+
+ if (p2p_derive_nonce_tag(p2p))
+ return 0;
+
+ pos = buf;
+ end = buf + buflen;
+ dev_ik = &p2p->pairing_info->dev_ik;
+
+ res = os_snprintf(pos, end - pos, MACSTR,
+ MAC2STR(p2p->cfg->dev_addr));
+ if (os_snprintf_error(end - pos, res))
+ return pos - buf;
+ pos += res;
+
+ res = os_snprintf(pos, end - pos, " ");
+ if (os_snprintf_error(end - pos, res))
+ return pos - buf;
+ pos += res;
+
+ pos += wpa_snprintf_hex(pos, end - pos, dev_ik->dira_nonce,
+ dev_ik->dira_nonce_len);
+
+ res = os_snprintf(pos, end - pos, " ");
+ if (os_snprintf_error(end - pos, res))
+ return pos - buf;
+ pos += res;
+
+ pos += wpa_snprintf_hex(pos, end - pos, dev_ik->dira_tag,
+ dev_ik->dira_tag_len);
+
+ res = os_snprintf(pos, end - pos, "\n");
+ if (os_snprintf_error(end - pos, res))
+ return pos - buf;
+ pos += res;
+
+ return pos - buf;
+}
void p2p_pasn_store_ptk(struct p2p_data *p2p, struct wpa_ptk *ptk);
int p2p_pasn_get_ptk(struct p2p_data *p2p, const u8 **buf, size_t *buf_len);
void p2p_usd_service_hash(struct p2p_data *p2p, const char *service_name);
+int p2p_get_dira_info(struct p2p_data *p2p, char *buf, size_t buflen);
#endif /* P2P_H */
reply_len = -1;
} else if (os_strcmp(buf, "P2P_GET_PASSPHRASE") == 0) {
reply_len = p2p_get_passphrase(wpa_s, reply, reply_size);
+ } else if (os_strcmp(buf, "P2P_GET_DIRA") == 0) {
+ reply_len = wpas_p2p_get_dira(wpa_s, reply, reply_size);
#ifdef CONFIG_PASN
#ifdef CONFIG_TESTING_OPTIONS
} else if (os_strcmp(buf, "P2P_GET_PASNPTK") == 0) {
#ifdef CONFIG_AP
"STA-FIRST",
#endif /* CONFIG_AP */
+ "P2P_GET_DIRA",
NULL
};
static const char * prefix[] = {
#endif /* CONFIG_PASN */
+int wpas_p2p_get_dira(struct wpa_supplicant *wpa_s, char *buf, size_t buf_len)
+{
+ struct p2p_data *p2p = wpa_s->global->p2p;
+
+ if (wpa_s->global->p2p_disabled || !p2p)
+ return 0;
+ return p2p_get_dira_info(p2p, buf, buf_len);
+}
+
+
void wpas_p2p_update_dev_addr(struct wpa_supplicant *wpa_s)
{
os_memcpy(wpa_s->global->p2p_dev_addr, wpa_s->own_addr, ETH_ALEN);