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,
41 enum dpp_attribute_id
{
42 DPP_ATTR_STATUS
= 0x1000,
43 DPP_ATTR_I_BOOTSTRAP_KEY_HASH
= 0x1001,
44 DPP_ATTR_R_BOOTSTRAP_KEY_HASH
= 0x1002,
45 DPP_ATTR_I_PROTOCOL_KEY
= 0x1003,
46 DPP_ATTR_WRAPPED_DATA
= 0x1004,
47 DPP_ATTR_I_NONCE
= 0x1005,
48 DPP_ATTR_I_CAPABILITIES
= 0x1006,
49 DPP_ATTR_R_NONCE
= 0x1007,
50 DPP_ATTR_R_CAPABILITIES
= 0x1008,
51 DPP_ATTR_R_PROTOCOL_KEY
= 0x1009,
52 DPP_ATTR_I_AUTH_TAG
= 0x100A,
53 DPP_ATTR_R_AUTH_TAG
= 0x100B,
54 DPP_ATTR_CONFIG_OBJ
= 0x100C,
55 DPP_ATTR_CONNECTOR
= 0x100D,
56 DPP_ATTR_CONFIG_ATTR_OBJ
= 0x100E,
57 DPP_ATTR_BOOTSTRAP_KEY
= 0x100F,
58 DPP_ATTR_OWN_NET_NK_HASH
= 0x1011,
59 DPP_ATTR_FINITE_CYCLIC_GROUP
= 0x1012,
60 DPP_ATTR_ENCRYPTED_KEY
= 0x1013,
61 DPP_ATTR_ENROLLEE_NONCE
= 0x1014,
62 DPP_ATTR_CODE_IDENTIFIER
= 0x1015,
63 DPP_ATTR_TRANSACTION_ID
= 0x1016,
64 DPP_ATTR_BOOTSTRAP_INFO
= 0x1017,
65 DPP_ATTR_CHANNEL
= 0x1018,
66 DPP_ATTR_PROTOCOL_VERSION
= 0x1019,
67 DPP_ATTR_ENVELOPED_DATA
= 0x101A,
68 DPP_ATTR_SEND_CONN_STATUS
= 0x101B,
69 DPP_ATTR_CONN_STATUS
= 0x101C,
72 enum dpp_status_error
{
74 DPP_STATUS_NOT_COMPATIBLE
= 1,
75 DPP_STATUS_AUTH_FAILURE
= 2,
76 DPP_STATUS_UNWRAP_FAILURE
= 3,
77 DPP_STATUS_BAD_GROUP
= 4,
78 DPP_STATUS_CONFIGURE_FAILURE
= 5,
79 DPP_STATUS_RESPONSE_PENDING
= 6,
80 DPP_STATUS_INVALID_CONNECTOR
= 7,
81 DPP_STATUS_NO_MATCH
= 8,
82 DPP_STATUS_CONFIG_REJECTED
= 9,
83 DPP_STATUS_NO_AP
= 10,
86 #define DPP_CAPAB_ENROLLEE BIT(0)
87 #define DPP_CAPAB_CONFIGURATOR BIT(1)
88 #define DPP_CAPAB_ROLE_MASK (BIT(0) | BIT(1))
90 #define DPP_BOOTSTRAP_MAX_FREQ 30
91 #define DPP_MAX_NONCE_LEN 32
92 #define DPP_MAX_HASH_LEN 64
93 #define DPP_MAX_SHARED_SECRET_LEN 66
95 struct dpp_curve_params
{
98 size_t aes_siv_key_len
;
106 enum dpp_bootstrap_type
{
107 DPP_BOOTSTRAP_QR_CODE
,
109 DPP_BOOTSTRAP_NFC_URI
,
112 struct dpp_bootstrap_info
{
115 enum dpp_bootstrap_type type
;
117 u8 mac_addr
[ETH_ALEN
];
121 unsigned int freq
[DPP_BOOTSTRAP_MAX_FREQ
];
122 unsigned int num_freq
;
125 u8 pubkey_hash
[SHA256_MAC_LEN
];
126 const struct dpp_curve_params
*curve
;
127 unsigned int pkex_t
; /* number of failures before dpp_pkex
129 char *configurator_params
;
132 #define PKEX_COUNTER_T_LIMIT 5
136 unsigned int initiator
:1;
137 unsigned int exchange_done
:1;
138 unsigned int failed
:1;
139 struct dpp_bootstrap_info
*own_bi
;
140 u8 own_mac
[ETH_ALEN
];
141 u8 peer_mac
[ETH_ALEN
];
146 u8 Mx
[DPP_MAX_SHARED_SECRET_LEN
];
147 u8 Nx
[DPP_MAX_SHARED_SECRET_LEN
];
148 u8 z
[DPP_MAX_HASH_LEN
];
149 EVP_PKEY
*peer_bootstrap_key
;
150 struct wpabuf
*exchange_req
;
151 struct wpabuf
*exchange_resp
;
152 unsigned int t
; /* number of failures on code use */
153 unsigned int exch_req_wait_time
;
154 unsigned int exch_req_tries
;
171 DPP_NETROLE_CONFIGURATOR
,
174 struct dpp_configuration
{
179 enum dpp_netrole netrole
;
181 /* For DPP configuration (connector) */
182 os_time_t netaccesskey_expiry
;
187 /* For legacy configuration */
193 struct dpp_asymmetric_key
{
194 struct dpp_asymmetric_key
*next
;
196 char *config_template
;
197 char *connector_template
;
200 #define DPP_MAX_CONF_OBJ 10
202 struct dpp_authentication
{
203 struct dpp_global
*global
;
206 const struct dpp_curve_params
*curve
;
207 struct dpp_bootstrap_info
*peer_bi
;
208 struct dpp_bootstrap_info
*own_bi
;
209 struct dpp_bootstrap_info
*tmp_own_bi
;
210 u8 waiting_pubkey_hash
[SHA256_MAC_LEN
];
211 int response_pending
;
212 enum dpp_status_error auth_resp_status
;
213 enum dpp_status_error conf_resp_status
;
214 u8 peer_mac_addr
[ETH_ALEN
];
215 u8 i_nonce
[DPP_MAX_NONCE_LEN
];
216 u8 r_nonce
[DPP_MAX_NONCE_LEN
];
217 u8 e_nonce
[DPP_MAX_NONCE_LEN
];
220 EVP_PKEY
*own_protocol_key
;
221 EVP_PKEY
*peer_protocol_key
;
222 struct wpabuf
*req_msg
;
223 struct wpabuf
*resp_msg
;
224 /* Intersection of possible frequencies for initiating DPP
225 * Authentication exchange */
226 unsigned int freq
[DPP_BOOTSTRAP_MAX_FREQ
];
227 unsigned int num_freq
, freq_idx
;
228 unsigned int curr_freq
;
229 unsigned int neg_freq
;
230 unsigned int num_freq_iters
;
232 u8 Mx
[DPP_MAX_SHARED_SECRET_LEN
];
234 u8 Nx
[DPP_MAX_SHARED_SECRET_LEN
];
236 u8 Lx
[DPP_MAX_SHARED_SECRET_LEN
];
238 u8 k1
[DPP_MAX_HASH_LEN
];
239 u8 k2
[DPP_MAX_HASH_LEN
];
240 u8 ke
[DPP_MAX_HASH_LEN
];
242 int waiting_auth_resp
;
243 int waiting_auth_conf
;
245 unsigned int auth_resp_tries
;
248 int remove_on_tx_status
;
249 int connect_on_tx_status
;
250 int waiting_conf_result
;
251 int waiting_conn_status_result
;
253 struct wpabuf
*conf_req
;
254 const struct wpabuf
*conf_resp
; /* owned by GAS server */
255 struct dpp_configuration
*conf_ap
;
256 struct dpp_configuration
*conf2_ap
;
257 struct dpp_configuration
*conf_sta
;
258 struct dpp_configuration
*conf2_sta
;
259 int provision_configurator
;
260 struct dpp_configurator
*conf
;
261 struct dpp_config_obj
{
262 char *connector
; /* received signedConnector */
263 u8 ssid
[SSID_MAX_LEN
];
270 struct wpabuf
*c_sign_key
;
271 } conf_obj
[DPP_MAX_CONF_OBJ
];
272 unsigned int num_conf_obj
;
273 struct dpp_asymmetric_key
*conf_key_pkg
;
274 struct wpabuf
*net_access_key
;
275 os_time_t net_access_key_expiry
;
276 int send_conn_status
;
277 int conn_status_requested
;
278 int akm_use_selector
;
279 int configurator_set
;
280 #ifdef CONFIG_TESTING_OPTIONS
281 char *config_obj_override
;
282 char *discovery_override
;
283 char *groups_override
;
284 unsigned int ignore_netaccesskey_mismatch
:1;
285 #endif /* CONFIG_TESTING_OPTIONS */
288 struct dpp_configurator
{
294 const struct dpp_curve_params
*curve
;
297 struct dpp_introduction
{
303 struct dpp_relay_config
{
304 const struct hostapd_ip_addr
*ipaddr
;
308 void (*tx
)(void *ctx
, const u8
*addr
, unsigned int freq
, const u8
*msg
,
310 void (*gas_resp_tx
)(void *ctx
, const u8
*addr
, u8 dialog_token
, int prot
,
314 struct dpp_controller_config
{
315 const char *configurator_params
;
319 #ifdef CONFIG_TESTING_OPTIONS
320 enum dpp_test_behavior
{
321 DPP_TEST_DISABLED
= 0,
322 DPP_TEST_AFTER_WRAPPED_DATA_AUTH_REQ
= 1,
323 DPP_TEST_AFTER_WRAPPED_DATA_AUTH_RESP
= 2,
324 DPP_TEST_AFTER_WRAPPED_DATA_AUTH_CONF
= 3,
325 DPP_TEST_AFTER_WRAPPED_DATA_PKEX_CR_REQ
= 4,
326 DPP_TEST_AFTER_WRAPPED_DATA_PKEX_CR_RESP
= 5,
327 DPP_TEST_AFTER_WRAPPED_DATA_CONF_REQ
= 6,
328 DPP_TEST_AFTER_WRAPPED_DATA_CONF_RESP
= 7,
329 DPP_TEST_ZERO_I_CAPAB
= 8,
330 DPP_TEST_ZERO_R_CAPAB
= 9,
331 DPP_TEST_NO_R_BOOTSTRAP_KEY_HASH_AUTH_REQ
= 10,
332 DPP_TEST_NO_I_BOOTSTRAP_KEY_HASH_AUTH_REQ
= 11,
333 DPP_TEST_NO_I_PROTO_KEY_AUTH_REQ
= 12,
334 DPP_TEST_NO_I_NONCE_AUTH_REQ
= 13,
335 DPP_TEST_NO_I_CAPAB_AUTH_REQ
= 14,
336 DPP_TEST_NO_WRAPPED_DATA_AUTH_REQ
= 15,
337 DPP_TEST_NO_STATUS_AUTH_RESP
= 16,
338 DPP_TEST_NO_R_BOOTSTRAP_KEY_HASH_AUTH_RESP
= 17,
339 DPP_TEST_NO_I_BOOTSTRAP_KEY_HASH_AUTH_RESP
= 18,
340 DPP_TEST_NO_R_PROTO_KEY_AUTH_RESP
= 19,
341 DPP_TEST_NO_R_NONCE_AUTH_RESP
= 20,
342 DPP_TEST_NO_I_NONCE_AUTH_RESP
= 21,
343 DPP_TEST_NO_R_CAPAB_AUTH_RESP
= 22,
344 DPP_TEST_NO_R_AUTH_AUTH_RESP
= 23,
345 DPP_TEST_NO_WRAPPED_DATA_AUTH_RESP
= 24,
346 DPP_TEST_NO_STATUS_AUTH_CONF
= 25,
347 DPP_TEST_NO_R_BOOTSTRAP_KEY_HASH_AUTH_CONF
= 26,
348 DPP_TEST_NO_I_BOOTSTRAP_KEY_HASH_AUTH_CONF
= 27,
349 DPP_TEST_NO_I_AUTH_AUTH_CONF
= 28,
350 DPP_TEST_NO_WRAPPED_DATA_AUTH_CONF
= 29,
351 DPP_TEST_I_NONCE_MISMATCH_AUTH_RESP
= 30,
352 DPP_TEST_INCOMPATIBLE_R_CAPAB_AUTH_RESP
= 31,
353 DPP_TEST_R_AUTH_MISMATCH_AUTH_RESP
= 32,
354 DPP_TEST_I_AUTH_MISMATCH_AUTH_CONF
= 33,
355 DPP_TEST_NO_FINITE_CYCLIC_GROUP_PKEX_EXCHANGE_REQ
= 34,
356 DPP_TEST_NO_ENCRYPTED_KEY_PKEX_EXCHANGE_REQ
= 35,
357 DPP_TEST_NO_STATUS_PKEX_EXCHANGE_RESP
= 36,
358 DPP_TEST_NO_ENCRYPTED_KEY_PKEX_EXCHANGE_RESP
= 37,
359 DPP_TEST_NO_BOOTSTRAP_KEY_PKEX_CR_REQ
= 38,
360 DPP_TEST_NO_I_AUTH_TAG_PKEX_CR_REQ
= 39,
361 DPP_TEST_NO_WRAPPED_DATA_PKEX_CR_REQ
= 40,
362 DPP_TEST_NO_BOOTSTRAP_KEY_PKEX_CR_RESP
= 41,
363 DPP_TEST_NO_R_AUTH_TAG_PKEX_CR_RESP
= 42,
364 DPP_TEST_NO_WRAPPED_DATA_PKEX_CR_RESP
= 43,
365 DPP_TEST_INVALID_ENCRYPTED_KEY_PKEX_EXCHANGE_REQ
= 44,
366 DPP_TEST_INVALID_ENCRYPTED_KEY_PKEX_EXCHANGE_RESP
= 45,
367 DPP_TEST_INVALID_STATUS_PKEX_EXCHANGE_RESP
= 46,
368 DPP_TEST_INVALID_BOOTSTRAP_KEY_PKEX_CR_REQ
= 47,
369 DPP_TEST_INVALID_BOOTSTRAP_KEY_PKEX_CR_RESP
= 48,
370 DPP_TEST_I_AUTH_TAG_MISMATCH_PKEX_CR_REQ
= 49,
371 DPP_TEST_R_AUTH_TAG_MISMATCH_PKEX_CR_RESP
= 50,
372 DPP_TEST_NO_E_NONCE_CONF_REQ
= 51,
373 DPP_TEST_NO_CONFIG_ATTR_OBJ_CONF_REQ
= 52,
374 DPP_TEST_NO_WRAPPED_DATA_CONF_REQ
= 53,
375 DPP_TEST_NO_E_NONCE_CONF_RESP
= 54,
376 DPP_TEST_NO_CONFIG_OBJ_CONF_RESP
= 55,
377 DPP_TEST_NO_STATUS_CONF_RESP
= 56,
378 DPP_TEST_NO_WRAPPED_DATA_CONF_RESP
= 57,
379 DPP_TEST_INVALID_STATUS_CONF_RESP
= 58,
380 DPP_TEST_E_NONCE_MISMATCH_CONF_RESP
= 59,
381 DPP_TEST_NO_TRANSACTION_ID_PEER_DISC_REQ
= 60,
382 DPP_TEST_NO_CONNECTOR_PEER_DISC_REQ
= 61,
383 DPP_TEST_NO_TRANSACTION_ID_PEER_DISC_RESP
= 62,
384 DPP_TEST_NO_STATUS_PEER_DISC_RESP
= 63,
385 DPP_TEST_NO_CONNECTOR_PEER_DISC_RESP
= 64,
386 DPP_TEST_AUTH_RESP_IN_PLACE_OF_CONF
= 65,
387 DPP_TEST_INVALID_I_PROTO_KEY_AUTH_REQ
= 66,
388 DPP_TEST_INVALID_R_PROTO_KEY_AUTH_RESP
= 67,
389 DPP_TEST_INVALID_R_BOOTSTRAP_KEY_HASH_AUTH_REQ
= 68,
390 DPP_TEST_INVALID_I_BOOTSTRAP_KEY_HASH_AUTH_REQ
= 69,
391 DPP_TEST_INVALID_R_BOOTSTRAP_KEY_HASH_AUTH_RESP
= 70,
392 DPP_TEST_INVALID_I_BOOTSTRAP_KEY_HASH_AUTH_RESP
= 71,
393 DPP_TEST_INVALID_R_BOOTSTRAP_KEY_HASH_AUTH_CONF
= 72,
394 DPP_TEST_INVALID_I_BOOTSTRAP_KEY_HASH_AUTH_CONF
= 73,
395 DPP_TEST_INVALID_STATUS_AUTH_RESP
= 74,
396 DPP_TEST_INVALID_STATUS_AUTH_CONF
= 75,
397 DPP_TEST_INVALID_CONFIG_ATTR_OBJ_CONF_REQ
= 76,
398 DPP_TEST_INVALID_TRANSACTION_ID_PEER_DISC_RESP
= 77,
399 DPP_TEST_INVALID_STATUS_PEER_DISC_RESP
= 78,
400 DPP_TEST_INVALID_CONNECTOR_PEER_DISC_RESP
= 79,
401 DPP_TEST_INVALID_CONNECTOR_PEER_DISC_REQ
= 80,
402 DPP_TEST_INVALID_I_NONCE_AUTH_REQ
= 81,
403 DPP_TEST_INVALID_TRANSACTION_ID_PEER_DISC_REQ
= 82,
404 DPP_TEST_INVALID_E_NONCE_CONF_REQ
= 83,
405 DPP_TEST_STOP_AT_PKEX_EXCHANGE_RESP
= 84,
406 DPP_TEST_STOP_AT_PKEX_CR_REQ
= 85,
407 DPP_TEST_STOP_AT_PKEX_CR_RESP
= 86,
408 DPP_TEST_STOP_AT_AUTH_REQ
= 87,
409 DPP_TEST_STOP_AT_AUTH_RESP
= 88,
410 DPP_TEST_STOP_AT_AUTH_CONF
= 89,
411 DPP_TEST_STOP_AT_CONF_REQ
= 90,
412 DPP_TEST_REJECT_CONFIG
= 91,
415 extern enum dpp_test_behavior dpp_test
;
416 extern u8 dpp_pkex_own_mac_override
[ETH_ALEN
];
417 extern u8 dpp_pkex_peer_mac_override
[ETH_ALEN
];
418 extern u8 dpp_pkex_ephemeral_key_override
[600];
419 extern size_t dpp_pkex_ephemeral_key_override_len
;
420 extern u8 dpp_protocol_key_override
[600];
421 extern size_t dpp_protocol_key_override_len
;
422 extern u8 dpp_nonce_override
[DPP_MAX_NONCE_LEN
];
423 extern size_t dpp_nonce_override_len
;
424 #endif /* CONFIG_TESTING_OPTIONS */
426 void dpp_bootstrap_info_free(struct dpp_bootstrap_info
*info
);
427 const char * dpp_bootstrap_type_txt(enum dpp_bootstrap_type type
);
428 int dpp_bootstrap_key_hash(struct dpp_bootstrap_info
*bi
);
429 int dpp_parse_uri_chan_list(struct dpp_bootstrap_info
*bi
,
430 const char *chan_list
);
431 int dpp_parse_uri_mac(struct dpp_bootstrap_info
*bi
, const char *mac
);
432 int dpp_parse_uri_info(struct dpp_bootstrap_info
*bi
, const char *info
);
433 int dpp_nfc_update_bi(struct dpp_bootstrap_info
*own_bi
,
434 struct dpp_bootstrap_info
*peer_bi
);
435 struct dpp_authentication
*
436 dpp_alloc_auth(struct dpp_global
*dpp
, void *msg_ctx
);
437 struct hostapd_hw_modes
;
438 struct dpp_authentication
* dpp_auth_init(struct dpp_global
*dpp
, void *msg_ctx
,
439 struct dpp_bootstrap_info
*peer_bi
,
440 struct dpp_bootstrap_info
*own_bi
,
441 u8 dpp_allowed_roles
,
442 unsigned int neg_freq
,
443 struct hostapd_hw_modes
*own_modes
,
445 struct dpp_authentication
*
446 dpp_auth_req_rx(struct dpp_global
*dpp
, void *msg_ctx
, u8 dpp_allowed_roles
,
447 int qr_mutual
, struct dpp_bootstrap_info
*peer_bi
,
448 struct dpp_bootstrap_info
*own_bi
,
449 unsigned int freq
, const u8
*hdr
, const u8
*attr_start
,
452 dpp_auth_resp_rx(struct dpp_authentication
*auth
, const u8
*hdr
,
453 const u8
*attr_start
, size_t attr_len
);
454 struct wpabuf
* dpp_build_conf_req(struct dpp_authentication
*auth
,
456 struct wpabuf
* dpp_build_conf_req_helper(struct dpp_authentication
*auth
,
458 enum dpp_netrole netrole
,
459 const char *mud_url
, int *opclasses
);
460 int dpp_auth_conf_rx(struct dpp_authentication
*auth
, const u8
*hdr
,
461 const u8
*attr_start
, size_t attr_len
);
462 int dpp_notify_new_qr_code(struct dpp_authentication
*auth
,
463 struct dpp_bootstrap_info
*peer_bi
);
464 struct dpp_configuration
* dpp_configuration_alloc(const char *type
);
465 int dpp_akm_psk(enum dpp_akm akm
);
466 int dpp_akm_sae(enum dpp_akm akm
);
467 int dpp_akm_legacy(enum dpp_akm akm
);
468 int dpp_akm_dpp(enum dpp_akm akm
);
469 int dpp_akm_ver2(enum dpp_akm akm
);
470 int dpp_configuration_valid(const struct dpp_configuration
*conf
);
471 void dpp_configuration_free(struct dpp_configuration
*conf
);
472 int dpp_set_configurator(struct dpp_authentication
*auth
, const char *cmd
);
473 void dpp_auth_deinit(struct dpp_authentication
*auth
);
475 dpp_conf_req_rx(struct dpp_authentication
*auth
, const u8
*attr_start
,
477 int dpp_conf_resp_rx(struct dpp_authentication
*auth
,
478 const struct wpabuf
*resp
);
479 enum dpp_status_error
dpp_conf_result_rx(struct dpp_authentication
*auth
,
481 const u8
*attr_start
, size_t attr_len
);
482 struct wpabuf
* dpp_build_conf_result(struct dpp_authentication
*auth
,
483 enum dpp_status_error status
);
484 enum dpp_status_error
dpp_conn_status_result_rx(struct dpp_authentication
*auth
,
486 const u8
*attr_start
,
488 u8
*ssid
, size_t *ssid_len
,
489 char **channel_list
);
490 struct wpabuf
* dpp_build_conn_status_result(struct dpp_authentication
*auth
,
491 enum dpp_status_error result
,
492 const u8
*ssid
, size_t ssid_len
,
493 const char *channel_list
);
494 struct wpabuf
* dpp_alloc_msg(enum dpp_public_action_frame_type type
,
496 const u8
* dpp_get_attr(const u8
*buf
, size_t len
, u16 req_id
, u16
*ret_len
);
497 int dpp_check_attrs(const u8
*buf
, size_t len
);
498 int dpp_key_expired(const char *timestamp
, os_time_t
*expiry
);
499 const char * dpp_akm_str(enum dpp_akm akm
);
500 const char * dpp_akm_selector_str(enum dpp_akm akm
);
501 int dpp_configurator_get_key(const struct dpp_configurator
*conf
, char *buf
,
503 void dpp_configurator_free(struct dpp_configurator
*conf
);
504 struct dpp_configurator
*
505 dpp_keygen_configurator(const char *curve
, const u8
*privkey
,
507 int dpp_configurator_own_config(struct dpp_authentication
*auth
,
508 const char *curve
, int ap
);
509 enum dpp_status_error
510 dpp_peer_intro(struct dpp_introduction
*intro
, const char *own_connector
,
511 const u8
*net_access_key
, size_t net_access_key_len
,
512 const u8
*csign_key
, size_t csign_key_len
,
513 const u8
*peer_connector
, size_t peer_connector_len
,
515 struct dpp_pkex
* dpp_pkex_init(void *msg_ctx
, struct dpp_bootstrap_info
*bi
,
517 const char *identifier
,
519 struct dpp_pkex
* dpp_pkex_rx_exchange_req(void *msg_ctx
,
520 struct dpp_bootstrap_info
*bi
,
523 const char *identifier
,
525 const u8
*buf
, size_t len
);
526 struct wpabuf
* dpp_pkex_rx_exchange_resp(struct dpp_pkex
*pkex
,
528 const u8
*buf
, size_t len
);
529 struct wpabuf
* dpp_pkex_rx_commit_reveal_req(struct dpp_pkex
*pkex
,
531 const u8
*buf
, size_t len
);
532 int dpp_pkex_rx_commit_reveal_resp(struct dpp_pkex
*pkex
, const u8
*hdr
,
533 const u8
*buf
, size_t len
);
534 void dpp_pkex_free(struct dpp_pkex
*pkex
);
536 char * dpp_corrupt_connector_signature(const char *connector
);
540 struct crypto_ecdh
*ecdh
;
541 const struct dpp_curve_params
*curve
;
543 struct wpabuf
*secret
;
546 struct dpp_pfs
* dpp_pfs_init(const u8
*net_access_key
,
547 size_t net_access_key_len
);
548 int dpp_pfs_process(struct dpp_pfs
*pfs
, const u8
*peer_ie
, size_t peer_ie_len
);
549 void dpp_pfs_free(struct dpp_pfs
*pfs
);
551 struct dpp_bootstrap_info
* dpp_add_qr_code(struct dpp_global
*dpp
,
553 struct dpp_bootstrap_info
* dpp_add_nfc_uri(struct dpp_global
*dpp
,
555 int dpp_bootstrap_gen(struct dpp_global
*dpp
, const char *cmd
);
556 struct dpp_bootstrap_info
*
557 dpp_bootstrap_get_id(struct dpp_global
*dpp
, unsigned int id
);
558 int dpp_bootstrap_remove(struct dpp_global
*dpp
, const char *id
);
559 struct dpp_bootstrap_info
*
560 dpp_pkex_finish(struct dpp_global
*dpp
, struct dpp_pkex
*pkex
, const u8
*peer
,
562 const char * dpp_bootstrap_get_uri(struct dpp_global
*dpp
, unsigned int id
);
563 int dpp_bootstrap_info(struct dpp_global
*dpp
, int id
,
564 char *reply
, int reply_size
);
565 int dpp_bootstrap_set(struct dpp_global
*dpp
, int id
, const char *params
);
566 void dpp_bootstrap_find_pair(struct dpp_global
*dpp
, const u8
*i_bootstrap
,
567 const u8
*r_bootstrap
,
568 struct dpp_bootstrap_info
**own_bi
,
569 struct dpp_bootstrap_info
**peer_bi
);
570 int dpp_configurator_add(struct dpp_global
*dpp
, const char *cmd
);
571 int dpp_configurator_remove(struct dpp_global
*dpp
, const char *id
);
572 int dpp_configurator_get_key_id(struct dpp_global
*dpp
, unsigned int id
,
573 char *buf
, size_t buflen
);
574 int dpp_configurator_from_backup(struct dpp_global
*dpp
,
575 struct dpp_asymmetric_key
*key
);
576 int dpp_relay_add_controller(struct dpp_global
*dpp
,
577 struct dpp_relay_config
*config
);
578 int dpp_relay_rx_action(struct dpp_global
*dpp
, const u8
*src
, const u8
*hdr
,
579 const u8
*buf
, size_t len
, unsigned int freq
,
580 const u8
*i_bootstrap
, const u8
*r_bootstrap
);
581 int dpp_relay_rx_gas_req(struct dpp_global
*dpp
, const u8
*src
, const u8
*data
,
583 int dpp_controller_start(struct dpp_global
*dpp
,
584 struct dpp_controller_config
*config
);
585 void dpp_controller_stop(struct dpp_global
*dpp
);
586 int dpp_tcp_init(struct dpp_global
*dpp
, struct dpp_authentication
*auth
,
587 const struct hostapd_ip_addr
*addr
, int port
);
589 struct dpp_global_config
{
592 int (*process_conf_obj
)(void *ctx
, struct dpp_authentication
*auth
);
595 struct dpp_global
* dpp_global_init(struct dpp_global_config
*config
);
596 void dpp_global_clear(struct dpp_global
*dpp
);
597 void dpp_global_deinit(struct dpp_global
*dpp
);
599 #endif /* CONFIG_DPP */