blob: 25759088a57ef9411e7935c6aeb67a26b413a8df [file] [log] [blame]
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07001/*
2 * DPP functionality shared between hostapd and wpa_supplicant
3 * Copyright (c) 2017, Qualcomm Atheros, Inc.
4 *
5 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
7 */
8
9#ifndef DPP_H
10#define DPP_H
11
12#include <openssl/x509.h>
13
14#include "utils/list.h"
15#include "common/wpa_common.h"
16#include "crypto/sha256.h"
17
18#define DPP_HDR_LEN (4 + 2) /* OUI, OUI Type, Crypto Suite, DPP frame type */
19
20enum dpp_public_action_frame_type {
21 DPP_PA_AUTHENTICATION_REQ = 0,
22 DPP_PA_AUTHENTICATION_RESP = 1,
23 DPP_PA_AUTHENTICATION_CONF = 2,
24 DPP_PA_PEER_DISCOVERY_REQ = 5,
25 DPP_PA_PEER_DISCOVERY_RESP = 6,
26 DPP_PA_PKEX_EXCHANGE_REQ = 7,
27 DPP_PA_PKEX_EXCHANGE_RESP = 8,
28 DPP_PA_PKEX_COMMIT_REVEAL_REQ = 9,
29 DPP_PA_PKEX_COMMIT_REVEAL_RESP = 10,
30};
31
32enum dpp_attribute_id {
33 DPP_ATTR_STATUS = 0x1000,
34 DPP_ATTR_I_BOOTSTRAP_KEY_HASH = 0x1001,
35 DPP_ATTR_R_BOOTSTRAP_KEY_HASH = 0x1002,
36 DPP_ATTR_I_PROTOCOL_KEY = 0x1003,
37 DPP_ATTR_WRAPPED_DATA = 0x1004,
38 DPP_ATTR_I_NONCE = 0x1005,
39 DPP_ATTR_I_CAPABILITIES = 0x1006,
40 DPP_ATTR_R_NONCE = 0x1007,
41 DPP_ATTR_R_CAPABILITIES = 0x1008,
42 DPP_ATTR_R_PROTOCOL_KEY = 0x1009,
43 DPP_ATTR_I_AUTH_TAG = 0x100A,
44 DPP_ATTR_R_AUTH_TAG = 0x100B,
45 DPP_ATTR_CONFIG_OBJ = 0x100C,
46 DPP_ATTR_CONNECTOR = 0x100D,
47 DPP_ATTR_CONFIG_ATTR_OBJ = 0x100E,
48 DPP_ATTR_BOOTSTRAP_KEY = 0x100F,
49 DPP_ATTR_OWN_NET_NK_HASH = 0x1011,
50 DPP_ATTR_FINITE_CYCLIC_GROUP = 0x1012,
51 DPP_ATTR_ENCRYPTED_KEY = 0x1013,
52 DPP_ATTR_ENROLLEE_NONCE = 0x1014,
53 DPP_ATTR_CODE_IDENTIFIER = 0x1015,
54 DPP_ATTR_TRANSACTION_ID = 0x1016,
Roshan Pius3a1667e2018-07-03 15:17:14 -070055 DPP_ATTR_BOOTSTRAP_INFO = 0x1017,
56 DPP_ATTR_CHANNEL = 0x1018,
Dmitry Shmidtd2986c22017-10-23 14:22:09 -070057};
58
59enum dpp_status_error {
60 DPP_STATUS_OK = 0,
61 DPP_STATUS_NOT_COMPATIBLE = 1,
62 DPP_STATUS_AUTH_FAILURE = 2,
63 DPP_STATUS_UNWRAP_FAILURE = 3,
64 DPP_STATUS_BAD_GROUP = 4,
65 DPP_STATUS_CONFIGURE_FAILURE = 5,
66 DPP_STATUS_RESPONSE_PENDING = 6,
Roshan Pius3a1667e2018-07-03 15:17:14 -070067 DPP_STATUS_INVALID_CONNECTOR = 7,
68 DPP_STATUS_NO_MATCH = 8,
Dmitry Shmidtd2986c22017-10-23 14:22:09 -070069};
70
71#define DPP_CAPAB_ENROLLEE BIT(0)
72#define DPP_CAPAB_CONFIGURATOR BIT(1)
73#define DPP_CAPAB_ROLE_MASK (BIT(0) | BIT(1))
74
75#define DPP_BOOTSTRAP_MAX_FREQ 30
76#define DPP_MAX_NONCE_LEN 32
77#define DPP_MAX_HASH_LEN 64
78#define DPP_MAX_SHARED_SECRET_LEN 66
79
80struct dpp_curve_params {
81 const char *name;
82 size_t hash_len;
83 size_t aes_siv_key_len;
84 size_t nonce_len;
85 size_t prime_len;
86 const char *jwk_crv;
87 u16 ike_group;
88 const char *jws_alg;
89};
90
91enum dpp_bootstrap_type {
92 DPP_BOOTSTRAP_QR_CODE,
93 DPP_BOOTSTRAP_PKEX,
94};
95
96struct dpp_bootstrap_info {
97 struct dl_list list;
98 unsigned int id;
99 enum dpp_bootstrap_type type;
100 char *uri;
101 u8 mac_addr[ETH_ALEN];
102 char *info;
103 unsigned int freq[DPP_BOOTSTRAP_MAX_FREQ];
104 unsigned int num_freq;
105 int own;
106 EVP_PKEY *pubkey;
107 u8 pubkey_hash[SHA256_MAC_LEN];
108 const struct dpp_curve_params *curve;
Roshan Pius3a1667e2018-07-03 15:17:14 -0700109 unsigned int pkex_t; /* number of failures before dpp_pkex
110 * instantiation */
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700111};
112
Roshan Pius3a1667e2018-07-03 15:17:14 -0700113#define PKEX_COUNTER_T_LIMIT 5
114
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700115struct dpp_pkex {
Roshan Pius3a1667e2018-07-03 15:17:14 -0700116 void *msg_ctx;
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700117 unsigned int initiator:1;
118 unsigned int exchange_done:1;
Roshan Pius3a1667e2018-07-03 15:17:14 -0700119 unsigned int failed:1;
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700120 struct dpp_bootstrap_info *own_bi;
121 u8 own_mac[ETH_ALEN];
122 u8 peer_mac[ETH_ALEN];
123 char *identifier;
124 char *code;
125 EVP_PKEY *x;
126 EVP_PKEY *y;
127 u8 Mx[DPP_MAX_SHARED_SECRET_LEN];
128 u8 Nx[DPP_MAX_SHARED_SECRET_LEN];
129 u8 z[DPP_MAX_HASH_LEN];
130 EVP_PKEY *peer_bootstrap_key;
131 struct wpabuf *exchange_req;
132 struct wpabuf *exchange_resp;
Roshan Pius3a1667e2018-07-03 15:17:14 -0700133 unsigned int t; /* number of failures on code use */
134 unsigned int exch_req_wait_time;
135 unsigned int exch_req_tries;
136 unsigned int freq;
137};
138
139enum dpp_akm {
140 DPP_AKM_UNKNOWN,
141 DPP_AKM_DPP,
142 DPP_AKM_PSK,
143 DPP_AKM_SAE,
144 DPP_AKM_PSK_SAE
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700145};
146
147struct dpp_configuration {
148 u8 ssid[32];
149 size_t ssid_len;
Roshan Pius3a1667e2018-07-03 15:17:14 -0700150 enum dpp_akm akm;
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700151
152 /* For DPP configuration (connector) */
153 os_time_t netaccesskey_expiry;
154
155 /* TODO: groups */
Hai Shalomce48b4a2018-09-05 11:41:35 -0700156 char *group_id;
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700157
158 /* For legacy configuration */
159 char *passphrase;
160 u8 psk[32];
161};
162
163struct dpp_authentication {
164 void *msg_ctx;
165 const struct dpp_curve_params *curve;
166 struct dpp_bootstrap_info *peer_bi;
167 struct dpp_bootstrap_info *own_bi;
Roshan Pius3a1667e2018-07-03 15:17:14 -0700168 struct dpp_bootstrap_info *tmp_own_bi;
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700169 u8 waiting_pubkey_hash[SHA256_MAC_LEN];
170 int response_pending;
171 enum dpp_status_error auth_resp_status;
172 u8 peer_mac_addr[ETH_ALEN];
173 u8 i_nonce[DPP_MAX_NONCE_LEN];
174 u8 r_nonce[DPP_MAX_NONCE_LEN];
175 u8 e_nonce[DPP_MAX_NONCE_LEN];
176 u8 i_capab;
177 u8 r_capab;
178 EVP_PKEY *own_protocol_key;
179 EVP_PKEY *peer_protocol_key;
180 struct wpabuf *req_msg;
181 struct wpabuf *resp_msg;
Roshan Pius3a1667e2018-07-03 15:17:14 -0700182 /* Intersection of possible frequencies for initiating DPP
183 * Authentication exchange */
184 unsigned int freq[DPP_BOOTSTRAP_MAX_FREQ];
185 unsigned int num_freq, freq_idx;
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700186 unsigned int curr_freq;
Roshan Pius3a1667e2018-07-03 15:17:14 -0700187 unsigned int neg_freq;
188 unsigned int num_freq_iters;
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700189 size_t secret_len;
190 u8 Mx[DPP_MAX_SHARED_SECRET_LEN];
Roshan Pius3a1667e2018-07-03 15:17:14 -0700191 size_t Mx_len;
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700192 u8 Nx[DPP_MAX_SHARED_SECRET_LEN];
Roshan Pius3a1667e2018-07-03 15:17:14 -0700193 size_t Nx_len;
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700194 u8 Lx[DPP_MAX_SHARED_SECRET_LEN];
Roshan Pius3a1667e2018-07-03 15:17:14 -0700195 size_t Lx_len;
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700196 u8 k1[DPP_MAX_HASH_LEN];
197 u8 k2[DPP_MAX_HASH_LEN];
198 u8 ke[DPP_MAX_HASH_LEN];
199 int initiator;
Roshan Pius3a1667e2018-07-03 15:17:14 -0700200 int waiting_auth_resp;
201 int waiting_auth_conf;
202 int auth_req_ack;
203 unsigned int auth_resp_tries;
204 u8 allowed_roles;
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700205 int configurator;
206 int remove_on_tx_status;
207 int auth_success;
208 struct wpabuf *conf_req;
Roshan Pius3a1667e2018-07-03 15:17:14 -0700209 const struct wpabuf *conf_resp; /* owned by GAS server */
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700210 struct dpp_configuration *conf_ap;
211 struct dpp_configuration *conf_sta;
212 struct dpp_configurator *conf;
213 char *connector; /* received signedConnector */
214 u8 ssid[SSID_MAX_LEN];
215 u8 ssid_len;
216 char passphrase[64];
217 u8 psk[PMK_LEN];
218 int psk_set;
Roshan Pius3a1667e2018-07-03 15:17:14 -0700219 enum dpp_akm akm;
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700220 struct wpabuf *net_access_key;
221 os_time_t net_access_key_expiry;
222 struct wpabuf *c_sign_key;
223#ifdef CONFIG_TESTING_OPTIONS
224 char *config_obj_override;
225 char *discovery_override;
226 char *groups_override;
227 unsigned int ignore_netaccesskey_mismatch:1;
228#endif /* CONFIG_TESTING_OPTIONS */
229};
230
231struct dpp_configurator {
232 struct dl_list list;
233 unsigned int id;
234 int own;
235 EVP_PKEY *csign;
236 char *kid;
237 const struct dpp_curve_params *curve;
238};
239
240struct dpp_introduction {
241 u8 pmkid[PMKID_LEN];
242 u8 pmk[PMK_LEN_MAX];
243 size_t pmk_len;
244};
245
Roshan Pius3a1667e2018-07-03 15:17:14 -0700246#ifdef CONFIG_TESTING_OPTIONS
247enum dpp_test_behavior {
248 DPP_TEST_DISABLED = 0,
249 DPP_TEST_AFTER_WRAPPED_DATA_AUTH_REQ = 1,
250 DPP_TEST_AFTER_WRAPPED_DATA_AUTH_RESP = 2,
251 DPP_TEST_AFTER_WRAPPED_DATA_AUTH_CONF = 3,
252 DPP_TEST_AFTER_WRAPPED_DATA_PKEX_CR_REQ = 4,
253 DPP_TEST_AFTER_WRAPPED_DATA_PKEX_CR_RESP = 5,
254 DPP_TEST_AFTER_WRAPPED_DATA_CONF_REQ = 6,
255 DPP_TEST_AFTER_WRAPPED_DATA_CONF_RESP = 7,
256 DPP_TEST_ZERO_I_CAPAB = 8,
257 DPP_TEST_ZERO_R_CAPAB = 9,
258 DPP_TEST_NO_R_BOOTSTRAP_KEY_HASH_AUTH_REQ = 10,
259 DPP_TEST_NO_I_BOOTSTRAP_KEY_HASH_AUTH_REQ = 11,
260 DPP_TEST_NO_I_PROTO_KEY_AUTH_REQ = 12,
261 DPP_TEST_NO_I_NONCE_AUTH_REQ = 13,
262 DPP_TEST_NO_I_CAPAB_AUTH_REQ = 14,
263 DPP_TEST_NO_WRAPPED_DATA_AUTH_REQ = 15,
264 DPP_TEST_NO_STATUS_AUTH_RESP = 16,
265 DPP_TEST_NO_R_BOOTSTRAP_KEY_HASH_AUTH_RESP = 17,
266 DPP_TEST_NO_I_BOOTSTRAP_KEY_HASH_AUTH_RESP = 18,
267 DPP_TEST_NO_R_PROTO_KEY_AUTH_RESP = 19,
268 DPP_TEST_NO_R_NONCE_AUTH_RESP = 20,
269 DPP_TEST_NO_I_NONCE_AUTH_RESP = 21,
270 DPP_TEST_NO_R_CAPAB_AUTH_RESP = 22,
271 DPP_TEST_NO_R_AUTH_AUTH_RESP = 23,
272 DPP_TEST_NO_WRAPPED_DATA_AUTH_RESP = 24,
273 DPP_TEST_NO_STATUS_AUTH_CONF = 25,
274 DPP_TEST_NO_R_BOOTSTRAP_KEY_HASH_AUTH_CONF = 26,
275 DPP_TEST_NO_I_BOOTSTRAP_KEY_HASH_AUTH_CONF = 27,
276 DPP_TEST_NO_I_AUTH_AUTH_CONF = 28,
277 DPP_TEST_NO_WRAPPED_DATA_AUTH_CONF = 29,
278 DPP_TEST_I_NONCE_MISMATCH_AUTH_RESP = 30,
279 DPP_TEST_INCOMPATIBLE_R_CAPAB_AUTH_RESP = 31,
280 DPP_TEST_R_AUTH_MISMATCH_AUTH_RESP = 32,
281 DPP_TEST_I_AUTH_MISMATCH_AUTH_CONF = 33,
282 DPP_TEST_NO_FINITE_CYCLIC_GROUP_PKEX_EXCHANGE_REQ = 34,
283 DPP_TEST_NO_ENCRYPTED_KEY_PKEX_EXCHANGE_REQ = 35,
284 DPP_TEST_NO_STATUS_PKEX_EXCHANGE_RESP = 36,
285 DPP_TEST_NO_ENCRYPTED_KEY_PKEX_EXCHANGE_RESP = 37,
286 DPP_TEST_NO_BOOTSTRAP_KEY_PKEX_CR_REQ = 38,
287 DPP_TEST_NO_I_AUTH_TAG_PKEX_CR_REQ = 39,
288 DPP_TEST_NO_WRAPPED_DATA_PKEX_CR_REQ = 40,
289 DPP_TEST_NO_BOOTSTRAP_KEY_PKEX_CR_RESP = 41,
290 DPP_TEST_NO_R_AUTH_TAG_PKEX_CR_RESP = 42,
291 DPP_TEST_NO_WRAPPED_DATA_PKEX_CR_RESP = 43,
292 DPP_TEST_INVALID_ENCRYPTED_KEY_PKEX_EXCHANGE_REQ = 44,
293 DPP_TEST_INVALID_ENCRYPTED_KEY_PKEX_EXCHANGE_RESP = 45,
294 DPP_TEST_INVALID_STATUS_PKEX_EXCHANGE_RESP = 46,
295 DPP_TEST_INVALID_BOOTSTRAP_KEY_PKEX_CR_REQ = 47,
296 DPP_TEST_INVALID_BOOTSTRAP_KEY_PKEX_CR_RESP = 48,
297 DPP_TEST_I_AUTH_TAG_MISMATCH_PKEX_CR_REQ = 49,
298 DPP_TEST_R_AUTH_TAG_MISMATCH_PKEX_CR_RESP = 50,
299 DPP_TEST_NO_E_NONCE_CONF_REQ = 51,
300 DPP_TEST_NO_CONFIG_ATTR_OBJ_CONF_REQ = 52,
301 DPP_TEST_NO_WRAPPED_DATA_CONF_REQ = 53,
302 DPP_TEST_NO_E_NONCE_CONF_RESP = 54,
303 DPP_TEST_NO_CONFIG_OBJ_CONF_RESP = 55,
304 DPP_TEST_NO_STATUS_CONF_RESP = 56,
305 DPP_TEST_NO_WRAPPED_DATA_CONF_RESP = 57,
306 DPP_TEST_INVALID_STATUS_CONF_RESP = 58,
307 DPP_TEST_E_NONCE_MISMATCH_CONF_RESP = 59,
308 DPP_TEST_NO_TRANSACTION_ID_PEER_DISC_REQ = 60,
309 DPP_TEST_NO_CONNECTOR_PEER_DISC_REQ = 61,
310 DPP_TEST_NO_TRANSACTION_ID_PEER_DISC_RESP = 62,
311 DPP_TEST_NO_STATUS_PEER_DISC_RESP = 63,
312 DPP_TEST_NO_CONNECTOR_PEER_DISC_RESP = 64,
313 DPP_TEST_AUTH_RESP_IN_PLACE_OF_CONF = 65,
314 DPP_TEST_INVALID_I_PROTO_KEY_AUTH_REQ = 66,
315 DPP_TEST_INVALID_R_PROTO_KEY_AUTH_RESP = 67,
316 DPP_TEST_INVALID_R_BOOTSTRAP_KEY_HASH_AUTH_REQ = 68,
317 DPP_TEST_INVALID_I_BOOTSTRAP_KEY_HASH_AUTH_REQ = 69,
318 DPP_TEST_INVALID_R_BOOTSTRAP_KEY_HASH_AUTH_RESP = 70,
319 DPP_TEST_INVALID_I_BOOTSTRAP_KEY_HASH_AUTH_RESP = 71,
320 DPP_TEST_INVALID_R_BOOTSTRAP_KEY_HASH_AUTH_CONF = 72,
321 DPP_TEST_INVALID_I_BOOTSTRAP_KEY_HASH_AUTH_CONF = 73,
322 DPP_TEST_INVALID_STATUS_AUTH_RESP = 74,
323 DPP_TEST_INVALID_STATUS_AUTH_CONF = 75,
324 DPP_TEST_INVALID_CONFIG_ATTR_OBJ_CONF_REQ = 76,
325 DPP_TEST_INVALID_TRANSACTION_ID_PEER_DISC_RESP = 77,
326 DPP_TEST_INVALID_STATUS_PEER_DISC_RESP = 78,
327 DPP_TEST_INVALID_CONNECTOR_PEER_DISC_RESP = 79,
328 DPP_TEST_INVALID_CONNECTOR_PEER_DISC_REQ = 80,
329 DPP_TEST_INVALID_I_NONCE_AUTH_REQ = 81,
330 DPP_TEST_INVALID_TRANSACTION_ID_PEER_DISC_REQ = 82,
331 DPP_TEST_INVALID_E_NONCE_CONF_REQ = 83,
332 DPP_TEST_STOP_AT_PKEX_EXCHANGE_RESP = 84,
333 DPP_TEST_STOP_AT_PKEX_CR_REQ = 85,
334 DPP_TEST_STOP_AT_PKEX_CR_RESP = 86,
335 DPP_TEST_STOP_AT_AUTH_REQ = 87,
336 DPP_TEST_STOP_AT_AUTH_RESP = 88,
337 DPP_TEST_STOP_AT_AUTH_CONF = 89,
338 DPP_TEST_STOP_AT_CONF_REQ = 90,
339};
340
341extern enum dpp_test_behavior dpp_test;
342extern u8 dpp_pkex_own_mac_override[ETH_ALEN];
343extern u8 dpp_pkex_peer_mac_override[ETH_ALEN];
344extern u8 dpp_pkex_ephemeral_key_override[600];
345extern size_t dpp_pkex_ephemeral_key_override_len;
346extern u8 dpp_protocol_key_override[600];
347extern size_t dpp_protocol_key_override_len;
348extern u8 dpp_nonce_override[DPP_MAX_NONCE_LEN];
349extern size_t dpp_nonce_override_len;
350#endif /* CONFIG_TESTING_OPTIONS */
351
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700352void dpp_bootstrap_info_free(struct dpp_bootstrap_info *info);
353const char * dpp_bootstrap_type_txt(enum dpp_bootstrap_type type);
354int dpp_bootstrap_key_hash(struct dpp_bootstrap_info *bi);
355int dpp_parse_uri_chan_list(struct dpp_bootstrap_info *bi,
356 const char *chan_list);
357int dpp_parse_uri_mac(struct dpp_bootstrap_info *bi, const char *mac);
358int dpp_parse_uri_info(struct dpp_bootstrap_info *bi, const char *info);
359struct dpp_bootstrap_info * dpp_parse_qr_code(const char *uri);
360char * dpp_keygen(struct dpp_bootstrap_info *bi, const char *curve,
361 const u8 *privkey, size_t privkey_len);
Roshan Pius3a1667e2018-07-03 15:17:14 -0700362struct hostapd_hw_modes;
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700363struct dpp_authentication * dpp_auth_init(void *msg_ctx,
364 struct dpp_bootstrap_info *peer_bi,
365 struct dpp_bootstrap_info *own_bi,
Roshan Pius3a1667e2018-07-03 15:17:14 -0700366 u8 dpp_allowed_roles,
367 unsigned int neg_freq,
368 struct hostapd_hw_modes *own_modes,
369 u16 num_modes);
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700370struct dpp_authentication *
371dpp_auth_req_rx(void *msg_ctx, u8 dpp_allowed_roles, int qr_mutual,
372 struct dpp_bootstrap_info *peer_bi,
373 struct dpp_bootstrap_info *own_bi,
374 unsigned int freq, const u8 *hdr, const u8 *attr_start,
Roshan Pius3a1667e2018-07-03 15:17:14 -0700375 size_t attr_len);
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700376struct wpabuf *
377dpp_auth_resp_rx(struct dpp_authentication *auth, const u8 *hdr,
378 const u8 *attr_start, size_t attr_len);
379struct wpabuf * dpp_build_conf_req(struct dpp_authentication *auth,
380 const char *json);
381int dpp_auth_conf_rx(struct dpp_authentication *auth, const u8 *hdr,
382 const u8 *attr_start, size_t attr_len);
383int dpp_notify_new_qr_code(struct dpp_authentication *auth,
384 struct dpp_bootstrap_info *peer_bi);
385void dpp_configuration_free(struct dpp_configuration *conf);
386void dpp_auth_deinit(struct dpp_authentication *auth);
387struct wpabuf *
388dpp_conf_req_rx(struct dpp_authentication *auth, const u8 *attr_start,
389 size_t attr_len);
390int dpp_conf_resp_rx(struct dpp_authentication *auth,
391 const struct wpabuf *resp);
392struct wpabuf * dpp_alloc_msg(enum dpp_public_action_frame_type type,
393 size_t len);
394const u8 * dpp_get_attr(const u8 *buf, size_t len, u16 req_id, u16 *ret_len);
395int dpp_check_attrs(const u8 *buf, size_t len);
396int dpp_key_expired(const char *timestamp, os_time_t *expiry);
Roshan Pius3a1667e2018-07-03 15:17:14 -0700397const char * dpp_akm_str(enum dpp_akm akm);
398int dpp_configurator_get_key(const struct dpp_configurator *conf, char *buf,
399 size_t buflen);
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700400void dpp_configurator_free(struct dpp_configurator *conf);
401struct dpp_configurator *
402dpp_keygen_configurator(const char *curve, const u8 *privkey,
403 size_t privkey_len);
404int dpp_configurator_own_config(struct dpp_authentication *auth,
Roshan Pius3a1667e2018-07-03 15:17:14 -0700405 const char *curve, int ap);
406enum dpp_status_error
407dpp_peer_intro(struct dpp_introduction *intro, const char *own_connector,
408 const u8 *net_access_key, size_t net_access_key_len,
409 const u8 *csign_key, size_t csign_key_len,
410 const u8 *peer_connector, size_t peer_connector_len,
411 os_time_t *expiry);
412struct dpp_pkex * dpp_pkex_init(void *msg_ctx, struct dpp_bootstrap_info *bi,
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700413 const u8 *own_mac,
414 const char *identifier,
415 const char *code);
Roshan Pius3a1667e2018-07-03 15:17:14 -0700416struct dpp_pkex * dpp_pkex_rx_exchange_req(void *msg_ctx,
417 struct dpp_bootstrap_info *bi,
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700418 const u8 *own_mac,
419 const u8 *peer_mac,
420 const char *identifier,
421 const char *code,
422 const u8 *buf, size_t len);
423struct wpabuf * dpp_pkex_rx_exchange_resp(struct dpp_pkex *pkex,
Roshan Pius3a1667e2018-07-03 15:17:14 -0700424 const u8 *peer_mac,
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700425 const u8 *buf, size_t len);
426struct wpabuf * dpp_pkex_rx_commit_reveal_req(struct dpp_pkex *pkex,
427 const u8 *hdr,
428 const u8 *buf, size_t len);
429int dpp_pkex_rx_commit_reveal_resp(struct dpp_pkex *pkex, const u8 *hdr,
430 const u8 *buf, size_t len);
431void dpp_pkex_free(struct dpp_pkex *pkex);
432
Roshan Pius3a1667e2018-07-03 15:17:14 -0700433char * dpp_corrupt_connector_signature(const char *connector);
434
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700435#endif /* DPP_H */