mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2025-02-25 05:09:34 -05:00
DPP2: Move connStatus object building into a helper function
Allow the same helper function to be used for reconfiguration. Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
parent
b227515fae
commit
961435097b
@ -6165,6 +6165,36 @@ fail:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
struct wpabuf * dpp_build_conn_status(enum dpp_status_error result,
|
||||||
|
const u8 *ssid, size_t ssid_len,
|
||||||
|
const char *channel_list)
|
||||||
|
{
|
||||||
|
struct wpabuf *json;
|
||||||
|
|
||||||
|
json = wpabuf_alloc(1000);
|
||||||
|
if (!json)
|
||||||
|
return NULL;
|
||||||
|
json_start_object(json, NULL);
|
||||||
|
json_add_int(json, "result", result);
|
||||||
|
if (ssid) {
|
||||||
|
json_value_sep(json);
|
||||||
|
if (json_add_base64url(json, "ssid64", ssid, ssid_len) < 0) {
|
||||||
|
wpabuf_free(json);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (channel_list) {
|
||||||
|
json_value_sep(json);
|
||||||
|
json_add_string(json, "channelList", channel_list);
|
||||||
|
}
|
||||||
|
json_end_object(json);
|
||||||
|
wpa_hexdump_ascii(MSG_DEBUG, "DPP: connStatus JSON",
|
||||||
|
wpabuf_head(json), wpabuf_len(json));
|
||||||
|
|
||||||
|
return json;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
struct wpabuf * dpp_build_conn_status_result(struct dpp_authentication *auth,
|
struct wpabuf * dpp_build_conn_status_result(struct dpp_authentication *auth,
|
||||||
enum dpp_status_error result,
|
enum dpp_status_error result,
|
||||||
const u8 *ssid, size_t ssid_len,
|
const u8 *ssid, size_t ssid_len,
|
||||||
@ -6176,23 +6206,9 @@ struct wpabuf * dpp_build_conn_status_result(struct dpp_authentication *auth,
|
|||||||
size_t len[2];
|
size_t len[2];
|
||||||
u8 *wrapped;
|
u8 *wrapped;
|
||||||
|
|
||||||
json = wpabuf_alloc(1000);
|
json = dpp_build_conn_status(result, ssid, ssid_len, channel_list);
|
||||||
if (!json)
|
if (!json)
|
||||||
return NULL;
|
return NULL;
|
||||||
json_start_object(json, NULL);
|
|
||||||
json_add_int(json, "result", result);
|
|
||||||
if (ssid) {
|
|
||||||
json_value_sep(json);
|
|
||||||
if (json_add_base64url(json, "ssid64", ssid, ssid_len) < 0)
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
if (channel_list) {
|
|
||||||
json_value_sep(json);
|
|
||||||
json_add_string(json, "channelList", channel_list);
|
|
||||||
}
|
|
||||||
json_end_object(json);
|
|
||||||
wpa_hexdump_ascii(MSG_DEBUG, "DPP: connStatus JSON",
|
|
||||||
wpabuf_head(json), wpabuf_len(json));
|
|
||||||
|
|
||||||
nonce_len = auth->curve->nonce_len;
|
nonce_len = auth->curve->nonce_len;
|
||||||
clear_len = 5 + 4 + nonce_len + 4 + wpabuf_len(json);
|
clear_len = 5 + 4 + nonce_len + 4 + wpabuf_len(json);
|
||||||
|
@ -30,6 +30,9 @@ struct dpp_global {
|
|||||||
|
|
||||||
void dpp_build_attr_status(struct wpabuf *msg, enum dpp_status_error status);
|
void dpp_build_attr_status(struct wpabuf *msg, enum dpp_status_error status);
|
||||||
unsigned int dpp_next_id(struct dpp_global *dpp);
|
unsigned int dpp_next_id(struct dpp_global *dpp);
|
||||||
|
struct wpabuf * dpp_build_conn_status(enum dpp_status_error result,
|
||||||
|
const u8 *ssid, size_t ssid_len,
|
||||||
|
const char *channel_list);
|
||||||
struct json_token * dpp_parse_own_connector(const char *own_connector);
|
struct json_token * dpp_parse_own_connector(const char *own_connector);
|
||||||
|
|
||||||
/* dpp_crypto.c */
|
/* dpp_crypto.c */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user