]>
Commit | Line | Data |
---|---|---|
be27e185 JM |
1 | /* |
2 | * DPP functionality shared between hostapd and wpa_supplicant | |
3 | * Copyright (c) 2017, Qualcomm Atheros, Inc. | |
0b4a906d | 4 | * Copyright (c) 2018-2019, The Linux Foundation |
be27e185 JM |
5 | * |
6 | * This software may be distributed under the terms of the BSD license. | |
7 | * See README for more details. | |
8 | */ | |
9 | ||
10 | #ifndef DPP_H | |
11 | #define DPP_H | |
12 | ||
13 | #include <openssl/x509.h> | |
14 | ||
15 | #include "utils/list.h" | |
650a70a7 | 16 | #include "common/wpa_common.h" |
be27e185 JM |
17 | #include "crypto/sha256.h" |
18 | ||
10ec6a5f JM |
19 | struct crypto_ecdh; |
20 | ||
dc4d271c JM |
21 | #define DPP_HDR_LEN (4 + 2) /* OUI, OUI Type, Crypto Suite, DPP frame type */ |
22 | ||
30d27b04 JM |
23 | enum dpp_public_action_frame_type { |
24 | DPP_PA_AUTHENTICATION_REQ = 0, | |
25 | DPP_PA_AUTHENTICATION_RESP = 1, | |
26 | DPP_PA_AUTHENTICATION_CONF = 2, | |
27 | DPP_PA_PEER_DISCOVERY_REQ = 5, | |
28 | DPP_PA_PEER_DISCOVERY_RESP = 6, | |
29 | DPP_PA_PKEX_EXCHANGE_REQ = 7, | |
30 | DPP_PA_PKEX_EXCHANGE_RESP = 8, | |
31 | DPP_PA_PKEX_COMMIT_REVEAL_REQ = 9, | |
32 | DPP_PA_PKEX_COMMIT_REVEAL_RESP = 10, | |
22f90b32 | 33 | DPP_PA_CONFIGURATION_RESULT = 11, |
30d27b04 JM |
34 | }; |
35 | ||
36 | enum dpp_attribute_id { | |
37 | DPP_ATTR_STATUS = 0x1000, | |
38 | DPP_ATTR_I_BOOTSTRAP_KEY_HASH = 0x1001, | |
39 | DPP_ATTR_R_BOOTSTRAP_KEY_HASH = 0x1002, | |
40 | DPP_ATTR_I_PROTOCOL_KEY = 0x1003, | |
41 | DPP_ATTR_WRAPPED_DATA = 0x1004, | |
42 | DPP_ATTR_I_NONCE = 0x1005, | |
43 | DPP_ATTR_I_CAPABILITIES = 0x1006, | |
44 | DPP_ATTR_R_NONCE = 0x1007, | |
45 | DPP_ATTR_R_CAPABILITIES = 0x1008, | |
46 | DPP_ATTR_R_PROTOCOL_KEY = 0x1009, | |
47 | DPP_ATTR_I_AUTH_TAG = 0x100A, | |
48 | DPP_ATTR_R_AUTH_TAG = 0x100B, | |
49 | DPP_ATTR_CONFIG_OBJ = 0x100C, | |
50 | DPP_ATTR_CONNECTOR = 0x100D, | |
51 | DPP_ATTR_CONFIG_ATTR_OBJ = 0x100E, | |
52 | DPP_ATTR_BOOTSTRAP_KEY = 0x100F, | |
30d27b04 JM |
53 | DPP_ATTR_OWN_NET_NK_HASH = 0x1011, |
54 | DPP_ATTR_FINITE_CYCLIC_GROUP = 0x1012, | |
55 | DPP_ATTR_ENCRYPTED_KEY = 0x1013, | |
56 | DPP_ATTR_ENROLLEE_NONCE = 0x1014, | |
57 | DPP_ATTR_CODE_IDENTIFIER = 0x1015, | |
85fd8263 | 58 | DPP_ATTR_TRANSACTION_ID = 0x1016, |
d2709206 JM |
59 | DPP_ATTR_BOOTSTRAP_INFO = 0x1017, |
60 | DPP_ATTR_CHANNEL = 0x1018, | |
0b4a906d JM |
61 | DPP_ATTR_PROTOCOL_VERSION = 0x1019, |
62 | DPP_ATTR_ENVELOPED_DATA = 0x101A, | |
30d27b04 JM |
63 | }; |
64 | ||
65 | enum dpp_status_error { | |
66 | DPP_STATUS_OK = 0, | |
67 | DPP_STATUS_NOT_COMPATIBLE = 1, | |
68 | DPP_STATUS_AUTH_FAILURE = 2, | |
69 | DPP_STATUS_UNWRAP_FAILURE = 3, | |
70 | DPP_STATUS_BAD_GROUP = 4, | |
71 | DPP_STATUS_CONFIGURE_FAILURE = 5, | |
72 | DPP_STATUS_RESPONSE_PENDING = 6, | |
e85b6601 JM |
73 | DPP_STATUS_INVALID_CONNECTOR = 7, |
74 | DPP_STATUS_NO_MATCH = 8, | |
22f90b32 | 75 | DPP_STATUS_CONFIG_REJECTED = 9, |
30d27b04 JM |
76 | }; |
77 | ||
78 | #define DPP_CAPAB_ENROLLEE BIT(0) | |
79 | #define DPP_CAPAB_CONFIGURATOR BIT(1) | |
80 | #define DPP_CAPAB_ROLE_MASK (BIT(0) | BIT(1)) | |
81 | ||
be27e185 | 82 | #define DPP_BOOTSTRAP_MAX_FREQ 30 |
30d27b04 JM |
83 | #define DPP_MAX_NONCE_LEN 32 |
84 | #define DPP_MAX_HASH_LEN 64 | |
85 | #define DPP_MAX_SHARED_SECRET_LEN 66 | |
be27e185 JM |
86 | |
87 | struct dpp_curve_params { | |
88 | const char *name; | |
89 | size_t hash_len; | |
90 | size_t aes_siv_key_len; | |
91 | size_t nonce_len; | |
92 | size_t prime_len; | |
93 | const char *jwk_crv; | |
500ed7f0 | 94 | u16 ike_group; |
31f03cb0 | 95 | const char *jws_alg; |
be27e185 JM |
96 | }; |
97 | ||
98 | enum dpp_bootstrap_type { | |
99 | DPP_BOOTSTRAP_QR_CODE, | |
500ed7f0 | 100 | DPP_BOOTSTRAP_PKEX, |
be27e185 JM |
101 | }; |
102 | ||
103 | struct dpp_bootstrap_info { | |
104 | struct dl_list list; | |
105 | unsigned int id; | |
106 | enum dpp_bootstrap_type type; | |
107 | char *uri; | |
108 | u8 mac_addr[ETH_ALEN]; | |
109 | char *info; | |
110 | unsigned int freq[DPP_BOOTSTRAP_MAX_FREQ]; | |
111 | unsigned int num_freq; | |
112 | int own; | |
113 | EVP_PKEY *pubkey; | |
114 | u8 pubkey_hash[SHA256_MAC_LEN]; | |
115 | const struct dpp_curve_params *curve; | |
29ab69e4 JM |
116 | unsigned int pkex_t; /* number of failures before dpp_pkex |
117 | * instantiation */ | |
be27e185 JM |
118 | }; |
119 | ||
29ab69e4 JM |
120 | #define PKEX_COUNTER_T_LIMIT 5 |
121 | ||
500ed7f0 | 122 | struct dpp_pkex { |
219d4c9f | 123 | void *msg_ctx; |
500ed7f0 JM |
124 | unsigned int initiator:1; |
125 | unsigned int exchange_done:1; | |
e0247e79 | 126 | unsigned int failed:1; |
500ed7f0 JM |
127 | struct dpp_bootstrap_info *own_bi; |
128 | u8 own_mac[ETH_ALEN]; | |
129 | u8 peer_mac[ETH_ALEN]; | |
130 | char *identifier; | |
131 | char *code; | |
132 | EVP_PKEY *x; | |
133 | EVP_PKEY *y; | |
134 | u8 Mx[DPP_MAX_SHARED_SECRET_LEN]; | |
135 | u8 Nx[DPP_MAX_SHARED_SECRET_LEN]; | |
136 | u8 z[DPP_MAX_HASH_LEN]; | |
137 | EVP_PKEY *peer_bootstrap_key; | |
138 | struct wpabuf *exchange_req; | |
139 | struct wpabuf *exchange_resp; | |
29ab69e4 | 140 | unsigned int t; /* number of failures on code use */ |
00d2d13d JM |
141 | unsigned int exch_req_wait_time; |
142 | unsigned int exch_req_tries; | |
143 | unsigned int freq; | |
500ed7f0 JM |
144 | }; |
145 | ||
5dd745b7 JM |
146 | enum dpp_akm { |
147 | DPP_AKM_UNKNOWN, | |
148 | DPP_AKM_DPP, | |
149 | DPP_AKM_PSK, | |
150 | DPP_AKM_SAE, | |
18015fc8 JM |
151 | DPP_AKM_PSK_SAE, |
152 | DPP_AKM_SAE_DPP, | |
153 | DPP_AKM_PSK_SAE_DPP, | |
5dd745b7 JM |
154 | }; |
155 | ||
461d39af JM |
156 | struct dpp_configuration { |
157 | u8 ssid[32]; | |
158 | size_t ssid_len; | |
e3a5882b | 159 | enum dpp_akm akm; |
461d39af JM |
160 | |
161 | /* For DPP configuration (connector) */ | |
162 | os_time_t netaccesskey_expiry; | |
163 | ||
a4bf0078 | 164 | /* TODO: groups */ |
20f612d9 | 165 | char *group_id; |
461d39af JM |
166 | |
167 | /* For legacy configuration */ | |
168 | char *passphrase; | |
169 | u8 psk[32]; | |
9305c233 | 170 | int psk_set; |
461d39af JM |
171 | }; |
172 | ||
30d27b04 JM |
173 | struct dpp_authentication { |
174 | void *msg_ctx; | |
0b4a906d | 175 | u8 peer_version; |
30d27b04 JM |
176 | const struct dpp_curve_params *curve; |
177 | struct dpp_bootstrap_info *peer_bi; | |
178 | struct dpp_bootstrap_info *own_bi; | |
73f21929 | 179 | struct dpp_bootstrap_info *tmp_own_bi; |
30d27b04 JM |
180 | u8 waiting_pubkey_hash[SHA256_MAC_LEN]; |
181 | int response_pending; | |
182 | enum dpp_status_error auth_resp_status; | |
22f90b32 | 183 | enum dpp_status_error conf_resp_status; |
30d27b04 JM |
184 | u8 peer_mac_addr[ETH_ALEN]; |
185 | u8 i_nonce[DPP_MAX_NONCE_LEN]; | |
186 | u8 r_nonce[DPP_MAX_NONCE_LEN]; | |
461d39af | 187 | u8 e_nonce[DPP_MAX_NONCE_LEN]; |
30d27b04 JM |
188 | u8 i_capab; |
189 | u8 r_capab; | |
190 | EVP_PKEY *own_protocol_key; | |
191 | EVP_PKEY *peer_protocol_key; | |
dc4d271c JM |
192 | struct wpabuf *req_msg; |
193 | struct wpabuf *resp_msg; | |
f97ace34 JM |
194 | /* Intersection of possible frequencies for initiating DPP |
195 | * Authentication exchange */ | |
196 | unsigned int freq[DPP_BOOTSTRAP_MAX_FREQ]; | |
197 | unsigned int num_freq, freq_idx; | |
30d27b04 | 198 | unsigned int curr_freq; |
d2709206 | 199 | unsigned int neg_freq; |
f97ace34 | 200 | unsigned int num_freq_iters; |
30d27b04 JM |
201 | size_t secret_len; |
202 | u8 Mx[DPP_MAX_SHARED_SECRET_LEN]; | |
630ea133 | 203 | size_t Mx_len; |
30d27b04 | 204 | u8 Nx[DPP_MAX_SHARED_SECRET_LEN]; |
630ea133 | 205 | size_t Nx_len; |
30d27b04 | 206 | u8 Lx[DPP_MAX_SHARED_SECRET_LEN]; |
630ea133 | 207 | size_t Lx_len; |
30d27b04 JM |
208 | u8 k1[DPP_MAX_HASH_LEN]; |
209 | u8 k2[DPP_MAX_HASH_LEN]; | |
210 | u8 ke[DPP_MAX_HASH_LEN]; | |
211 | int initiator; | |
f97ace34 | 212 | int waiting_auth_resp; |
95b0104a | 213 | int waiting_auth_conf; |
248264c6 | 214 | int auth_req_ack; |
95b0104a | 215 | unsigned int auth_resp_tries; |
d1f08264 | 216 | u8 allowed_roles; |
30d27b04 JM |
217 | int configurator; |
218 | int remove_on_tx_status; | |
22f90b32 JM |
219 | int connect_on_tx_status; |
220 | int waiting_conf_result; | |
30d27b04 | 221 | int auth_success; |
461d39af | 222 | struct wpabuf *conf_req; |
82feacce | 223 | const struct wpabuf *conf_resp; /* owned by GAS server */ |
461d39af JM |
224 | struct dpp_configuration *conf_ap; |
225 | struct dpp_configuration *conf_sta; | |
226 | struct dpp_configurator *conf; | |
227 | char *connector; /* received signedConnector */ | |
228 | u8 ssid[SSID_MAX_LEN]; | |
229 | u8 ssid_len; | |
8528994e JM |
230 | char passphrase[64]; |
231 | u8 psk[PMK_LEN]; | |
232 | int psk_set; | |
5dd745b7 | 233 | enum dpp_akm akm; |
461d39af JM |
234 | struct wpabuf *net_access_key; |
235 | os_time_t net_access_key_expiry; | |
236 | struct wpabuf *c_sign_key; | |
461d39af JM |
237 | #ifdef CONFIG_TESTING_OPTIONS |
238 | char *config_obj_override; | |
239 | char *discovery_override; | |
240 | char *groups_override; | |
461d39af JM |
241 | unsigned int ignore_netaccesskey_mismatch:1; |
242 | #endif /* CONFIG_TESTING_OPTIONS */ | |
243 | }; | |
244 | ||
245 | struct dpp_configurator { | |
246 | struct dl_list list; | |
247 | unsigned int id; | |
248 | int own; | |
249 | EVP_PKEY *csign; | |
250 | char *kid; | |
251 | const struct dpp_curve_params *curve; | |
30d27b04 JM |
252 | }; |
253 | ||
650a70a7 JM |
254 | struct dpp_introduction { |
255 | u8 pmkid[PMKID_LEN]; | |
256 | u8 pmk[PMK_LEN_MAX]; | |
257 | size_t pmk_len; | |
650a70a7 JM |
258 | }; |
259 | ||
60239f60 JM |
260 | #ifdef CONFIG_TESTING_OPTIONS |
261 | enum dpp_test_behavior { | |
262 | DPP_TEST_DISABLED = 0, | |
263 | DPP_TEST_AFTER_WRAPPED_DATA_AUTH_REQ = 1, | |
264 | DPP_TEST_AFTER_WRAPPED_DATA_AUTH_RESP = 2, | |
265 | DPP_TEST_AFTER_WRAPPED_DATA_AUTH_CONF = 3, | |
266 | DPP_TEST_AFTER_WRAPPED_DATA_PKEX_CR_REQ = 4, | |
267 | DPP_TEST_AFTER_WRAPPED_DATA_PKEX_CR_RESP = 5, | |
268 | DPP_TEST_AFTER_WRAPPED_DATA_CONF_REQ = 6, | |
269 | DPP_TEST_AFTER_WRAPPED_DATA_CONF_RESP = 7, | |
270 | DPP_TEST_ZERO_I_CAPAB = 8, | |
271 | DPP_TEST_ZERO_R_CAPAB = 9, | |
0e7cb8c6 JM |
272 | DPP_TEST_NO_R_BOOTSTRAP_KEY_HASH_AUTH_REQ = 10, |
273 | DPP_TEST_NO_I_BOOTSTRAP_KEY_HASH_AUTH_REQ = 11, | |
274 | DPP_TEST_NO_I_PROTO_KEY_AUTH_REQ = 12, | |
275 | DPP_TEST_NO_I_NONCE_AUTH_REQ = 13, | |
276 | DPP_TEST_NO_I_CAPAB_AUTH_REQ = 14, | |
277 | DPP_TEST_NO_WRAPPED_DATA_AUTH_REQ = 15, | |
ce9acce0 JM |
278 | DPP_TEST_NO_STATUS_AUTH_RESP = 16, |
279 | DPP_TEST_NO_R_BOOTSTRAP_KEY_HASH_AUTH_RESP = 17, | |
280 | DPP_TEST_NO_I_BOOTSTRAP_KEY_HASH_AUTH_RESP = 18, | |
281 | DPP_TEST_NO_R_PROTO_KEY_AUTH_RESP = 19, | |
282 | DPP_TEST_NO_R_NONCE_AUTH_RESP = 20, | |
283 | DPP_TEST_NO_I_NONCE_AUTH_RESP = 21, | |
284 | DPP_TEST_NO_R_CAPAB_AUTH_RESP = 22, | |
285 | DPP_TEST_NO_R_AUTH_AUTH_RESP = 23, | |
286 | DPP_TEST_NO_WRAPPED_DATA_AUTH_RESP = 24, | |
f9c7d770 JM |
287 | DPP_TEST_NO_STATUS_AUTH_CONF = 25, |
288 | DPP_TEST_NO_R_BOOTSTRAP_KEY_HASH_AUTH_CONF = 26, | |
289 | DPP_TEST_NO_I_BOOTSTRAP_KEY_HASH_AUTH_CONF = 27, | |
290 | DPP_TEST_NO_I_AUTH_AUTH_CONF = 28, | |
291 | DPP_TEST_NO_WRAPPED_DATA_AUTH_CONF = 29, | |
978bc3f2 JM |
292 | DPP_TEST_I_NONCE_MISMATCH_AUTH_RESP = 30, |
293 | DPP_TEST_INCOMPATIBLE_R_CAPAB_AUTH_RESP = 31, | |
294 | DPP_TEST_R_AUTH_MISMATCH_AUTH_RESP = 32, | |
295 | DPP_TEST_I_AUTH_MISMATCH_AUTH_CONF = 33, | |
61f9f27f JM |
296 | DPP_TEST_NO_FINITE_CYCLIC_GROUP_PKEX_EXCHANGE_REQ = 34, |
297 | DPP_TEST_NO_ENCRYPTED_KEY_PKEX_EXCHANGE_REQ = 35, | |
298 | DPP_TEST_NO_STATUS_PKEX_EXCHANGE_RESP = 36, | |
299 | DPP_TEST_NO_ENCRYPTED_KEY_PKEX_EXCHANGE_RESP = 37, | |
300 | DPP_TEST_NO_BOOTSTRAP_KEY_PKEX_CR_REQ = 38, | |
301 | DPP_TEST_NO_I_AUTH_TAG_PKEX_CR_REQ = 39, | |
302 | DPP_TEST_NO_WRAPPED_DATA_PKEX_CR_REQ = 40, | |
303 | DPP_TEST_NO_BOOTSTRAP_KEY_PKEX_CR_RESP = 41, | |
304 | DPP_TEST_NO_R_AUTH_TAG_PKEX_CR_RESP = 42, | |
305 | DPP_TEST_NO_WRAPPED_DATA_PKEX_CR_RESP = 43, | |
1cfcbd32 JM |
306 | DPP_TEST_INVALID_ENCRYPTED_KEY_PKEX_EXCHANGE_REQ = 44, |
307 | DPP_TEST_INVALID_ENCRYPTED_KEY_PKEX_EXCHANGE_RESP = 45, | |
f31ef96d | 308 | DPP_TEST_INVALID_STATUS_PKEX_EXCHANGE_RESP = 46, |
89d0bf67 JM |
309 | DPP_TEST_INVALID_BOOTSTRAP_KEY_PKEX_CR_REQ = 47, |
310 | DPP_TEST_INVALID_BOOTSTRAP_KEY_PKEX_CR_RESP = 48, | |
7e0ebe21 JM |
311 | DPP_TEST_I_AUTH_TAG_MISMATCH_PKEX_CR_REQ = 49, |
312 | DPP_TEST_R_AUTH_TAG_MISMATCH_PKEX_CR_RESP = 50, | |
f411ad1b JM |
313 | DPP_TEST_NO_E_NONCE_CONF_REQ = 51, |
314 | DPP_TEST_NO_CONFIG_ATTR_OBJ_CONF_REQ = 52, | |
315 | DPP_TEST_NO_WRAPPED_DATA_CONF_REQ = 53, | |
316 | DPP_TEST_NO_E_NONCE_CONF_RESP = 54, | |
317 | DPP_TEST_NO_CONFIG_OBJ_CONF_RESP = 55, | |
318 | DPP_TEST_NO_STATUS_CONF_RESP = 56, | |
319 | DPP_TEST_NO_WRAPPED_DATA_CONF_RESP = 57, | |
af7f10fc JM |
320 | DPP_TEST_INVALID_STATUS_CONF_RESP = 58, |
321 | DPP_TEST_E_NONCE_MISMATCH_CONF_RESP = 59, | |
a306ed5a JM |
322 | DPP_TEST_NO_TRANSACTION_ID_PEER_DISC_REQ = 60, |
323 | DPP_TEST_NO_CONNECTOR_PEER_DISC_REQ = 61, | |
324 | DPP_TEST_NO_TRANSACTION_ID_PEER_DISC_RESP = 62, | |
325 | DPP_TEST_NO_STATUS_PEER_DISC_RESP = 63, | |
326 | DPP_TEST_NO_CONNECTOR_PEER_DISC_RESP = 64, | |
762fb4f0 | 327 | DPP_TEST_AUTH_RESP_IN_PLACE_OF_CONF = 65, |
b6b4226b JM |
328 | DPP_TEST_INVALID_I_PROTO_KEY_AUTH_REQ = 66, |
329 | DPP_TEST_INVALID_R_PROTO_KEY_AUTH_RESP = 67, | |
65ecce87 JM |
330 | DPP_TEST_INVALID_R_BOOTSTRAP_KEY_HASH_AUTH_REQ = 68, |
331 | DPP_TEST_INVALID_I_BOOTSTRAP_KEY_HASH_AUTH_REQ = 69, | |
332 | DPP_TEST_INVALID_R_BOOTSTRAP_KEY_HASH_AUTH_RESP = 70, | |
333 | DPP_TEST_INVALID_I_BOOTSTRAP_KEY_HASH_AUTH_RESP = 71, | |
334 | DPP_TEST_INVALID_R_BOOTSTRAP_KEY_HASH_AUTH_CONF = 72, | |
335 | DPP_TEST_INVALID_I_BOOTSTRAP_KEY_HASH_AUTH_CONF = 73, | |
3f35ec2d JM |
336 | DPP_TEST_INVALID_STATUS_AUTH_RESP = 74, |
337 | DPP_TEST_INVALID_STATUS_AUTH_CONF = 75, | |
f9cf7d03 | 338 | DPP_TEST_INVALID_CONFIG_ATTR_OBJ_CONF_REQ = 76, |
4b8de0c9 JM |
339 | DPP_TEST_INVALID_TRANSACTION_ID_PEER_DISC_RESP = 77, |
340 | DPP_TEST_INVALID_STATUS_PEER_DISC_RESP = 78, | |
341 | DPP_TEST_INVALID_CONNECTOR_PEER_DISC_RESP = 79, | |
342 | DPP_TEST_INVALID_CONNECTOR_PEER_DISC_REQ = 80, | |
a4446739 | 343 | DPP_TEST_INVALID_I_NONCE_AUTH_REQ = 81, |
55c6c858 | 344 | DPP_TEST_INVALID_TRANSACTION_ID_PEER_DISC_REQ = 82, |
f0a383a9 | 345 | DPP_TEST_INVALID_E_NONCE_CONF_REQ = 83, |
34603767 JM |
346 | DPP_TEST_STOP_AT_PKEX_EXCHANGE_RESP = 84, |
347 | DPP_TEST_STOP_AT_PKEX_CR_REQ = 85, | |
348 | DPP_TEST_STOP_AT_PKEX_CR_RESP = 86, | |
349 | DPP_TEST_STOP_AT_AUTH_REQ = 87, | |
350 | DPP_TEST_STOP_AT_AUTH_RESP = 88, | |
351 | DPP_TEST_STOP_AT_AUTH_CONF = 89, | |
352 | DPP_TEST_STOP_AT_CONF_REQ = 90, | |
67b3bcc9 | 353 | DPP_TEST_REJECT_CONFIG = 91, |
60239f60 JM |
354 | }; |
355 | ||
356 | extern enum dpp_test_behavior dpp_test; | |
2bdc47a9 JM |
357 | extern u8 dpp_pkex_own_mac_override[ETH_ALEN]; |
358 | extern u8 dpp_pkex_peer_mac_override[ETH_ALEN]; | |
acc555f9 JM |
359 | extern u8 dpp_pkex_ephemeral_key_override[600]; |
360 | extern size_t dpp_pkex_ephemeral_key_override_len; | |
f5526975 JM |
361 | extern u8 dpp_protocol_key_override[600]; |
362 | extern size_t dpp_protocol_key_override_len; | |
055cd397 JM |
363 | extern u8 dpp_nonce_override[DPP_MAX_NONCE_LEN]; |
364 | extern size_t dpp_nonce_override_len; | |
60239f60 JM |
365 | #endif /* CONFIG_TESTING_OPTIONS */ |
366 | ||
be27e185 | 367 | void dpp_bootstrap_info_free(struct dpp_bootstrap_info *info); |
484788b8 | 368 | const char * dpp_bootstrap_type_txt(enum dpp_bootstrap_type type); |
500ed7f0 | 369 | int dpp_bootstrap_key_hash(struct dpp_bootstrap_info *bi); |
be27e185 JM |
370 | int dpp_parse_uri_chan_list(struct dpp_bootstrap_info *bi, |
371 | const char *chan_list); | |
372 | int dpp_parse_uri_mac(struct dpp_bootstrap_info *bi, const char *mac); | |
373 | int dpp_parse_uri_info(struct dpp_bootstrap_info *bi, const char *info); | |
374 | struct dpp_bootstrap_info * dpp_parse_qr_code(const char *uri); | |
375 | char * dpp_keygen(struct dpp_bootstrap_info *bi, const char *curve, | |
376 | const u8 *privkey, size_t privkey_len); | |
f97ace34 | 377 | struct hostapd_hw_modes; |
30d27b04 JM |
378 | struct dpp_authentication * dpp_auth_init(void *msg_ctx, |
379 | struct dpp_bootstrap_info *peer_bi, | |
380 | struct dpp_bootstrap_info *own_bi, | |
d1f08264 | 381 | u8 dpp_allowed_roles, |
f97ace34 JM |
382 | unsigned int neg_freq, |
383 | struct hostapd_hw_modes *own_modes, | |
384 | u16 num_modes); | |
30d27b04 JM |
385 | struct dpp_authentication * |
386 | dpp_auth_req_rx(void *msg_ctx, u8 dpp_allowed_roles, int qr_mutual, | |
387 | struct dpp_bootstrap_info *peer_bi, | |
388 | struct dpp_bootstrap_info *own_bi, | |
dc4d271c | 389 | unsigned int freq, const u8 *hdr, const u8 *attr_start, |
27fefbbb | 390 | size_t attr_len); |
30d27b04 | 391 | struct wpabuf * |
dc4d271c JM |
392 | dpp_auth_resp_rx(struct dpp_authentication *auth, const u8 *hdr, |
393 | const u8 *attr_start, size_t attr_len); | |
461d39af JM |
394 | struct wpabuf * dpp_build_conf_req(struct dpp_authentication *auth, |
395 | const char *json); | |
dc4d271c JM |
396 | int dpp_auth_conf_rx(struct dpp_authentication *auth, const u8 *hdr, |
397 | const u8 *attr_start, size_t attr_len); | |
30d27b04 JM |
398 | int dpp_notify_new_qr_code(struct dpp_authentication *auth, |
399 | struct dpp_bootstrap_info *peer_bi); | |
9305c233 | 400 | struct dpp_configuration * dpp_configuration_alloc(const char *type); |
18015fc8 JM |
401 | int dpp_akm_psk(enum dpp_akm akm); |
402 | int dpp_akm_sae(enum dpp_akm akm); | |
403 | int dpp_akm_legacy(enum dpp_akm akm); | |
404 | int dpp_akm_dpp(enum dpp_akm akm); | |
405 | int dpp_akm_ver2(enum dpp_akm akm); | |
9305c233 | 406 | int dpp_configuration_valid(const struct dpp_configuration *conf); |
461d39af | 407 | void dpp_configuration_free(struct dpp_configuration *conf); |
9305c233 | 408 | int dpp_configuration_parse(struct dpp_authentication *auth, const char *cmd); |
30d27b04 | 409 | void dpp_auth_deinit(struct dpp_authentication *auth); |
461d39af JM |
410 | struct wpabuf * |
411 | dpp_conf_req_rx(struct dpp_authentication *auth, const u8 *attr_start, | |
412 | size_t attr_len); | |
413 | int dpp_conf_resp_rx(struct dpp_authentication *auth, | |
414 | const struct wpabuf *resp); | |
22f90b32 JM |
415 | enum dpp_status_error dpp_conf_result_rx(struct dpp_authentication *auth, |
416 | const u8 *hdr, | |
417 | const u8 *attr_start, size_t attr_len); | |
418 | struct wpabuf * dpp_build_conf_result(struct dpp_authentication *auth, | |
419 | enum dpp_status_error status); | |
30d27b04 JM |
420 | struct wpabuf * dpp_alloc_msg(enum dpp_public_action_frame_type type, |
421 | size_t len); | |
422 | const u8 * dpp_get_attr(const u8 *buf, size_t len, u16 req_id, u16 *ret_len); | |
423 | int dpp_check_attrs(const u8 *buf, size_t len); | |
461d39af | 424 | int dpp_key_expired(const char *timestamp, os_time_t *expiry); |
5dd745b7 | 425 | const char * dpp_akm_str(enum dpp_akm akm); |
8179ae3a PK |
426 | int dpp_configurator_get_key(const struct dpp_configurator *conf, char *buf, |
427 | size_t buflen); | |
461d39af JM |
428 | void dpp_configurator_free(struct dpp_configurator *conf); |
429 | struct dpp_configurator * | |
430 | dpp_keygen_configurator(const char *curve, const u8 *privkey, | |
431 | size_t privkey_len); | |
f522bb23 | 432 | int dpp_configurator_own_config(struct dpp_authentication *auth, |
a2588be8 | 433 | const char *curve, int ap); |
e85b6601 JM |
434 | enum dpp_status_error |
435 | dpp_peer_intro(struct dpp_introduction *intro, const char *own_connector, | |
436 | const u8 *net_access_key, size_t net_access_key_len, | |
437 | const u8 *csign_key, size_t csign_key_len, | |
438 | const u8 *peer_connector, size_t peer_connector_len, | |
439 | os_time_t *expiry); | |
219d4c9f | 440 | struct dpp_pkex * dpp_pkex_init(void *msg_ctx, struct dpp_bootstrap_info *bi, |
500ed7f0 JM |
441 | const u8 *own_mac, |
442 | const char *identifier, | |
443 | const char *code); | |
219d4c9f JM |
444 | struct dpp_pkex * dpp_pkex_rx_exchange_req(void *msg_ctx, |
445 | struct dpp_bootstrap_info *bi, | |
500ed7f0 JM |
446 | const u8 *own_mac, |
447 | const u8 *peer_mac, | |
448 | const char *identifier, | |
449 | const char *code, | |
450 | const u8 *buf, size_t len); | |
451 | struct wpabuf * dpp_pkex_rx_exchange_resp(struct dpp_pkex *pkex, | |
af4103e5 | 452 | const u8 *peer_mac, |
500ed7f0 JM |
453 | const u8 *buf, size_t len); |
454 | struct wpabuf * dpp_pkex_rx_commit_reveal_req(struct dpp_pkex *pkex, | |
4be5bc98 | 455 | const u8 *hdr, |
500ed7f0 | 456 | const u8 *buf, size_t len); |
4be5bc98 | 457 | int dpp_pkex_rx_commit_reveal_resp(struct dpp_pkex *pkex, const u8 *hdr, |
500ed7f0 JM |
458 | const u8 *buf, size_t len); |
459 | void dpp_pkex_free(struct dpp_pkex *pkex); | |
be27e185 | 460 | |
4b8de0c9 JM |
461 | char * dpp_corrupt_connector_signature(const char *connector); |
462 | ||
10ec6a5f JM |
463 | |
464 | struct dpp_pfs { | |
465 | struct crypto_ecdh *ecdh; | |
466 | const struct dpp_curve_params *curve; | |
467 | struct wpabuf *ie; | |
468 | struct wpabuf *secret; | |
469 | }; | |
470 | ||
471 | struct dpp_pfs * dpp_pfs_init(const u8 *net_access_key, | |
472 | size_t net_access_key_len); | |
473 | int dpp_pfs_process(struct dpp_pfs *pfs, const u8 *peer_ie, size_t peer_ie_len); | |
474 | void dpp_pfs_free(struct dpp_pfs *pfs); | |
475 | ||
be27e185 | 476 | #endif /* DPP_H */ |