Skip to content

Commit 7eaa7f5

Browse files
krish2718nordicjm
authored andcommitted
[nrf fromlist] net: l2: wifi: Make build time certs as optional
Certificates usage depends on STA/AP mode, but we don't have that information at a build time, so, make all certs as optional and if a file isn't found then generate an empty header so that corresponding C code will be built. Any missing mandatory certificates will be validated before connection and connection is failed. Upstream PR #: 87656 Signed-off-by: Chaitanya Tata <[email protected]>
1 parent f6e0862 commit 7eaa7f5

File tree

1 file changed

+13
-38
lines changed

1 file changed

+13
-38
lines changed

subsys/net/l2/wifi/CMakeLists.txt

+13-38
Original file line numberDiff line numberDiff line change
@@ -33,53 +33,28 @@ if(CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE AND CONFIG_NET_L2_WIFI_SHELL)
3333
# convert .pem files to array data at build time
3434
zephyr_include_directories(${gen_inc_dir})
3535

36-
generate_inc_file_for_target(
37-
app
36+
foreach(cert_file IN ITEMS
3837
${ZEPHYR_BASE}/samples/net/wifi/test_certs/client.pem
39-
${gen_dir}/client.pem.inc
40-
)
41-
42-
generate_inc_file_for_target(
43-
app
4438
${ZEPHYR_BASE}/samples/net/wifi/test_certs/client-key.pem
45-
${gen_dir}/client-key.pem.inc
46-
)
47-
48-
generate_inc_file_for_target(
49-
app
5039
${ZEPHYR_BASE}/samples/net/wifi/test_certs/ca.pem
51-
${gen_dir}/ca.pem.inc
52-
)
53-
54-
generate_inc_file_for_target(
55-
app
5640
${ZEPHYR_BASE}/samples/net/wifi/test_certs/client2.pem
57-
${gen_dir}/client2.pem.inc
58-
)
59-
60-
generate_inc_file_for_target(
61-
app
6241
${ZEPHYR_BASE}/samples/net/wifi/test_certs/client-key2.pem
63-
${gen_dir}/client-key2.pem.inc
64-
)
65-
66-
generate_inc_file_for_target(
67-
app
6842
${ZEPHYR_BASE}/samples/net/wifi/test_certs/ca2.pem
69-
${gen_dir}/ca2.pem.inc
70-
)
71-
72-
generate_inc_file_for_target(
73-
app
7443
${ZEPHYR_BASE}/samples/net/wifi/test_certs/server.pem
75-
${gen_dir}/server.pem.inc
76-
)
77-
78-
generate_inc_file_for_target(
79-
app
8044
${ZEPHYR_BASE}/samples/net/wifi/test_certs/server-key.pem
81-
${gen_dir}/server-key.pem.inc
8245
)
46+
if(EXISTS ${cert_file})
47+
get_filename_component(cert_name ${cert_file} NAME)
48+
generate_inc_file_for_target(
49+
app
50+
${cert_file}
51+
${gen_dir}/${cert_name}.inc
52+
)
53+
else()
54+
get_filename_component(cert_name ${cert_file} NAME)
55+
file(WRITE ${gen_dir}/${cert_name}.inc "// Empty file generated because ${cert_file} does not exist\n")
56+
endif()
57+
endforeach()
8358

8459
# Add explicit dependency on app target for ZEPHYR_CURRENT_LIBRARY, so these
8560
# headers are generated at the correct point in the build

0 commit comments

Comments
 (0)