فهرست منبع

Merge 'master' into feature/esp32s2beta_update

Angus Gratton 6 سال پیش
والد
کامیت
0a0bb09585
62فایلهای تغییر یافته به همراه160 افزوده شده و 203 حذف شده
  1. 1 1
      components/driver/ledc.c
  2. 2 2
      components/driver/test/test_pcnt.c
  3. 0 5
      components/esp32/esp_adapter.c
  4. 0 9
      components/esp32s2beta/esp_adapter.c
  5. 0 1
      components/esp_wifi/CMakeLists.txt
  6. 1 1
      components/esp_wifi/lib_esp32
  7. 0 1
      components/tcp_transport/CMakeLists.txt
  8. 0 57
      components/tcp_transport/transport_strcasestr.c
  9. 0 38
      components/tcp_transport/transport_strcasestr.h
  10. 1 2
      components/tcp_transport/transport_ws.c
  11. 1 0
      components/wpa_supplicant/CMakeLists.txt
  12. 0 10
      components/wpa_supplicant/include/crypto/wepkey.h
  13. 4 1
      components/wpa_supplicant/include/esp_supplicant/esp_wpa.h
  14. 0 1
      components/wpa_supplicant/src/ap/ieee802_1x.c
  15. 2 2
      components/wpa_supplicant/src/crypto/aes-cbc.c
  16. 2 2
      components/wpa_supplicant/src/crypto/aes-internal-dec.c
  17. 2 2
      components/wpa_supplicant/src/crypto/aes-internal-enc.c
  18. 2 2
      components/wpa_supplicant/src/crypto/aes-internal.c
  19. 2 2
      components/wpa_supplicant/src/crypto/aes-unwrap.c
  20. 2 2
      components/wpa_supplicant/src/crypto/aes-wrap.c
  21. 0 0
      components/wpa_supplicant/src/crypto/aes.h
  22. 1 1
      components/wpa_supplicant/src/crypto/aes_i.h
  23. 0 0
      components/wpa_supplicant/src/crypto/aes_wrap.h
  24. 0 0
      components/wpa_supplicant/src/crypto/crypto.h
  25. 3 3
      components/wpa_supplicant/src/crypto/crypto_internal-cipher.c
  26. 1 1
      components/wpa_supplicant/src/crypto/crypto_internal-modexp.c
  27. 1 1
      components/wpa_supplicant/src/crypto/crypto_internal-rsa.c
  28. 3 3
      components/wpa_supplicant/src/crypto/crypto_internal.c
  29. 1 1
      components/wpa_supplicant/src/crypto/crypto_mbedtls.c
  30. 8 8
      components/wpa_supplicant/src/crypto/crypto_ops.c
  31. 1 1
      components/wpa_supplicant/src/crypto/des-internal.c
  32. 2 2
      components/wpa_supplicant/src/crypto/dh_group5.c
  33. 0 0
      components/wpa_supplicant/src/crypto/dh_group5.h
  34. 3 3
      components/wpa_supplicant/src/crypto/dh_groups.c
  35. 0 0
      components/wpa_supplicant/src/crypto/dh_groups.h
  36. 1 1
      components/wpa_supplicant/src/crypto/md4-internal.c
  37. 3 3
      components/wpa_supplicant/src/crypto/md5-internal.c
  38. 2 2
      components/wpa_supplicant/src/crypto/md5.c
  39. 0 0
      components/wpa_supplicant/src/crypto/md5.h
  40. 3 3
      components/wpa_supplicant/src/crypto/ms_funcs.c
  41. 0 0
      components/wpa_supplicant/src/crypto/ms_funcs.h
  42. 0 0
      components/wpa_supplicant/src/crypto/random.h
  43. 1 1
      components/wpa_supplicant/src/crypto/rc4.c
  44. 4 4
      components/wpa_supplicant/src/crypto/sha1-internal.c
  45. 3 3
      components/wpa_supplicant/src/crypto/sha1-pbkdf2.c
  46. 2 2
      components/wpa_supplicant/src/crypto/sha1.c
  47. 0 0
      components/wpa_supplicant/src/crypto/sha1.h
  48. 2 2
      components/wpa_supplicant/src/crypto/sha256-internal.c
  49. 2 2
      components/wpa_supplicant/src/crypto/sha256.c
  50. 0 0
      components/wpa_supplicant/src/crypto/sha256.h
  51. 0 1
      components/wpa_supplicant/src/eap_peer/eap_ttls.c
  52. 0 1
      components/wpa_supplicant/src/esp_supplicant/esp_wpa_main.c
  53. 0 1
      components/wpa_supplicant/src/rsn_supp/wpa.c
  54. 0 2
      components/wpa_supplicant/src/wps/wps.c
  55. 1 1
      components/wpa_supplicant/src/wps/wps_attr_build.c
  56. 1 1
      components/wpa_supplicant/src/wps/wps_common.c
  57. 1 0
      docs/en/api-guides/bootloader.rst
  58. 59 1
      docs/zh_CN/api-guides/bootloader.rst
  59. 1 1
      docs/zh_CN/api-guides/index.rst
  60. 22 2
      tools/cmake/kconfig.cmake
  61. 1 1
      tools/idf_monitor.py
  62. 5 3
      tools/kconfig_new/confserver.py

