From patchwork Tue Aug 27 14:21:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13779619 Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B463F1C4618 for ; Tue, 27 Aug 2024 14:21:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724768510; cv=none; b=SI+kiIuSRvOdgSs7sPJGhewtBY9i9wgN4BLBn3vG3DcEPAl96PS7VN2E18en5AUOVOwwT7GdUEvgGx9MpQnos+/ETMCfUeEXSLc3ftD9aS0KCHP4xdotCeQ58MGSz8sRfqnQgrNQHe3LtLwVMtQVCz6SmhXILJW8SxDL2AyrSF4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724768510; c=relaxed/simple; bh=7ajmBEMjj21nVZnR+t/JTbKL9a/iHzaweqdfhRouYRM=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=drEhHyEWIpORprpCIlhwfh6HPfnc1omhTNLMv0JrpChSmrPFwk2ri0DLAmYwYvB6OjDO76GBPNhbgsIGWa/lsQFh5aoK2kNxcqwMuMngvQyT6e/zFow41NS3LAsy/Qag5SnBLOp7I/spnbimCkuKXvSXJNb6OhAN0EyCmOCKPNQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=gDi6nEjV; arc=none smtp.client-ip=209.85.214.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gDi6nEjV" Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-2021c03c13aso41825545ad.1 for ; Tue, 27 Aug 2024 07:21:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724768508; x=1725373308; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=RdC5IqSkOq7x0LS9WJZbQI2kU4B3dkOtPe4g96iqKlY=; b=gDi6nEjVoeei56yK1DyMfOwgMmP9eQO1fMSsDsiMF/XyMIWT07jp8QLwUM9Ofcg31C TOcn3vEX5mfetMm4bJEuDeEfPyjkl+QOxx5b01mCMb0zlNP3Au+4uyyMKy7CHIKHoIbI tmYAHzYhy3g7wm5LDee9zSFrxg0RdDm1/WjXozPrjX6FgkwyMtNxplqHsz53/akfZ9BC jQV3mJudyODFjriXiq2+zxw/wcLvcCGRHN+xlhLHhbEYdqYYxpkPOtd9CYkeA6UU5MZL sTdJ1IODgswGmQo2QeQg7AmnTdm26G2qpsbDo1cIEhs4sfMdJAUmZSvnVr8QxPmpSyUw 7Wjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724768508; x=1725373308; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=RdC5IqSkOq7x0LS9WJZbQI2kU4B3dkOtPe4g96iqKlY=; b=iaIredS1lQT6SlIXZjbhJ4Zu7YC9ujEs1e/8uzprmJCxGBluAZILMmlr1e83N+BH21 hiNPFtlnnXh4gcft/6A7+6s2K+QOp/0OBxWfb+zcqhjf07s7VmgmCLqmZMYh0psQV/G7 yrGJ0yGM9VmvDCzAbStLZsKnjADlZ77tlcEAiEG7dEn1eA6jaxZE9/+VnDHaAXE2hNQX E2iOX59pg/Rb/qlaH0IiVt/4nzV1qmtRCCfcL8yZMErxBEeV20Yq7hR3DWj/dofYViVf 95K/bUM9bxT2JpHGEyRDFv0u0sVQjcFsXZLaIwqkdBwjUTwrliWqVg7b3mHhoY/SWBKm kVBA== X-Gm-Message-State: AOJu0Yzm1/SblzTSveFBBV9X5GzPxgmm7rw0tzL9g+NG5GcRX6TWZ8vj hNv0H35tfJBAyZDNOv6Nl9ufLGgOBSODx6B7t55cwD8a6OiYJKn04u9LLA== X-Google-Smtp-Source: AGHT+IEGohMGhWqDK1xAtEgtkvNEHQWnjt++H7Jejxj9GAYACtHBErPfdF5pS5OELmWI4nLfSFZ5hQ== X-Received: by 2002:a17:903:bc3:b0:202:3158:ebdb with SMTP id d9443c01a7336-204ddd33f4bmr30411795ad.19.1724768507630; Tue, 27 Aug 2024 07:21:47 -0700 (PDT) Received: from LOCLAP699.locus-rst-dev-locuspark.locus ([152.193.78.90]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20385609099sm83635695ad.192.2024.08.27.07.21.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Aug 2024 07:21:47 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 1/4] dpp: factor out key derivation and starting PKEX into functions Date: Tue, 27 Aug 2024 07:21:22 -0700 Message-Id: <20240827142125.751023-1-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This will make things a bit easier in future patches, and reduces some of the length/complexity of these functions. --- src/dpp.c | 92 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 51 insertions(+), 41 deletions(-) diff --git a/src/dpp.c b/src/dpp.c index d89c3056..c1047ca3 100644 --- a/src/dpp.c +++ b/src/dpp.c @@ -4280,6 +4280,17 @@ static uint32_t *dpp_default_freqs(struct dpp_sm *dpp, size_t *out_len) return freqs_out; } +static void __dpp_pkex_start_enrollee(struct dpp_sm *dpp) +{ + dpp->current_freq = dpp->freqs[0]; + + dpp_reset_protocol_timer(dpp, DPP_PKEX_PROTO_TIMEOUT); + + l_debug("PKEX start enrollee (id=%s)", dpp->pkex_id ?: "unset"); + + dpp_start_offchannel(dpp, dpp->current_freq); +} + static bool dpp_pkex_scan_notify(int err, struct l_queue *bss_list, const struct scan_freq_set *freqs, void *user_data) @@ -4314,13 +4325,7 @@ static bool dpp_pkex_scan_notify(int err, struct l_queue *bss_list, dpp->freqs = scan_freq_set_to_fixed_array(freq_set, &dpp->freqs_len); start: - dpp->current_freq = dpp->freqs[0]; - - dpp_reset_protocol_timer(dpp, DPP_PKEX_PROTO_TIMEOUT); - - l_debug("PKEX start enrollee (id=%s)", dpp->pkex_id ?: "unset"); - - dpp_start_offchannel(dpp, dpp->current_freq); + __dpp_pkex_start_enrollee(dpp); return false; @@ -4338,40 +4343,6 @@ static void dpp_pkex_scan_destroy(void *user_data) static bool dpp_start_pkex_enrollee(struct dpp_sm *dpp) { - _auto_(l_ecc_point_free) struct l_ecc_point *qi = NULL; - - memcpy(dpp->peer_addr, broadcast, 6); - - /* - * In theory a driver could support a lesser duration than 200ms. This - * complicates things since we would need to tack on additional - * offchannel requests to meet the 200ms requirement. This could be done - * but for now use max_roc or 200ms, whichever is less. - */ - dpp->dwell = (dpp->max_roc < 200) ? dpp->max_roc : 200; - /* "DPP R2 devices are expected to use PKEXv1 by default" */ - dpp->pkex_version = 1; - - if (!l_ecdh_generate_key_pair(dpp->curve, &dpp->pkex_private, - &dpp->pkex_public)) - goto failed; - - /* - * "If Qi is the point-at-infinity, the code shall be deleted and the - * user should be notified to provision a new code" - */ - qi = dpp_derive_qi(dpp->curve, dpp->pkex_key, dpp->pkex_id, - netdev_get_address(dpp->netdev)); - if (!qi || l_ecc_point_is_infinity(qi)) { - l_debug("Cannot derive Qi, provision a new code"); - goto failed; - } - - dpp->pkex_m = l_ecc_point_new(dpp->curve); - - if (!l_ecc_point_add(dpp->pkex_m, dpp->pkex_public, qi)) - goto failed; - dpp_property_changed_notify(dpp); /* @@ -4438,6 +4409,40 @@ static bool dpp_parse_pkex_args(struct l_dbus_message *message, return true; } +static bool dpp_pkex_derive_keys(struct dpp_sm *dpp) +{ + _auto_(l_ecc_point_free) struct l_ecc_point *qi = NULL; + + /* + * In theory a driver could support a lesser duration than 200ms. This + * complicates things since we would need to tack on additional + * offchannel requests to meet the 200ms requirement. This could be done + * but for now use max_roc or 200ms, whichever is less. + */ + dpp->dwell = (dpp->max_roc < 200) ? dpp->max_roc : 200; + /* "DPP R2 devices are expected to use PKEXv1 by default" */ + dpp->pkex_version = 1; + + if (!l_ecdh_generate_key_pair(dpp->curve, &dpp->pkex_private, + &dpp->pkex_public)) + return false; + + /* + * "If Qi is the point-at-infinity, the code shall be deleted and the + * user should be notified to provision a new code" + */ + qi = dpp_derive_qi(dpp->curve, dpp->pkex_key, dpp->pkex_id, + netdev_get_address(dpp->netdev)); + if (!qi || l_ecc_point_is_infinity(qi)) { + l_debug("Cannot derive Qi, provision a new code"); + return false; + } + + dpp->pkex_m = l_ecc_point_new(dpp->curve); + + return l_ecc_point_add(dpp->pkex_m, dpp->pkex_public, qi); +} + static struct l_dbus_message *dpp_dbus_pkex_start_enrollee(struct l_dbus *dbus, struct l_dbus_message *message, void *user_data) @@ -4472,6 +4477,11 @@ static struct l_dbus_message *dpp_dbus_pkex_start_enrollee(struct l_dbus *dbus, return dbus_error_from_errno(ret, message); } + if (!dpp_pkex_derive_keys(dpp)) { + dpp_reset(dpp); + return dbus_error_failed(message); + } + if (!wait_for_disconnect && !dpp_start_pkex_enrollee(dpp)) goto invalid_args; From patchwork Tue Aug 27 14:21:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13779620 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4D9101C4620 for ; Tue, 27 Aug 2024 14:21:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724768511; cv=none; b=WCVp2d8JF0oosUbxwvOazl5ZGujkm+Of9ByvpPZEdwy1b+4HvnkYfREG/aqE/kq+xXHWzJyFQLRzA9BQCcHIuRZGcQx/xhGEKf7Banbpt5Tc7AUAvpmlDJSyKueaYD+50vzjG8mK+GfPkbMM37rtHFfji0t1FEVtCedODlhETS4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724768511; c=relaxed/simple; bh=6Gi2Q3bkShDwYTKg4eYJhAqdUhSoU19ScMOBerJ/CDE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=gw4ygMovsX7VSQ1xyRRiaXIbAaMME4ae/OD+YJoi/zvRoQH+CTaLPNR4//2Ew7l2HnlAPJR0IDNgBZN5pEMqXQTqj4H52AALasrl7ZmkSXZjbzCG87bMl81JFgVgYGjW4uEuwM+6qLbIfLpKjeX9VGxmtjtUT+ye6G7OdW3na/0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=kpr3Kk/h; arc=none smtp.client-ip=209.85.214.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="kpr3Kk/h" Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-201df0b2df4so45299225ad.0 for ; Tue, 27 Aug 2024 07:21:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724768509; x=1725373309; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=66ad9m81ugj7vnhFE5irO8ME7Z5n8qGvT1ofOD7cFM4=; b=kpr3Kk/hjyGrn/7OZQLJcyB9sCjrt/urUU0719DSy1eecANhElAQ8zAaIFGZkWnggf MBbsFW9KllwtCU/EKHOv5N1Spf6Ou0QYeGnc1dtHbla9W0b5Tv+tdnrpEKH9fAio71J/ 9N6zRYJ7E5bWpLfxLDNvZJhp2C6HGo4llVD5+bDxUc/MuNS/Vi0ewvA4svzaJXh4Ih+F j6EhCBHGuEfcLhjamWORGwcztaGWa5T6bVUU4K5tUQHirmaoE+XKlgkm2xct/EsfjqAh ArJZ18ongM3h5087oDcG3MVhWvOMpCxYo+3vQvWqDEBjqMfZgqiho7IkZg5gioxZtzks 8MCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724768509; x=1725373309; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=66ad9m81ugj7vnhFE5irO8ME7Z5n8qGvT1ofOD7cFM4=; b=K0XhIH+aqEM/N9R5E4aZRDbDWEYP2mKHyLN+Ve9HIMopqqkI0No9l+FVZh3LrgGuhk l+pbH2crfDllI/jLG3fH+gkjSbg/IZoRzWu4IKN6QZtX+K8suqs0Uj+vllI/vnfkSNIt tg4SZTv7HYxZ7Gdy+TJiFSXxTfTFm2OpEGOoUo89UsHHXkaES1vQRE8k4JkyeAnTRWNm BvP3tJWSjN+0URrCi9OMhFRG+VkhN6ySqnkFsTAPJ1WnFM+1YCxWQHUVdopI939wI73F LEsNGnq/uPbkKkiix7/1FihgWwvv6kaIxrKz6QWMhtdF0W7rLq6w7nd8eTHWmZbOAmo7 xZxg== X-Gm-Message-State: AOJu0Ywmdpah2l/c/8gTtp+IL65f5vAXCqfZXHVAd2ayx6cA4HRltEEq /EWJqXIG+UMxTFvNxUgLSlW+9ENo1JESX+tWKMCDqv0g5F96mzZmf0ebXQ== X-Google-Smtp-Source: AGHT+IFyZ7yKDZM5Ytmdb0zluQnZWp+eHsJDhBdgUjmH9tDLV5luI9nNWJT0DzFdXi/qCHGo6dNKfw== X-Received: by 2002:a17:903:1d2:b0:200:aa78:cfc7 with SMTP id d9443c01a7336-2039e44f09dmr194249765ad.2.1724768509221; Tue, 27 Aug 2024 07:21:49 -0700 (PDT) Received: from LOCLAP699.locus-rst-dev-locuspark.locus ([152.193.78.90]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20385609099sm83635695ad.192.2024.08.27.07.21.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Aug 2024 07:21:48 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 2/4] dpp: add Address/Frequency as parameters to PKEX enrollees Date: Tue, 27 Aug 2024 07:21:23 -0700 Message-Id: <20240827142125.751023-2-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240827142125.751023-1-prestwoj@gmail.com> References: <20240827142125.751023-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The DPP spec allows for obtaining frequency and MAC addresses up to the implementation. IWD already takes advantage of this by first scanning for nearby APs and using only those frequencies. For further optimization an enrollee may be able to determine the configurators frequency and MAC ahead of time which would make finding the configurator much faster. --- src/dpp.c | 43 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/src/dpp.c b/src/dpp.c index c1047ca3..39b66154 100644 --- a/src/dpp.c +++ b/src/dpp.c @@ -4345,6 +4345,12 @@ static bool dpp_start_pkex_enrollee(struct dpp_sm *dpp) { dpp_property_changed_notify(dpp); + /* Already have a set (or single) frequency */ + if (dpp->freqs) { + __dpp_pkex_start_enrollee(dpp); + return true; + } + /* * The 'dpp_default_freqs' function returns the default frequencies * outlined in section 5.6.1. For 2.4/5GHz this is only 3 frequencies @@ -4374,13 +4380,17 @@ failed: static bool dpp_parse_pkex_args(struct l_dbus_message *message, const char **key_out, - const char **id_out) + const char **id_out, + const char **mac_out, + uint32_t *freq_out) { struct l_dbus_message_iter iter; struct l_dbus_message_iter variant; const char *dict_key; const char *key = NULL; const char *id = NULL; + const char *mac = NULL; + uint32_t freq = 0; if (!l_dbus_message_get_arguments(message, "a{sv}", &iter)) return false; @@ -4394,6 +4404,14 @@ static bool dpp_parse_pkex_args(struct l_dbus_message *message, if (!l_dbus_message_iter_get_variant(&variant, "s", &id)) return false; + } else if (!strcmp(dict_key, "Address")) { + if (!l_dbus_message_iter_get_variant(&variant, "s", + &mac)) + return false; + } else if (!strcmp(dict_key, "Frequency")) { + if (!l_dbus_message_iter_get_variant(&variant, "u", + &freq)) + return false; } } @@ -4406,6 +4424,12 @@ static bool dpp_parse_pkex_args(struct l_dbus_message *message, *key_out = key; *id_out = id; + if (mac_out) + *mac_out = mac; + + if (freq_out) + *freq_out = freq; + return true; } @@ -4450,6 +4474,8 @@ static struct l_dbus_message *dpp_dbus_pkex_start_enrollee(struct l_dbus *dbus, struct dpp_sm *dpp = user_data; const char *key; const char *id; + const char *mac_str; + uint32_t freq; bool wait_for_disconnect; int ret; @@ -4459,8 +4485,19 @@ static struct l_dbus_message *dpp_dbus_pkex_start_enrollee(struct l_dbus *dbus, dpp->interface != DPP_INTERFACE_UNBOUND) return dbus_error_busy(message); - if (!dpp_parse_pkex_args(message, &key, &id)) + if (!dpp_parse_pkex_args(message, &key, &id, &mac_str, &freq)) + goto invalid_args; + + if (mac_str && !util_string_to_address(mac_str, dpp->peer_addr)) goto invalid_args; + else if (!mac_str) + memcpy(dpp->peer_addr, broadcast, 6); + + if (freq) { + dpp->freqs = l_new(uint32_t, 1); + dpp->freqs[0] = freq; + dpp->freqs_len = 1; + } dpp->pkex_key = l_strdup(key); @@ -4595,7 +4632,7 @@ static struct l_dbus_message *dpp_dbus_pkex_configure_enrollee( l_debug(""); - if (!dpp_parse_pkex_args(message, &key, &id)) + if (!dpp_parse_pkex_args(message, &key, &id, NULL, NULL)) return dbus_error_invalid_args(message); return dpp_start_pkex_configurator(dpp, key, id, NULL, message); From patchwork Tue Aug 27 14:21:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13779621 Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 105511C4620 for ; Tue, 27 Aug 2024 14:21:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724768513; cv=none; b=M52k0SH8UvTq4MniBCYI7viXoTWUdEfcb3uV5cmUWu9AqlqHpM+7Mayj5NeRhwthDjVzN+gYZfJAu48uu3l2+Zay7NhVs9VTfPqePCI73cetP3o69eWZ0B6nsZQcJKkfdnj0Wwb2pbH0aGMjXs5VNeIvDNg+rsRHyzE9n0lNryk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724768513; c=relaxed/simple; bh=6HNUUEnnHRseH+mJ0jBWzk/kDTcAwiSPTvdzQkLQF0I=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=KuV3FZ/IrchkU52zvvXD0mpoJ9kF9Nu/fLMPyAbFupubbU8hpsi+oeyFDD11lA4HYQNoghoDeQ+xGz59aZVTObWzgKj5Wjg/+HEbzCnpWARdSa5h7jAfgjIDMsOtzKDtR/SeH4+ZHEbNH9Nu5b2P96QZCRYDyO4LereAhsGcuEI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=esDxIn/5; arc=none smtp.client-ip=209.85.214.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="esDxIn/5" Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-2021c03c13aso41826275ad.1 for ; Tue, 27 Aug 2024 07:21:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724768511; x=1725373311; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HnS7fbnVMv3giJPDN9VHWSFTfWLIMLUR1CORR/RXiX0=; b=esDxIn/5dq6ZBj54k3/SGIkSe3DXZNuiDw7+D6P+6pLdK++qmFbxIqKhngkQVY+nuR qHAuHl04YKGT95ZUmIrJc+8tN9oUb+H6nkjwAANZGuCMn6vgZspNgX0fCVj1MO72bqG0 IgCSuqeF8TmiNJ47dx5MxIWpaPf/0FYmM+2nGTMQ7a8Mlp7wUftSxKZEQsLxXMvOJJEp 7Od72c828/j70WoPQtkCnLo+8ERIjnM49DNIHFdA+tx8/hnQSKTzc6GOnPU3FzdjzPJ8 sMc8CMsWhQg5T0mOA1flxp/LAp6sm+d6yfw6wj0zQOdtN2ct3eeponN/42Gfcw76TTOV rCKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724768511; x=1725373311; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HnS7fbnVMv3giJPDN9VHWSFTfWLIMLUR1CORR/RXiX0=; b=KKAqoXgoQA1sRcLp3AgFjhdn6t+JAVXamquFuDhFl2owQ4fpXGV5c3GQ+GPlS3zJMX PeETTX3Bq7KD6b7p21sdkaK7a2ETUhs2a2f9GiZQ9gTJ8Ezw5vRkq9XQPR6TGMVSO4Wa eJvZSGUXtETXuext0r3vJcP5VFgfZOt5weLYW2mx8tO59bnQ3AistQ5NU9HBTS45I//z J5RWVNHL4hbsFZB3aDYnhmECUhp65yPJJ00RpuXayNIEVw9HE2j7WMMfpoZcInz7zEpE Qx8jIXAn5nXQojLVBsb43a+SLGKSmGi2SR9woBSAWbJoIFst9FOOnRsvibVN+r+xEBXM vmnQ== X-Gm-Message-State: AOJu0YzraSQv5s8VIdVMUCNcWxo4fRES8mhXWWbTEO0XdUZqEWkYqmk9 JilRzCzHqUXKuXU4M2RWLcy18XtEseL82CF4c8SiXdt3F+fab+RalV4NEw== X-Google-Smtp-Source: AGHT+IE+RsjJmBC4YJKeBY2o2jFfyBqQc20e7oKszHupXZpKseEU2ANm0Keave49Lxjr/+r58BcdeA== X-Received: by 2002:a17:902:fa0b:b0:202:2f22:2fac with SMTP id d9443c01a7336-204ddccdab7mr34846505ad.8.1724768510993; Tue, 27 Aug 2024 07:21:50 -0700 (PDT) Received: from LOCLAP699.locus-rst-dev-locuspark.locus ([152.193.78.90]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20385609099sm83635695ad.192.2024.08.27.07.21.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Aug 2024 07:21:50 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 3/4] dpp: allow PKEX configurators to run without multicast RX support Date: Tue, 27 Aug 2024 07:21:24 -0700 Message-Id: <20240827142125.751023-3-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240827142125.751023-1-prestwoj@gmail.com> References: <20240827142125.751023-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Since IWD enrollees can send unicast frames, a PKEX configurator could still run without multicast support. Using this combination basically allows any driver to utilize DPP/PKEX assuming the MAC address can be communicated using some out of band mechanism. --- src/dpp.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/dpp.c b/src/dpp.c index 39b66154..dad74efe 100644 --- a/src/dpp.c +++ b/src/dpp.c @@ -4574,11 +4574,9 @@ static struct l_dbus_message *dpp_start_pkex_configurator(struct dpp_sm *dpp, dpp->interface != DPP_INTERFACE_UNBOUND) return dbus_error_busy(message); - if (!dpp->mcast_support) { - l_debug("Multicast frame registration not supported, cannot " - "start a configurator"); - return dbus_error_not_supported(message); - } + if (!dpp->mcast_support) + l_debug("Multicast frame registration not supported, only " + "enrollees sending uncast will be supported"); if (!network || !bss) return dbus_error_not_connected(message); From patchwork Tue Aug 27 14:21:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13779622 Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B67351C4620 for ; Tue, 27 Aug 2024 14:21:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724768515; cv=none; b=kpSLGxqE0Kcwjlf8hL3zuim3MUkRszGthwZ7rBd57hLRYKW6lFg1/scmJYf2dgjIN28nwkyC+bcaH200kjiwn9vL18vW8oDFr0pcjaJewkDIzd7ef7N/k3j/CBzstrQbwAO4e4Qi5jQIz97i1IUIchHMJXwKwhKRLgPG8sN7wBU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724768515; c=relaxed/simple; bh=4OeSd2SPy5Feagw4CT4hsHzqulHO1yry7kR+i7xao00=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=pjESDarkxfPYcQk8/AINeBETYJKgecn1XsvAt8Qv3DByKqg3I9XyjtBoN+XGIj7EiWBmhvj0s18cvDOwEndLJjjjg95FKm1bY/QtOzp4jGpSTLFvaLi4d4y16npm0yXPexIhaZYMLfUzOsnxKf3FVtGPbxFM0u7iOz8ZEE4y+OU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=MPN1hmKg; arc=none smtp.client-ip=209.85.214.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MPN1hmKg" Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-201df0b2df4so45300015ad.0 for ; Tue, 27 Aug 2024 07:21:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724768513; x=1725373313; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/mjhiey7NRC+rkwJf+1XNqX2fw39I3dE4iuM5M2DZ80=; b=MPN1hmKgFCQLTGcZwgXSa0+bvufT8c+KqVwS1HlWp5UBlY6SSHiAYlvmKe9BnC7iPM 4IBsJfE6VnKVgTdca4/pKPcP6hftk7u91KYi5CN7UX7NMktyw8DYwBHzUAEGZx7sLZNL sZ9OQUciyQtn57JmMVjsMuRVblyuJfpIcb042p62a6NqJNT7ms1LBhZVeAlRrIPm2Sn4 s6NTJA836CiL8w9hV3vhjp97v/SItnRoxYJSoikvBTceJN+AzIFDDodKwf8FZYTC9f2i I5yrCzxW/jZR4+3WYtmuebrpEfkGersW5WiyZR+zNHMB+wx2LpFzW2YM2DM+rVydcpyH Fo0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724768513; x=1725373313; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/mjhiey7NRC+rkwJf+1XNqX2fw39I3dE4iuM5M2DZ80=; b=ugAWYjqX+5npRmeADHzePlArxc0g81ao0vw/etxYVvix6VAv5jVe4kXuqdaXk9IzdU JGvJRibVroS6AZvKamHXJSz5ApZlyHbZQBdwP18/+a8fIEmgO4NJQLHJ48Y4XzbaXBj2 oVB4GQzS2Te69A7vkb7mZMl8gzrBxoUeI/gB1vYvGJ+Z9jPW3+WKluAg5Ric6R1zK31R JkRr0JazRPN7eahpt2cl+gsxRGVn3ZbWA55aYJXw9WsM9/X6u09CAFKR11R6rSavv8k/ uSrnWD1dMSdCcvOO094/exhM8aAAdj9ylgIuMzecr6eBxUvXjy4ZfLEQzh/Spps2W1mj xB7g== X-Gm-Message-State: AOJu0YwlI39aUIHXZpmIMW4nWweLQwppdCTXUgqYllHSVWfVWpVoC2J6 VfLxKHQcZ5ekLFnPUJhzGEWfcKbwskl60b0beeI1CPAcOigJfFyY4uJ9iQ== X-Google-Smtp-Source: AGHT+IEWBenVyJbwsOplsFqWqWNVyKfkHZ5rAzWBDm9UZ85+JA2xfL5DALBxC0ixuHGK4qgxcuwfXA== X-Received: by 2002:a17:903:2288:b0:203:a134:78ce with SMTP id d9443c01a7336-203a13478ecmr154212565ad.14.1724768512600; Tue, 27 Aug 2024 07:21:52 -0700 (PDT) Received: from LOCLAP699.locus-rst-dev-locuspark.locus ([152.193.78.90]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20385609099sm83635695ad.192.2024.08.27.07.21.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Aug 2024 07:21:52 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 4/4] dpp: scale PKEX timeout by the number of frequencies used Date: Tue, 27 Aug 2024 07:21:25 -0700 Message-Id: <20240827142125.751023-4-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240827142125.751023-1-prestwoj@gmail.com> References: <20240827142125.751023-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 If the number of frequencies used is very small reduce the timeout to avoid waiting for extended periods of time. --- src/dpp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/dpp.c b/src/dpp.c index dad74efe..5d56456d 100644 --- a/src/dpp.c +++ b/src/dpp.c @@ -59,6 +59,7 @@ #define DPP_FRAME_RETRY_TIMEOUT 1 #define DPP_AUTH_PROTO_TIMEOUT 10 #define DPP_PKEX_PROTO_TIMEOUT 120 +#define DPP_PKEX_PROTO_PER_FREQ_TIMEOUT 10 static uint32_t netdev_watch; static struct l_genl_family *nl80211; @@ -4284,7 +4285,8 @@ static void __dpp_pkex_start_enrollee(struct dpp_sm *dpp) { dpp->current_freq = dpp->freqs[0]; - dpp_reset_protocol_timer(dpp, DPP_PKEX_PROTO_TIMEOUT); + dpp_reset_protocol_timer(dpp, + dpp->freqs_len * DPP_PKEX_PROTO_PER_FREQ_TIMEOUT); l_debug("PKEX start enrollee (id=%s)", dpp->pkex_id ?: "unset");