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