Skip to content

Commit 40cfc91

Browse files
committed
Merge branch 'feature/192bit_security_' into 'master'
ESP_WIFI: Added GCMP, GMAC, WPA3 192 bit Support Closes WIFI-3907 and WIFI-3778 See merge request espressif/esp-idf!14530
2 parents b4432d4 + f1b4a02 commit 40cfc91

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1651
-700
lines changed

components/esp_rom/esp32c3/ld/esp32c3.rom.ld

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1567,7 +1567,6 @@ ppEnqueueRxq = 0x400016c8;
15671567
ppEnqueueTxDone = 0x400016cc;
15681568
ppGetTxQFirstAvail_Locked = 0x400016d0;
15691569
ppGetTxframe = 0x400016d4;
1570-
ppProcTxSecFrame = 0x400016dc;
15711570
ppProcessRxPktHdr = 0x400016e0;
15721571
ppProcessTxQ = 0x400016e4;
15731572
ppRecordBarRRC = 0x400016e8;

components/esp_rom/esp32s3/ld/esp32s3.rom.ld

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1873,7 +1873,6 @@ ppEnqueueTxDone = 0x400055a4;
18731873
ppGetTxQFirstAvail_Locked = 0x400055b0;
18741874
ppGetTxframe = 0x400055bc;
18751875
ppMapTxQueue = 0x400055c8;
1876-
ppProcTxSecFrame = 0x400055d4;
18771876
ppProcessRxPktHdr = 0x400055e0;
18781877
ppProcessTxQ = 0x400055ec;
18791878
ppRecordBarRRC = 0x400055f8;

components/esp_wifi/Kconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,4 +312,17 @@ menu "Wi-Fi"
312312
This function depends on BT-off
313313
because currently we don't support external coex and internal coex simultaneously.
314314

315+
config ESP_WIFI_GCMP_SUPPORT
316+
bool "WiFi GCMP Support(GCMP128 and GCMP256)"
317+
default n
318+
depends on (IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32S3)
319+
help
320+
Select this option to enable GCMP support. GCMP support is compulsory for WiFi Suite-B support.
321+
322+
config ESP_WIFI_GMAC_SUPPORT
323+
bool "WiFi GMAC Support(GMAC128 and GMAC256)"
324+
default n
325+
help
326+
Select this option to enable GMAC support. GMAC support is compulsory for WiFi 192 bit certification.
327+
315328
endmenu # Wi-Fi

components/esp_wifi/include/esp_wifi_crypto_types.h

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
1-
// Hardware crypto support Copyright 2017 Espressif Systems (Shanghai) PTE LTD
2-
//
3-
// Licensed under the Apache License, Version 2.0 (the "License");
4-
// you may not use this file except in compliance with the License.
5-
// You may obtain a copy of the License at
6-
7-
// http://www.apache.org/licenses/LICENSE-2.0
8-
//
9-
// Unless required by applicable law or agreed to in writing, software
10-
// distributed under the License is distributed on an "AS IS" BASIS,
11-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
// See the License for the specific language governing permissions and
13-
// limitations under the License.
1+
/*
2+
* SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
146

157

168
#ifndef __ESP_WIFI_CRYPTO_TYPES_H__
@@ -358,6 +350,21 @@ typedef uint8_t * (*esp_ccmp_decrypt_t)(const uint8_t *tk, const uint8_t *ieee80
358350
typedef uint8_t * (*esp_ccmp_encrypt_t)(const uint8_t *tk, uint8_t *frame, size_t len, size_t hdrlen,
359351
uint8_t *pn, int keyid, size_t *encrypted_len);
360352

353+
/**
354+
* @brief One-Key GMAC hash with AES for MIC computation
355+
*
356+
* @key: key for the hash operation
357+
* @keylen: key length
358+
* @iv: initialization vector
359+
* @iv_len: initialization vector length
360+
* @aad: aad
361+
* @aad_len: aad length
362+
* @mic: Buffer for MIC (128 bits, i.e., 16 bytes)
363+
* Returns: 0 on success, -1 on failure
364+
*/
365+
typedef int (*esp_aes_gmac_t)(const uint8_t *key, size_t keylen, const uint8_t *iv, size_t iv_len,
366+
const uint8_t *aad, size_t aad_len, uint8_t *mic);
367+
361368
/**
362369
* @brief The crypto callback function structure used when do station security connect.
363370
* The structure can be set as software crypto or the crypto optimized by ESP32
@@ -390,6 +397,7 @@ typedef struct {
390397
esp_omac1_aes_128_t omac1_aes_128;
391398
esp_ccmp_decrypt_t ccmp_decrypt;
392399
esp_ccmp_encrypt_t ccmp_encrypt;
400+
esp_aes_gmac_t aes_gmac;
393401
}wpa_crypto_funcs_t;
394402

395403
/**

components/esp_wifi/include/esp_wifi_types.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,10 @@ typedef enum {
142142
WIFI_CIPHER_TYPE_TKIP_CCMP, /**< the cipher type is TKIP and CCMP */
143143
WIFI_CIPHER_TYPE_AES_CMAC128,/**< the cipher type is AES-CMAC-128 */
144144
WIFI_CIPHER_TYPE_SMS4, /**< the cipher type is SMS4 */
145+
WIFI_CIPHER_TYPE_GCMP, /**< the cipher type is GCMP */
146+
WIFI_CIPHER_TYPE_GCMP256, /**< the cipher type is GCMP-256 */
147+
WIFI_CIPHER_TYPE_AES_GMAC128,/**< the cipher type is AES-GMAC-128 */
148+
WIFI_CIPHER_TYPE_AES_GMAC256,/**< the cipher type is AES-GMAC-256 */
145149
WIFI_CIPHER_TYPE_UNKNOWN, /**< the cipher type is unknown */
146150
} wifi_cipher_type_t;
147151

