dpp.h (4b72b91a7132df1f77bbae194e1071ac621f1edb) dpp.h (32a95656b51ebefcdf3e0b02c110825f59abd26f)
1/*
2 * DPP functionality shared between hostapd and wpa_supplicant
3 * Copyright (c) 2017, Qualcomm Atheros, Inc.
4 * Copyright (c) 2018-2020, The Linux Foundation
5 *
6 * This software may be distributed under the terms of the BSD license.
7 * See README for more details.
8 */

--- 11 unchanged lines hidden (view full) ---

20struct dpp_global;
21struct json_token;
22struct dpp_reconfig_id;
23
24#ifdef CONFIG_TESTING_OPTIONS
25#define DPP_VERSION (dpp_version_override)
26extern int dpp_version_override;
27#else /* CONFIG_TESTING_OPTIONS */
1/*
2 * DPP functionality shared between hostapd and wpa_supplicant
3 * Copyright (c) 2017, Qualcomm Atheros, Inc.
4 * Copyright (c) 2018-2020, The Linux Foundation
5 *
6 * This software may be distributed under the terms of the BSD license.
7 * See README for more details.
8 */

--- 11 unchanged lines hidden (view full) ---

20struct dpp_global;
21struct json_token;
22struct dpp_reconfig_id;
23
24#ifdef CONFIG_TESTING_OPTIONS
25#define DPP_VERSION (dpp_version_override)
26extern int dpp_version_override;
27#else /* CONFIG_TESTING_OPTIONS */
28#ifdef CONFIG_DPP2
28#ifdef CONFIG_DPP3
29#define DPP_VERSION 3
30#elif defined(CONFIG_DPP2)
29#define DPP_VERSION 2
30#else
31#define DPP_VERSION 1
32#endif
33#endif /* CONFIG_TESTING_OPTIONS */
34
35#define DPP_HDR_LEN (4 + 2) /* OUI, OUI Type, Crypto Suite, DPP frame type */
36#define DPP_TCP_PORT 8908
37
38enum dpp_public_action_frame_type {
39 DPP_PA_AUTHENTICATION_REQ = 0,
40 DPP_PA_AUTHENTICATION_RESP = 1,
41 DPP_PA_AUTHENTICATION_CONF = 2,
42 DPP_PA_PEER_DISCOVERY_REQ = 5,
43 DPP_PA_PEER_DISCOVERY_RESP = 6,
31#define DPP_VERSION 2
32#else
33#define DPP_VERSION 1
34#endif
35#endif /* CONFIG_TESTING_OPTIONS */
36
37#define DPP_HDR_LEN (4 + 2) /* OUI, OUI Type, Crypto Suite, DPP frame type */
38#define DPP_TCP_PORT 8908
39
40enum dpp_public_action_frame_type {
41 DPP_PA_AUTHENTICATION_REQ = 0,
42 DPP_PA_AUTHENTICATION_RESP = 1,
43 DPP_PA_AUTHENTICATION_CONF = 2,
44 DPP_PA_PEER_DISCOVERY_REQ = 5,
45 DPP_PA_PEER_DISCOVERY_RESP = 6,
44 DPP_PA_PKEX_EXCHANGE_REQ = 7,
46 DPP_PA_PKEX_V1_EXCHANGE_REQ = 7,
45 DPP_PA_PKEX_EXCHANGE_RESP = 8,
46 DPP_PA_PKEX_COMMIT_REVEAL_REQ = 9,
47 DPP_PA_PKEX_COMMIT_REVEAL_RESP = 10,
48 DPP_PA_CONFIGURATION_RESULT = 11,
49 DPP_PA_CONNECTION_STATUS_RESULT = 12,
50 DPP_PA_PRESENCE_ANNOUNCEMENT = 13,
51 DPP_PA_RECONFIG_ANNOUNCEMENT = 14,
52 DPP_PA_RECONFIG_AUTH_REQ = 15,
53 DPP_PA_RECONFIG_AUTH_RESP = 16,
54 DPP_PA_RECONFIG_AUTH_CONF = 17,
47 DPP_PA_PKEX_EXCHANGE_RESP = 8,
48 DPP_PA_PKEX_COMMIT_REVEAL_REQ = 9,
49 DPP_PA_PKEX_COMMIT_REVEAL_RESP = 10,
50 DPP_PA_CONFIGURATION_RESULT = 11,
51 DPP_PA_CONNECTION_STATUS_RESULT = 12,
52 DPP_PA_PRESENCE_ANNOUNCEMENT = 13,
53 DPP_PA_RECONFIG_ANNOUNCEMENT = 14,
54 DPP_PA_RECONFIG_AUTH_REQ = 15,
55 DPP_PA_RECONFIG_AUTH_RESP = 16,
56 DPP_PA_RECONFIG_AUTH_CONF = 17,
57 DPP_PA_PKEX_EXCHANGE_REQ = 18,
55};
56
57enum dpp_attribute_id {
58 DPP_ATTR_STATUS = 0x1000,
59 DPP_ATTR_I_BOOTSTRAP_KEY_HASH = 0x1001,
60 DPP_ATTR_R_BOOTSTRAP_KEY_HASH = 0x1002,
61 DPP_ATTR_I_PROTOCOL_KEY = 0x1003,
62 DPP_ATTR_WRAPPED_DATA = 0x1004,

--- 105 unchanged lines hidden (view full) ---

168
169#define PKEX_COUNTER_T_LIMIT 5
170
171struct dpp_pkex {
172 void *msg_ctx;
173 unsigned int initiator:1;
174 unsigned int exchange_done:1;
175 unsigned int failed:1;
58};
59
60enum dpp_attribute_id {
61 DPP_ATTR_STATUS = 0x1000,
62 DPP_ATTR_I_BOOTSTRAP_KEY_HASH = 0x1001,
63 DPP_ATTR_R_BOOTSTRAP_KEY_HASH = 0x1002,
64 DPP_ATTR_I_PROTOCOL_KEY = 0x1003,
65 DPP_ATTR_WRAPPED_DATA = 0x1004,

--- 105 unchanged lines hidden (view full) ---

171
172#define PKEX_COUNTER_T_LIMIT 5
173
174struct dpp_pkex {
175 void *msg_ctx;
176 unsigned int initiator:1;
177 unsigned int exchange_done:1;
178 unsigned int failed:1;
179 unsigned int v2:1;
176 struct dpp_bootstrap_info *own_bi;
177 u8 own_mac[ETH_ALEN];
178 u8 peer_mac[ETH_ALEN];
179 char *identifier;
180 char *code;
181 struct crypto_ec_key *x;
182 struct crypto_ec_key *y;
183 u8 Mx[DPP_MAX_SHARED_SECRET_LEN];
184 u8 Nx[DPP_MAX_SHARED_SECRET_LEN];
185 u8 z[DPP_MAX_HASH_LEN];
186 struct crypto_ec_key *peer_bootstrap_key;
187 struct wpabuf *exchange_req;
188 struct wpabuf *exchange_resp;
189 unsigned int t; /* number of failures on code use */
190 unsigned int exch_req_wait_time;
191 unsigned int exch_req_tries;
192 unsigned int freq;
180 struct dpp_bootstrap_info *own_bi;
181 u8 own_mac[ETH_ALEN];
182 u8 peer_mac[ETH_ALEN];
183 char *identifier;
184 char *code;
185 struct crypto_ec_key *x;
186 struct crypto_ec_key *y;
187 u8 Mx[DPP_MAX_SHARED_SECRET_LEN];
188 u8 Nx[DPP_MAX_SHARED_SECRET_LEN];
189 u8 z[DPP_MAX_HASH_LEN];
190 struct crypto_ec_key *peer_bootstrap_key;
191 struct wpabuf *exchange_req;
192 struct wpabuf *exchange_resp;
193 unsigned int t; /* number of failures on code use */
194 unsigned int exch_req_wait_time;
195 unsigned int exch_req_tries;
196 unsigned int freq;
197 u8 peer_version;
193};
194
195enum dpp_akm {
196 DPP_AKM_UNKNOWN,
197 DPP_AKM_DPP,
198 DPP_AKM_PSK,
199 DPP_AKM_SAE,
200 DPP_AKM_PSK_SAE,

--- 166 unchanged lines hidden (view full) ---

367 struct crypto_ec_key *connector_key;
368 struct crypto_ec_key *pp_key;
369};
370
371struct dpp_introduction {
372 u8 pmkid[PMKID_LEN];
373 u8 pmk[PMK_LEN_MAX];
374 size_t pmk_len;
198};
199
200enum dpp_akm {
201 DPP_AKM_UNKNOWN,
202 DPP_AKM_DPP,
203 DPP_AKM_PSK,
204 DPP_AKM_SAE,
205 DPP_AKM_PSK_SAE,

--- 166 unchanged lines hidden (view full) ---

372 struct crypto_ec_key *connector_key;
373 struct crypto_ec_key *pp_key;
374};
375
376struct dpp_introduction {
377 u8 pmkid[PMKID_LEN];
378 u8 pmk[PMK_LEN_MAX];
379 size_t pmk_len;
380 int peer_version;
375};
376
377struct dpp_relay_config {
378 const struct hostapd_ip_addr *ipaddr;
379 const u8 *pkhash;
380
381 void *msg_ctx;
382 void *cb_ctx;

--- 103 unchanged lines hidden (view full) ---

486 DPP_TEST_STOP_AT_PKEX_EXCHANGE_RESP = 84,
487 DPP_TEST_STOP_AT_PKEX_CR_REQ = 85,
488 DPP_TEST_STOP_AT_PKEX_CR_RESP = 86,
489 DPP_TEST_STOP_AT_AUTH_REQ = 87,
490 DPP_TEST_STOP_AT_AUTH_RESP = 88,
491 DPP_TEST_STOP_AT_AUTH_CONF = 89,
492 DPP_TEST_STOP_AT_CONF_REQ = 90,
493 DPP_TEST_REJECT_CONFIG = 91,
381};
382
383struct dpp_relay_config {
384 const struct hostapd_ip_addr *ipaddr;
385 const u8 *pkhash;
386
387 void *msg_ctx;
388 void *cb_ctx;

--- 103 unchanged lines hidden (view full) ---

492 DPP_TEST_STOP_AT_PKEX_EXCHANGE_RESP = 84,
493 DPP_TEST_STOP_AT_PKEX_CR_REQ = 85,
494 DPP_TEST_STOP_AT_PKEX_CR_RESP = 86,
495 DPP_TEST_STOP_AT_AUTH_REQ = 87,
496 DPP_TEST_STOP_AT_AUTH_RESP = 88,
497 DPP_TEST_STOP_AT_AUTH_CONF = 89,
498 DPP_TEST_STOP_AT_CONF_REQ = 90,
499 DPP_TEST_REJECT_CONFIG = 91,
500 DPP_TEST_NO_PROTOCOL_VERSION_PEER_DISC_REQ = 92,
501 DPP_TEST_NO_PROTOCOL_VERSION_PEER_DISC_RESP = 93,
494};
495
496extern enum dpp_test_behavior dpp_test;
497extern u8 dpp_pkex_own_mac_override[ETH_ALEN];
498extern u8 dpp_pkex_peer_mac_override[ETH_ALEN];
499extern u8 dpp_pkex_ephemeral_key_override[600];
500extern size_t dpp_pkex_ephemeral_key_override_len;
501extern u8 dpp_protocol_key_override[600];

--- 86 unchanged lines hidden (view full) ---

588int dpp_configurator_own_config(struct dpp_authentication *auth,
589 const char *curve, int ap);
590enum dpp_status_error
591dpp_peer_intro(struct dpp_introduction *intro, const char *own_connector,
592 const u8 *net_access_key, size_t net_access_key_len,
593 const u8 *csign_key, size_t csign_key_len,
594 const u8 *peer_connector, size_t peer_connector_len,
595 os_time_t *expiry);
502};
503
504extern enum dpp_test_behavior dpp_test;
505extern u8 dpp_pkex_own_mac_override[ETH_ALEN];
506extern u8 dpp_pkex_peer_mac_override[ETH_ALEN];
507extern u8 dpp_pkex_ephemeral_key_override[600];
508extern size_t dpp_pkex_ephemeral_key_override_len;
509extern u8 dpp_protocol_key_override[600];

--- 86 unchanged lines hidden (view full) ---

596int dpp_configurator_own_config(struct dpp_authentication *auth,
597 const char *curve, int ap);
598enum dpp_status_error
599dpp_peer_intro(struct dpp_introduction *intro, const char *own_connector,
600 const u8 *net_access_key, size_t net_access_key_len,
601 const u8 *csign_key, size_t csign_key_len,
602 const u8 *peer_connector, size_t peer_connector_len,
603 os_time_t *expiry);
604int dpp_get_connector_version(const char *connector);
596struct dpp_pkex * dpp_pkex_init(void *msg_ctx, struct dpp_bootstrap_info *bi,
597 const u8 *own_mac,
605struct dpp_pkex * dpp_pkex_init(void *msg_ctx, struct dpp_bootstrap_info *bi,
606 const u8 *own_mac,
598 const char *identifier,
599 const char *code);
607 const char *identifier, const char *code,
608 bool v2);
600struct dpp_pkex * dpp_pkex_rx_exchange_req(void *msg_ctx,
601 struct dpp_bootstrap_info *bi,
602 const u8 *own_mac,
603 const u8 *peer_mac,
604 const char *identifier,
605 const char *code,
609struct dpp_pkex * dpp_pkex_rx_exchange_req(void *msg_ctx,
610 struct dpp_bootstrap_info *bi,
611 const u8 *own_mac,
612 const u8 *peer_mac,
613 const char *identifier,
614 const char *code,
606 const u8 *buf, size_t len);
615 const u8 *buf, size_t len, bool v2);
607struct wpabuf * dpp_pkex_rx_exchange_resp(struct dpp_pkex *pkex,
608 const u8 *peer_mac,
609 const u8 *buf, size_t len);
610struct wpabuf * dpp_pkex_rx_commit_reveal_req(struct dpp_pkex *pkex,
611 const u8 *hdr,
612 const u8 *buf, size_t len);
613int dpp_pkex_rx_commit_reveal_resp(struct dpp_pkex *pkex, const u8 *hdr,
614 const u8 *buf, size_t len);

--- 120 unchanged lines hidden ---
616struct wpabuf * dpp_pkex_rx_exchange_resp(struct dpp_pkex *pkex,
617 const u8 *peer_mac,
618 const u8 *buf, size_t len);
619struct wpabuf * dpp_pkex_rx_commit_reveal_req(struct dpp_pkex *pkex,
620 const u8 *hdr,
621 const u8 *buf, size_t len);
622int dpp_pkex_rx_commit_reveal_resp(struct dpp_pkex *pkex, const u8 *hdr,
623 const u8 *buf, size_t len);

--- 120 unchanged lines hidden ---