1set(srcs "port/os_xtensa.c"
2    "src/ap/ap_config.c"
3    "src/ap/ieee802_1x.c"
4    "src/ap/wpa_auth.c"
5    "src/ap/wpa_auth_ie.c"
6    "src/common/sae.c"
7    "src/common/wpa_common.c"
8    "src/common/dpp.c"
9    "src/utils/bitfield.c"
10    "src/crypto/aes-siv.c"
11    "src/crypto/sha256-kdf.c"
12    "src/crypto/ccmp.c"
13    "src/crypto/aes-gcm.c"
14    "src/crypto/crypto_ops.c"
15    "src/crypto/dh_group5.c"
16    "src/crypto/dh_groups.c"
17    "src/crypto/ms_funcs.c"
18    "src/crypto/sha1-tlsprf.c"
19    "src/crypto/sha256-tlsprf.c"
20    "src/crypto/sha384-tlsprf.c"
21    "src/crypto/sha256-prf.c"
22    "src/crypto/sha1-prf.c"
23    "src/crypto/sha384-prf.c"
24    "src/crypto/md4-internal.c"
25    "src/eap_peer/chap.c"
26    "src/eap_peer/eap.c"
27    "src/eap_peer/eap_common.c"
28    "src/eap_peer/eap_mschapv2.c"
29    "src/eap_peer/eap_peap.c"
30    "src/eap_peer/eap_peap_common.c"
31    "src/eap_peer/eap_tls.c"
32    "src/eap_peer/eap_tls_common.c"
33    "src/eap_peer/eap_ttls.c"
34    "src/eap_peer/mschapv2.c"
35    "src/eap_peer/eap_fast.c"
36    "src/eap_peer/eap_fast_common.c"
37    "src/eap_peer/eap_fast_pac.c"
38    "src/rsn_supp/pmksa_cache.c"
39    "src/rsn_supp/wpa.c"
40    "src/rsn_supp/wpa_ie.c"
41    "src/utils/base64.c"
42    "src/utils/common.c"
43    "src/utils/ext_password.c"
44    "src/utils/uuid.c"
45    "src/utils/wpabuf.c"
46    "src/utils/wpa_debug.c"
47    "src/utils/json.c"
48    "src/wps/wps.c"
49    "src/wps/wps_attr_build.c"
50    "src/wps/wps_attr_parse.c"
51    "src/wps/wps_attr_process.c"
52    "src/wps/wps_common.c"
53    "src/wps/wps_dev_attr.c"
54    "src/wps/wps_enrollee.c"
55    "src/wps/wps_registrar.c"
56    "src/wps/wps_validate.c")
57
58set(esp_srcs "esp_supplicant/src/esp_wpa2.c"
59    "esp_supplicant/src/esp_wpa_main.c"
60    "esp_supplicant/src/esp_wpas_glue.c"
61    "esp_supplicant/src/esp_wps.c"
62    "esp_supplicant/src/esp_wpa3.c"
63    "esp_supplicant/src/esp_dpp.c")
64if(CONFIG_ESP_WIFI_SOFTAP_SUPPORT)
65    set(esp_srcs ${esp_srcs} "esp_supplicant/src/esp_hostap.c")
66endif()
67
68if(CONFIG_WPA_MBEDTLS_CRYPTO)
69    set(tls_src "src/crypto/tls_mbedtls.c")
70else()
71    set(tls_src
72    "src/tls/asn1.c"
73    "src/tls/bignum.c"
74    "src/tls/pkcs1.c"
75    "src/tls/pkcs5.c"
76    "src/tls/pkcs8.c"
77    "src/tls/bignum.c"
78    "src/tls/rsa.c"
79    "src/tls/tls_internal.c"
80    "src/tls/tlsv1_client.c"
81    "src/tls/tlsv1_client_read.c"
82    "src/tls/tlsv1_client_write.c"
83    "src/tls/tlsv1_common.c"
84    "src/tls/tlsv1_cred.c"
85    "src/tls/tlsv1_record.c"
86    "src/tls/tlsv1_server.c"
87    "src/tls/tlsv1_server_read.c"
88    "src/tls/tlsv1_server_write.c"
89    "src/tls/x509v3.c")
90endif()
91
92if(CONFIG_WPA_MBEDTLS_CRYPTO)
93    set(crypto_src
94    "src/crypto/crypto_mbedtls.c"
95    "src/crypto/crypto_mbedtls-bignum.c"
96    "src/crypto/crypto_mbedtls-ec.c")
97    # Add internal RC4 if RC4 is disabled in mbedtls
98    if(CONFIG_MBEDTLS_RC4_DISABLED)
99        set(crypto_src ${crypto_src} "src/crypto/rc4.c")
100    endif()
101    if(NOT CONFIG_MBEDTLS_DES_C)
102        set(crypto_src ${crypto_src} "src/crypto/des-internal.c")
103    endif()
104    # Enabling this only for WiFi is probably not a good idea since MbedTLS
105    # uses generic crypto init/update functions for this. That causes
106    # binary size increment since all the other enabled module
107    # functions will also linked in. Even after not using direct MbedTLS APIs
108    # for these, these API are still faster since these all will be using
109    # AES APIs which is using hardware AES blocks.
110    if(NOT CONFIG_MBEDTLS_CMAC_C)
111        set(crypto_src ${crypto_src} "src/crypto/aes-omac1.c")
112    endif()
113    if(NOT CONFIG_MBEDTLS_NIST_KW_C)
114        set(crypto_src ${crypto_src}
115        "src/crypto/aes-wrap.c"
116        "src/crypto/aes-unwrap.c")
117    endif()
118    if(NOT CONFIG_MBEDTLS_NIST_KW_C OR NOT CONFIG_MBEDTLS_CMAC_C OR NOT CONFIG_MBEDTLS_CCM_C)
119        set(crypto_src ${crypto_src} "src/crypto/aes-ccm.c")
120    endif()
121else()
122    set(crypto_src
123    "src/crypto/rc4.c"
124    "src/crypto/aes-ctr.c"
125    "src/crypto/aes-cbc.c"
126    "src/crypto/aes-ccm.c"
127    "src/crypto/aes-internal-dec.c"
128    "src/crypto/aes-internal-enc.c"
129    "src/crypto/aes-internal.c"
130    "src/crypto/aes-omac1.c"
131    "src/crypto/aes-unwrap.c"
132    "src/crypto/aes-wrap.c"
133    "src/crypto/crypto_internal-cipher.c"
134    "src/crypto/crypto_internal-modexp.c"
135    "src/crypto/crypto_internal-rsa.c"
136    "src/crypto/crypto_mbedtls-rsa.c"
137    "src/crypto/crypto_internal.c"
138    "src/crypto/des-internal.c"
139    "src/crypto/md4-internal.c"
140    "src/crypto/md5-internal.c"
141    "src/crypto/md5.c"
142    "src/crypto/sha1-internal.c"
143    "src/crypto/sha1-pbkdf2.c"
144    "src/crypto/sha1.c"
145    "src/crypto/sha1-tprf.c"
146    "src/crypto/sha256-internal.c"
147    "src/crypto/sha384-internal.c"
148    "src/crypto/sha512-internal.c"
149    "src/crypto/sha256.c")
150endif()
151
152if(CONFIG_WPA_11KV_SUPPORT)
153    set(roaming_src
154    "src/common/rrm.c"
155    "src/common/wnm_sta.c"
156    "src/common/bss.c"
157    "src/common/scan.c"
158    "src/common/ieee802_11_common.c"
159    "esp_supplicant/src/esp_common.c"
160    "esp_supplicant/src/esp_scan.c"
161    )
162else()
163    set(roaming_src "")
164endif()
165if(CONFIG_WPA_MBO_SUPPORT)
166    set(mbo_src "src/common/mbo.c")
167else()
168    set(mbo_src "")
169endif()
170
171idf_component_register(SRCS "${srcs}" ${esp_srcs} "${tls_src}" "${roaming_src}" "${crypto_src}" "${mbo_src}"
172                    INCLUDE_DIRS include port/include esp_supplicant/include
173                    PRIV_INCLUDE_DIRS src src/utils esp_supplicant/src
174                    PRIV_REQUIRES mbedtls esp_timer)
175
176target_compile_options(${COMPONENT_LIB} PRIVATE -Wno-strict-aliasing -Wno-write-strings)
177target_compile_definitions(${COMPONENT_LIB} PRIVATE
178    __ets__
179    ESP_SUPPLICANT
180    IEEE8021X_EAPOL
181    EAP_PEER_METHOD
182    EAP_MSCHAPv2
183    EAP_TTLS
184    EAP_TLS
185    EAP_PEAP
186    EAP_FAST
187    USE_WPA2_TASK
188    CONFIG_WPS2
189    CONFIG_WPS_PIN
190    USE_WPS_TASK
191    ESPRESSIF_USE
192    ESP32_WORKAROUND
193    CONFIG_ECC
194    CONFIG_IEEE80211W
195    CONFIG_SHA256
196    CONFIG_DPP
197    CONFIG_WNM
198    )
199
200if(CONFIG_ESP32_WIFI_ENABLE_WPA3_SAE)
201    target_compile_definitions(${COMPONENT_LIB} PRIVATE CONFIG_WPA3_SAE)
202endif()
203if(CONFIG_WPA_WPS_STRICT)
204    target_compile_definitions(${COMPONENT_LIB} PRIVATE CONFIG_WPS_STRICT)
205endif()
206if(CONFIG_WPA_SUITE_B_192)
207    target_compile_definitions(${COMPONENT_LIB} PRIVATE CONFIG_SUITEB192)
208endif()
209if(CONFIG_WPA_SUITE_B)
210    target_compile_definitions(${COMPONENT_LIB} PRIVATE CONFIG_SUITEB)
211endif()
212if(CONFIG_ESP_WIFI_GCMP_SUPPORT)
213    target_compile_definitions(${COMPONENT_LIB} PRIVATE CONFIG_GCMP)
214endif()
215if(CONFIG_ESP_WIFI_GMAC_SUPPORT)
216    target_compile_definitions(${COMPONENT_LIB} PRIVATE CONFIG_GMAC)
217endif()
218
219if(CONFIG_WPA_MBO_SUPPORT)
220    target_compile_definitions(${COMPONENT_LIB} PRIVATE CONFIG_MBO)
221endif()
222set_property(TARGET ${COMPONENT_LIB} APPEND PROPERTY LINK_INTERFACE_MULTIPLICITY 3)
223