+ 1 - 1
components/driver/ledc.c

@@ -343,7 +343,7 @@ esp_err_t ledc_timer_config(const ledc_timer_config_t* timer_conf)
         ESP_LOGE(LEDC_TAG, "invalid timer #%u", timer_num);
         return ESP_ERR_INVALID_ARG;
     }
-    return ledc_set_timer_div(timer_num, timer_num, timer_conf->clk_cfg, freq_hz, duty_resolution);
+    return ledc_set_timer_div(speed_mode, timer_num, timer_conf->clk_cfg, freq_hz, duty_resolution);
 }
 
 esp_err_t ledc_set_pin(int gpio_num, ledc_mode_t speed_mode, ledc_channel_t ledc_channel)

+ 2 - 2
components/driver/test/test_pcnt.c

@@ -57,7 +57,7 @@ static void produce_pulse(void)
         .freq_hz = 1,
         .clk_cfg = LEDC_AUTO_CLK,
     };
-    ledc_timer_config(&ledc_timer);
+    ESP_ERROR_CHECK(ledc_timer_config(&ledc_timer));
 
     ledc_channel_config_t ledc_channel = {
         .speed_mode = LEDC_HIGH_SPEED_MODE,
@@ -68,7 +68,7 @@ static void produce_pulse(void)
         .duty = 100,
         .hpoint = 0,
     };
-    ledc_channel_config(&ledc_channel);
+    ESP_ERROR_CHECK(ledc_channel_config(&ledc_channel));
 }
 
 static void IRAM_ATTR pcnt_intr_handler(void *arg)

+ 0 - 5
components/esp32/esp_adapter.c

@@ -38,11 +38,6 @@
 #include "esp_private/wifi_os_adapter.h"
 #include "esp_private/wifi.h"
 #include "esp_phy_init.h"
-#include "crypto/md5.h"
-#include "crypto/sha1.h"
-#include "crypto/crypto.h"
-#include "crypto/aes.h"
-#include "crypto/dh_group5.h"
 #include "driver/periph_ctrl.h"
 #include "nvs.h"
 #include "os.h"

+ 0 - 9
components/esp32s2beta/esp_adapter.c

@@ -38,20 +38,13 @@
 #include "esp_private/wifi_os_adapter.h"
 #include "esp_private/wifi.h"
 #include "esp_phy_init.h"
-#include "crypto/md5.h"
-#include "crypto/sha1.h"
-#include "crypto/crypto.h"
-#include "crypto/aes.h"
-#include "crypto/dh_group5.h"
 #include "driver/periph_ctrl.h"
 #include "nvs.h"
 #include "os.h"
 #include "esp_smartconfig.h"
 #include "esp_coexist_internal.h"
 #include "esp_coexist_adapter.h"
-#if CONFIG_IDF_TARGET_ESP32S2BETA
 #include "esp32s2beta/clk.h"
-#endif
 
 #define TAG "esp_adapter"
 
