aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <jouni@codeaurora.org>2019-11-27 13:19:08 (GMT)
committerJouni Malinen <j@w1.fi>2019-11-27 13:34:38 (GMT)
commitc54227c26a9f55ca619037255f52e5fa4a90cf63 (patch)
treef05eae1cc8ffb65229376b4dae61dc9103904c74
parent5632b0715860518cf0b71b2466bf7c7e1c8c273b (diff)
downloadhostap-c54227c26a9f55ca619037255f52e5fa4a90cf63.zip
hostap-c54227c26a9f55ca619037255f52e5fa4a90cf63.tar.gz
hostap-c54227c26a9f55ca619037255f52e5fa4a90cf63.tar.bz2
DPP2: Replace connectionStatus object ssid with ssid64
The UTF-8 encoded ssid string was replaced with base64url encoded ssid64 string, so update the implementation to match. Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
-rw-r--r--src/common/dpp.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/common/dpp.c b/src/common/dpp.c
index ab7072c..f015106 100644
--- a/src/common/dpp.c
+++ b/src/common/dpp.c
@@ -6487,6 +6487,7 @@ enum dpp_status_error dpp_conn_status_result_rx(struct dpp_authentication *auth,
size_t unwrapped_len = 0;
enum dpp_status_error ret = 256;
struct json_token *root = NULL, *token;
+ struct wpabuf *ssid64;
*ssid_len = 0;
*channel_list = NULL;
@@ -6561,12 +6562,12 @@ enum dpp_status_error dpp_conn_status_result_rx(struct dpp_authentication *auth,
goto fail;
}
- token = json_get_member(root, "ssid");
- if (token && token->type == JSON_STRING &&
- os_strlen(token->string) <= SSID_MAX_LEN) {
- *ssid_len = os_strlen(token->string);
- os_memcpy(ssid, token->string, *ssid_len);
+ ssid64 = json_get_member_base64url(root, "ssid64");
+ if (ssid64 && wpabuf_len(ssid64) <= SSID_MAX_LEN) {
+ *ssid_len = wpabuf_len(ssid64);
+ os_memcpy(ssid, wpabuf_head(ssid64), *ssid_len);
}
+ wpabuf_free(ssid64);
token = json_get_member(root, "channelList");
if (token && token->type == JSON_STRING &&
@@ -6593,7 +6594,7 @@ struct wpabuf * dpp_build_conn_status_result(struct dpp_authentication *auth,
const u8 *ssid, size_t ssid_len,
const char *channel_list)
{
- struct wpabuf *msg, *clear, *json;
+ struct wpabuf *msg = NULL, *clear = NULL, *json;
size_t nonce_len, clear_len, attr_len;
const u8 *addr[2];
size_t len[2];
@@ -6604,12 +6605,14 @@ struct wpabuf * dpp_build_conn_status_result(struct dpp_authentication *auth,
return NULL;
wpabuf_printf(json, "{\"result\":%d", result);
if (ssid) {
- char ssid_str[6 * SSID_MAX_LEN + 1];
+ unsigned char *ssid64;
- wpabuf_put_str(json, ",\"ssid\":\"");
- json_escape_string(ssid_str, sizeof(ssid_str),
- (const char *) ssid, ssid_len);
- wpabuf_put_str(json, ssid_str);
+ ssid64 = base64_url_encode(ssid, ssid_len, NULL, 0);
+ if (!ssid64)
+ goto fail;
+ wpabuf_put_str(json, ",\"ssid64\":\"");
+ wpabuf_put_str(json, (char *) ssid64);
+ os_free(ssid64);
wpabuf_put_str(json, "\"");
}
if (channel_list)