Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 1 | /* |
| 2 | * DPP functionality shared between hostapd and wpa_supplicant |
| 3 | * Copyright (c) 2017, Qualcomm Atheros, Inc. |
Hai Shalom | fdcde76 | 2020-04-02 11:19:20 -0700 | [diff] [blame] | 4 | * Copyright (c) 2018-2020, The Linux Foundation |
Hai Shalom | a20dcd7 | 2022-02-04 13:43:00 -0800 | [diff] [blame] | 5 | * Copyright (c) 2021-2022, Qualcomm Innovation Center, Inc. |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 6 | * |
| 7 | * This software may be distributed under the terms of the BSD license. |
| 8 | * See README for more details. |
| 9 | */ |
| 10 | |
| 11 | #ifndef DPP_H |
| 12 | #define DPP_H |
| 13 | |
Hai Shalom | 021b0b5 | 2019-04-10 11:17:58 -0700 | [diff] [blame] | 14 | #ifdef CONFIG_DPP |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 15 | #include "utils/list.h" |
| 16 | #include "common/wpa_common.h" |
| 17 | #include "crypto/sha256.h" |
Hai Shalom | a20dcd7 | 2022-02-04 13:43:00 -0800 | [diff] [blame] | 18 | #include "crypto/crypto.h" |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 19 | |
Hai Shalom | 81f62d8 | 2019-07-22 12:10:00 -0700 | [diff] [blame] | 20 | struct hostapd_ip_addr; |
Hai Shalom | 021b0b5 | 2019-04-10 11:17:58 -0700 | [diff] [blame] | 21 | struct dpp_global; |
Hai Shalom | 4fbc08f | 2020-05-18 12:37:00 -0700 | [diff] [blame] | 22 | struct json_token; |
Hai Shalom | 899fcc7 | 2020-10-19 14:38:18 -0700 | [diff] [blame] | 23 | struct dpp_reconfig_id; |
Hai Shalom | 4fbc08f | 2020-05-18 12:37:00 -0700 | [diff] [blame] | 24 | |
| 25 | #ifdef CONFIG_TESTING_OPTIONS |
| 26 | #define DPP_VERSION (dpp_version_override) |
| 27 | extern int dpp_version_override; |
| 28 | #else /* CONFIG_TESTING_OPTIONS */ |
Hai Shalom | a20dcd7 | 2022-02-04 13:43:00 -0800 | [diff] [blame] | 29 | #ifdef CONFIG_DPP3 |
| 30 | #define DPP_VERSION 3 |
| 31 | #elif defined(CONFIG_DPP2) |
Hai Shalom | 4fbc08f | 2020-05-18 12:37:00 -0700 | [diff] [blame] | 32 | #define DPP_VERSION 2 |
| 33 | #else |
| 34 | #define DPP_VERSION 1 |
| 35 | #endif |
| 36 | #endif /* CONFIG_TESTING_OPTIONS */ |
Hai Shalom | 021b0b5 | 2019-04-10 11:17:58 -0700 | [diff] [blame] | 37 | |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 38 | #define DPP_HDR_LEN (4 + 2) /* OUI, OUI Type, Crypto Suite, DPP frame type */ |
Hai Shalom | 6084025 | 2021-02-19 19:02:11 -0800 | [diff] [blame] | 39 | #define DPP_TCP_PORT 8908 |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 40 | |
| 41 | enum dpp_public_action_frame_type { |
| 42 | DPP_PA_AUTHENTICATION_REQ = 0, |
| 43 | DPP_PA_AUTHENTICATION_RESP = 1, |
| 44 | DPP_PA_AUTHENTICATION_CONF = 2, |
| 45 | DPP_PA_PEER_DISCOVERY_REQ = 5, |
| 46 | DPP_PA_PEER_DISCOVERY_RESP = 6, |
Hai Shalom | a20dcd7 | 2022-02-04 13:43:00 -0800 | [diff] [blame] | 47 | DPP_PA_PKEX_V1_EXCHANGE_REQ = 7, |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 48 | DPP_PA_PKEX_EXCHANGE_RESP = 8, |
| 49 | DPP_PA_PKEX_COMMIT_REVEAL_REQ = 9, |
| 50 | DPP_PA_PKEX_COMMIT_REVEAL_RESP = 10, |
Hai Shalom | 021b0b5 | 2019-04-10 11:17:58 -0700 | [diff] [blame] | 51 | DPP_PA_CONFIGURATION_RESULT = 11, |
Hai Shalom | c356592 | 2019-10-28 11:58:20 -0700 | [diff] [blame] | 52 | DPP_PA_CONNECTION_STATUS_RESULT = 12, |
Hai Shalom | fdcde76 | 2020-04-02 11:19:20 -0700 | [diff] [blame] | 53 | DPP_PA_PRESENCE_ANNOUNCEMENT = 13, |
| 54 | DPP_PA_RECONFIG_ANNOUNCEMENT = 14, |
| 55 | DPP_PA_RECONFIG_AUTH_REQ = 15, |
| 56 | DPP_PA_RECONFIG_AUTH_RESP = 16, |
| 57 | DPP_PA_RECONFIG_AUTH_CONF = 17, |
Hai Shalom | a20dcd7 | 2022-02-04 13:43:00 -0800 | [diff] [blame] | 58 | DPP_PA_PKEX_EXCHANGE_REQ = 18, |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 59 | }; |
| 60 | |
| 61 | enum dpp_attribute_id { |
| 62 | DPP_ATTR_STATUS = 0x1000, |
| 63 | DPP_ATTR_I_BOOTSTRAP_KEY_HASH = 0x1001, |
| 64 | DPP_ATTR_R_BOOTSTRAP_KEY_HASH = 0x1002, |
| 65 | DPP_ATTR_I_PROTOCOL_KEY = 0x1003, |
| 66 | DPP_ATTR_WRAPPED_DATA = 0x1004, |
| 67 | DPP_ATTR_I_NONCE = 0x1005, |
| 68 | DPP_ATTR_I_CAPABILITIES = 0x1006, |
| 69 | DPP_ATTR_R_NONCE = 0x1007, |
| 70 | DPP_ATTR_R_CAPABILITIES = 0x1008, |
| 71 | DPP_ATTR_R_PROTOCOL_KEY = 0x1009, |
| 72 | DPP_ATTR_I_AUTH_TAG = 0x100A, |
| 73 | DPP_ATTR_R_AUTH_TAG = 0x100B, |
| 74 | DPP_ATTR_CONFIG_OBJ = 0x100C, |
| 75 | DPP_ATTR_CONNECTOR = 0x100D, |
| 76 | DPP_ATTR_CONFIG_ATTR_OBJ = 0x100E, |
| 77 | DPP_ATTR_BOOTSTRAP_KEY = 0x100F, |
| 78 | DPP_ATTR_OWN_NET_NK_HASH = 0x1011, |
| 79 | DPP_ATTR_FINITE_CYCLIC_GROUP = 0x1012, |
| 80 | DPP_ATTR_ENCRYPTED_KEY = 0x1013, |
| 81 | DPP_ATTR_ENROLLEE_NONCE = 0x1014, |
| 82 | DPP_ATTR_CODE_IDENTIFIER = 0x1015, |
| 83 | DPP_ATTR_TRANSACTION_ID = 0x1016, |
Roshan Pius | 3a1667e | 2018-07-03 15:17:14 -0700 | [diff] [blame] | 84 | DPP_ATTR_BOOTSTRAP_INFO = 0x1017, |
| 85 | DPP_ATTR_CHANNEL = 0x1018, |
Hai Shalom | 021b0b5 | 2019-04-10 11:17:58 -0700 | [diff] [blame] | 86 | DPP_ATTR_PROTOCOL_VERSION = 0x1019, |
| 87 | DPP_ATTR_ENVELOPED_DATA = 0x101A, |
Hai Shalom | c356592 | 2019-10-28 11:58:20 -0700 | [diff] [blame] | 88 | DPP_ATTR_SEND_CONN_STATUS = 0x101B, |
| 89 | DPP_ATTR_CONN_STATUS = 0x101C, |
Hai Shalom | fdcde76 | 2020-04-02 11:19:20 -0700 | [diff] [blame] | 90 | DPP_ATTR_RECONFIG_FLAGS = 0x101D, |
| 91 | DPP_ATTR_C_SIGN_KEY_HASH = 0x101E, |
| 92 | DPP_ATTR_CSR_ATTR_REQ = 0x101F, |
Hai Shalom | 899fcc7 | 2020-10-19 14:38:18 -0700 | [diff] [blame] | 93 | DPP_ATTR_A_NONCE = 0x1020, |
| 94 | DPP_ATTR_E_PRIME_ID = 0x1021, |
| 95 | DPP_ATTR_CONFIGURATOR_NONCE = 0x1022, |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 96 | }; |
| 97 | |
| 98 | enum dpp_status_error { |
| 99 | DPP_STATUS_OK = 0, |
| 100 | DPP_STATUS_NOT_COMPATIBLE = 1, |
| 101 | DPP_STATUS_AUTH_FAILURE = 2, |
| 102 | DPP_STATUS_UNWRAP_FAILURE = 3, |
| 103 | DPP_STATUS_BAD_GROUP = 4, |
| 104 | DPP_STATUS_CONFIGURE_FAILURE = 5, |
| 105 | DPP_STATUS_RESPONSE_PENDING = 6, |
Roshan Pius | 3a1667e | 2018-07-03 15:17:14 -0700 | [diff] [blame] | 106 | DPP_STATUS_INVALID_CONNECTOR = 7, |
| 107 | DPP_STATUS_NO_MATCH = 8, |
Hai Shalom | 021b0b5 | 2019-04-10 11:17:58 -0700 | [diff] [blame] | 108 | DPP_STATUS_CONFIG_REJECTED = 9, |
Hai Shalom | c356592 | 2019-10-28 11:58:20 -0700 | [diff] [blame] | 109 | DPP_STATUS_NO_AP = 10, |
Hai Shalom | fdcde76 | 2020-04-02 11:19:20 -0700 | [diff] [blame] | 110 | DPP_STATUS_CONFIGURE_PENDING = 11, |
| 111 | DPP_STATUS_CSR_NEEDED = 12, |
| 112 | DPP_STATUS_CSR_BAD = 13, |
Sunil Ravi | a04bd25 | 2022-05-02 22:54:18 -0700 | [diff] [blame^] | 113 | DPP_STATUS_NEW_KEY_NEEDED = 14, |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 114 | }; |
| 115 | |
Hai Shalom | 4fbc08f | 2020-05-18 12:37:00 -0700 | [diff] [blame] | 116 | /* DPP Reconfig Flags object - connectorKey values */ |
| 117 | enum dpp_connector_key { |
| 118 | DPP_CONFIG_REUSEKEY = 0, |
| 119 | DPP_CONFIG_REPLACEKEY = 1, |
| 120 | }; |
| 121 | |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 122 | #define DPP_CAPAB_ENROLLEE BIT(0) |
| 123 | #define DPP_CAPAB_CONFIGURATOR BIT(1) |
| 124 | #define DPP_CAPAB_ROLE_MASK (BIT(0) | BIT(1)) |
| 125 | |
| 126 | #define DPP_BOOTSTRAP_MAX_FREQ 30 |
| 127 | #define DPP_MAX_NONCE_LEN 32 |
| 128 | #define DPP_MAX_HASH_LEN 64 |
| 129 | #define DPP_MAX_SHARED_SECRET_LEN 66 |
Hai Shalom | 899fcc7 | 2020-10-19 14:38:18 -0700 | [diff] [blame] | 130 | #define DPP_CP_LEN 64 |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 131 | |
| 132 | struct dpp_curve_params { |
| 133 | const char *name; |
| 134 | size_t hash_len; |
| 135 | size_t aes_siv_key_len; |
| 136 | size_t nonce_len; |
| 137 | size_t prime_len; |
| 138 | const char *jwk_crv; |
| 139 | u16 ike_group; |
| 140 | const char *jws_alg; |
| 141 | }; |
| 142 | |
| 143 | enum dpp_bootstrap_type { |
| 144 | DPP_BOOTSTRAP_QR_CODE, |
| 145 | DPP_BOOTSTRAP_PKEX, |
Ahmed ElArabawy | 0ff61c5 | 2019-12-26 12:38:39 -0800 | [diff] [blame] | 146 | DPP_BOOTSTRAP_NFC_URI, |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 147 | }; |
| 148 | |
Sunil Ravi | a04bd25 | 2022-05-02 22:54:18 -0700 | [diff] [blame^] | 149 | enum dpp_bootstrap_supported_curves { |
| 150 | DPP_BOOTSTRAP_CURVE_P_256 = 0, |
| 151 | DPP_BOOTSTRAP_CURVE_P_384 = 1, |
| 152 | DPP_BOOTSTRAP_CURVE_P_521 = 2, |
| 153 | DPP_BOOTSTRAP_CURVE_BP_256 = 3, |
| 154 | DPP_BOOTSTRAP_CURVE_BP_384 = 4, |
| 155 | DPP_BOOTSTRAP_CURVE_BP_512 = 5, |
| 156 | }; |
| 157 | |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 158 | struct dpp_bootstrap_info { |
| 159 | struct dl_list list; |
| 160 | unsigned int id; |
| 161 | enum dpp_bootstrap_type type; |
| 162 | char *uri; |
| 163 | u8 mac_addr[ETH_ALEN]; |
Hai Shalom | fdcde76 | 2020-04-02 11:19:20 -0700 | [diff] [blame] | 164 | char *chan; |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 165 | char *info; |
Hai Shalom | fdcde76 | 2020-04-02 11:19:20 -0700 | [diff] [blame] | 166 | char *pk; |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 167 | unsigned int freq[DPP_BOOTSTRAP_MAX_FREQ]; |
| 168 | unsigned int num_freq; |
Hai Shalom | 899fcc7 | 2020-10-19 14:38:18 -0700 | [diff] [blame] | 169 | bool channels_listed; |
Hai Shalom | 4fbc08f | 2020-05-18 12:37:00 -0700 | [diff] [blame] | 170 | u8 version; |
Sunil Ravi | a04bd25 | 2022-05-02 22:54:18 -0700 | [diff] [blame^] | 171 | u8 supported_curves; /* enum dpp_bootstrap_supported_curves bitmap */ |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 172 | int own; |
Hai Shalom | a20dcd7 | 2022-02-04 13:43:00 -0800 | [diff] [blame] | 173 | struct crypto_ec_key *pubkey; |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 174 | u8 pubkey_hash[SHA256_MAC_LEN]; |
Hai Shalom | fdcde76 | 2020-04-02 11:19:20 -0700 | [diff] [blame] | 175 | u8 pubkey_hash_chirp[SHA256_MAC_LEN]; |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 176 | const struct dpp_curve_params *curve; |
Roshan Pius | 3a1667e | 2018-07-03 15:17:14 -0700 | [diff] [blame] | 177 | unsigned int pkex_t; /* number of failures before dpp_pkex |
| 178 | * instantiation */ |
Hai Shalom | b755a2a | 2020-04-23 21:49:02 -0700 | [diff] [blame] | 179 | int nfc_negotiated; /* whether this has been used in NFC negotiated |
| 180 | * connection handover */ |
Hai Shalom | fdcde76 | 2020-04-02 11:19:20 -0700 | [diff] [blame] | 181 | char *configurator_params; |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 182 | }; |
| 183 | |
Roshan Pius | 3a1667e | 2018-07-03 15:17:14 -0700 | [diff] [blame] | 184 | #define PKEX_COUNTER_T_LIMIT 5 |
| 185 | |
Sunil Ravi | a04bd25 | 2022-05-02 22:54:18 -0700 | [diff] [blame^] | 186 | enum dpp_pkex_ver { |
| 187 | PKEX_VER_AUTO, |
| 188 | PKEX_VER_ONLY_1, |
| 189 | PKEX_VER_ONLY_2, |
| 190 | }; |
| 191 | |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 192 | struct dpp_pkex { |
Roshan Pius | 3a1667e | 2018-07-03 15:17:14 -0700 | [diff] [blame] | 193 | void *msg_ctx; |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 194 | unsigned int initiator:1; |
| 195 | unsigned int exchange_done:1; |
Roshan Pius | 3a1667e | 2018-07-03 15:17:14 -0700 | [diff] [blame] | 196 | unsigned int failed:1; |
Hai Shalom | a20dcd7 | 2022-02-04 13:43:00 -0800 | [diff] [blame] | 197 | unsigned int v2:1; |
| 198 | unsigned int forced_ver:1; |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 199 | struct dpp_bootstrap_info *own_bi; |
| 200 | u8 own_mac[ETH_ALEN]; |
| 201 | u8 peer_mac[ETH_ALEN]; |
| 202 | char *identifier; |
| 203 | char *code; |
Hai Shalom | a20dcd7 | 2022-02-04 13:43:00 -0800 | [diff] [blame] | 204 | struct crypto_ec_key *x; |
| 205 | struct crypto_ec_key *y; |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 206 | u8 Mx[DPP_MAX_SHARED_SECRET_LEN]; |
| 207 | u8 Nx[DPP_MAX_SHARED_SECRET_LEN]; |
| 208 | u8 z[DPP_MAX_HASH_LEN]; |
Hai Shalom | a20dcd7 | 2022-02-04 13:43:00 -0800 | [diff] [blame] | 209 | struct crypto_ec_key *peer_bootstrap_key; |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 210 | struct wpabuf *exchange_req; |
| 211 | struct wpabuf *exchange_resp; |
Roshan Pius | 3a1667e | 2018-07-03 15:17:14 -0700 | [diff] [blame] | 212 | unsigned int t; /* number of failures on code use */ |
| 213 | unsigned int exch_req_wait_time; |
| 214 | unsigned int exch_req_tries; |
| 215 | unsigned int freq; |
Hai Shalom | a20dcd7 | 2022-02-04 13:43:00 -0800 | [diff] [blame] | 216 | u8 peer_version; |
Roshan Pius | 3a1667e | 2018-07-03 15:17:14 -0700 | [diff] [blame] | 217 | }; |
| 218 | |
| 219 | enum dpp_akm { |
| 220 | DPP_AKM_UNKNOWN, |
| 221 | DPP_AKM_DPP, |
| 222 | DPP_AKM_PSK, |
| 223 | DPP_AKM_SAE, |
Hai Shalom | 021b0b5 | 2019-04-10 11:17:58 -0700 | [diff] [blame] | 224 | DPP_AKM_PSK_SAE, |
| 225 | DPP_AKM_SAE_DPP, |
| 226 | DPP_AKM_PSK_SAE_DPP, |
Hai Shalom | 899fcc7 | 2020-10-19 14:38:18 -0700 | [diff] [blame] | 227 | DPP_AKM_DOT1X, |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 228 | }; |
| 229 | |
Hai Shalom | c356592 | 2019-10-28 11:58:20 -0700 | [diff] [blame] | 230 | enum dpp_netrole { |
| 231 | DPP_NETROLE_STA, |
| 232 | DPP_NETROLE_AP, |
Ahmed ElArabawy | 0ff61c5 | 2019-12-26 12:38:39 -0800 | [diff] [blame] | 233 | DPP_NETROLE_CONFIGURATOR, |
Hai Shalom | c356592 | 2019-10-28 11:58:20 -0700 | [diff] [blame] | 234 | }; |
| 235 | |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 236 | struct dpp_configuration { |
| 237 | u8 ssid[32]; |
| 238 | size_t ssid_len; |
Ahmed ElArabawy | 0ff61c5 | 2019-12-26 12:38:39 -0800 | [diff] [blame] | 239 | int ssid_charset; |
Roshan Pius | 3a1667e | 2018-07-03 15:17:14 -0700 | [diff] [blame] | 240 | enum dpp_akm akm; |
Hai Shalom | c356592 | 2019-10-28 11:58:20 -0700 | [diff] [blame] | 241 | enum dpp_netrole netrole; |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 242 | |
| 243 | /* For DPP configuration (connector) */ |
| 244 | os_time_t netaccesskey_expiry; |
| 245 | |
| 246 | /* TODO: groups */ |
Hai Shalom | ce48b4a | 2018-09-05 11:41:35 -0700 | [diff] [blame] | 247 | char *group_id; |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 248 | |
| 249 | /* For legacy configuration */ |
| 250 | char *passphrase; |
| 251 | u8 psk[32]; |
Hai Shalom | 021b0b5 | 2019-04-10 11:17:58 -0700 | [diff] [blame] | 252 | int psk_set; |
Hai Shalom | 899fcc7 | 2020-10-19 14:38:18 -0700 | [diff] [blame] | 253 | |
| 254 | char *csrattrs; |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 255 | }; |
| 256 | |
Hai Shalom | fdcde76 | 2020-04-02 11:19:20 -0700 | [diff] [blame] | 257 | struct dpp_asymmetric_key { |
| 258 | struct dpp_asymmetric_key *next; |
Hai Shalom | a20dcd7 | 2022-02-04 13:43:00 -0800 | [diff] [blame] | 259 | struct crypto_ec_key *csign; |
| 260 | struct crypto_ec_key *pp_key; |
Hai Shalom | fdcde76 | 2020-04-02 11:19:20 -0700 | [diff] [blame] | 261 | char *config_template; |
| 262 | char *connector_template; |
| 263 | }; |
| 264 | |
Hai Shalom | c356592 | 2019-10-28 11:58:20 -0700 | [diff] [blame] | 265 | #define DPP_MAX_CONF_OBJ 10 |
Hai Shalom | 0676811 | 2019-12-04 15:49:43 -0800 | [diff] [blame] | 266 | #define DPP_MAX_CHANNELS 32 |
Hai Shalom | c356592 | 2019-10-28 11:58:20 -0700 | [diff] [blame] | 267 | |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 268 | struct dpp_authentication { |
Hai Shalom | fdcde76 | 2020-04-02 11:19:20 -0700 | [diff] [blame] | 269 | struct dpp_global *global; |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 270 | void *msg_ctx; |
Hai Shalom | 021b0b5 | 2019-04-10 11:17:58 -0700 | [diff] [blame] | 271 | u8 peer_version; |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 272 | const struct dpp_curve_params *curve; |
Sunil Ravi | a04bd25 | 2022-05-02 22:54:18 -0700 | [diff] [blame^] | 273 | const struct dpp_curve_params *new_curve; |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 274 | struct dpp_bootstrap_info *peer_bi; |
| 275 | struct dpp_bootstrap_info *own_bi; |
Roshan Pius | 3a1667e | 2018-07-03 15:17:14 -0700 | [diff] [blame] | 276 | struct dpp_bootstrap_info *tmp_own_bi; |
Hai Shalom | 899fcc7 | 2020-10-19 14:38:18 -0700 | [diff] [blame] | 277 | struct dpp_bootstrap_info *tmp_peer_bi; |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 278 | u8 waiting_pubkey_hash[SHA256_MAC_LEN]; |
| 279 | int response_pending; |
Hai Shalom | 4fbc08f | 2020-05-18 12:37:00 -0700 | [diff] [blame] | 280 | int reconfig; |
| 281 | enum dpp_connector_key reconfig_connector_key; |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 282 | enum dpp_status_error auth_resp_status; |
Hai Shalom | 021b0b5 | 2019-04-10 11:17:58 -0700 | [diff] [blame] | 283 | enum dpp_status_error conf_resp_status; |
Hai Shalom | 899fcc7 | 2020-10-19 14:38:18 -0700 | [diff] [blame] | 284 | enum dpp_status_error force_conf_resp_status; |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 285 | u8 peer_mac_addr[ETH_ALEN]; |
| 286 | u8 i_nonce[DPP_MAX_NONCE_LEN]; |
| 287 | u8 r_nonce[DPP_MAX_NONCE_LEN]; |
| 288 | u8 e_nonce[DPP_MAX_NONCE_LEN]; |
Hai Shalom | 899fcc7 | 2020-10-19 14:38:18 -0700 | [diff] [blame] | 289 | u8 c_nonce[DPP_MAX_NONCE_LEN]; |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 290 | u8 i_capab; |
| 291 | u8 r_capab; |
Hai Shalom | 899fcc7 | 2020-10-19 14:38:18 -0700 | [diff] [blame] | 292 | enum dpp_netrole e_netrole; |
Hai Shalom | a20dcd7 | 2022-02-04 13:43:00 -0800 | [diff] [blame] | 293 | struct crypto_ec_key *own_protocol_key; |
| 294 | struct crypto_ec_key *peer_protocol_key; |
| 295 | struct crypto_ec_key *reconfig_old_protocol_key; |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 296 | struct wpabuf *req_msg; |
| 297 | struct wpabuf *resp_msg; |
Hai Shalom | 4fbc08f | 2020-05-18 12:37:00 -0700 | [diff] [blame] | 298 | struct wpabuf *reconfig_req_msg; |
| 299 | struct wpabuf *reconfig_resp_msg; |
Roshan Pius | 3a1667e | 2018-07-03 15:17:14 -0700 | [diff] [blame] | 300 | /* Intersection of possible frequencies for initiating DPP |
| 301 | * Authentication exchange */ |
| 302 | unsigned int freq[DPP_BOOTSTRAP_MAX_FREQ]; |
| 303 | unsigned int num_freq, freq_idx; |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 304 | unsigned int curr_freq; |
Roshan Pius | 3a1667e | 2018-07-03 15:17:14 -0700 | [diff] [blame] | 305 | unsigned int neg_freq; |
| 306 | unsigned int num_freq_iters; |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 307 | size_t secret_len; |
| 308 | u8 Mx[DPP_MAX_SHARED_SECRET_LEN]; |
Roshan Pius | 3a1667e | 2018-07-03 15:17:14 -0700 | [diff] [blame] | 309 | size_t Mx_len; |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 310 | u8 Nx[DPP_MAX_SHARED_SECRET_LEN]; |
Roshan Pius | 3a1667e | 2018-07-03 15:17:14 -0700 | [diff] [blame] | 311 | size_t Nx_len; |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 312 | u8 Lx[DPP_MAX_SHARED_SECRET_LEN]; |
Roshan Pius | 3a1667e | 2018-07-03 15:17:14 -0700 | [diff] [blame] | 313 | size_t Lx_len; |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 314 | u8 k1[DPP_MAX_HASH_LEN]; |
| 315 | u8 k2[DPP_MAX_HASH_LEN]; |
| 316 | u8 ke[DPP_MAX_HASH_LEN]; |
Hai Shalom | 4fbc08f | 2020-05-18 12:37:00 -0700 | [diff] [blame] | 317 | u8 bk[DPP_MAX_HASH_LEN]; |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 318 | int initiator; |
Roshan Pius | 3a1667e | 2018-07-03 15:17:14 -0700 | [diff] [blame] | 319 | int waiting_auth_resp; |
| 320 | int waiting_auth_conf; |
| 321 | int auth_req_ack; |
| 322 | unsigned int auth_resp_tries; |
| 323 | u8 allowed_roles; |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 324 | int configurator; |
| 325 | int remove_on_tx_status; |
Hai Shalom | 021b0b5 | 2019-04-10 11:17:58 -0700 | [diff] [blame] | 326 | int connect_on_tx_status; |
| 327 | int waiting_conf_result; |
Hai Shalom | c356592 | 2019-10-28 11:58:20 -0700 | [diff] [blame] | 328 | int waiting_conn_status_result; |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 329 | int auth_success; |
Hai Shalom | 4fbc08f | 2020-05-18 12:37:00 -0700 | [diff] [blame] | 330 | bool reconfig_success; |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 331 | struct wpabuf *conf_req; |
Roshan Pius | 3a1667e | 2018-07-03 15:17:14 -0700 | [diff] [blame] | 332 | const struct wpabuf *conf_resp; /* owned by GAS server */ |
Hai Shalom | 899fcc7 | 2020-10-19 14:38:18 -0700 | [diff] [blame] | 333 | struct wpabuf *conf_resp_tcp; |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 334 | struct dpp_configuration *conf_ap; |
Hai Shalom | c356592 | 2019-10-28 11:58:20 -0700 | [diff] [blame] | 335 | struct dpp_configuration *conf2_ap; |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 336 | struct dpp_configuration *conf_sta; |
Hai Shalom | c356592 | 2019-10-28 11:58:20 -0700 | [diff] [blame] | 337 | struct dpp_configuration *conf2_sta; |
Hai Shalom | fdcde76 | 2020-04-02 11:19:20 -0700 | [diff] [blame] | 338 | int provision_configurator; |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 339 | struct dpp_configurator *conf; |
Hai Shalom | c356592 | 2019-10-28 11:58:20 -0700 | [diff] [blame] | 340 | struct dpp_config_obj { |
| 341 | char *connector; /* received signedConnector */ |
| 342 | u8 ssid[SSID_MAX_LEN]; |
| 343 | u8 ssid_len; |
Ahmed ElArabawy | 0ff61c5 | 2019-12-26 12:38:39 -0800 | [diff] [blame] | 344 | int ssid_charset; |
Hai Shalom | c356592 | 2019-10-28 11:58:20 -0700 | [diff] [blame] | 345 | char passphrase[64]; |
| 346 | u8 psk[PMK_LEN]; |
| 347 | int psk_set; |
| 348 | enum dpp_akm akm; |
| 349 | struct wpabuf *c_sign_key; |
Hai Shalom | 899fcc7 | 2020-10-19 14:38:18 -0700 | [diff] [blame] | 350 | struct wpabuf *certbag; |
| 351 | struct wpabuf *certs; |
| 352 | struct wpabuf *cacert; |
| 353 | char *server_name; |
| 354 | struct wpabuf *pp_key; |
Hai Shalom | c356592 | 2019-10-28 11:58:20 -0700 | [diff] [blame] | 355 | } conf_obj[DPP_MAX_CONF_OBJ]; |
| 356 | unsigned int num_conf_obj; |
Hai Shalom | fdcde76 | 2020-04-02 11:19:20 -0700 | [diff] [blame] | 357 | struct dpp_asymmetric_key *conf_key_pkg; |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 358 | struct wpabuf *net_access_key; |
| 359 | os_time_t net_access_key_expiry; |
Hai Shalom | c356592 | 2019-10-28 11:58:20 -0700 | [diff] [blame] | 360 | int send_conn_status; |
| 361 | int conn_status_requested; |
| 362 | int akm_use_selector; |
Hai Shalom | fdcde76 | 2020-04-02 11:19:20 -0700 | [diff] [blame] | 363 | int configurator_set; |
Hai Shalom | 4fbc08f | 2020-05-18 12:37:00 -0700 | [diff] [blame] | 364 | u8 transaction_id; |
Hai Shalom | 899fcc7 | 2020-10-19 14:38:18 -0700 | [diff] [blame] | 365 | u8 *csrattrs; |
| 366 | size_t csrattrs_len; |
| 367 | bool waiting_csr; |
| 368 | struct wpabuf *csr; |
| 369 | struct wpabuf *priv_key; /* DER-encoded private key used for csr */ |
| 370 | bool waiting_cert; |
| 371 | char *trusted_eap_server_name; |
| 372 | struct wpabuf *cacert; |
| 373 | struct wpabuf *certbag; |
Sunil Ravi | a04bd25 | 2022-05-02 22:54:18 -0700 | [diff] [blame^] | 374 | bool waiting_new_key; |
| 375 | bool new_key_received; |
Hai Shalom | a20dcd7 | 2022-02-04 13:43:00 -0800 | [diff] [blame] | 376 | void *config_resp_ctx; |
Hai Shalom | 6084025 | 2021-02-19 19:02:11 -0800 | [diff] [blame] | 377 | void *gas_server_ctx; |
Hai Shalom | a20dcd7 | 2022-02-04 13:43:00 -0800 | [diff] [blame] | 378 | bool use_config_query; |
| 379 | bool waiting_config; |
| 380 | char *e_name; |
| 381 | char *e_mud_url; |
| 382 | int *e_band_support; |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 383 | #ifdef CONFIG_TESTING_OPTIONS |
| 384 | char *config_obj_override; |
| 385 | char *discovery_override; |
| 386 | char *groups_override; |
| 387 | unsigned int ignore_netaccesskey_mismatch:1; |
| 388 | #endif /* CONFIG_TESTING_OPTIONS */ |
Hai Shalom | 0676811 | 2019-12-04 15:49:43 -0800 | [diff] [blame] | 389 | unsigned short band_list[DPP_MAX_CHANNELS]; |
| 390 | int band_list_size; |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 391 | }; |
| 392 | |
| 393 | struct dpp_configurator { |
| 394 | struct dl_list list; |
| 395 | unsigned int id; |
| 396 | int own; |
Hai Shalom | a20dcd7 | 2022-02-04 13:43:00 -0800 | [diff] [blame] | 397 | struct crypto_ec_key *csign; |
Hai Shalom | 4fbc08f | 2020-05-18 12:37:00 -0700 | [diff] [blame] | 398 | u8 kid_hash[SHA256_MAC_LEN]; |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 399 | char *kid; |
| 400 | const struct dpp_curve_params *curve; |
Sunil Ravi | a04bd25 | 2022-05-02 22:54:18 -0700 | [diff] [blame^] | 401 | const struct dpp_curve_params *net_access_key_curve; |
Hai Shalom | 4fbc08f | 2020-05-18 12:37:00 -0700 | [diff] [blame] | 402 | char *connector; /* own Connector for reconfiguration */ |
Hai Shalom | a20dcd7 | 2022-02-04 13:43:00 -0800 | [diff] [blame] | 403 | struct crypto_ec_key *connector_key; |
| 404 | struct crypto_ec_key *pp_key; |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 405 | }; |
| 406 | |
| 407 | struct dpp_introduction { |
| 408 | u8 pmkid[PMKID_LEN]; |
| 409 | u8 pmk[PMK_LEN_MAX]; |
| 410 | size_t pmk_len; |
Hai Shalom | a20dcd7 | 2022-02-04 13:43:00 -0800 | [diff] [blame] | 411 | int peer_version; |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 412 | }; |
| 413 | |
Hai Shalom | 81f62d8 | 2019-07-22 12:10:00 -0700 | [diff] [blame] | 414 | struct dpp_relay_config { |
| 415 | const struct hostapd_ip_addr *ipaddr; |
| 416 | const u8 *pkhash; |
| 417 | |
Hai Shalom | 899fcc7 | 2020-10-19 14:38:18 -0700 | [diff] [blame] | 418 | void *msg_ctx; |
Hai Shalom | 81f62d8 | 2019-07-22 12:10:00 -0700 | [diff] [blame] | 419 | void *cb_ctx; |
| 420 | void (*tx)(void *ctx, const u8 *addr, unsigned int freq, const u8 *msg, |
| 421 | size_t len); |
| 422 | void (*gas_resp_tx)(void *ctx, const u8 *addr, u8 dialog_token, int prot, |
| 423 | struct wpabuf *buf); |
| 424 | }; |
| 425 | |
| 426 | struct dpp_controller_config { |
| 427 | const char *configurator_params; |
| 428 | int tcp_port; |
Hai Shalom | 4fbc08f | 2020-05-18 12:37:00 -0700 | [diff] [blame] | 429 | u8 allowed_roles; |
Hai Shalom | 899fcc7 | 2020-10-19 14:38:18 -0700 | [diff] [blame] | 430 | int qr_mutual; |
| 431 | enum dpp_netrole netrole; |
| 432 | void *msg_ctx; |
| 433 | void *cb_ctx; |
| 434 | int (*process_conf_obj)(void *ctx, struct dpp_authentication *auth); |
Hai Shalom | a20dcd7 | 2022-02-04 13:43:00 -0800 | [diff] [blame] | 435 | bool (*tcp_msg_sent)(void *ctx, struct dpp_authentication *auth); |
Hai Shalom | 81f62d8 | 2019-07-22 12:10:00 -0700 | [diff] [blame] | 436 | }; |
| 437 | |
Roshan Pius | 3a1667e | 2018-07-03 15:17:14 -0700 | [diff] [blame] | 438 | #ifdef CONFIG_TESTING_OPTIONS |
| 439 | enum dpp_test_behavior { |
| 440 | DPP_TEST_DISABLED = 0, |
| 441 | DPP_TEST_AFTER_WRAPPED_DATA_AUTH_REQ = 1, |
| 442 | DPP_TEST_AFTER_WRAPPED_DATA_AUTH_RESP = 2, |
| 443 | DPP_TEST_AFTER_WRAPPED_DATA_AUTH_CONF = 3, |
| 444 | DPP_TEST_AFTER_WRAPPED_DATA_PKEX_CR_REQ = 4, |
| 445 | DPP_TEST_AFTER_WRAPPED_DATA_PKEX_CR_RESP = 5, |
| 446 | DPP_TEST_AFTER_WRAPPED_DATA_CONF_REQ = 6, |
| 447 | DPP_TEST_AFTER_WRAPPED_DATA_CONF_RESP = 7, |
| 448 | DPP_TEST_ZERO_I_CAPAB = 8, |
| 449 | DPP_TEST_ZERO_R_CAPAB = 9, |
| 450 | DPP_TEST_NO_R_BOOTSTRAP_KEY_HASH_AUTH_REQ = 10, |
| 451 | DPP_TEST_NO_I_BOOTSTRAP_KEY_HASH_AUTH_REQ = 11, |
| 452 | DPP_TEST_NO_I_PROTO_KEY_AUTH_REQ = 12, |
| 453 | DPP_TEST_NO_I_NONCE_AUTH_REQ = 13, |
| 454 | DPP_TEST_NO_I_CAPAB_AUTH_REQ = 14, |
| 455 | DPP_TEST_NO_WRAPPED_DATA_AUTH_REQ = 15, |
| 456 | DPP_TEST_NO_STATUS_AUTH_RESP = 16, |
| 457 | DPP_TEST_NO_R_BOOTSTRAP_KEY_HASH_AUTH_RESP = 17, |
| 458 | DPP_TEST_NO_I_BOOTSTRAP_KEY_HASH_AUTH_RESP = 18, |
| 459 | DPP_TEST_NO_R_PROTO_KEY_AUTH_RESP = 19, |
| 460 | DPP_TEST_NO_R_NONCE_AUTH_RESP = 20, |
| 461 | DPP_TEST_NO_I_NONCE_AUTH_RESP = 21, |
| 462 | DPP_TEST_NO_R_CAPAB_AUTH_RESP = 22, |
| 463 | DPP_TEST_NO_R_AUTH_AUTH_RESP = 23, |
| 464 | DPP_TEST_NO_WRAPPED_DATA_AUTH_RESP = 24, |
| 465 | DPP_TEST_NO_STATUS_AUTH_CONF = 25, |
| 466 | DPP_TEST_NO_R_BOOTSTRAP_KEY_HASH_AUTH_CONF = 26, |
| 467 | DPP_TEST_NO_I_BOOTSTRAP_KEY_HASH_AUTH_CONF = 27, |
| 468 | DPP_TEST_NO_I_AUTH_AUTH_CONF = 28, |
| 469 | DPP_TEST_NO_WRAPPED_DATA_AUTH_CONF = 29, |
| 470 | DPP_TEST_I_NONCE_MISMATCH_AUTH_RESP = 30, |
| 471 | DPP_TEST_INCOMPATIBLE_R_CAPAB_AUTH_RESP = 31, |
| 472 | DPP_TEST_R_AUTH_MISMATCH_AUTH_RESP = 32, |
| 473 | DPP_TEST_I_AUTH_MISMATCH_AUTH_CONF = 33, |
| 474 | DPP_TEST_NO_FINITE_CYCLIC_GROUP_PKEX_EXCHANGE_REQ = 34, |
| 475 | DPP_TEST_NO_ENCRYPTED_KEY_PKEX_EXCHANGE_REQ = 35, |
| 476 | DPP_TEST_NO_STATUS_PKEX_EXCHANGE_RESP = 36, |
| 477 | DPP_TEST_NO_ENCRYPTED_KEY_PKEX_EXCHANGE_RESP = 37, |
| 478 | DPP_TEST_NO_BOOTSTRAP_KEY_PKEX_CR_REQ = 38, |
| 479 | DPP_TEST_NO_I_AUTH_TAG_PKEX_CR_REQ = 39, |
| 480 | DPP_TEST_NO_WRAPPED_DATA_PKEX_CR_REQ = 40, |
| 481 | DPP_TEST_NO_BOOTSTRAP_KEY_PKEX_CR_RESP = 41, |
| 482 | DPP_TEST_NO_R_AUTH_TAG_PKEX_CR_RESP = 42, |
| 483 | DPP_TEST_NO_WRAPPED_DATA_PKEX_CR_RESP = 43, |
| 484 | DPP_TEST_INVALID_ENCRYPTED_KEY_PKEX_EXCHANGE_REQ = 44, |
| 485 | DPP_TEST_INVALID_ENCRYPTED_KEY_PKEX_EXCHANGE_RESP = 45, |
| 486 | DPP_TEST_INVALID_STATUS_PKEX_EXCHANGE_RESP = 46, |
| 487 | DPP_TEST_INVALID_BOOTSTRAP_KEY_PKEX_CR_REQ = 47, |
| 488 | DPP_TEST_INVALID_BOOTSTRAP_KEY_PKEX_CR_RESP = 48, |
| 489 | DPP_TEST_I_AUTH_TAG_MISMATCH_PKEX_CR_REQ = 49, |
| 490 | DPP_TEST_R_AUTH_TAG_MISMATCH_PKEX_CR_RESP = 50, |
| 491 | DPP_TEST_NO_E_NONCE_CONF_REQ = 51, |
| 492 | DPP_TEST_NO_CONFIG_ATTR_OBJ_CONF_REQ = 52, |
| 493 | DPP_TEST_NO_WRAPPED_DATA_CONF_REQ = 53, |
| 494 | DPP_TEST_NO_E_NONCE_CONF_RESP = 54, |
| 495 | DPP_TEST_NO_CONFIG_OBJ_CONF_RESP = 55, |
| 496 | DPP_TEST_NO_STATUS_CONF_RESP = 56, |
| 497 | DPP_TEST_NO_WRAPPED_DATA_CONF_RESP = 57, |
| 498 | DPP_TEST_INVALID_STATUS_CONF_RESP = 58, |
| 499 | DPP_TEST_E_NONCE_MISMATCH_CONF_RESP = 59, |
| 500 | DPP_TEST_NO_TRANSACTION_ID_PEER_DISC_REQ = 60, |
| 501 | DPP_TEST_NO_CONNECTOR_PEER_DISC_REQ = 61, |
| 502 | DPP_TEST_NO_TRANSACTION_ID_PEER_DISC_RESP = 62, |
| 503 | DPP_TEST_NO_STATUS_PEER_DISC_RESP = 63, |
| 504 | DPP_TEST_NO_CONNECTOR_PEER_DISC_RESP = 64, |
| 505 | DPP_TEST_AUTH_RESP_IN_PLACE_OF_CONF = 65, |
| 506 | DPP_TEST_INVALID_I_PROTO_KEY_AUTH_REQ = 66, |
| 507 | DPP_TEST_INVALID_R_PROTO_KEY_AUTH_RESP = 67, |
| 508 | DPP_TEST_INVALID_R_BOOTSTRAP_KEY_HASH_AUTH_REQ = 68, |
| 509 | DPP_TEST_INVALID_I_BOOTSTRAP_KEY_HASH_AUTH_REQ = 69, |
| 510 | DPP_TEST_INVALID_R_BOOTSTRAP_KEY_HASH_AUTH_RESP = 70, |
| 511 | DPP_TEST_INVALID_I_BOOTSTRAP_KEY_HASH_AUTH_RESP = 71, |
| 512 | DPP_TEST_INVALID_R_BOOTSTRAP_KEY_HASH_AUTH_CONF = 72, |
| 513 | DPP_TEST_INVALID_I_BOOTSTRAP_KEY_HASH_AUTH_CONF = 73, |
| 514 | DPP_TEST_INVALID_STATUS_AUTH_RESP = 74, |
| 515 | DPP_TEST_INVALID_STATUS_AUTH_CONF = 75, |
| 516 | DPP_TEST_INVALID_CONFIG_ATTR_OBJ_CONF_REQ = 76, |
| 517 | DPP_TEST_INVALID_TRANSACTION_ID_PEER_DISC_RESP = 77, |
| 518 | DPP_TEST_INVALID_STATUS_PEER_DISC_RESP = 78, |
| 519 | DPP_TEST_INVALID_CONNECTOR_PEER_DISC_RESP = 79, |
| 520 | DPP_TEST_INVALID_CONNECTOR_PEER_DISC_REQ = 80, |
| 521 | DPP_TEST_INVALID_I_NONCE_AUTH_REQ = 81, |
| 522 | DPP_TEST_INVALID_TRANSACTION_ID_PEER_DISC_REQ = 82, |
| 523 | DPP_TEST_INVALID_E_NONCE_CONF_REQ = 83, |
| 524 | DPP_TEST_STOP_AT_PKEX_EXCHANGE_RESP = 84, |
| 525 | DPP_TEST_STOP_AT_PKEX_CR_REQ = 85, |
| 526 | DPP_TEST_STOP_AT_PKEX_CR_RESP = 86, |
| 527 | DPP_TEST_STOP_AT_AUTH_REQ = 87, |
| 528 | DPP_TEST_STOP_AT_AUTH_RESP = 88, |
| 529 | DPP_TEST_STOP_AT_AUTH_CONF = 89, |
| 530 | DPP_TEST_STOP_AT_CONF_REQ = 90, |
Hai Shalom | 021b0b5 | 2019-04-10 11:17:58 -0700 | [diff] [blame] | 531 | DPP_TEST_REJECT_CONFIG = 91, |
Hai Shalom | a20dcd7 | 2022-02-04 13:43:00 -0800 | [diff] [blame] | 532 | DPP_TEST_NO_PROTOCOL_VERSION_PEER_DISC_REQ = 92, |
| 533 | DPP_TEST_NO_PROTOCOL_VERSION_PEER_DISC_RESP = 93, |
| 534 | DPP_TEST_INVALID_PROTOCOL_VERSION_PEER_DISC_REQ = 94, |
| 535 | DPP_TEST_INVALID_PROTOCOL_VERSION_PEER_DISC_RESP = 95, |
Sunil Ravi | a04bd25 | 2022-05-02 22:54:18 -0700 | [diff] [blame^] | 536 | DPP_TEST_INVALID_PROTOCOL_VERSION_RECONFIG_AUTH_REQ = 96, |
| 537 | DPP_TEST_NO_PROTOCOL_VERSION_RECONFIG_AUTH_REQ = 97, |
Roshan Pius | 3a1667e | 2018-07-03 15:17:14 -0700 | [diff] [blame] | 538 | }; |
| 539 | |
| 540 | extern enum dpp_test_behavior dpp_test; |
| 541 | extern u8 dpp_pkex_own_mac_override[ETH_ALEN]; |
| 542 | extern u8 dpp_pkex_peer_mac_override[ETH_ALEN]; |
| 543 | extern u8 dpp_pkex_ephemeral_key_override[600]; |
| 544 | extern size_t dpp_pkex_ephemeral_key_override_len; |
| 545 | extern u8 dpp_protocol_key_override[600]; |
| 546 | extern size_t dpp_protocol_key_override_len; |
| 547 | extern u8 dpp_nonce_override[DPP_MAX_NONCE_LEN]; |
| 548 | extern size_t dpp_nonce_override_len; |
| 549 | #endif /* CONFIG_TESTING_OPTIONS */ |
| 550 | |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 551 | void dpp_bootstrap_info_free(struct dpp_bootstrap_info *info); |
| 552 | const char * dpp_bootstrap_type_txt(enum dpp_bootstrap_type type); |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 553 | int dpp_parse_uri_chan_list(struct dpp_bootstrap_info *bi, |
| 554 | const char *chan_list); |
| 555 | int dpp_parse_uri_mac(struct dpp_bootstrap_info *bi, const char *mac); |
| 556 | int dpp_parse_uri_info(struct dpp_bootstrap_info *bi, const char *info); |
Hai Shalom | fdcde76 | 2020-04-02 11:19:20 -0700 | [diff] [blame] | 557 | int dpp_nfc_update_bi(struct dpp_bootstrap_info *own_bi, |
| 558 | struct dpp_bootstrap_info *peer_bi); |
Hai Shalom | a20dcd7 | 2022-02-04 13:43:00 -0800 | [diff] [blame] | 559 | const char * dpp_netrole_str(enum dpp_netrole netrole); |
Hai Shalom | fdcde76 | 2020-04-02 11:19:20 -0700 | [diff] [blame] | 560 | struct dpp_authentication * |
| 561 | dpp_alloc_auth(struct dpp_global *dpp, void *msg_ctx); |
Roshan Pius | 3a1667e | 2018-07-03 15:17:14 -0700 | [diff] [blame] | 562 | struct hostapd_hw_modes; |
Hai Shalom | fdcde76 | 2020-04-02 11:19:20 -0700 | [diff] [blame] | 563 | struct dpp_authentication * dpp_auth_init(struct dpp_global *dpp, void *msg_ctx, |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 564 | struct dpp_bootstrap_info *peer_bi, |
| 565 | struct dpp_bootstrap_info *own_bi, |
Roshan Pius | 3a1667e | 2018-07-03 15:17:14 -0700 | [diff] [blame] | 566 | u8 dpp_allowed_roles, |
| 567 | unsigned int neg_freq, |
| 568 | struct hostapd_hw_modes *own_modes, |
| 569 | u16 num_modes); |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 570 | struct dpp_authentication * |
Hai Shalom | fdcde76 | 2020-04-02 11:19:20 -0700 | [diff] [blame] | 571 | dpp_auth_req_rx(struct dpp_global *dpp, void *msg_ctx, u8 dpp_allowed_roles, |
| 572 | int qr_mutual, struct dpp_bootstrap_info *peer_bi, |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 573 | struct dpp_bootstrap_info *own_bi, |
| 574 | unsigned int freq, const u8 *hdr, const u8 *attr_start, |
Roshan Pius | 3a1667e | 2018-07-03 15:17:14 -0700 | [diff] [blame] | 575 | size_t attr_len); |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 576 | struct wpabuf * |
| 577 | dpp_auth_resp_rx(struct dpp_authentication *auth, const u8 *hdr, |
| 578 | const u8 *attr_start, size_t attr_len); |
| 579 | struct wpabuf * dpp_build_conf_req(struct dpp_authentication *auth, |
| 580 | const char *json); |
Hai Shalom | c356592 | 2019-10-28 11:58:20 -0700 | [diff] [blame] | 581 | struct wpabuf * dpp_build_conf_req_helper(struct dpp_authentication *auth, |
Ahmed ElArabawy | 0ff61c5 | 2019-12-26 12:38:39 -0800 | [diff] [blame] | 582 | const char *name, |
| 583 | enum dpp_netrole netrole, |
Hai Shalom | c356592 | 2019-10-28 11:58:20 -0700 | [diff] [blame] | 584 | const char *mud_url, int *opclasses); |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 585 | int dpp_auth_conf_rx(struct dpp_authentication *auth, const u8 *hdr, |
| 586 | const u8 *attr_start, size_t attr_len); |
| 587 | int dpp_notify_new_qr_code(struct dpp_authentication *auth, |
| 588 | struct dpp_bootstrap_info *peer_bi); |
Hai Shalom | a20dcd7 | 2022-02-04 13:43:00 -0800 | [diff] [blame] | 589 | void dpp_controller_pkex_add(struct dpp_global *dpp, |
| 590 | struct dpp_bootstrap_info *bi, |
| 591 | const char *code, const char *identifier); |
Hai Shalom | 021b0b5 | 2019-04-10 11:17:58 -0700 | [diff] [blame] | 592 | struct dpp_configuration * dpp_configuration_alloc(const char *type); |
| 593 | int dpp_akm_psk(enum dpp_akm akm); |
| 594 | int dpp_akm_sae(enum dpp_akm akm); |
| 595 | int dpp_akm_legacy(enum dpp_akm akm); |
| 596 | int dpp_akm_dpp(enum dpp_akm akm); |
| 597 | int dpp_akm_ver2(enum dpp_akm akm); |
| 598 | int dpp_configuration_valid(const struct dpp_configuration *conf); |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 599 | void dpp_configuration_free(struct dpp_configuration *conf); |
Hai Shalom | fdcde76 | 2020-04-02 11:19:20 -0700 | [diff] [blame] | 600 | int dpp_set_configurator(struct dpp_authentication *auth, const char *cmd); |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 601 | void dpp_auth_deinit(struct dpp_authentication *auth); |
| 602 | struct wpabuf * |
Hai Shalom | 899fcc7 | 2020-10-19 14:38:18 -0700 | [diff] [blame] | 603 | dpp_build_conf_resp(struct dpp_authentication *auth, const u8 *e_nonce, |
| 604 | u16 e_nonce_len, enum dpp_netrole netrole, |
| 605 | bool cert_req); |
| 606 | struct wpabuf * |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 607 | dpp_conf_req_rx(struct dpp_authentication *auth, const u8 *attr_start, |
| 608 | size_t attr_len); |
| 609 | int dpp_conf_resp_rx(struct dpp_authentication *auth, |
| 610 | const struct wpabuf *resp); |
Hai Shalom | 021b0b5 | 2019-04-10 11:17:58 -0700 | [diff] [blame] | 611 | enum dpp_status_error dpp_conf_result_rx(struct dpp_authentication *auth, |
| 612 | const u8 *hdr, |
| 613 | const u8 *attr_start, size_t attr_len); |
| 614 | struct wpabuf * dpp_build_conf_result(struct dpp_authentication *auth, |
| 615 | enum dpp_status_error status); |
Hai Shalom | c356592 | 2019-10-28 11:58:20 -0700 | [diff] [blame] | 616 | enum dpp_status_error dpp_conn_status_result_rx(struct dpp_authentication *auth, |
| 617 | const u8 *hdr, |
| 618 | const u8 *attr_start, |
| 619 | size_t attr_len, |
| 620 | u8 *ssid, size_t *ssid_len, |
| 621 | char **channel_list); |
| 622 | struct wpabuf * dpp_build_conn_status_result(struct dpp_authentication *auth, |
| 623 | enum dpp_status_error result, |
| 624 | const u8 *ssid, size_t ssid_len, |
| 625 | const char *channel_list); |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 626 | struct wpabuf * dpp_alloc_msg(enum dpp_public_action_frame_type type, |
| 627 | size_t len); |
| 628 | const u8 * dpp_get_attr(const u8 *buf, size_t len, u16 req_id, u16 *ret_len); |
| 629 | int dpp_check_attrs(const u8 *buf, size_t len); |
| 630 | int dpp_key_expired(const char *timestamp, os_time_t *expiry); |
Roshan Pius | 3a1667e | 2018-07-03 15:17:14 -0700 | [diff] [blame] | 631 | const char * dpp_akm_str(enum dpp_akm akm); |
Hai Shalom | c356592 | 2019-10-28 11:58:20 -0700 | [diff] [blame] | 632 | const char * dpp_akm_selector_str(enum dpp_akm akm); |
Roshan Pius | 3a1667e | 2018-07-03 15:17:14 -0700 | [diff] [blame] | 633 | int dpp_configurator_get_key(const struct dpp_configurator *conf, char *buf, |
| 634 | size_t buflen); |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 635 | void dpp_configurator_free(struct dpp_configurator *conf); |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 636 | int dpp_configurator_own_config(struct dpp_authentication *auth, |
Roshan Pius | 3a1667e | 2018-07-03 15:17:14 -0700 | [diff] [blame] | 637 | const char *curve, int ap); |
| 638 | enum dpp_status_error |
| 639 | dpp_peer_intro(struct dpp_introduction *intro, const char *own_connector, |
| 640 | const u8 *net_access_key, size_t net_access_key_len, |
| 641 | const u8 *csign_key, size_t csign_key_len, |
| 642 | const u8 *peer_connector, size_t peer_connector_len, |
| 643 | os_time_t *expiry); |
Hai Shalom | a20dcd7 | 2022-02-04 13:43:00 -0800 | [diff] [blame] | 644 | int dpp_get_connector_version(const char *connector); |
Roshan Pius | 3a1667e | 2018-07-03 15:17:14 -0700 | [diff] [blame] | 645 | struct dpp_pkex * dpp_pkex_init(void *msg_ctx, struct dpp_bootstrap_info *bi, |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 646 | const u8 *own_mac, |
Hai Shalom | a20dcd7 | 2022-02-04 13:43:00 -0800 | [diff] [blame] | 647 | const char *identifier, const char *code, |
| 648 | bool v2); |
Roshan Pius | 3a1667e | 2018-07-03 15:17:14 -0700 | [diff] [blame] | 649 | struct dpp_pkex * dpp_pkex_rx_exchange_req(void *msg_ctx, |
| 650 | struct dpp_bootstrap_info *bi, |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 651 | const u8 *own_mac, |
| 652 | const u8 *peer_mac, |
| 653 | const char *identifier, |
| 654 | const char *code, |
Hai Shalom | a20dcd7 | 2022-02-04 13:43:00 -0800 | [diff] [blame] | 655 | const u8 *buf, size_t len, bool v2); |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 656 | struct wpabuf * dpp_pkex_rx_exchange_resp(struct dpp_pkex *pkex, |
Roshan Pius | 3a1667e | 2018-07-03 15:17:14 -0700 | [diff] [blame] | 657 | const u8 *peer_mac, |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 658 | const u8 *buf, size_t len); |
| 659 | struct wpabuf * dpp_pkex_rx_commit_reveal_req(struct dpp_pkex *pkex, |
| 660 | const u8 *hdr, |
| 661 | const u8 *buf, size_t len); |
| 662 | int dpp_pkex_rx_commit_reveal_resp(struct dpp_pkex *pkex, const u8 *hdr, |
| 663 | const u8 *buf, size_t len); |
| 664 | void dpp_pkex_free(struct dpp_pkex *pkex); |
| 665 | |
Roshan Pius | 3a1667e | 2018-07-03 15:17:14 -0700 | [diff] [blame] | 666 | char * dpp_corrupt_connector_signature(const char *connector); |
| 667 | |
Hai Shalom | 021b0b5 | 2019-04-10 11:17:58 -0700 | [diff] [blame] | 668 | |
| 669 | struct dpp_pfs { |
| 670 | struct crypto_ecdh *ecdh; |
| 671 | const struct dpp_curve_params *curve; |
| 672 | struct wpabuf *ie; |
| 673 | struct wpabuf *secret; |
| 674 | }; |
| 675 | |
| 676 | struct dpp_pfs * dpp_pfs_init(const u8 *net_access_key, |
| 677 | size_t net_access_key_len); |
| 678 | int dpp_pfs_process(struct dpp_pfs *pfs, const u8 *peer_ie, size_t peer_ie_len); |
| 679 | void dpp_pfs_free(struct dpp_pfs *pfs); |
| 680 | |
Hai Shalom | 899fcc7 | 2020-10-19 14:38:18 -0700 | [diff] [blame] | 681 | struct wpabuf * dpp_build_csr(struct dpp_authentication *auth, |
| 682 | const char *name); |
Hai Shalom | 899fcc7 | 2020-10-19 14:38:18 -0700 | [diff] [blame] | 683 | int dpp_validate_csr(struct dpp_authentication *auth, const struct wpabuf *csr); |
| 684 | |
Hai Shalom | 021b0b5 | 2019-04-10 11:17:58 -0700 | [diff] [blame] | 685 | struct dpp_bootstrap_info * dpp_add_qr_code(struct dpp_global *dpp, |
| 686 | const char *uri); |
Ahmed ElArabawy | 0ff61c5 | 2019-12-26 12:38:39 -0800 | [diff] [blame] | 687 | struct dpp_bootstrap_info * dpp_add_nfc_uri(struct dpp_global *dpp, |
| 688 | const char *uri); |
Hai Shalom | 021b0b5 | 2019-04-10 11:17:58 -0700 | [diff] [blame] | 689 | int dpp_bootstrap_gen(struct dpp_global *dpp, const char *cmd); |
| 690 | struct dpp_bootstrap_info * |
| 691 | dpp_bootstrap_get_id(struct dpp_global *dpp, unsigned int id); |
| 692 | int dpp_bootstrap_remove(struct dpp_global *dpp, const char *id); |
| 693 | struct dpp_bootstrap_info * |
| 694 | dpp_pkex_finish(struct dpp_global *dpp, struct dpp_pkex *pkex, const u8 *peer, |
| 695 | unsigned int freq); |
| 696 | const char * dpp_bootstrap_get_uri(struct dpp_global *dpp, unsigned int id); |
| 697 | int dpp_bootstrap_info(struct dpp_global *dpp, int id, |
| 698 | char *reply, int reply_size); |
Hai Shalom | fdcde76 | 2020-04-02 11:19:20 -0700 | [diff] [blame] | 699 | int dpp_bootstrap_set(struct dpp_global *dpp, int id, const char *params); |
Hai Shalom | 021b0b5 | 2019-04-10 11:17:58 -0700 | [diff] [blame] | 700 | void dpp_bootstrap_find_pair(struct dpp_global *dpp, const u8 *i_bootstrap, |
| 701 | const u8 *r_bootstrap, |
| 702 | struct dpp_bootstrap_info **own_bi, |
| 703 | struct dpp_bootstrap_info **peer_bi); |
Hai Shalom | fdcde76 | 2020-04-02 11:19:20 -0700 | [diff] [blame] | 704 | struct dpp_bootstrap_info * dpp_bootstrap_find_chirp(struct dpp_global *dpp, |
| 705 | const u8 *hash); |
Hai Shalom | 021b0b5 | 2019-04-10 11:17:58 -0700 | [diff] [blame] | 706 | int dpp_configurator_add(struct dpp_global *dpp, const char *cmd); |
Sunil Ravi | a04bd25 | 2022-05-02 22:54:18 -0700 | [diff] [blame^] | 707 | int dpp_configurator_set(struct dpp_global *dpp, const char *cmd); |
Hai Shalom | 021b0b5 | 2019-04-10 11:17:58 -0700 | [diff] [blame] | 708 | int dpp_configurator_remove(struct dpp_global *dpp, const char *id); |
| 709 | int dpp_configurator_get_key_id(struct dpp_global *dpp, unsigned int id, |
| 710 | char *buf, size_t buflen); |
Hai Shalom | fdcde76 | 2020-04-02 11:19:20 -0700 | [diff] [blame] | 711 | int dpp_configurator_from_backup(struct dpp_global *dpp, |
| 712 | struct dpp_asymmetric_key *key); |
Hai Shalom | 4fbc08f | 2020-05-18 12:37:00 -0700 | [diff] [blame] | 713 | struct dpp_configurator * dpp_configurator_find_kid(struct dpp_global *dpp, |
| 714 | const u8 *kid); |
Hai Shalom | 81f62d8 | 2019-07-22 12:10:00 -0700 | [diff] [blame] | 715 | int dpp_relay_add_controller(struct dpp_global *dpp, |
| 716 | struct dpp_relay_config *config); |
| 717 | int dpp_relay_rx_action(struct dpp_global *dpp, const u8 *src, const u8 *hdr, |
| 718 | const u8 *buf, size_t len, unsigned int freq, |
Hai Shalom | a20dcd7 | 2022-02-04 13:43:00 -0800 | [diff] [blame] | 719 | const u8 *i_bootstrap, const u8 *r_bootstrap, |
| 720 | void *cb_ctx); |
Hai Shalom | 81f62d8 | 2019-07-22 12:10:00 -0700 | [diff] [blame] | 721 | int dpp_relay_rx_gas_req(struct dpp_global *dpp, const u8 *src, const u8 *data, |
| 722 | size_t data_len); |
| 723 | int dpp_controller_start(struct dpp_global *dpp, |
| 724 | struct dpp_controller_config *config); |
Sunil Ravi | a04bd25 | 2022-05-02 22:54:18 -0700 | [diff] [blame^] | 725 | int dpp_controller_set_params(struct dpp_global *dpp, |
| 726 | const char *configurator_params); |
Hai Shalom | 81f62d8 | 2019-07-22 12:10:00 -0700 | [diff] [blame] | 727 | void dpp_controller_stop(struct dpp_global *dpp); |
Hai Shalom | a20dcd7 | 2022-02-04 13:43:00 -0800 | [diff] [blame] | 728 | void dpp_controller_stop_for_ctx(struct dpp_global *dpp, void *cb_ctx); |
Hai Shalom | 899fcc7 | 2020-10-19 14:38:18 -0700 | [diff] [blame] | 729 | struct dpp_authentication * dpp_controller_get_auth(struct dpp_global *dpp, |
| 730 | unsigned int id); |
| 731 | void dpp_controller_new_qr_code(struct dpp_global *dpp, |
| 732 | struct dpp_bootstrap_info *bi); |
Hai Shalom | a20dcd7 | 2022-02-04 13:43:00 -0800 | [diff] [blame] | 733 | int dpp_tcp_pkex_init(struct dpp_global *dpp, struct dpp_pkex *pkex, |
| 734 | const struct hostapd_ip_addr *addr, int port, |
| 735 | void *msg_ctx, void *cb_ctx, |
| 736 | int (*pkex_done)(void *ctx, void *conn, |
| 737 | struct dpp_bootstrap_info *bi)); |
Hai Shalom | 81f62d8 | 2019-07-22 12:10:00 -0700 | [diff] [blame] | 738 | int dpp_tcp_init(struct dpp_global *dpp, struct dpp_authentication *auth, |
Hai Shalom | 899fcc7 | 2020-10-19 14:38:18 -0700 | [diff] [blame] | 739 | const struct hostapd_ip_addr *addr, int port, |
| 740 | const char *name, enum dpp_netrole netrole, void *msg_ctx, |
| 741 | void *cb_ctx, |
| 742 | int (*process_conf_obj)(void *ctx, |
Hai Shalom | a20dcd7 | 2022-02-04 13:43:00 -0800 | [diff] [blame] | 743 | struct dpp_authentication *auth), |
| 744 | bool (*tcp_msg_sent)(void *ctx, |
| 745 | struct dpp_authentication *auth)); |
| 746 | int dpp_tcp_auth(struct dpp_global *dpp, void *_conn, |
| 747 | struct dpp_authentication *auth, const char *name, |
| 748 | enum dpp_netrole netrole, |
| 749 | int (*process_conf_obj)(void *ctx, |
| 750 | struct dpp_authentication *auth), |
| 751 | bool (*tcp_msg_sent)(void *ctx, |
| 752 | struct dpp_authentication *auth)); |
| 753 | bool dpp_tcp_conn_status_requested(struct dpp_global *dpp); |
| 754 | void dpp_tcp_send_conn_status(struct dpp_global *dpp, |
| 755 | enum dpp_status_error result, |
| 756 | const u8 *ssid, size_t ssid_len, |
| 757 | const char *channel_list); |
Hai Shalom | 899fcc7 | 2020-10-19 14:38:18 -0700 | [diff] [blame] | 758 | |
Hai Shalom | fdcde76 | 2020-04-02 11:19:20 -0700 | [diff] [blame] | 759 | struct wpabuf * dpp_build_presence_announcement(struct dpp_bootstrap_info *bi); |
Hai Shalom | 899fcc7 | 2020-10-19 14:38:18 -0700 | [diff] [blame] | 760 | void dpp_notify_chirp_received(void *msg_ctx, int id, const u8 *src, |
| 761 | unsigned int freq, const u8 *hash); |
Hai Shalom | 81f62d8 | 2019-07-22 12:10:00 -0700 | [diff] [blame] | 762 | |
| 763 | struct dpp_global_config { |
Hai Shalom | 81f62d8 | 2019-07-22 12:10:00 -0700 | [diff] [blame] | 764 | void *cb_ctx; |
Hai Shalom | fdcde76 | 2020-04-02 11:19:20 -0700 | [diff] [blame] | 765 | void (*remove_bi)(void *ctx, struct dpp_bootstrap_info *bi); |
Hai Shalom | 81f62d8 | 2019-07-22 12:10:00 -0700 | [diff] [blame] | 766 | }; |
| 767 | |
| 768 | struct dpp_global * dpp_global_init(struct dpp_global_config *config); |
Hai Shalom | 021b0b5 | 2019-04-10 11:17:58 -0700 | [diff] [blame] | 769 | void dpp_global_clear(struct dpp_global *dpp); |
| 770 | void dpp_global_deinit(struct dpp_global *dpp); |
| 771 | |
Hai Shalom | 4fbc08f | 2020-05-18 12:37:00 -0700 | [diff] [blame] | 772 | /* dpp_reconfig.c */ |
| 773 | |
| 774 | struct wpabuf * dpp_build_reconfig_announcement(const u8 *csign_key, |
Hai Shalom | 899fcc7 | 2020-10-19 14:38:18 -0700 | [diff] [blame] | 775 | size_t csign_key_len, |
| 776 | const u8 *net_access_key, |
| 777 | size_t net_access_key_len, |
| 778 | struct dpp_reconfig_id *id); |
Hai Shalom | 4fbc08f | 2020-05-18 12:37:00 -0700 | [diff] [blame] | 779 | struct dpp_authentication * |
| 780 | dpp_reconfig_init(struct dpp_global *dpp, void *msg_ctx, |
Hai Shalom | 899fcc7 | 2020-10-19 14:38:18 -0700 | [diff] [blame] | 781 | struct dpp_configurator *conf, unsigned int freq, u16 group, |
| 782 | const u8 *a_nonce_attr, size_t a_nonce_len, |
| 783 | const u8 *e_id_attr, size_t e_id_len); |
Hai Shalom | 4fbc08f | 2020-05-18 12:37:00 -0700 | [diff] [blame] | 784 | struct dpp_authentication * |
| 785 | dpp_reconfig_auth_req_rx(struct dpp_global *dpp, void *msg_ctx, |
| 786 | const char *own_connector, |
| 787 | const u8 *net_access_key, size_t net_access_key_len, |
| 788 | const u8 *csign_key, size_t csign_key_len, |
| 789 | unsigned int freq, const u8 *hdr, |
| 790 | const u8 *attr_start, size_t attr_len); |
| 791 | struct wpabuf * |
| 792 | dpp_reconfig_auth_resp_rx(struct dpp_authentication *auth, const u8 *hdr, |
| 793 | const u8 *attr_start, size_t attr_len); |
| 794 | int dpp_reconfig_auth_conf_rx(struct dpp_authentication *auth, const u8 *hdr, |
| 795 | const u8 *attr_start, size_t attr_len); |
| 796 | |
Hai Shalom | 899fcc7 | 2020-10-19 14:38:18 -0700 | [diff] [blame] | 797 | struct dpp_reconfig_id * dpp_gen_reconfig_id(const u8 *csign_key, |
| 798 | size_t csign_key_len, |
| 799 | const u8 *pp_key, |
| 800 | size_t pp_key_len); |
| 801 | int dpp_update_reconfig_id(struct dpp_reconfig_id *id); |
| 802 | void dpp_free_reconfig_id(struct dpp_reconfig_id *id); |
| 803 | |
Hai Shalom | 021b0b5 | 2019-04-10 11:17:58 -0700 | [diff] [blame] | 804 | #endif /* CONFIG_DPP */ |
Dmitry Shmidt | d2986c2 | 2017-10-23 14:22:09 -0700 | [diff] [blame] | 805 | #endif /* DPP_H */ |