components/wpa_supplicant/CMakeLists.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ set(srcs "port/os_xtensa.c"
1010
"src/crypto/aes-siv.c"
1111
"src/crypto/sha256-kdf.c"
1212
"src/crypto/ccmp.c"
13+
"src/crypto/aes-gcm.c"
1314
"src/crypto/crypto_ops.c"
1415
"src/crypto/dh_group5.c"
1516
"src/crypto/dh_groups.c"
@@ -19,6 +20,7 @@ set(srcs "port/os_xtensa.c"
1920
"src/crypto/sha384-tlsprf.c"
2021
"src/crypto/sha256-prf.c"
2122
"src/crypto/sha1-prf.c"
23+
"src/crypto/sha384-prf.c"
2224
"src/crypto/md4-internal.c"
2325
"src/eap_peer/chap.c"
2426
"src/eap_peer/eap.c"
@@ -194,6 +196,18 @@ endif()
194196
if(CONFIG_WPA_WPS_STRICT)
195197
target_compile_definitions(${COMPONENT_LIB} PRIVATE CONFIG_WPS_STRICT)
196198
endif()
199+
if(CONFIG_WPA_SUITE_B_192)
200+
target_compile_definitions(${COMPONENT_LIB} PRIVATE CONFIG_SUITEB192)
201+
endif()
202+
if(CONFIG_WPA_SUITE_B)
203+
target_compile_definitions(${COMPONENT_LIB} PRIVATE CONFIG_SUITEB)
204+
endif()
205+
if(CONFIG_ESP_WIFI_GCMP_SUPPORT)
206+
target_compile_definitions(${COMPONENT_LIB} PRIVATE CONFIG_GCMP)
207+
endif()
208+
if(CONFIG_ESP_WIFI_GMAC_SUPPORT)
209+
target_compile_definitions(${COMPONENT_LIB} PRIVATE CONFIG_GMAC)
210+
endif()
197211

198212
if(CONFIG_WPA_MBO_SUPPORT)
199213
target_compile_definitions(${COMPONENT_LIB} PRIVATE CONFIG_MBO)

components/wpa_supplicant/Kconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@ menu "Supplicant"
1818
Select this option to enable WAPI-PSK
1919
which is a Chinese National Standard Encryption for Wireless LANs (GB 15629.11-2003).
2020

21+
config WPA_SUITE_B_192
22+
bool "Enable NSA suite B support with 192 bit key"
23+
default n
24+
select ESP_WIFI_GCMP_SUPPORT
25+
select ESP_WIFI_GMAC_SUPPORT
26+
help
27+
Select this option to enable 192 bit NSA suite-B.
28+
This is necessary to support WPA3 192 bit security.
29+
2130
config WPA_DEBUG_PRINT
2231
bool "Print debug messages from WPA Supplicant"
2332
default n

components/wpa_supplicant/component.mk

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,15 @@ endif
8585
ifdef CONFIG_WPA_MBO_SUPPORT
8686
CFLAGS += -DCONFIG_MBO
8787
endif
88+
ifdef CONFIG_WPA_SUITE_B_192
89+
CFLAGS += -DCONFIG_SUITEB192
90+
endif
91+
ifdef CONFIG_WPA_SUITE_B
92+
CFLAGS += -DCONFIG_SUITEB
93+
endif
94+
ifdef CONFIG_ESP_WIFI_GCMP_SUPPORT
95+
CFLAGS += -DCONFIG_GCMP
96+
endif
97+
ifdef CONFIG_ESP_WIFI_GMAC_SUPPORT
98+
CFLAGS += -DCONFIG_GMAC
99+
endif

components/wpa_supplicant/esp_supplicant/include/esp_wpa2.h

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
1-
// Hardware crypto support Copyright 2019 Espressif Systems (Shanghai) PTE LTD
2-
//
3-
// Licensed under the Apache License, Version 2.0 (the "License");
4-
// you may not use this file except in compliance with the License.
5-
// You may obtain a copy of the License at
6-
7-
// http://www.apache.org/licenses/LICENSE-2.0
8-
//
9-
// Unless required by applicable law or agreed to in writing, software
10-
// distributed under the License is distributed on an "AS IS" BASIS,
11-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
// See the License for the specific language governing permissions and
13-
// limitations under the License.
1+
/*
2+
* SPDX-FileCopyrightText: 2019-2021 Espressif Systems (Shanghai) CO LTD
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
146

157
#ifndef _ESP_WPA2_H
168
#define _ESP_WPA2_H
@@ -209,6 +201,16 @@ esp_err_t esp_wifi_sta_wpa2_ent_get_disable_time_check(bool *disable);
209201
*/
210202
esp_err_t esp_wifi_sta_wpa2_ent_set_ttls_phase2_method(esp_eap_ttls_phase2_types type);
211203

204+
/**
205+
* @brief enable/disable 192 bit suite b certification checks
206+
*
207+
* @param enable: bool to enable/disable it.
208+
*
209+
* @return
210+
* - ESP_OK: succeed
211+
*/
212+
esp_err_t esp_wifi_sta_wpa2_set_suiteb_192bit_certification(bool enable);
213+
212214
#ifdef __cplusplus
213215
}
214216
#endif

0 commit comments

Comments
 (0)