Skip to content

Commit 134caa6

Browse files
committed
net: l2: wifi: Refactor certificates processing code into common file
Refactor certificate processing code to eliminate duplication and enable reuse across modules that require enterprise support. Signed-off-by: Triveni Danda <triveni.danda@nordicsemi.no>
1 parent c3bb3bf commit 134caa6

File tree

6 files changed

+418
-524
lines changed

6 files changed

+418
-524
lines changed

include/zephyr/net/wifi_certs.h

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* Copyright (c) 2025 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#ifndef WIFI_CREDS_H__
8+
#define WIFI_CREDS_H__
9+
10+
#include <stdbool.h>
11+
#include <zephyr/kernel.h>
12+
#include <zephyr/net/wifi_mgmt.h>
13+
#include <utils/common.h>
14+
#include <eap_peer/eap_config.h>
15+
#include <ctrl_iface_zephyr.h>
16+
#include <wpa_supplicant/config.h>
17+
18+
/**
19+
* Set Wi-Fi Enterprise credentials.
20+
*
21+
* Sets up the required credentials for Enterprise mode in both
22+
* Access Point and Station modes.
23+
*
24+
* Certificates typically used:
25+
* - CA certificate
26+
* - Client certificate
27+
* - Client private key
28+
* - Server certificate and server key (for AP mode)
29+
*
30+
* @param iface Network interface
31+
* @param AP or Station mode
32+
*/
33+
int wifi_set_enterprise_credentials(struct net_if *iface,
34+
bool is_ap);
35+
36+
/**
37+
* Clear Wi-Fi enterprise credentials
38+
* @param Wi-Fi enterprise params
39+
*/
40+
void wifi_clear_enterprise_credentials(void);
41+
42+
#endif /* WIFI_CREDS_H__ */

subsys/net/l2/wifi/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ zephyr_library_include_directories_ifdef(
1313
)
1414

1515
zephyr_library_sources_ifdef(CONFIG_NET_L2_WIFI_MGMT wifi_mgmt.c)
16+
zephyr_library_sources_ifdef(CONFIG_WIFI_CERTIFICATE_LIB wifi_certs.c)
1617
zephyr_library_sources_ifdef(CONFIG_NET_L2_WIFI_SHELL wifi_shell.c)
1718
zephyr_library_sources_ifdef(CONFIG_WIFI_NM wifi_nm.c)
1819
zephyr_library_sources_ifdef(CONFIG_NET_L2_WIFI_UTILS wifi_utils.c)

subsys/net/l2/wifi/Kconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,10 @@ config WIFI_ENT_IDENTITY_MAX_USERS
128128

129129
if WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE
130130

131+
config WIFI_CERTIFICATE_LIB
132+
bool "Process certificates in enterprise mode"
133+
default y
134+
131135
config WIFI_SHELL_RUNTIME_CERTIFICATES
132136
bool "Provide Wi-Fi enterprise security certificates at run-time"
133137
select TLS_CREDENTIALS

0 commit comments

Comments
 (0)