aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJouni Malinen <jouni@qca.qualcomm.com>2017-07-04 14:48:44 (GMT)
committerJouni Malinen <j@w1.fi>2017-07-04 14:48:44 (GMT)
commitf522bb2377bedd2ea44885efceb85cc12b3a7d8f (patch)
tree67397a402a1a660164714e698183bb6420932026 /src
parentdc7fc09ccdf476c92c85d4e3b98666be529d4f16 (diff)
downloadhostap-f522bb2377bedd2ea44885efceb85cc12b3a7d8f.zip
hostap-f522bb2377bedd2ea44885efceb85cc12b3a7d8f.tar.gz
hostap-f522bb2377bedd2ea44885efceb85cc12b3a7d8f.tar.bz2
DPP: Add DPP_CONFIGURATOR_SIGN to generate own connector
The DPP Configurator can use this new command to generate its own signed connector for the network that it manages. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Diffstat (limited to 'src')
-rw-r--r--src/common/dpp.c44
-rw-r--r--src/common/dpp.h2
2 files changed, 46 insertions, 0 deletions
diff --git a/src/common/dpp.c b/src/common/dpp.c
index 528bdb4..026c81e 100644
--- a/src/common/dpp.c
+++ b/src/common/dpp.c
@@ -4421,6 +4421,50 @@ fail:
}
+int dpp_configurator_own_config(struct dpp_authentication *auth,
+ const char *curve)
+{
+ struct wpabuf *conf_obj;
+ int ret = -1;
+
+ if (!auth->conf) {
+ wpa_printf(MSG_DEBUG, "DPP: No configurator specified");
+ return -1;
+ }
+
+ if (!curve) {
+ auth->curve = &dpp_curves[0];
+ } else {
+ auth->curve = dpp_get_curve_name(curve);
+ if (!auth->curve) {
+ wpa_printf(MSG_INFO, "DPP: Unsupported curve: %s",
+ curve);
+ return -1;
+ }
+ }
+ wpa_printf(MSG_DEBUG,
+ "DPP: Building own configuration/connector with curve %s",
+ auth->curve->name);
+
+ auth->own_protocol_key = dpp_gen_keypair(auth->curve);
+ if (!auth->own_protocol_key)
+ return -1;
+ dpp_copy_netaccesskey(auth);
+ auth->peer_protocol_key = auth->own_protocol_key;
+ dpp_copy_csign(auth, auth->conf->csign);
+
+ conf_obj = dpp_build_conf_obj(auth, 0);
+ if (!conf_obj)
+ goto fail;
+ ret = dpp_parse_conf_obj(auth, wpabuf_head(conf_obj),
+ wpabuf_len(conf_obj));
+fail:
+ wpabuf_free(conf_obj);
+ auth->peer_protocol_key = NULL;
+ return ret;
+}
+
+
static int dpp_compatible_netrole(const char *role1, const char *role2)
{
return (os_strcmp(role1, "sta") == 0 && os_strcmp(role2, "ap") == 0) ||
diff --git a/src/common/dpp.h b/src/common/dpp.h
index 8aa78c5..4a53c5d 100644
--- a/src/common/dpp.h
+++ b/src/common/dpp.h
@@ -254,6 +254,8 @@ void dpp_configurator_free(struct dpp_configurator *conf);
struct dpp_configurator *
dpp_keygen_configurator(const char *curve, const u8 *privkey,
size_t privkey_len);
+int dpp_configurator_own_config(struct dpp_authentication *auth,
+ const char *curve);
int dpp_peer_intro(struct dpp_introduction *intro, const char *own_connector,
const u8 *net_access_key, size_t net_access_key_len,
const u8 *csign_key, size_t csign_key_len,