2 * DPP functionality shared between hostapd and wpa_supplicant
3 * Copyright (c) 2017, Qualcomm Atheros, Inc.
4 * Copyright (c) 2018-2020, The Linux Foundation
6 * This software may be distributed under the terms of the BSD license.
7 * See README for more details.
14 #include <openssl/x509.h>
16 #include "utils/list.h"
17 #include "common/wpa_common.h"
18 #include "crypto/sha256.h"
21 struct hostapd_ip_addr
;
24 #define DPP_HDR_LEN (4 + 2) /* OUI, OUI Type, Crypto Suite, DPP frame type */
25 #define DPP_TCP_PORT 7871
27 enum dpp_public_action_frame_type
{
28 DPP_PA_AUTHENTICATION_REQ
= 0,
29 DPP_PA_AUTHENTICATION_RESP
= 1,
30 DPP_PA_AUTHENTICATION_CONF
= 2,
31 DPP_PA_PEER_DISCOVERY_REQ
= 5,
32 DPP_PA_PEER_DISCOVERY_RESP
= 6,
33 DPP_PA_PKEX_EXCHANGE_REQ
= 7,
34 DPP_PA_PKEX_EXCHANGE_RESP
= 8,
35 DPP_PA_PKEX_COMMIT_REVEAL_REQ
= 9,
36 DPP_PA_PKEX_COMMIT_REVEAL_RESP
= 10,
37 DPP_PA_CONFIGURATION_RESULT
= 11,
38 DPP_PA_CONNECTION_STATUS_RESULT
= 12,
39 DPP_PA_PRESENCE_ANNOUNCEMENT
= 13,
40 DPP_PA_RECONFIG_ANNOUNCEMENT
= 14,
41 DPP_PA_RECONFIG_AUTH_REQ
= 15,
42 DPP_PA_RECONFIG_AUTH_RESP
= 16,
43 DPP_PA_RECONFIG_AUTH_CONF
= 17,
46 enum dpp_attribute_id
{
47 DPP_ATTR_STATUS
= 0x1000,
48 DPP_ATTR_I_BOOTSTRAP_KEY_HASH
= 0x1001,
49 DPP_ATTR_R_BOOTSTRAP_KEY_HASH
= 0x1002,
50 DPP_ATTR_I_PROTOCOL_KEY
= 0x1003,
51 DPP_ATTR_WRAPPED_DATA
= 0x1004,
52 DPP_ATTR_I_NONCE
= 0x1005,
53 DPP_ATTR_I_CAPABILITIES
= 0x1006,
54 DPP_ATTR_R_NONCE
= 0x1007,
55 DPP_ATTR_R_CAPABILITIES
= 0x1008,
56 DPP_ATTR_R_PROTOCOL_KEY
= 0x1009,
57 DPP_ATTR_I_AUTH_TAG
= 0x100A,
58 DPP_ATTR_R_AUTH_TAG
= 0x100B,
59 DPP_ATTR_CONFIG_OBJ
= 0x100C,
60 DPP_ATTR_CONNECTOR
= 0x100D,
61 DPP_ATTR_CONFIG_ATTR_OBJ
= 0x100E,
62 DPP_ATTR_BOOTSTRAP_KEY
= 0x100F,
63 DPP_ATTR_OWN_NET_NK_HASH
= 0x1011,
64 DPP_ATTR_FINITE_CYCLIC_GROUP
= 0x1012,
65 DPP_ATTR_ENCRYPTED_KEY
= 0x1013,
66 DPP_ATTR_ENROLLEE_NONCE
= 0x1014,
67 DPP_ATTR_CODE_IDENTIFIER
= 0x1015,
68 DPP_ATTR_TRANSACTION_ID
= 0x1016,
69 DPP_ATTR_BOOTSTRAP_INFO
= 0x1017,
70 DPP_ATTR_CHANNEL
= 0x1018,
71 DPP_ATTR_PROTOCOL_VERSION
= 0x1019,
72 DPP_ATTR_ENVELOPED_DATA
= 0x101A,
73 DPP_ATTR_SEND_CONN_STATUS
= 0x101B,
74 DPP_ATTR_CONN_STATUS
= 0x101C,
75 DPP_ATTR_RECONFIG_FLAGS
= 0x101D,
76 DPP_ATTR_C_SIGN_KEY_HASH
= 0x101E,
77 DPP_ATTR_CSR_ATTR_REQ
= 0x101F,
80 enum dpp_status_error
{
82 DPP_STATUS_NOT_COMPATIBLE
= 1,
83 DPP_STATUS_AUTH_FAILURE
= 2,
84 DPP_STATUS_UNWRAP_FAILURE
= 3,
85 DPP_STATUS_BAD_GROUP
= 4,
86 DPP_STATUS_CONFIGURE_FAILURE
= 5,
87 DPP_STATUS_RESPONSE_PENDING
= 6,
88 DPP_STATUS_INVALID_CONNECTOR
= 7,
89 DPP_STATUS_NO_MATCH
= 8,
90 DPP_STATUS_CONFIG_REJECTED
= 9,
91 DPP_STATUS_NO_AP
= 10,
92 DPP_STATUS_CONFIGURE_PENDING
= 11,
93 DPP_STATUS_CSR_NEEDED
= 12,
94 DPP_STATUS_CSR_BAD
= 13,
97 #define DPP_CAPAB_ENROLLEE BIT(0)
98 #define DPP_CAPAB_CONFIGURATOR BIT(1)
99 #define DPP_CAPAB_ROLE_MASK (BIT(0) | BIT(1))
101 #define DPP_BOOTSTRAP_MAX_FREQ 30
102 #define DPP_MAX_NONCE_LEN 32
103 #define DPP_MAX_HASH_LEN 64
104 #define DPP_MAX_SHARED_SECRET_LEN 66
106 struct dpp_curve_params
{
109 size_t aes_siv_key_len
;
117 enum dpp_bootstrap_type
{
118 DPP_BOOTSTRAP_QR_CODE
,
120 DPP_BOOTSTRAP_NFC_URI
,
123 struct dpp_bootstrap_info
{
126 enum dpp_bootstrap_type type
;
128 u8 mac_addr
[ETH_ALEN
];
132 unsigned int freq
[DPP_BOOTSTRAP_MAX_FREQ
];
133 unsigned int num_freq
;
136 u8 pubkey_hash
[SHA256_MAC_LEN
];
137 u8 pubkey_hash_chirp
[SHA256_MAC_LEN
];
138 const struct dpp_curve_params
*curve
;
139 unsigned int pkex_t
; /* number of failures before dpp_pkex
141 char *configurator_params
;
144 #define PKEX_COUNTER_T_LIMIT 5
148 unsigned int initiator
:1;
149 unsigned int exchange_done
:1;
150 unsigned int failed
:1;
151 struct dpp_bootstrap_info
*own_bi
;
152 u8 own_mac
[ETH_ALEN
];
153 u8 peer_mac
[ETH_ALEN
];
158 u8 Mx
[DPP_MAX_SHARED_SECRET_LEN
];
159 u8 Nx
[DPP_MAX_SHARED_SECRET_LEN
];
160 u8 z
[DPP_MAX_HASH_LEN
];
161 EVP_PKEY
*peer_bootstrap_key
;
162 struct wpabuf
*exchange_req
;
163 struct wpabuf
*exchange_resp
;
164 unsigned int t
; /* number of failures on code use */
165 unsigned int exch_req_wait_time
;
166 unsigned int exch_req_tries
;
183 DPP_NETROLE_CONFIGURATOR
,
186 struct dpp_configuration
{
191 enum dpp_netrole netrole
;
193 /* For DPP configuration (connector) */
194 os_time_t netaccesskey_expiry
;
199 /* For legacy configuration */
205 struct dpp_asymmetric_key
{
206 struct dpp_asymmetric_key
*next
;
208 char *config_template
;
209 char *connector_template
;
212 #define DPP_MAX_CONF_OBJ 10
214 struct dpp_authentication
{
215 struct dpp_global
*global
;
218 const struct dpp_curve_params
*curve
;
219 struct dpp_bootstrap_info
*peer_bi
;
220 struct dpp_bootstrap_info
*own_bi
;
221 struct dpp_bootstrap_info
*tmp_own_bi
;
222 u8 waiting_pubkey_hash
[SHA256_MAC_LEN
];
223 int response_pending
;
224 enum dpp_status_error auth_resp_status
;
225 enum dpp_status_error conf_resp_status
;
226 u8 peer_mac_addr
[ETH_ALEN
];
227 u8 i_nonce
[DPP_MAX_NONCE_LEN
];
228 u8 r_nonce
[DPP_MAX_NONCE_LEN
];
229 u8 e_nonce
[DPP_MAX_NONCE_LEN
];
232 EVP_PKEY
*own_protocol_key
;
233 EVP_PKEY
*peer_protocol_key
;
234 struct wpabuf
*req_msg
;
235 struct wpabuf
*resp_msg
;
236 /* Intersection of possible frequencies for initiating DPP
237 * Authentication exchange */
238 unsigned int freq
[DPP_BOOTSTRAP_MAX_FREQ
];
239 unsigned int num_freq
, freq_idx
;
240 unsigned int curr_freq
;
241 unsigned int neg_freq
;
242 unsigned int num_freq_iters
;
244 u8 Mx
[DPP_MAX_SHARED_SECRET_LEN
];
246 u8 Nx
[DPP_MAX_SHARED_SECRET_LEN
];
248 u8 Lx
[DPP_MAX_SHARED_SECRET_LEN
];
250 u8 k1
[DPP_MAX_HASH_LEN
];
251 u8 k2
[DPP_MAX_HASH_LEN
];
252 u8 ke
[DPP_MAX_HASH_LEN
];
254 int waiting_auth_resp
;
255 int waiting_auth_conf
;
257 unsigned int auth_resp_tries
;
260 int remove_on_tx_status
;
261 int connect_on_tx_status
;
262 int waiting_conf_result
;
263 int waiting_conn_status_result
;
265 struct wpabuf
*conf_req
;
266 const struct wpabuf
*conf_resp
; /* owned by GAS server */
267 struct dpp_configuration
*conf_ap
;
268 struct dpp_configuration
*conf2_ap
;
269 struct dpp_configuration
*conf_sta
;
270 struct dpp_configuration
*conf2_sta
;
271 int provision_configurator
;
272 struct dpp_configurator
*conf
;
273 struct dpp_config_obj
{
274 char *connector
; /* received signedConnector */
275 u8 ssid
[SSID_MAX_LEN
];
282 struct wpabuf
*c_sign_key
;
283 } conf_obj
[DPP_MAX_CONF_OBJ
];
284 unsigned int num_conf_obj
;
285 struct dpp_asymmetric_key
*conf_key_pkg
;
286 struct wpabuf
*net_access_key
;
287 os_time_t net_access_key_expiry
;
288 int send_conn_status
;
289 int conn_status_requested
;
290 int akm_use_selector
;
291 int configurator_set
;
292 #ifdef CONFIG_TESTING_OPTIONS
293 char *config_obj_override
;
294 char *discovery_override
;
295 char *groups_override
;
296 unsigned int ignore_netaccesskey_mismatch
:1;
297 #endif /* CONFIG_TESTING_OPTIONS */
300 struct dpp_configurator
{
306 const struct dpp_curve_params
*curve
;
309 struct dpp_introduction
{
315 struct dpp_relay_config
{
316 const struct hostapd_ip_addr
*ipaddr
;
320 void (*tx
)(void *ctx
, const u8
*addr
, unsigned int freq
, const u8
*msg
,
322 void (*gas_resp_tx
)(void *ctx
, const u8
*addr
, u8 dialog_token
, int prot
,
326 struct dpp_controller_config
{
327 const char *configurator_params
;
331 #ifdef CONFIG_TESTING_OPTIONS
332 enum dpp_test_behavior
{
333 DPP_TEST_DISABLED
= 0,
334 DPP_TEST_AFTER_WRAPPED_DATA_AUTH_REQ
= 1,
335 DPP_TEST_AFTER_WRAPPED_DATA_AUTH_RESP
= 2,
336 DPP_TEST_AFTER_WRAPPED_DATA_AUTH_CONF
= 3,
337 DPP_TEST_AFTER_WRAPPED_DATA_PKEX_CR_REQ
= 4,
338 DPP_TEST_AFTER_WRAPPED_DATA_PKEX_CR_RESP
= 5,
339 DPP_TEST_AFTER_WRAPPED_DATA_CONF_REQ
= 6,
340 DPP_TEST_AFTER_WRAPPED_DATA_CONF_RESP
= 7,
341 DPP_TEST_ZERO_I_CAPAB
= 8,
342 DPP_TEST_ZERO_R_CAPAB
= 9,
343 DPP_TEST_NO_R_BOOTSTRAP_KEY_HASH_AUTH_REQ
= 10,
344 DPP_TEST_NO_I_BOOTSTRAP_KEY_HASH_AUTH_REQ
= 11,
345 DPP_TEST_NO_I_PROTO_KEY_AUTH_REQ
= 12,
346 DPP_TEST_NO_I_NONCE_AUTH_REQ
= 13,
347 DPP_TEST_NO_I_CAPAB_AUTH_REQ
= 14,
348 DPP_TEST_NO_WRAPPED_DATA_AUTH_REQ
= 15,
349 DPP_TEST_NO_STATUS_AUTH_RESP
= 16,
350 DPP_TEST_NO_R_BOOTSTRAP_KEY_HASH_AUTH_RESP
= 17,
351 DPP_TEST_NO_I_BOOTSTRAP_KEY_HASH_AUTH_RESP
= 18,
352 DPP_TEST_NO_R_PROTO_KEY_AUTH_RESP
= 19,
353 DPP_TEST_NO_R_NONCE_AUTH_RESP
= 20,
354 DPP_TEST_NO_I_NONCE_AUTH_RESP
= 21,
355 DPP_TEST_NO_R_CAPAB_AUTH_RESP
= 22,
356 DPP_TEST_NO_R_AUTH_AUTH_RESP
= 23,
357 DPP_TEST_NO_WRAPPED_DATA_AUTH_RESP
= 24,
358 DPP_TEST_NO_STATUS_AUTH_CONF
= 25,
359 DPP_TEST_NO_R_BOOTSTRAP_KEY_HASH_AUTH_CONF
= 26,
360 DPP_TEST_NO_I_BOOTSTRAP_KEY_HASH_AUTH_CONF
= 27,
361 DPP_TEST_NO_I_AUTH_AUTH_CONF
= 28,
362 DPP_TEST_NO_WRAPPED_DATA_AUTH_CONF
= 29,
363 DPP_TEST_I_NONCE_MISMATCH_AUTH_RESP
= 30,
364 DPP_TEST_INCOMPATIBLE_R_CAPAB_AUTH_RESP
= 31,
365 DPP_TEST_R_AUTH_MISMATCH_AUTH_RESP
= 32,
366 DPP_TEST_I_AUTH_MISMATCH_AUTH_CONF
= 33,
367 DPP_TEST_NO_FINITE_CYCLIC_GROUP_PKEX_EXCHANGE_REQ
= 34,
368 DPP_TEST_NO_ENCRYPTED_KEY_PKEX_EXCHANGE_REQ
= 35,
369 DPP_TEST_NO_STATUS_PKEX_EXCHANGE_RESP
= 36,
370 DPP_TEST_NO_ENCRYPTED_KEY_PKEX_EXCHANGE_RESP
= 37,
371 DPP_TEST_NO_BOOTSTRAP_KEY_PKEX_CR_REQ
= 38,
372 DPP_TEST_NO_I_AUTH_TAG_PKEX_CR_REQ
= 39,
373 DPP_TEST_NO_WRAPPED_DATA_PKEX_CR_REQ
= 40,
374 DPP_TEST_NO_BOOTSTRAP_KEY_PKEX_CR_RESP
= 41,
375 DPP_TEST_NO_R_AUTH_TAG_PKEX_CR_RESP
= 42,
376 DPP_TEST_NO_WRAPPED_DATA_PKEX_CR_RESP
= 43,
377 DPP_TEST_INVALID_ENCRYPTED_KEY_PKEX_EXCHANGE_REQ
= 44,
378 DPP_TEST_INVALID_ENCRYPTED_KEY_PKEX_EXCHANGE_RESP
= 45,
379 DPP_TEST_INVALID_STATUS_PKEX_EXCHANGE_RESP
= 46,
380 DPP_TEST_INVALID_BOOTSTRAP_KEY_PKEX_CR_REQ
= 47,
381 DPP_TEST_INVALID_BOOTSTRAP_KEY_PKEX_CR_RESP
= 48,
382 DPP_TEST_I_AUTH_TAG_MISMATCH_PKEX_CR_REQ
= 49,
383 DPP_TEST_R_AUTH_TAG_MISMATCH_PKEX_CR_RESP
= 50,
384 DPP_TEST_NO_E_NONCE_CONF_REQ
= 51,
385 DPP_TEST_NO_CONFIG_ATTR_OBJ_CONF_REQ
= 52,
386 DPP_TEST_NO_WRAPPED_DATA_CONF_REQ
= 53,
387 DPP_TEST_NO_E_NONCE_CONF_RESP
= 54,
388 DPP_TEST_NO_CONFIG_OBJ_CONF_RESP
= 55,
389 DPP_TEST_NO_STATUS_CONF_RESP
= 56,
390 DPP_TEST_NO_WRAPPED_DATA_CONF_RESP
= 57,
391 DPP_TEST_INVALID_STATUS_CONF_RESP
= 58,
392 DPP_TEST_E_NONCE_MISMATCH_CONF_RESP
= 59,
393 DPP_TEST_NO_TRANSACTION_ID_PEER_DISC_REQ
= 60,
394 DPP_TEST_NO_CONNECTOR_PEER_DISC_REQ
= 61,
395 DPP_TEST_NO_TRANSACTION_ID_PEER_DISC_RESP
= 62,
396 DPP_TEST_NO_STATUS_PEER_DISC_RESP
= 63,
397 DPP_TEST_NO_CONNECTOR_PEER_DISC_RESP
= 64,
398 DPP_TEST_AUTH_RESP_IN_PLACE_OF_CONF
= 65,
399 DPP_TEST_INVALID_I_PROTO_KEY_AUTH_REQ
= 66,
400 DPP_TEST_INVALID_R_PROTO_KEY_AUTH_RESP
= 67,
401 DPP_TEST_INVALID_R_BOOTSTRAP_KEY_HASH_AUTH_REQ
= 68,
402 DPP_TEST_INVALID_I_BOOTSTRAP_KEY_HASH_AUTH_REQ
= 69,
403 DPP_TEST_INVALID_R_BOOTSTRAP_KEY_HASH_AUTH_RESP
= 70,
404 DPP_TEST_INVALID_I_BOOTSTRAP_KEY_HASH_AUTH_RESP
= 71,
405 DPP_TEST_INVALID_R_BOOTSTRAP_KEY_HASH_AUTH_CONF
= 72,
406 DPP_TEST_INVALID_I_BOOTSTRAP_KEY_HASH_AUTH_CONF
= 73,
407 DPP_TEST_INVALID_STATUS_AUTH_RESP
= 74,
408 DPP_TEST_INVALID_STATUS_AUTH_CONF
= 75,
409 DPP_TEST_INVALID_CONFIG_ATTR_OBJ_CONF_REQ
= 76,
410 DPP_TEST_INVALID_TRANSACTION_ID_PEER_DISC_RESP
= 77,
411 DPP_TEST_INVALID_STATUS_PEER_DISC_RESP
= 78,
412 DPP_TEST_INVALID_CONNECTOR_PEER_DISC_RESP
= 79,
413 DPP_TEST_INVALID_CONNECTOR_PEER_DISC_REQ
= 80,
414 DPP_TEST_INVALID_I_NONCE_AUTH_REQ
= 81,
415 DPP_TEST_INVALID_TRANSACTION_ID_PEER_DISC_REQ
= 82,
416 DPP_TEST_INVALID_E_NONCE_CONF_REQ
= 83,
417 DPP_TEST_STOP_AT_PKEX_EXCHANGE_RESP
= 84,
418 DPP_TEST_STOP_AT_PKEX_CR_REQ
= 85,
419 DPP_TEST_STOP_AT_PKEX_CR_RESP
= 86,
420 DPP_TEST_STOP_AT_AUTH_REQ
= 87,
421 DPP_TEST_STOP_AT_AUTH_RESP
= 88,
422 DPP_TEST_STOP_AT_AUTH_CONF
= 89,
423 DPP_TEST_STOP_AT_CONF_REQ
= 90,
424 DPP_TEST_REJECT_CONFIG
= 91,
427 extern enum dpp_test_behavior dpp_test
;
428 extern u8 dpp_pkex_own_mac_override
[ETH_ALEN
];
429 extern u8 dpp_pkex_peer_mac_override
[ETH_ALEN
];
430 extern u8 dpp_pkex_ephemeral_key_override
[600];
431 extern size_t dpp_pkex_ephemeral_key_override_len
;
432 extern u8 dpp_protocol_key_override
[600];
433 extern size_t dpp_protocol_key_override_len
;
434 extern u8 dpp_nonce_override
[DPP_MAX_NONCE_LEN
];
435 extern size_t dpp_nonce_override_len
;
436 #endif /* CONFIG_TESTING_OPTIONS */
438 void dpp_bootstrap_info_free(struct dpp_bootstrap_info
*info
);
439 const char * dpp_bootstrap_type_txt(enum dpp_bootstrap_type type
);
440 int dpp_parse_uri_chan_list(struct dpp_bootstrap_info
*bi
,
441 const char *chan_list
);
442 int dpp_parse_uri_mac(struct dpp_bootstrap_info
*bi
, const char *mac
);
443 int dpp_parse_uri_info(struct dpp_bootstrap_info
*bi
, const char *info
);
444 int dpp_nfc_update_bi(struct dpp_bootstrap_info
*own_bi
,
445 struct dpp_bootstrap_info
*peer_bi
);
446 struct dpp_authentication
*
447 dpp_alloc_auth(struct dpp_global
*dpp
, void *msg_ctx
);
448 struct hostapd_hw_modes
;
449 struct dpp_authentication
* dpp_auth_init(struct dpp_global
*dpp
, void *msg_ctx
,
450 struct dpp_bootstrap_info
*peer_bi
,
451 struct dpp_bootstrap_info
*own_bi
,
452 u8 dpp_allowed_roles
,
453 unsigned int neg_freq
,
454 struct hostapd_hw_modes
*own_modes
,
456 struct dpp_authentication
*
457 dpp_auth_req_rx(struct dpp_global
*dpp
, void *msg_ctx
, u8 dpp_allowed_roles
,
458 int qr_mutual
, struct dpp_bootstrap_info
*peer_bi
,
459 struct dpp_bootstrap_info
*own_bi
,
460 unsigned int freq
, const u8
*hdr
, const u8
*attr_start
,
463 dpp_auth_resp_rx(struct dpp_authentication
*auth
, const u8
*hdr
,
464 const u8
*attr_start
, size_t attr_len
);
465 struct wpabuf
* dpp_build_conf_req(struct dpp_authentication
*auth
,
467 struct wpabuf
* dpp_build_conf_req_helper(struct dpp_authentication
*auth
,
469 enum dpp_netrole netrole
,
470 const char *mud_url
, int *opclasses
);
471 int dpp_auth_conf_rx(struct dpp_authentication
*auth
, const u8
*hdr
,
472 const u8
*attr_start
, size_t attr_len
);
473 int dpp_notify_new_qr_code(struct dpp_authentication
*auth
,
474 struct dpp_bootstrap_info
*peer_bi
);
475 struct dpp_configuration
* dpp_configuration_alloc(const char *type
);
476 int dpp_akm_psk(enum dpp_akm akm
);
477 int dpp_akm_sae(enum dpp_akm akm
);
478 int dpp_akm_legacy(enum dpp_akm akm
);
479 int dpp_akm_dpp(enum dpp_akm akm
);
480 int dpp_akm_ver2(enum dpp_akm akm
);
481 int dpp_configuration_valid(const struct dpp_configuration
*conf
);
482 void dpp_configuration_free(struct dpp_configuration
*conf
);
483 int dpp_set_configurator(struct dpp_authentication
*auth
, const char *cmd
);
484 void dpp_auth_deinit(struct dpp_authentication
*auth
);
486 dpp_conf_req_rx(struct dpp_authentication
*auth
, const u8
*attr_start
,
488 int dpp_conf_resp_rx(struct dpp_authentication
*auth
,
489 const struct wpabuf
*resp
);
490 enum dpp_status_error
dpp_conf_result_rx(struct dpp_authentication
*auth
,
492 const u8
*attr_start
, size_t attr_len
);
493 struct wpabuf
* dpp_build_conf_result(struct dpp_authentication
*auth
,
494 enum dpp_status_error status
);
495 enum dpp_status_error
dpp_conn_status_result_rx(struct dpp_authentication
*auth
,
497 const u8
*attr_start
,
499 u8
*ssid
, size_t *ssid_len
,
500 char **channel_list
);
501 struct wpabuf
* dpp_build_conn_status_result(struct dpp_authentication
*auth
,
502 enum dpp_status_error result
,
503 const u8
*ssid
, size_t ssid_len
,
504 const char *channel_list
);
505 struct wpabuf
* dpp_alloc_msg(enum dpp_public_action_frame_type type
,
507 const u8
* dpp_get_attr(const u8
*buf
, size_t len
, u16 req_id
, u16
*ret_len
);
508 int dpp_check_attrs(const u8
*buf
, size_t len
);
509 int dpp_key_expired(const char *timestamp
, os_time_t
*expiry
);
510 const char * dpp_akm_str(enum dpp_akm akm
);
511 const char * dpp_akm_selector_str(enum dpp_akm akm
);
512 int dpp_configurator_get_key(const struct dpp_configurator
*conf
, char *buf
,
514 void dpp_configurator_free(struct dpp_configurator
*conf
);
515 struct dpp_configurator
*
516 dpp_keygen_configurator(const char *curve
, const u8
*privkey
,
518 int dpp_configurator_own_config(struct dpp_authentication
*auth
,
519 const char *curve
, int ap
);
520 enum dpp_status_error
521 dpp_peer_intro(struct dpp_introduction
*intro
, const char *own_connector
,
522 const u8
*net_access_key
, size_t net_access_key_len
,
523 const u8
*csign_key
, size_t csign_key_len
,
524 const u8
*peer_connector
, size_t peer_connector_len
,
526 struct dpp_pkex
* dpp_pkex_init(void *msg_ctx
, struct dpp_bootstrap_info
*bi
,
528 const char *identifier
,
530 struct dpp_pkex
* dpp_pkex_rx_exchange_req(void *msg_ctx
,
531 struct dpp_bootstrap_info
*bi
,
534 const char *identifier
,
536 const u8
*buf
, size_t len
);
537 struct wpabuf
* dpp_pkex_rx_exchange_resp(struct dpp_pkex
*pkex
,
539 const u8
*buf
, size_t len
);
540 struct wpabuf
* dpp_pkex_rx_commit_reveal_req(struct dpp_pkex
*pkex
,
542 const u8
*buf
, size_t len
);
543 int dpp_pkex_rx_commit_reveal_resp(struct dpp_pkex
*pkex
, const u8
*hdr
,
544 const u8
*buf
, size_t len
);
545 void dpp_pkex_free(struct dpp_pkex
*pkex
);
547 char * dpp_corrupt_connector_signature(const char *connector
);
551 struct crypto_ecdh
*ecdh
;
552 const struct dpp_curve_params
*curve
;
554 struct wpabuf
*secret
;
557 struct dpp_pfs
* dpp_pfs_init(const u8
*net_access_key
,
558 size_t net_access_key_len
);
559 int dpp_pfs_process(struct dpp_pfs
*pfs
, const u8
*peer_ie
, size_t peer_ie_len
);
560 void dpp_pfs_free(struct dpp_pfs
*pfs
);
562 struct dpp_bootstrap_info
* dpp_add_qr_code(struct dpp_global
*dpp
,
564 struct dpp_bootstrap_info
* dpp_add_nfc_uri(struct dpp_global
*dpp
,
566 int dpp_bootstrap_gen(struct dpp_global
*dpp
, const char *cmd
);
567 struct dpp_bootstrap_info
*
568 dpp_bootstrap_get_id(struct dpp_global
*dpp
, unsigned int id
);
569 int dpp_bootstrap_remove(struct dpp_global
*dpp
, const char *id
);
570 struct dpp_bootstrap_info
*
571 dpp_pkex_finish(struct dpp_global
*dpp
, struct dpp_pkex
*pkex
, const u8
*peer
,
573 const char * dpp_bootstrap_get_uri(struct dpp_global
*dpp
, unsigned int id
);
574 int dpp_bootstrap_info(struct dpp_global
*dpp
, int id
,
575 char *reply
, int reply_size
);
576 int dpp_bootstrap_set(struct dpp_global
*dpp
, int id
, const char *params
);
577 void dpp_bootstrap_find_pair(struct dpp_global
*dpp
, const u8
*i_bootstrap
,
578 const u8
*r_bootstrap
,
579 struct dpp_bootstrap_info
**own_bi
,
580 struct dpp_bootstrap_info
**peer_bi
);
581 int dpp_configurator_add(struct dpp_global
*dpp
, const char *cmd
);
582 int dpp_configurator_remove(struct dpp_global
*dpp
, const char *id
);
583 int dpp_configurator_get_key_id(struct dpp_global
*dpp
, unsigned int id
,
584 char *buf
, size_t buflen
);
585 int dpp_configurator_from_backup(struct dpp_global
*dpp
,
586 struct dpp_asymmetric_key
*key
);
587 int dpp_relay_add_controller(struct dpp_global
*dpp
,
588 struct dpp_relay_config
*config
);
589 int dpp_relay_rx_action(struct dpp_global
*dpp
, const u8
*src
, const u8
*hdr
,
590 const u8
*buf
, size_t len
, unsigned int freq
,
591 const u8
*i_bootstrap
, const u8
*r_bootstrap
);
592 int dpp_relay_rx_gas_req(struct dpp_global
*dpp
, const u8
*src
, const u8
*data
,
594 int dpp_controller_start(struct dpp_global
*dpp
,
595 struct dpp_controller_config
*config
);
596 void dpp_controller_stop(struct dpp_global
*dpp
);
597 int dpp_tcp_init(struct dpp_global
*dpp
, struct dpp_authentication
*auth
,
598 const struct hostapd_ip_addr
*addr
, int port
);
599 struct wpabuf
* dpp_build_presence_announcement(struct dpp_bootstrap_info
*bi
);
601 struct dpp_global_config
{
604 int (*process_conf_obj
)(void *ctx
, struct dpp_authentication
*auth
);
605 void (*remove_bi
)(void *ctx
, struct dpp_bootstrap_info
*bi
);
608 struct dpp_global
* dpp_global_init(struct dpp_global_config
*config
);
609 void dpp_global_clear(struct dpp_global
*dpp
);
610 void dpp_global_deinit(struct dpp_global
*dpp
);
612 #endif /* CONFIG_DPP */