2017-06-15 20:18:10 +02:00
|
|
|
/*
|
|
|
|
* DPP functionality shared between hostapd and wpa_supplicant
|
|
|
|
* Copyright (c) 2017, Qualcomm Atheros, Inc.
|
2019-03-13 11:18:01 +01:00
|
|
|
* Copyright (c) 2018-2019, The Linux Foundation
|
2017-06-15 20:18:10 +02:00
|
|
|
*
|
|
|
|
* This software may be distributed under the terms of the BSD license.
|
|
|
|
* See README for more details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef DPP_H
|
|
|
|
#define DPP_H
|
|
|
|
|
2019-04-08 17:07:28 +02:00
|
|
|
#ifdef CONFIG_DPP
|
2017-06-15 20:18:10 +02:00
|
|
|
#include <openssl/x509.h>
|
|
|
|
|
|
|
|
#include "utils/list.h"
|
2017-06-18 19:19:57 +02:00
|
|
|
#include "common/wpa_common.h"
|
2017-06-15 20:18:10 +02:00
|
|
|
#include "crypto/sha256.h"
|
|
|
|
|
2019-03-17 22:51:53 +01:00
|
|
|
struct crypto_ecdh;
|
2019-03-24 15:44:21 +01:00
|
|
|
struct dpp_global;
|
2019-03-17 22:51:53 +01:00
|
|
|
|
2017-10-18 21:51:30 +02:00
|
|
|
#define DPP_HDR_LEN (4 + 2) /* OUI, OUI Type, Crypto Suite, DPP frame type */
|
|
|
|
|
2017-06-15 20:18:12 +02:00
|
|
|
enum dpp_public_action_frame_type {
|
|
|
|
DPP_PA_AUTHENTICATION_REQ = 0,
|
|
|
|
DPP_PA_AUTHENTICATION_RESP = 1,
|
|
|
|
DPP_PA_AUTHENTICATION_CONF = 2,
|
|
|
|
DPP_PA_PEER_DISCOVERY_REQ = 5,
|
|
|
|
DPP_PA_PEER_DISCOVERY_RESP = 6,
|
|
|
|
DPP_PA_PKEX_EXCHANGE_REQ = 7,
|
|
|
|
DPP_PA_PKEX_EXCHANGE_RESP = 8,
|
|
|
|
DPP_PA_PKEX_COMMIT_REVEAL_REQ = 9,
|
|
|
|
DPP_PA_PKEX_COMMIT_REVEAL_RESP = 10,
|
2019-03-14 16:05:02 +01:00
|
|
|
DPP_PA_CONFIGURATION_RESULT = 11,
|
2017-06-15 20:18:12 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
enum dpp_attribute_id {
|
|
|
|
DPP_ATTR_STATUS = 0x1000,
|
|
|
|
DPP_ATTR_I_BOOTSTRAP_KEY_HASH = 0x1001,
|
|
|
|
DPP_ATTR_R_BOOTSTRAP_KEY_HASH = 0x1002,
|
|
|
|
DPP_ATTR_I_PROTOCOL_KEY = 0x1003,
|
|
|
|
DPP_ATTR_WRAPPED_DATA = 0x1004,
|
|
|
|
DPP_ATTR_I_NONCE = 0x1005,
|
|
|
|
DPP_ATTR_I_CAPABILITIES = 0x1006,
|
|
|
|
DPP_ATTR_R_NONCE = 0x1007,
|
|
|
|
DPP_ATTR_R_CAPABILITIES = 0x1008,
|
|
|
|
DPP_ATTR_R_PROTOCOL_KEY = 0x1009,
|
|
|
|
DPP_ATTR_I_AUTH_TAG = 0x100A,
|
|
|
|
DPP_ATTR_R_AUTH_TAG = 0x100B,
|
|
|
|
DPP_ATTR_CONFIG_OBJ = 0x100C,
|
|
|
|
DPP_ATTR_CONNECTOR = 0x100D,
|
|
|
|
DPP_ATTR_CONFIG_ATTR_OBJ = 0x100E,
|
|
|
|
DPP_ATTR_BOOTSTRAP_KEY = 0x100F,
|
|
|
|
DPP_ATTR_OWN_NET_NK_HASH = 0x1011,
|
|
|
|
DPP_ATTR_FINITE_CYCLIC_GROUP = 0x1012,
|
|
|
|
DPP_ATTR_ENCRYPTED_KEY = 0x1013,
|
|
|
|
DPP_ATTR_ENROLLEE_NONCE = 0x1014,
|
|
|
|
DPP_ATTR_CODE_IDENTIFIER = 0x1015,
|
2017-08-23 11:49:22 +02:00
|
|
|
DPP_ATTR_TRANSACTION_ID = 0x1016,
|
2017-10-29 15:08:02 +01:00
|
|
|
DPP_ATTR_BOOTSTRAP_INFO = 0x1017,
|
|
|
|
DPP_ATTR_CHANNEL = 0x1018,
|
2019-03-13 11:18:01 +01:00
|
|
|
DPP_ATTR_PROTOCOL_VERSION = 0x1019,
|
|
|
|
DPP_ATTR_ENVELOPED_DATA = 0x101A,
|
2017-06-15 20:18:12 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
enum dpp_status_error {
|
|
|
|
DPP_STATUS_OK = 0,
|
|
|
|
DPP_STATUS_NOT_COMPATIBLE = 1,
|
|
|
|
DPP_STATUS_AUTH_FAILURE = 2,
|
|
|
|
DPP_STATUS_UNWRAP_FAILURE = 3,
|
|
|
|
DPP_STATUS_BAD_GROUP = 4,
|
|
|
|
DPP_STATUS_CONFIGURE_FAILURE = 5,
|
|
|
|
DPP_STATUS_RESPONSE_PENDING = 6,
|
2017-10-29 10:43:41 +01:00
|
|
|
DPP_STATUS_INVALID_CONNECTOR = 7,
|
|
|
|
DPP_STATUS_NO_MATCH = 8,
|
2019-03-14 16:05:02 +01:00
|
|
|
DPP_STATUS_CONFIG_REJECTED = 9,
|
2017-06-15 20:18:12 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#define DPP_CAPAB_ENROLLEE BIT(0)
|
|
|
|
#define DPP_CAPAB_CONFIGURATOR BIT(1)
|
|
|
|
#define DPP_CAPAB_ROLE_MASK (BIT(0) | BIT(1))
|
|
|
|
|
2017-06-15 20:18:10 +02:00
|
|
|
#define DPP_BOOTSTRAP_MAX_FREQ 30
|
2017-06-15 20:18:12 +02:00
|
|
|
#define DPP_MAX_NONCE_LEN 32
|
|
|
|
#define DPP_MAX_HASH_LEN 64
|
|
|
|
#define DPP_MAX_SHARED_SECRET_LEN 66
|
2017-06-15 20:18:10 +02:00
|
|
|
|
|
|
|
struct dpp_curve_params {
|
|
|
|
const char *name;
|
|
|
|
size_t hash_len;
|
|
|
|
size_t aes_siv_key_len;
|
|
|
|
size_t nonce_len;
|
|
|
|
size_t prime_len;
|
|
|
|
const char *jwk_crv;
|
2017-07-02 11:36:23 +02:00
|
|
|
u16 ike_group;
|
2017-07-02 11:36:31 +02:00
|
|
|
const char *jws_alg;
|
2017-06-15 20:18:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
enum dpp_bootstrap_type {
|
|
|
|
DPP_BOOTSTRAP_QR_CODE,
|
2017-07-02 11:36:23 +02:00
|
|
|
DPP_BOOTSTRAP_PKEX,
|
2017-06-15 20:18:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct dpp_bootstrap_info {
|
|
|
|
struct dl_list list;
|
|
|
|
unsigned int id;
|
|
|
|
enum dpp_bootstrap_type type;
|
|
|
|
char *uri;
|
|
|
|
u8 mac_addr[ETH_ALEN];
|
|
|
|
char *info;
|
|
|
|
unsigned int freq[DPP_BOOTSTRAP_MAX_FREQ];
|
|
|
|
unsigned int num_freq;
|
|
|
|
int own;
|
|
|
|
EVP_PKEY *pubkey;
|
|
|
|
u8 pubkey_hash[SHA256_MAC_LEN];
|
|
|
|
const struct dpp_curve_params *curve;
|
2017-11-03 16:49:45 +01:00
|
|
|
unsigned int pkex_t; /* number of failures before dpp_pkex
|
|
|
|
* instantiation */
|
2017-06-15 20:18:10 +02:00
|
|
|
};
|
|
|
|
|
2017-11-03 16:49:45 +01:00
|
|
|
#define PKEX_COUNTER_T_LIMIT 5
|
|
|
|
|
2017-07-02 11:36:23 +02:00
|
|
|
struct dpp_pkex {
|
2017-11-02 11:21:00 +01:00
|
|
|
void *msg_ctx;
|
2017-07-02 11:36:23 +02:00
|
|
|
unsigned int initiator:1;
|
|
|
|
unsigned int exchange_done:1;
|
2017-11-03 15:43:58 +01:00
|
|
|
unsigned int failed:1;
|
2017-07-02 11:36:23 +02:00
|
|
|
struct dpp_bootstrap_info *own_bi;
|
|
|
|
u8 own_mac[ETH_ALEN];
|
|
|
|
u8 peer_mac[ETH_ALEN];
|
|
|
|
char *identifier;
|
|
|
|
char *code;
|
|
|
|
EVP_PKEY *x;
|
|
|
|
EVP_PKEY *y;
|
|
|
|
u8 Mx[DPP_MAX_SHARED_SECRET_LEN];
|
|
|
|
u8 Nx[DPP_MAX_SHARED_SECRET_LEN];
|
|
|
|
u8 z[DPP_MAX_HASH_LEN];
|
|
|
|
EVP_PKEY *peer_bootstrap_key;
|
|
|
|
struct wpabuf *exchange_req;
|
|
|
|
struct wpabuf *exchange_resp;
|
2017-11-03 16:49:45 +01:00
|
|
|
unsigned int t; /* number of failures on code use */
|
2017-11-22 14:54:35 +01:00
|
|
|
unsigned int exch_req_wait_time;
|
|
|
|
unsigned int exch_req_tries;
|
|
|
|
unsigned int freq;
|
2017-07-02 11:36:23 +02:00
|
|
|
};
|
|
|
|
|
2017-11-22 20:04:41 +01:00
|
|
|
enum dpp_akm {
|
|
|
|
DPP_AKM_UNKNOWN,
|
|
|
|
DPP_AKM_DPP,
|
|
|
|
DPP_AKM_PSK,
|
|
|
|
DPP_AKM_SAE,
|
2019-03-16 16:17:46 +01:00
|
|
|
DPP_AKM_PSK_SAE,
|
|
|
|
DPP_AKM_SAE_DPP,
|
|
|
|
DPP_AKM_PSK_SAE_DPP,
|
2017-11-22 20:04:41 +01:00
|
|
|
};
|
|
|
|
|
2017-06-15 20:18:15 +02:00
|
|
|
struct dpp_configuration {
|
|
|
|
u8 ssid[32];
|
|
|
|
size_t ssid_len;
|
2017-11-22 20:22:23 +01:00
|
|
|
enum dpp_akm akm;
|
2017-06-15 20:18:15 +02:00
|
|
|
|
|
|
|
/* For DPP configuration (connector) */
|
|
|
|
os_time_t netaccesskey_expiry;
|
|
|
|
|
2017-08-22 22:46:27 +02:00
|
|
|
/* TODO: groups */
|
2018-08-10 09:03:14 +02:00
|
|
|
char *group_id;
|
2017-06-15 20:18:15 +02:00
|
|
|
|
|
|
|
/* For legacy configuration */
|
|
|
|
char *passphrase;
|
|
|
|
u8 psk[32];
|
2019-03-16 11:19:10 +01:00
|
|
|
int psk_set;
|
2017-06-15 20:18:15 +02:00
|
|
|
};
|
|
|
|
|
2017-06-15 20:18:12 +02:00
|
|
|
struct dpp_authentication {
|
|
|
|
void *msg_ctx;
|
2019-03-13 11:18:01 +01:00
|
|
|
u8 peer_version;
|
2017-06-15 20:18:12 +02:00
|
|
|
const struct dpp_curve_params *curve;
|
|
|
|
struct dpp_bootstrap_info *peer_bi;
|
|
|
|
struct dpp_bootstrap_info *own_bi;
|
2017-11-26 16:41:22 +01:00
|
|
|
struct dpp_bootstrap_info *tmp_own_bi;
|
2017-06-15 20:18:12 +02:00
|
|
|
u8 waiting_pubkey_hash[SHA256_MAC_LEN];
|
|
|
|
int response_pending;
|
|
|
|
enum dpp_status_error auth_resp_status;
|
2019-03-14 16:05:02 +01:00
|
|
|
enum dpp_status_error conf_resp_status;
|
2017-06-15 20:18:12 +02:00
|
|
|
u8 peer_mac_addr[ETH_ALEN];
|
|
|
|
u8 i_nonce[DPP_MAX_NONCE_LEN];
|
|
|
|
u8 r_nonce[DPP_MAX_NONCE_LEN];
|
2017-06-15 20:18:15 +02:00
|
|
|
u8 e_nonce[DPP_MAX_NONCE_LEN];
|
2017-06-15 20:18:12 +02:00
|
|
|
u8 i_capab;
|
|
|
|
u8 r_capab;
|
|
|
|
EVP_PKEY *own_protocol_key;
|
|
|
|
EVP_PKEY *peer_protocol_key;
|
2017-10-18 21:51:30 +02:00
|
|
|
struct wpabuf *req_msg;
|
|
|
|
struct wpabuf *resp_msg;
|
2017-11-12 11:17:54 +01:00
|
|
|
/* Intersection of possible frequencies for initiating DPP
|
|
|
|
* Authentication exchange */
|
|
|
|
unsigned int freq[DPP_BOOTSTRAP_MAX_FREQ];
|
|
|
|
unsigned int num_freq, freq_idx;
|
2017-06-15 20:18:12 +02:00
|
|
|
unsigned int curr_freq;
|
2017-10-29 15:08:02 +01:00
|
|
|
unsigned int neg_freq;
|
2017-11-12 11:17:54 +01:00
|
|
|
unsigned int num_freq_iters;
|
2017-06-15 20:18:12 +02:00
|
|
|
size_t secret_len;
|
|
|
|
u8 Mx[DPP_MAX_SHARED_SECRET_LEN];
|
2018-01-13 03:12:46 +01:00
|
|
|
size_t Mx_len;
|
2017-06-15 20:18:12 +02:00
|
|
|
u8 Nx[DPP_MAX_SHARED_SECRET_LEN];
|
2018-01-13 03:12:46 +01:00
|
|
|
size_t Nx_len;
|
2017-06-15 20:18:12 +02:00
|
|
|
u8 Lx[DPP_MAX_SHARED_SECRET_LEN];
|
2018-01-13 03:12:46 +01:00
|
|
|
size_t Lx_len;
|
2017-06-15 20:18:12 +02:00
|
|
|
u8 k1[DPP_MAX_HASH_LEN];
|
|
|
|
u8 k2[DPP_MAX_HASH_LEN];
|
|
|
|
u8 ke[DPP_MAX_HASH_LEN];
|
|
|
|
int initiator;
|
2017-11-12 11:17:54 +01:00
|
|
|
int waiting_auth_resp;
|
2017-11-13 11:34:17 +01:00
|
|
|
int waiting_auth_conf;
|
2017-11-22 23:22:13 +01:00
|
|
|
int auth_req_ack;
|
2017-11-13 11:34:17 +01:00
|
|
|
unsigned int auth_resp_tries;
|
2017-11-13 10:29:45 +01:00
|
|
|
u8 allowed_roles;
|
2017-06-15 20:18:12 +02:00
|
|
|
int configurator;
|
|
|
|
int remove_on_tx_status;
|
2019-03-14 16:05:02 +01:00
|
|
|
int connect_on_tx_status;
|
|
|
|
int waiting_conf_result;
|
2017-06-15 20:18:12 +02:00
|
|
|
int auth_success;
|
2017-06-15 20:18:15 +02:00
|
|
|
struct wpabuf *conf_req;
|
2017-11-27 12:48:40 +01:00
|
|
|
const struct wpabuf *conf_resp; /* owned by GAS server */
|
2017-06-15 20:18:15 +02:00
|
|
|
struct dpp_configuration *conf_ap;
|
|
|
|
struct dpp_configuration *conf_sta;
|
|
|
|
struct dpp_configurator *conf;
|
|
|
|
char *connector; /* received signedConnector */
|
|
|
|
u8 ssid[SSID_MAX_LEN];
|
|
|
|
u8 ssid_len;
|
2017-06-21 17:01:51 +02:00
|
|
|
char passphrase[64];
|
|
|
|
u8 psk[PMK_LEN];
|
|
|
|
int psk_set;
|
2017-11-22 20:04:41 +01:00
|
|
|
enum dpp_akm akm;
|
2017-06-15 20:18:15 +02:00
|
|
|
struct wpabuf *net_access_key;
|
|
|
|
os_time_t net_access_key_expiry;
|
|
|
|
struct wpabuf *c_sign_key;
|
|
|
|
#ifdef CONFIG_TESTING_OPTIONS
|
|
|
|
char *config_obj_override;
|
|
|
|
char *discovery_override;
|
|
|
|
char *groups_override;
|
|
|
|
unsigned int ignore_netaccesskey_mismatch:1;
|
|
|
|
#endif /* CONFIG_TESTING_OPTIONS */
|
|
|
|
};
|
|
|
|
|
|
|
|
struct dpp_configurator {
|
|
|
|
struct dl_list list;
|
|
|
|
unsigned int id;
|
|
|
|
int own;
|
|
|
|
EVP_PKEY *csign;
|
|
|
|
char *kid;
|
|
|
|
const struct dpp_curve_params *curve;
|
2017-06-15 20:18:12 +02:00
|
|
|
};
|
|
|
|
|
2017-06-18 19:19:57 +02:00
|
|
|
struct dpp_introduction {
|
|
|
|
u8 pmkid[PMKID_LEN];
|
|
|
|
u8 pmk[PMK_LEN_MAX];
|
|
|
|
size_t pmk_len;
|
|
|
|
};
|
|
|
|
|
2017-10-22 10:15:21 +02:00
|
|
|
#ifdef CONFIG_TESTING_OPTIONS
|
|
|
|
enum dpp_test_behavior {
|
|
|
|
DPP_TEST_DISABLED = 0,
|
|
|
|
DPP_TEST_AFTER_WRAPPED_DATA_AUTH_REQ = 1,
|
|
|
|
DPP_TEST_AFTER_WRAPPED_DATA_AUTH_RESP = 2,
|
|
|
|
DPP_TEST_AFTER_WRAPPED_DATA_AUTH_CONF = 3,
|
|
|
|
DPP_TEST_AFTER_WRAPPED_DATA_PKEX_CR_REQ = 4,
|
|
|
|
DPP_TEST_AFTER_WRAPPED_DATA_PKEX_CR_RESP = 5,
|
|
|
|
DPP_TEST_AFTER_WRAPPED_DATA_CONF_REQ = 6,
|
|
|
|
DPP_TEST_AFTER_WRAPPED_DATA_CONF_RESP = 7,
|
|
|
|
DPP_TEST_ZERO_I_CAPAB = 8,
|
|
|
|
DPP_TEST_ZERO_R_CAPAB = 9,
|
2017-10-22 16:20:24 +02:00
|
|
|
DPP_TEST_NO_R_BOOTSTRAP_KEY_HASH_AUTH_REQ = 10,
|
|
|
|
DPP_TEST_NO_I_BOOTSTRAP_KEY_HASH_AUTH_REQ = 11,
|
|
|
|
DPP_TEST_NO_I_PROTO_KEY_AUTH_REQ = 12,
|
|
|
|
DPP_TEST_NO_I_NONCE_AUTH_REQ = 13,
|
|
|
|
DPP_TEST_NO_I_CAPAB_AUTH_REQ = 14,
|
|
|
|
DPP_TEST_NO_WRAPPED_DATA_AUTH_REQ = 15,
|
2017-10-22 21:17:55 +02:00
|
|
|
DPP_TEST_NO_STATUS_AUTH_RESP = 16,
|
|
|
|
DPP_TEST_NO_R_BOOTSTRAP_KEY_HASH_AUTH_RESP = 17,
|
|
|
|
DPP_TEST_NO_I_BOOTSTRAP_KEY_HASH_AUTH_RESP = 18,
|
|
|
|
DPP_TEST_NO_R_PROTO_KEY_AUTH_RESP = 19,
|
|
|
|
DPP_TEST_NO_R_NONCE_AUTH_RESP = 20,
|
|
|
|
DPP_TEST_NO_I_NONCE_AUTH_RESP = 21,
|
|
|
|
DPP_TEST_NO_R_CAPAB_AUTH_RESP = 22,
|
|
|
|
DPP_TEST_NO_R_AUTH_AUTH_RESP = 23,
|
|
|
|
DPP_TEST_NO_WRAPPED_DATA_AUTH_RESP = 24,
|
2017-10-23 12:34:30 +02:00
|
|
|
DPP_TEST_NO_STATUS_AUTH_CONF = 25,
|
|
|
|
DPP_TEST_NO_R_BOOTSTRAP_KEY_HASH_AUTH_CONF = 26,
|
|
|
|
DPP_TEST_NO_I_BOOTSTRAP_KEY_HASH_AUTH_CONF = 27,
|
|
|
|
DPP_TEST_NO_I_AUTH_AUTH_CONF = 28,
|
|
|
|
DPP_TEST_NO_WRAPPED_DATA_AUTH_CONF = 29,
|
2017-10-28 10:23:22 +02:00
|
|
|
DPP_TEST_I_NONCE_MISMATCH_AUTH_RESP = 30,
|
|
|
|
DPP_TEST_INCOMPATIBLE_R_CAPAB_AUTH_RESP = 31,
|
|
|
|
DPP_TEST_R_AUTH_MISMATCH_AUTH_RESP = 32,
|
|
|
|
DPP_TEST_I_AUTH_MISMATCH_AUTH_CONF = 33,
|
2017-11-02 22:53:55 +01:00
|
|
|
DPP_TEST_NO_FINITE_CYCLIC_GROUP_PKEX_EXCHANGE_REQ = 34,
|
|
|
|
DPP_TEST_NO_ENCRYPTED_KEY_PKEX_EXCHANGE_REQ = 35,
|
|
|
|
DPP_TEST_NO_STATUS_PKEX_EXCHANGE_RESP = 36,
|
|
|
|
DPP_TEST_NO_ENCRYPTED_KEY_PKEX_EXCHANGE_RESP = 37,
|
|
|
|
DPP_TEST_NO_BOOTSTRAP_KEY_PKEX_CR_REQ = 38,
|
|
|
|
DPP_TEST_NO_I_AUTH_TAG_PKEX_CR_REQ = 39,
|
|
|
|
DPP_TEST_NO_WRAPPED_DATA_PKEX_CR_REQ = 40,
|
|
|
|
DPP_TEST_NO_BOOTSTRAP_KEY_PKEX_CR_RESP = 41,
|
|
|
|
DPP_TEST_NO_R_AUTH_TAG_PKEX_CR_RESP = 42,
|
|
|
|
DPP_TEST_NO_WRAPPED_DATA_PKEX_CR_RESP = 43,
|
2017-11-02 23:42:54 +01:00
|
|
|
DPP_TEST_INVALID_ENCRYPTED_KEY_PKEX_EXCHANGE_REQ = 44,
|
|
|
|
DPP_TEST_INVALID_ENCRYPTED_KEY_PKEX_EXCHANGE_RESP = 45,
|
2017-11-03 18:33:17 +01:00
|
|
|
DPP_TEST_INVALID_STATUS_PKEX_EXCHANGE_RESP = 46,
|
2017-11-03 18:54:48 +01:00
|
|
|
DPP_TEST_INVALID_BOOTSTRAP_KEY_PKEX_CR_REQ = 47,
|
|
|
|
DPP_TEST_INVALID_BOOTSTRAP_KEY_PKEX_CR_RESP = 48,
|
2017-11-03 19:18:24 +01:00
|
|
|
DPP_TEST_I_AUTH_TAG_MISMATCH_PKEX_CR_REQ = 49,
|
|
|
|
DPP_TEST_R_AUTH_TAG_MISMATCH_PKEX_CR_RESP = 50,
|
2017-11-03 19:39:00 +01:00
|
|
|
DPP_TEST_NO_E_NONCE_CONF_REQ = 51,
|
|
|
|
DPP_TEST_NO_CONFIG_ATTR_OBJ_CONF_REQ = 52,
|
|
|
|
DPP_TEST_NO_WRAPPED_DATA_CONF_REQ = 53,
|
|
|
|
DPP_TEST_NO_E_NONCE_CONF_RESP = 54,
|
|
|
|
DPP_TEST_NO_CONFIG_OBJ_CONF_RESP = 55,
|
|
|
|
DPP_TEST_NO_STATUS_CONF_RESP = 56,
|
|
|
|
DPP_TEST_NO_WRAPPED_DATA_CONF_RESP = 57,
|
2017-11-03 20:11:00 +01:00
|
|
|
DPP_TEST_INVALID_STATUS_CONF_RESP = 58,
|
|
|
|
DPP_TEST_E_NONCE_MISMATCH_CONF_RESP = 59,
|
2017-11-06 11:40:18 +01:00
|
|
|
DPP_TEST_NO_TRANSACTION_ID_PEER_DISC_REQ = 60,
|
|
|
|
DPP_TEST_NO_CONNECTOR_PEER_DISC_REQ = 61,
|
|
|
|
DPP_TEST_NO_TRANSACTION_ID_PEER_DISC_RESP = 62,
|
|
|
|
DPP_TEST_NO_STATUS_PEER_DISC_RESP = 63,
|
|
|
|
DPP_TEST_NO_CONNECTOR_PEER_DISC_RESP = 64,
|
2017-11-13 11:47:30 +01:00
|
|
|
DPP_TEST_AUTH_RESP_IN_PLACE_OF_CONF = 65,
|
2017-11-18 23:11:44 +01:00
|
|
|
DPP_TEST_INVALID_I_PROTO_KEY_AUTH_REQ = 66,
|
|
|
|
DPP_TEST_INVALID_R_PROTO_KEY_AUTH_RESP = 67,
|
2017-11-19 10:32:02 +01:00
|
|
|
DPP_TEST_INVALID_R_BOOTSTRAP_KEY_HASH_AUTH_REQ = 68,
|
|
|
|
DPP_TEST_INVALID_I_BOOTSTRAP_KEY_HASH_AUTH_REQ = 69,
|
|
|
|
DPP_TEST_INVALID_R_BOOTSTRAP_KEY_HASH_AUTH_RESP = 70,
|
|
|
|
DPP_TEST_INVALID_I_BOOTSTRAP_KEY_HASH_AUTH_RESP = 71,
|
|
|
|
DPP_TEST_INVALID_R_BOOTSTRAP_KEY_HASH_AUTH_CONF = 72,
|
|
|
|
DPP_TEST_INVALID_I_BOOTSTRAP_KEY_HASH_AUTH_CONF = 73,
|
2017-11-19 11:53:04 +01:00
|
|
|
DPP_TEST_INVALID_STATUS_AUTH_RESP = 74,
|
|
|
|
DPP_TEST_INVALID_STATUS_AUTH_CONF = 75,
|
2017-11-19 13:12:10 +01:00
|
|
|
DPP_TEST_INVALID_CONFIG_ATTR_OBJ_CONF_REQ = 76,
|
2017-11-19 16:15:02 +01:00
|
|
|
DPP_TEST_INVALID_TRANSACTION_ID_PEER_DISC_RESP = 77,
|
|
|
|
DPP_TEST_INVALID_STATUS_PEER_DISC_RESP = 78,
|
|
|
|
DPP_TEST_INVALID_CONNECTOR_PEER_DISC_RESP = 79,
|
|
|
|
DPP_TEST_INVALID_CONNECTOR_PEER_DISC_REQ = 80,
|
2017-11-22 15:23:42 +01:00
|
|
|
DPP_TEST_INVALID_I_NONCE_AUTH_REQ = 81,
|
2017-11-30 20:56:19 +01:00
|
|
|
DPP_TEST_INVALID_TRANSACTION_ID_PEER_DISC_REQ = 82,
|
2017-11-30 21:01:10 +01:00
|
|
|
DPP_TEST_INVALID_E_NONCE_CONF_REQ = 83,
|
2017-12-02 00:04:42 +01:00
|
|
|
DPP_TEST_STOP_AT_PKEX_EXCHANGE_RESP = 84,
|
|
|
|
DPP_TEST_STOP_AT_PKEX_CR_REQ = 85,
|
|
|
|
DPP_TEST_STOP_AT_PKEX_CR_RESP = 86,
|
|
|
|
DPP_TEST_STOP_AT_AUTH_REQ = 87,
|
|
|
|
DPP_TEST_STOP_AT_AUTH_RESP = 88,
|
|
|
|
DPP_TEST_STOP_AT_AUTH_CONF = 89,
|
|
|
|
DPP_TEST_STOP_AT_CONF_REQ = 90,
|
2019-03-14 16:08:44 +01:00
|
|
|
DPP_TEST_REJECT_CONFIG = 91,
|
2017-10-22 10:15:21 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
extern enum dpp_test_behavior dpp_test;
|
2017-11-23 22:47:52 +01:00
|
|
|
extern u8 dpp_pkex_own_mac_override[ETH_ALEN];
|
|
|
|
extern u8 dpp_pkex_peer_mac_override[ETH_ALEN];
|
2017-11-24 00:41:50 +01:00
|
|
|
extern u8 dpp_pkex_ephemeral_key_override[600];
|
|
|
|
extern size_t dpp_pkex_ephemeral_key_override_len;
|
2017-12-05 22:49:55 +01:00
|
|
|
extern u8 dpp_protocol_key_override[600];
|
|
|
|
extern size_t dpp_protocol_key_override_len;
|
2017-12-07 12:35:19 +01:00
|
|
|
extern u8 dpp_nonce_override[DPP_MAX_NONCE_LEN];
|
|
|
|
extern size_t dpp_nonce_override_len;
|
2017-10-22 10:15:21 +02:00
|
|
|
#endif /* CONFIG_TESTING_OPTIONS */
|
|
|
|
|
2017-06-15 20:18:10 +02:00
|
|
|
void dpp_bootstrap_info_free(struct dpp_bootstrap_info *info);
|
2017-07-04 14:45:03 +02:00
|
|
|
const char * dpp_bootstrap_type_txt(enum dpp_bootstrap_type type);
|
2017-07-02 11:36:23 +02:00
|
|
|
int dpp_bootstrap_key_hash(struct dpp_bootstrap_info *bi);
|
2017-06-15 20:18:10 +02:00
|
|
|
int dpp_parse_uri_chan_list(struct dpp_bootstrap_info *bi,
|
|
|
|
const char *chan_list);
|
|
|
|
int dpp_parse_uri_mac(struct dpp_bootstrap_info *bi, const char *mac);
|
|
|
|
int dpp_parse_uri_info(struct dpp_bootstrap_info *bi, const char *info);
|
|
|
|
struct dpp_bootstrap_info * dpp_parse_qr_code(const char *uri);
|
|
|
|
char * dpp_keygen(struct dpp_bootstrap_info *bi, const char *curve,
|
|
|
|
const u8 *privkey, size_t privkey_len);
|
2017-11-12 11:17:54 +01:00
|
|
|
struct hostapd_hw_modes;
|
2017-06-15 20:18:12 +02:00
|
|
|
struct dpp_authentication * dpp_auth_init(void *msg_ctx,
|
|
|
|
struct dpp_bootstrap_info *peer_bi,
|
|
|
|
struct dpp_bootstrap_info *own_bi,
|
2017-11-13 10:29:45 +01:00
|
|
|
u8 dpp_allowed_roles,
|
2017-11-12 11:17:54 +01:00
|
|
|
unsigned int neg_freq,
|
|
|
|
struct hostapd_hw_modes *own_modes,
|
|
|
|
u16 num_modes);
|
2017-06-15 20:18:12 +02:00
|
|
|
struct dpp_authentication *
|
|
|
|
dpp_auth_req_rx(void *msg_ctx, u8 dpp_allowed_roles, int qr_mutual,
|
|
|
|
struct dpp_bootstrap_info *peer_bi,
|
|
|
|
struct dpp_bootstrap_info *own_bi,
|
2017-10-18 21:51:30 +02:00
|
|
|
unsigned int freq, const u8 *hdr, const u8 *attr_start,
|
2017-10-22 10:46:12 +02:00
|
|
|
size_t attr_len);
|
2017-06-15 20:18:12 +02:00
|
|
|
struct wpabuf *
|
2017-10-18 21:51:30 +02:00
|
|
|
dpp_auth_resp_rx(struct dpp_authentication *auth, const u8 *hdr,
|
|
|
|
const u8 *attr_start, size_t attr_len);
|
2017-06-15 20:18:15 +02:00
|
|
|
struct wpabuf * dpp_build_conf_req(struct dpp_authentication *auth,
|
|
|
|
const char *json);
|
2017-10-18 21:51:30 +02:00
|
|
|
int dpp_auth_conf_rx(struct dpp_authentication *auth, const u8 *hdr,
|
|
|
|
const u8 *attr_start, size_t attr_len);
|
2017-06-15 20:18:12 +02:00
|
|
|
int dpp_notify_new_qr_code(struct dpp_authentication *auth,
|
|
|
|
struct dpp_bootstrap_info *peer_bi);
|
2019-03-16 11:19:10 +01:00
|
|
|
struct dpp_configuration * dpp_configuration_alloc(const char *type);
|
2019-03-16 16:17:46 +01:00
|
|
|
int dpp_akm_psk(enum dpp_akm akm);
|
|
|
|
int dpp_akm_sae(enum dpp_akm akm);
|
|
|
|
int dpp_akm_legacy(enum dpp_akm akm);
|
|
|
|
int dpp_akm_dpp(enum dpp_akm akm);
|
|
|
|
int dpp_akm_ver2(enum dpp_akm akm);
|
2019-03-16 11:19:10 +01:00
|
|
|
int dpp_configuration_valid(const struct dpp_configuration *conf);
|
2017-06-15 20:18:15 +02:00
|
|
|
void dpp_configuration_free(struct dpp_configuration *conf);
|
2019-03-24 15:44:21 +01:00
|
|
|
int dpp_set_configurator(struct dpp_global *dpp, void *msg_ctx,
|
|
|
|
struct dpp_authentication *auth,
|
|
|
|
const char *cmd);
|
2017-06-15 20:18:12 +02:00
|
|
|
void dpp_auth_deinit(struct dpp_authentication *auth);
|
2017-06-15 20:18:15 +02:00
|
|
|
struct wpabuf *
|
|
|
|
dpp_conf_req_rx(struct dpp_authentication *auth, const u8 *attr_start,
|
|
|
|
size_t attr_len);
|
|
|
|
int dpp_conf_resp_rx(struct dpp_authentication *auth,
|
|
|
|
const struct wpabuf *resp);
|
2019-03-14 16:05:02 +01:00
|
|
|
enum dpp_status_error dpp_conf_result_rx(struct dpp_authentication *auth,
|
|
|
|
const u8 *hdr,
|
|
|
|
const u8 *attr_start, size_t attr_len);
|
|
|
|
struct wpabuf * dpp_build_conf_result(struct dpp_authentication *auth,
|
|
|
|
enum dpp_status_error status);
|
2017-06-15 20:18:12 +02:00
|
|
|
struct wpabuf * dpp_alloc_msg(enum dpp_public_action_frame_type type,
|
|
|
|
size_t len);
|
|
|
|
const u8 * dpp_get_attr(const u8 *buf, size_t len, u16 req_id, u16 *ret_len);
|
|
|
|
int dpp_check_attrs(const u8 *buf, size_t len);
|
2017-06-15 20:18:15 +02:00
|
|
|
int dpp_key_expired(const char *timestamp, os_time_t *expiry);
|
2017-11-22 20:04:41 +01:00
|
|
|
const char * dpp_akm_str(enum dpp_akm akm);
|
2018-03-16 11:04:21 +01:00
|
|
|
int dpp_configurator_get_key(const struct dpp_configurator *conf, char *buf,
|
|
|
|
size_t buflen);
|
2017-06-15 20:18:15 +02:00
|
|
|
void dpp_configurator_free(struct dpp_configurator *conf);
|
|
|
|
struct dpp_configurator *
|
|
|
|
dpp_keygen_configurator(const char *curve, const u8 *privkey,
|
|
|
|
size_t privkey_len);
|
2017-07-04 16:48:44 +02:00
|
|
|
int dpp_configurator_own_config(struct dpp_authentication *auth,
|
2017-11-27 11:43:40 +01:00
|
|
|
const char *curve, int ap);
|
2017-10-29 10:43:41 +01:00
|
|
|
enum dpp_status_error
|
|
|
|
dpp_peer_intro(struct dpp_introduction *intro, const char *own_connector,
|
|
|
|
const u8 *net_access_key, size_t net_access_key_len,
|
|
|
|
const u8 *csign_key, size_t csign_key_len,
|
|
|
|
const u8 *peer_connector, size_t peer_connector_len,
|
|
|
|
os_time_t *expiry);
|
2017-11-02 11:21:00 +01:00
|
|
|
struct dpp_pkex * dpp_pkex_init(void *msg_ctx, struct dpp_bootstrap_info *bi,
|
2017-07-02 11:36:23 +02:00
|
|
|
const u8 *own_mac,
|
|
|
|
const char *identifier,
|
|
|
|
const char *code);
|
2017-11-02 11:21:00 +01:00
|
|
|
struct dpp_pkex * dpp_pkex_rx_exchange_req(void *msg_ctx,
|
|
|
|
struct dpp_bootstrap_info *bi,
|
2017-07-02 11:36:23 +02:00
|
|
|
const u8 *own_mac,
|
|
|
|
const u8 *peer_mac,
|
|
|
|
const char *identifier,
|
|
|
|
const char *code,
|
|
|
|
const u8 *buf, size_t len);
|
|
|
|
struct wpabuf * dpp_pkex_rx_exchange_resp(struct dpp_pkex *pkex,
|
2017-11-23 22:32:33 +01:00
|
|
|
const u8 *peer_mac,
|
2017-07-02 11:36:23 +02:00
|
|
|
const u8 *buf, size_t len);
|
|
|
|
struct wpabuf * dpp_pkex_rx_commit_reveal_req(struct dpp_pkex *pkex,
|
2017-10-18 22:10:34 +02:00
|
|
|
const u8 *hdr,
|
2017-07-02 11:36:23 +02:00
|
|
|
const u8 *buf, size_t len);
|
2017-10-18 22:10:34 +02:00
|
|
|
int dpp_pkex_rx_commit_reveal_resp(struct dpp_pkex *pkex, const u8 *hdr,
|
2017-07-02 11:36:23 +02:00
|
|
|
const u8 *buf, size_t len);
|
|
|
|
void dpp_pkex_free(struct dpp_pkex *pkex);
|
2017-06-15 20:18:10 +02:00
|
|
|
|
2017-11-19 16:15:02 +01:00
|
|
|
char * dpp_corrupt_connector_signature(const char *connector);
|
|
|
|
|
2019-03-17 22:51:53 +01:00
|
|
|
|
|
|
|
struct dpp_pfs {
|
|
|
|
struct crypto_ecdh *ecdh;
|
|
|
|
const struct dpp_curve_params *curve;
|
|
|
|
struct wpabuf *ie;
|
|
|
|
struct wpabuf *secret;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct dpp_pfs * dpp_pfs_init(const u8 *net_access_key,
|
|
|
|
size_t net_access_key_len);
|
|
|
|
int dpp_pfs_process(struct dpp_pfs *pfs, const u8 *peer_ie, size_t peer_ie_len);
|
|
|
|
void dpp_pfs_free(struct dpp_pfs *pfs);
|
|
|
|
|
2019-03-24 15:44:21 +01:00
|
|
|
struct dpp_bootstrap_info * dpp_add_qr_code(struct dpp_global *dpp,
|
|
|
|
const char *uri);
|
|
|
|
int dpp_bootstrap_gen(struct dpp_global *dpp, const char *cmd);
|
|
|
|
struct dpp_bootstrap_info *
|
|
|
|
dpp_bootstrap_get_id(struct dpp_global *dpp, unsigned int id);
|
|
|
|
int dpp_bootstrap_remove(struct dpp_global *dpp, const char *id);
|
|
|
|
struct dpp_bootstrap_info *
|
|
|
|
dpp_pkex_finish(struct dpp_global *dpp, struct dpp_pkex *pkex, const u8 *peer,
|
|
|
|
unsigned int freq);
|
|
|
|
const char * dpp_bootstrap_get_uri(struct dpp_global *dpp, unsigned int id);
|
|
|
|
int dpp_bootstrap_info(struct dpp_global *dpp, int id,
|
|
|
|
char *reply, int reply_size);
|
|
|
|
void dpp_bootstrap_find_pair(struct dpp_global *dpp, const u8 *i_bootstrap,
|
|
|
|
const u8 *r_bootstrap,
|
|
|
|
struct dpp_bootstrap_info **own_bi,
|
|
|
|
struct dpp_bootstrap_info **peer_bi);
|
|
|
|
int dpp_configurator_add(struct dpp_global *dpp, const char *cmd);
|
|
|
|
int dpp_configurator_remove(struct dpp_global *dpp, const char *id);
|
|
|
|
int dpp_configurator_get_key_id(struct dpp_global *dpp, unsigned int id,
|
|
|
|
char *buf, size_t buflen);
|
|
|
|
struct dpp_global * dpp_global_init(void);
|
|
|
|
void dpp_global_clear(struct dpp_global *dpp);
|
|
|
|
void dpp_global_deinit(struct dpp_global *dpp);
|
|
|
|
|
2019-04-08 17:07:28 +02:00
|
|
|
#endif /* CONFIG_DPP */
|
2017-06-15 20:18:10 +02:00
|
|
|
#endif /* DPP_H */
|