@@ -583,9 +576,7 @@ wifi_osi_funcs_t g_wifi_osi_funcs = {
     ._get_random = os_get_random,
     ._get_time = get_time_wrapper,
     ._random = os_random,
-#if CONFIG_IDF_TARGET_ESP32S2BETA
     ._slowclk_cal_get = esp_clk_slowclk_cal_get,
-#endif
     ._log_write = esp_log_write,
     ._log_timestamp = esp_log_timestamp,
     ._malloc_internal =  malloc_internal_wrapper,

+ 0 - 1
components/esp_wifi/CMakeLists.txt

@@ -9,7 +9,6 @@ else()
 endif()
 
 idf_component_register(SRCS "src/coexist.c"
-                            "src/crypto_ops.c"
                             "src/lib_printf.c"
                             "src/mesh_event.c"
                             "src/phy_init.c"

+ 1 - 1
components/esp_wifi/lib_esp32

@@ -1 +1 @@
-Subproject commit 57e1fd11f2f2e17c39ce9612e5fd87d687bcf133
+Subproject commit 09ed80c2b047ae5bb41ddbfb9be44ec2bc71fedd

+ 0 - 1
components/tcp_transport/CMakeLists.txt

@@ -3,7 +3,6 @@ idf_component_register(SRCS "transport.c"
                             "transport_tcp.c"
                             "transport_ws.c"
                             "transport_utils.c"
-                            "transport_strcasestr.c"
                     INCLUDE_DIRS "include"
                     PRIV_INCLUDE_DIRS "private_include"
                     REQUIRES lwip esp-tls)

+ 0 - 57
components/tcp_transport/transport_strcasestr.c

@@ -1,57 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *	The Regents of the University of California.  All rights reserved.
- *
- * The quadratic code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-/* Linear algorithm Copyright (C) 2008 Eric Blake
- * Permission to use, copy, modify, and distribute the linear portion of
- * software is freely granted, provided that this notice is preserved.
- */
-#include "transport_strcasestr.h"
-#include <string.h>
-#include <ctype.h>
-
-char *transport_strcasestr(const char *buffer, const char *key)
-{
-    char c, sc;
-    size_t len;
-
-    if ((c = *key++) != 0) {
-        c = tolower((unsigned char)c);
-        len = strlen(key);
-        do {
-            do {
-                if ((sc = *buffer++) == 0)
-                    return (NULL);
-            } while ((char)tolower((unsigned char)sc) != c);
-        } while (strncasecmp(buffer, key, len) != 0);
-        buffer--;
-    }
-    return ((char *)buffer);
-}

+ 0 - 38
components/tcp_transport/transport_strcasestr.h

@@ -1,38 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *	The Regents of the University of California.  All rights reserved.
- *
- * The quadratic code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-/* Linear algorithm Copyright (C) 2008 Eric Blake
- * Permission to use, copy, modify, and distribute the linear portion of
- * software is freely granted, provided that this notice is preserved.
- */
-
-char *transport_strcasestr(const char *buffer, const char *key);
-

+ 1 - 2
components/tcp_transport/transport_ws.c

@@ -8,7 +8,6 @@
 #include "esp_transport_tcp.h"
 #include "esp_transport_ws.h"
 #include "esp_transport_utils.h"
-#include "transport_strcasestr.h"
 #include "mbedtls/base64.h"
 #include "mbedtls/sha1.h"
 
@@ -64,7 +63,7 @@ static char *trimwhitespace(const char *str)
 
 static char *get_http_header(const char *buffer, const char *key)
 {
-    char *found = transport_strcasestr(buffer, key);
+    char *found = strcasestr(buffer, key);
     if (found) {
         found += strlen(key);
         char *found_end = strstr(found, "\r\n");

+ 1 - 0
components/wpa_supplicant/CMakeLists.txt

@@ -12,6 +12,7 @@ set(srcs "port/os_xtensa.c"
     "src/crypto/aes-wrap.c"
     "src/crypto/bignum.c"
     "src/crypto/crypto_mbedtls.c"
+    "src/crypto/crypto_ops.c"
     "src/crypto/crypto_internal-cipher.c"
     "src/crypto/crypto_internal-modexp.c"
     "src/crypto/crypto_internal-rsa.c"

+ 0 - 10
components/wpa_supplicant/include/crypto/wepkey.h

@@ -1,10 +0,0 @@
-#ifndef WEPKEY_H
-#define WEPKEY_H
-
-#define WEPKEY_64_BYTES   5
-#define WePKEY_128_BYTES  13
-
-unsigned int wepkey_64(uint8_t *out, unsigned int size, const char *in, int n);
-unsigned int wepkey_128(uint8_t *out, unsigned int size, const char *in, int n);
-
-#endif /* WEPKEY_H */

+ 4 - 1
components/wpa_supplicant/include/esp_supplicant/esp_wpa.h

@@ -40,7 +40,10 @@ extern "C" {
 /** @addtogroup WPA_APIs
   * @{
   */
-
+/* Crypto callback functions */
+const wpa_crypto_funcs_t g_wifi_default_wpa_crypto_funcs;
+/* Mesh crypto callback functions */
+const mesh_crypto_funcs_t g_wifi_default_mesh_crypto_funcs;
 
 /**
   * @brief     Supplicant initialization

+ 0 - 1
components/wpa_supplicant/src/ap/ieee802_1x.c

@@ -10,7 +10,6 @@
 
 #include "utils/common.h"
 #include "crypto/crypto.h"
-#include "crypto/random.h"
 #include "common/ieee802_11_defs.h"
 #include "hostapd.h"
 #include "ap/sta_info.h"

+ 2 - 2
components/wpa_supplicant/src/crypto/aes-cbc.c

@@ -31,8 +31,8 @@
 #include "utils/includes.h"
 
 #include "utils/common.h"
-#include "crypto/aes.h"
-#include "crypto/aes_wrap.h"
+#include "aes.h"
+#include "aes_wrap.h"
 
 #ifdef USE_MBEDTLS_CRYPTO
 #include "mbedtls/aes.h"

+ 2 - 2
components/wpa_supplicant/src/crypto/aes-internal-dec.c

@@ -24,8 +24,8 @@
 #include "utils/includes.h"
 
 #include "utils/common.h"
-#include "crypto/crypto.h"
-#include "crypto/aes_i.h"
+#include "crypto.h"
+#include "aes_i.h"
 
 
 

+ 2 - 2
components/wpa_supplicant/src/crypto/aes-internal-enc.c

@@ -23,8 +23,8 @@
 
 #include "utils/includes.h"
 #include "utils/common.h"
-#include "crypto/crypto.h"
-#include "crypto/aes_i.h"
+#include "crypto.h"
+#include "aes_i.h"
 
 #include "os.h"
 

+ 2 - 2
components/wpa_supplicant/src/crypto/aes-internal.c

@@ -24,8 +24,8 @@
 #include "utils/includes.h"
 
 #include "utils/common.h"
-#include "crypto/crypto.h"
-#include "crypto/aes_i.h"
+#include "crypto.h"
+#include "aes_i.h"
 
 /*
  * rijndael-alg-fst.c

+ 2 - 2
components/wpa_supplicant/src/crypto/aes-unwrap.c

@@ -34,8 +34,8 @@
 #ifdef USE_MBEDTLS_CRYPTO
 #include "mbedtls/aes.h"
 #else /* USE_MBEDTLS_CRYPTO */
-#include "crypto/aes.h"
-#include "crypto/aes_wrap.h"
+#include "aes.h"
+#include "aes_wrap.h"
 #endif /* USE_MBEDTLS_CRYPTO */
 
 /**

+ 2 - 2
components/wpa_supplicant/src/crypto/aes-wrap.c

@@ -25,8 +25,8 @@
 #include "utils/includes.h"
 
 #include "utils/common.h"
-#include "crypto/aes.h"
-#include "crypto/aes_wrap.h"
+#include "aes.h"
+#include "aes_wrap.h"
 #ifdef USE_MBEDTLS_CRYPTO
 #include "mbedtls/aes.h"
 #endif /* USE_MBEDTLS_CRYPTO */

+ 0 - 0
components/wpa_supplicant/include/crypto/aes.h → components/wpa_supplicant/src/crypto/aes.h


+ 1 - 1
components/wpa_supplicant/src/crypto/aes_i.h

@@ -15,7 +15,7 @@
 #ifndef AES_I_H
 #define AES_I_H
 
-#include "crypto/aes.h"
+#include "aes.h"
 
 /* #define FULL_UNROLL */
 #define AES_SMALL_TABLES

+ 0 - 0
components/wpa_supplicant/include/crypto/aes_wrap.h → components/wpa_supplicant/src/crypto/aes_wrap.h


+ 0 - 0
components/wpa_supplicant/include/crypto/crypto.h → components/wpa_supplicant/src/crypto/crypto.h


+ 3 - 3
components/wpa_supplicant/src/crypto/crypto_internal-cipher.c

@@ -23,10 +23,10 @@
 
 #include "utils/common.h"
 #include "utils/includes.h"
-#include "crypto/crypto.h"
-#include "crypto/aes.h"
+#include "crypto.h"
+#include "aes.h"
 #if defined(CONFIG_DES) || defined(CONFIG_DES3)
-#include "crypto/des_i.h"
+#include "des_i.h"
 #endif
 #ifdef USE_MBEDTLS_CRYPTO
 #include "mbedtls/aes.h"

+ 1 - 1
components/wpa_supplicant/src/crypto/crypto_internal-modexp.c

@@ -35,7 +35,7 @@
 #else /* USE_MBEDTLS_CRYPTO */
 #include "bignum.h"
 #endif /* USE_MBEDTLS_CRYPTO */
-#include "crypto/crypto.h"
+#include "crypto.h"
 
 #ifdef USE_MBEDTLS_CRYPTO
 int

+ 1 - 1
components/wpa_supplicant/src/crypto/crypto_internal-rsa.c

@@ -7,7 +7,7 @@
  */
 
 #include "utils/common.h"
-#include "crypto/crypto.h"
+#include "crypto.h"
 
 #include "utils/includes.h"
 #include "utils/common.h"

+ 3 - 3
components/wpa_supplicant/src/crypto/crypto_internal.c

@@ -23,9 +23,9 @@
 
 #include "utils/includes.h"
 #include "utils/common.h"
-#include "crypto/crypto.h"
-#include "crypto/sha1_i.h"
-#include "crypto/md5_i.h"
+#include "crypto.h"
+#include "sha1_i.h"
+#include "md5_i.h"
 #ifdef USE_MBEDTLS_CRYPTO
 #include "mbedtls/sha256.h"
 #endif

+ 1 - 1
components/wpa_supplicant/src/crypto/crypto_mbedtls.c

@@ -19,7 +19,7 @@
 
 #include "utils/includes.h"
 #include "utils/common.h"
-#include "crypto/crypto.h"
+#include "crypto.h"
 
 #include "mbedtls/ecp.h"
 #include "mbedtls/entropy.h"

+ 8 - 8
components/esp_wifi/src/crypto_ops.c → components/wpa_supplicant/src/crypto/crypto_ops.c

@@ -13,14 +13,14 @@
 // limitations under the License.
 
 #include "utils/common.h"
-#include "crypto/aes_wrap.h"
-#include "crypto/sha256.h"
-#include "crypto/crypto.h"
-#include "crypto/md5.h"
-#include "crypto/sha1.h"
-#include "crypto/aes.h"
-#include "crypto/dh_group5.h"
-#include "esp_wifi_crypto_types.h"
+#include "aes_wrap.h"
+#include "sha256.h"
+#include "crypto.h"
+#include "md5.h"
+#include "sha1.h"
+#include "aes.h"
+#include "esp_wpa.h"
+
 /* 
  * This structure is used to set the cyrpto callback function for station to connect when in security mode.
  * These functions either call MbedTLS API's if USE_MBEDTLS_CRYPTO flag is set through Kconfig, or native

+ 1 - 1
components/wpa_supplicant/src/crypto/des-internal.c

@@ -12,7 +12,7 @@
 #include "utils/includes.h"
 
 #include "utils/common.h"
-#include "crypto/crypto.h"
+#include "crypto.h"
 //#include "des_i.h"
 
 /*

+ 2 - 2
components/wpa_supplicant/src/crypto/dh_group5.c

@@ -15,8 +15,8 @@
 #include "utils/includes.h"
 
 #include "utils/common.h"
-#include "crypto/dh_groups.h"
-#include "crypto/dh_group5.h"
+#include "dh_groups.h"
+#include "dh_group5.h"
 
 
 void * 

+ 0 - 0
components/wpa_supplicant/include/crypto/dh_group5.h → components/wpa_supplicant/src/crypto/dh_group5.h


+ 3 - 3
components/wpa_supplicant/src/crypto/dh_groups.c

@@ -15,9 +15,9 @@
 #include "utils/includes.h"
 
 #include "utils/common.h"
-#include "crypto/crypto.h"
-#include "crypto/random.h"
-#include "crypto/dh_groups.h"
+#include "crypto.h"
+#include "random.h"
+#include "dh_groups.h"
 #include "utils/wpabuf.h"
 #include "utils/wpa_debug.h"
 #include "esp_wifi_crypto_types.h"

+ 0 - 0
components/wpa_supplicant/include/crypto/dh_groups.h → components/wpa_supplicant/src/crypto/dh_groups.h


+ 1 - 1
components/wpa_supplicant/src/crypto/md4-internal.c

@@ -6,7 +6,7 @@
 
 #include "utils/includes.h"
 #include "utils/common.h"
-#include "crypto/crypto.h"
+#include "crypto.h"
 
 #define MD4_BLOCK_LENGTH	64
 #define MD4_DIGEST_LENGTH	16

+ 3 - 3
components/wpa_supplicant/src/crypto/md5-internal.c

@@ -15,9 +15,9 @@
 #include "utils/includes.h"
 
 #include "utils/common.h"
-#include "crypto/md5.h"
-#include "crypto/md5_i.h"
-#include "crypto/crypto.h"
+#include "md5.h"
+#include "md5_i.h"
+#include "crypto.h"
 
 
 static void MD5Transform(u32 buf[4], u32 const in[16]);

+ 2 - 2
components/wpa_supplicant/src/crypto/md5.c

@@ -15,8 +15,8 @@
 #include "utils/includes.h"
 
 #include "utils/common.h"
-#include "crypto/md5.h"
-#include "crypto/crypto.h"
+#include "md5.h"
+#include "crypto.h"
 
 
 /**

+ 0 - 0
components/wpa_supplicant/include/crypto/md5.h → components/wpa_supplicant/src/crypto/md5.h


+ 3 - 3
components/wpa_supplicant/src/crypto/ms_funcs.c

@@ -10,9 +10,9 @@
 #include "utils/includes.h"
 
 #include "utils/common.h"
-#include "crypto/sha1.h"
-#include "crypto/ms_funcs.h"
-#include "crypto/crypto.h"
+#include "sha1.h"
+#include "ms_funcs.h"
+#include "crypto.h"
 
 /**
  * utf8_to_ucs2 - Convert UTF-8 string to UCS-2 encoding

+ 0 - 0
components/wpa_supplicant/include/crypto/ms_funcs.h → components/wpa_supplicant/src/crypto/ms_funcs.h


+ 0 - 0
components/wpa_supplicant/include/crypto/random.h → components/wpa_supplicant/src/crypto/random.h


+ 1 - 1
components/wpa_supplicant/src/crypto/rc4.c

@@ -15,7 +15,7 @@
 #include "utils/includes.h"
 
 #include "utils/common.h"
-#include "crypto/crypto.h"
+#include "crypto.h"
 
 #define S_SWAP(a,b) do { u8 t = S[a]; S[a] = S[b]; S[b] = t; } while(0)
 

+ 4 - 4
components/wpa_supplicant/src/crypto/sha1-internal.c

@@ -15,10 +15,10 @@
 #include "utils/includes.h"
 
 #include "utils/common.h"
-#include "crypto/sha1.h"
-#include "crypto/sha1_i.h"
-#include "crypto/md5.h"
-#include "crypto/crypto.h"
+#include "sha1.h"
+#include "sha1_i.h"
+#include "md5.h"
+#include "crypto.h"
 
 #ifdef USE_MBEDTLS_CRYPTO
 #include "mbedtls/sha1.h"

+ 3 - 3
components/wpa_supplicant/src/crypto/sha1-pbkdf2.c

@@ -14,9 +14,9 @@
 
 #include "utils/includes.h"
 #include "utils/common.h"
-#include "crypto/sha1.h"
-#include "crypto/md5.h"
-#include "crypto/crypto.h"
+#include "sha1.h"
+#include "md5.h"
+#include "crypto.h"
 
 #ifdef USE_MBEDTLS_CRYPTO
 #include "mbedtls/pkcs5.h"

+ 2 - 2
components/wpa_supplicant/src/crypto/sha1.c

@@ -15,8 +15,8 @@
 #include "utils/includes.h"
 
 #include "utils/common.h"
-#include "crypto/sha1.h"
-#include "crypto/crypto.h"
+#include "sha1.h"
+#include "crypto.h"
 
 
 /**

+ 0 - 0
components/wpa_supplicant/include/crypto/sha1.h → components/wpa_supplicant/src/crypto/sha1.h


+ 2 - 2
components/wpa_supplicant/src/crypto/sha256-internal.c

@@ -33,8 +33,8 @@
 #ifdef USE_MBEDTLS_CRYPTO
 #include "mbedtls/sha256.h"
 #else /* USE_MBEDTLS_CRYPTO */
-#include "crypto/sha256.h"
-#include "crypto/crypto.h"
+#include "sha256.h"
+#include "crypto.h"
 #endif /* USE_MBEDTLS_CRYPTO */
 
 #ifdef USE_MBEDTLS_CRYPTO

+ 2 - 2
components/wpa_supplicant/src/crypto/sha256.c

@@ -30,8 +30,8 @@
 #include "utils/includes.h"
 
 #include "utils/common.h"
-#include "crypto/sha256.h"
-#include "crypto/crypto.h"
+#include "sha256.h"
+#include "crypto.h"
 
 
 /**

+ 0 - 0
components/wpa_supplicant/include/crypto/sha256.h → components/wpa_supplicant/src/crypto/sha256.h


+ 0 - 1
components/wpa_supplicant/src/eap_peer/eap_ttls.c

@@ -10,7 +10,6 @@
 
 #ifdef EAP_TTLS
 #include "utils/common.h"
-#include "crypto/ms_funcs.h"
 #include "crypto/sha1.h"
 #include "tls/tls.h"
 #include "eap_peer/eap.h"

+ 0 - 1
components/wpa_supplicant/src/esp_supplicant/esp_wpa_main.c

@@ -29,7 +29,6 @@
 #include "crypto/crypto.h"
 #include "crypto/sha1.h"
 #include "crypto/aes_wrap.h"
-#include "crypto/wepkey.h"
 
 #include "esp_wifi_driver.h"
 #include "esp_private/wifi.h"

+ 0 - 1
components/wpa_supplicant/src/rsn_supp/wpa.c

@@ -26,7 +26,6 @@
 #include "crypto/crypto.h"
 #include "crypto/sha1.h"
 #include "crypto/aes_wrap.h"
-#include "crypto/wepkey.h"
 
 /**
  * eapol_sm_notify_eap_success - Notification of external EAP success trigger

+ 0 - 2
components/wpa_supplicant/src/wps/wps.c

@@ -14,8 +14,6 @@
 #include "utils/wpa_debug.h"
 #include "common/ieee802_11_defs.h"
 
-#include "crypto/dh_group5.h"
-
 #include "wps/wps_i.h"
 #include "wps/wps_dev_attr.h"
 

+ 1 - 1
components/wpa_supplicant/src/wps/wps_attr_build.c

@@ -11,9 +11,9 @@
 
 #include "crypto/aes_wrap.h"
 #include "crypto/crypto.h"
-#include "crypto/dh_group5.h"
 #include "crypto/sha256.h"
 #include "crypto/random.h"
+#include "crypto/dh_group5.h"
 
 #include "common/ieee802_11_defs.h"
 #include "wps/wps_i.h"

+ 1 - 1
components/wpa_supplicant/src/wps/wps_common.c

@@ -12,9 +12,9 @@
 
 #include "crypto/aes_wrap.h"
 #include "crypto/crypto.h"
-#include "crypto/dh_group5.h"
 #include "crypto/sha1.h"
 #include "crypto/sha256.h"
+#include "crypto/dh_group5.h"
 #include "crypto/random.h"
 
 #include "wps/wps_i.h"

+ 1 - 0
docs/en/api-guides/bootloader.rst

@@ -1,5 +1,6 @@
 Bootloader
 =====================
+:link_to_translation:`zh_CN:[中文]`
 
 Bootloader performs the following functions:
 

+ 59 - 1
docs/zh_CN/api-guides/bootloader.rst

@@ -1 +1,59 @@
-.. include:: ../../en/api-guides/bootloader.rst
+引导加载程序(Bootloader)
+==========================
+:link_to_translation:`en:[English]`
+
+引导加载程序(Bootloader)主要执行以下任务:
+
+1. 内部模块的最小化初始配置;
+2. 根据分区表和 ota_data(如果存在)选择需要引导的应用程序(app)分区;
+3. 将此应用程序映像加载到 RAM(IRAM 和 DRAM)中,最后把控制权转交给应用程序。
+
+引导加载程序位于 Flash 的 `0x1000` 偏移地址处。
+
+恢复出厂设置
+------------
+用户可以编写一个基本的工作固件,然后将其加载到工厂分区(factory)中。 
+
+接下来,通过 OTA(空中升级)更新固件,更新后的固件会被保存到某个 OTA app 分区中,OTA 数据分区也会做相应更新以指示从该分区引导应用程序。
+
+如果你希望回滚到出厂固件并清除设置,则需要设置 :ref:`CONFIG_BOOTLOADER_FACTORY_RESET`。
+
+出厂重置机制允许将设备重置为出厂模式:
+
+- 清除一个或多个数据分区。 
+- 从工厂分区启动。 
+
+:ref:`CONFIG_BOOTLOADER_DATA_FACTORY_RESET` - 允许用户选择在恢复出厂设置时需要删除的数据分区。可以通过逗号来分隔多个分区的名字,并适当增加空格以便阅读(例如 "nvs, phy_init, nvs_custom, ...")。请确保此处指定的名称和分区表中的名称相同,且不含有 “app” 类型的分区。
+
+:ref:`CONFIG_BOOTLOADER_OTA_DATA_ERASE` - 恢复出厂模式后,设备会从工厂分区启动,OTA 数据分区会被清除。
+
+:ref:`CONFIG_BOOTLOADER_NUM_PIN_FACTORY_RESET`- 设置用于触发出厂重置的 GPIO 编号,必须在芯片复位时将此 GPIO 拉低才能触发出厂重置事件。
+
+:ref:`CONFIG_BOOTLOADER_HOLD_TIME_GPIO`- 设置进入重置或测试模式所需要的保持时间(默认为 5 秒)。设备复位后,GPIO 必须在这段时间内持续保持低电平,然后才会执行出厂重置或引导测试分区。
+
+示例分区表如下::
+
+	# Name,   Type, SubType, Offset,   Size, Flags
+	# 注意,如果你增大了引导加载程序的大小,请确保更新偏移量,避免和其它分区发生重叠
+	nvs,      data, nvs,     0x9000,   0x4000
+	otadata,  data, ota,     0xd000,   0x2000
+	phy_init, data, phy,     0xf000,   0x1000
+	factory,  0,    0,       0x10000,  1M
+	test,     0,    test,    ,         512K
+	ota_0,    0,    ota_0,   ,         512K
+	ota_1,    0,    ota_1,   ,         512K
+
+从测试固件启动
+--------------
+用户可以编写在生产环境中测试用的特殊固件,然后在需要的时候运行。此时需要在分区表中专门申请一块分区用于保存该测试固件(详情请参阅 :doc:`分区表 <partition-tables>`)。如果想要触发测试固件,还需要设置 :ref:`CONFIG_BOOTLOADER_APP_TEST`。
+
+:ref:`CONFIG_BOOTLOADER_NUM_PIN_APP_TEST` - 设置引导测试分区的 GPIO 管脚编号,该 GPIO 会被配置为输入模式,并且会使能内部上拉电阻。若想触发测试固件,该 GPIO 必须在芯片复位时拉低。设备重启时如果该 GPIO 没有被激活(即处于高电平状态),那么会加载常规配置的应用程序(可能位于工厂分区或者 OTA 分区)。 
+
+:ref:`CONFIG_BOOTLOADER_HOLD_TIME_GPIO` - 设置进入重置或测试模式所需要的保持时间(默认为 5 秒)。设备复位后,GPIO 必须在这段时间内持续保持低电平,然后才会执行出厂重置或引导测试分区。
+
+自定义引导程序
+--------------
+用户可以重写当前的引导加载程序,具体做法是,复制 `/esp-idf/components/bootloader` 文件夹到项目目录中,然后编辑 `/your_project/components/bootloader/subproject/ain/bootloader_main.c` 文件。
+
+在引导加载程序的代码中,用户不可以使用驱动和其他组件提供的函数,如果确实需要,请将该功能的实现部分放在 bootloader 目录中(注意,这会增加引导程序的大小)。监视生成的引导程序的大小是有必要的,因为它可能会与内存中的分区表发生重叠而损坏固件。目前,引导程序被限制在了分区表之前的区域(分区表位于 `0x8000` 地址处)。
+

+ 1 - 1
docs/zh_CN/api-guides/index.rst

@@ -18,7 +18,7 @@ API 指南
    Thread Local Storage <thread-local-storage>
    High Level Interrupts <hlinterrupts>
    JTAG 调试 <jtag-debugging/index>
-   Bootloader <bootloader>
+   引导加载程序 <bootloader>
    分区表 <partition-tables>
    Secure Boot <../security/secure-boot>
    ULP 协处理器 <ulp>

+ 22 - 2
tools/cmake/kconfig.cmake

@@ -30,8 +30,28 @@ function(__kconfig_init)
                     "on the PATH, or an MSYS2 version of gcc on the PATH to build mconf-idf. "
                     "Consult the setup docs for ESP-IDF on Windows.")
             endif()
-        elseif(WINPTY)
-            set(MCONF "\"${WINPTY}\" \"${MCONF}\"")
+        else()
+            execute_process(COMMAND "${MCONF}" -v
+                RESULT_VARIABLE mconf_res
+                OUTPUT_VARIABLE mconf_out
+                ERROR_VARIABLE mconf_err)
+            if(${mconf_res})
+                message(WARNING "Failed to detect version of mconf-idf. Return code was ${mconf_res}.")
+            else()
+                string(STRIP "${mconf_out}" mconf_out)
+                set(mconf_expected_ver "mconf-v4.6.0.0-idf-20190628-win32")
+                if(NOT ${mconf_out} STREQUAL "mconf-idf version ${mconf_expected_ver}")
+                    message(WARNING "Unexpected ${mconf_out}. Expected ${mconf_expected_ver}. "
+                                    "Please check the ESP-IDF Getting Started guide for version "
+                                    "${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}.${IDF_VERSION_PATCH} "
+                                    "to correct this issue")
+                else()
+                    message(STATUS "${mconf_out}")   # prints: mconf-idf version ....
+                endif()
+            endif()
+            if(WINPTY)
+                set(MCONF "\"${WINPTY}\" \"${MCONF}\"")
+            endif()
         endif()
     endif()
 

+ 1 - 1
tools/idf_monitor.py

@@ -490,7 +490,7 @@ class Monitor(object):
                     item = self.cmd_queue.get_nowait()
                 except queue.Empty:
                     try:
-                        item = self.event_queue.get(False, 0.001)
+                        item = self.event_queue.get(True, 0.03)
                     except queue.Empty:
                         continue
 

+ 5 - 3
tools/kconfig_new/confserver.py

@@ -74,12 +74,14 @@ def run_server(kconfig, sdkconfig, sdkconfig_rename, default_version=MAX_PROTOCO
     sdkconfig_renames = [sdkconfig_rename] if sdkconfig_rename else []
     sdkconfig_renames += os.environ.get("COMPONENT_SDKCONFIG_RENAMES", "").split()
     deprecated_options = confgen.DeprecatedOptions(config.config_prefix, path_rename_files=sdkconfig_renames)
-    with tempfile.NamedTemporaryFile(mode='w+b') as f_o:
+    f_o = tempfile.NamedTemporaryFile(mode='w+b', delete=False)
+    try:
         with open(sdkconfig, mode='rb') as f_i:
             f_o.write(f_i.read())
-        f_o.flush()
-        f_o.seek(0)
+        f_o.close()  # need to close as DeprecatedOptions will reopen, and Windows only allows one open file
         deprecated_options.replace(sdkconfig_in=f_o.name, sdkconfig_out=sdkconfig)
+    finally:
+        os.unlink(f_o.name)
     config.load_config(sdkconfig)
 
     print("Server running, waiting for requests on stdin...", file=sys.stderr)