Procházet zdrojové kódy

example/simple_ota_example: Add support for skipping OTA server certificate CN field

Jitin George před 6 roky
rodič
revize
156ffa412e

+ 8 - 2
examples/system/ota/simple_ota_example/main/Kconfig.projbuild

@@ -12,15 +12,21 @@ menu "Example Configuration"
         help
         help
             WiFi password (WPA or WPA2) for the example to use.
             WiFi password (WPA or WPA2) for the example to use.
 
 
-    config FIRMWARE_UPGRADE_URL
+    config EXAMPLE_FIRMWARE_UPGRADE_URL
         string "firmware upgrade url endpoint"
         string "firmware upgrade url endpoint"
         default "https://192.168.0.3:8070/hello-world.bin"
         default "https://192.168.0.3:8070/hello-world.bin"
         help
         help
             URL of server which hosts the firmware
             URL of server which hosts the firmware
             image.
             image.
 
 
-    config FIRMWARE_UPGRADE_URL_FROM_STDIN
+    config EXAMPLE_FIRMWARE_UPGRADE_URL_FROM_STDIN
         bool
         bool
         default y if FIRMWARE_UPGRADE_URL = "FROM_STDIN"
         default y if FIRMWARE_UPGRADE_URL = "FROM_STDIN"
 
 
+    config EXAMPLE_SKIP_COMMON_NAME_CHECK
+        bool "Skip server certificate CN fieldcheck"
+        default n
+        help
+            This allows you to skip the validation of OTA server certificate CN field.
+
 endmenu
 endmenu

+ 4 - 0
examples/system/ota/simple_ota_example/main/simple_ota_example.c

@@ -158,6 +158,10 @@ void simple_ota_example_task(void * pvParameter)
     }
     }
 #endif
 #endif
 
 
+#ifdef CONFIG_SKIP_COMMON_NAME_CHECK
+    config.skip_cert_common_name_check = true;
+#endif
+
     esp_err_t ret = esp_https_ota(&config);
     esp_err_t ret = esp_https_ota(&config);
     if (ret == ESP_OK) {
     if (ret == ESP_OK) {
         esp_restart();
         esp_restart();

+ 1 - 0
examples/system/ota/simple_ota_example/sdkconfig.ci

@@ -1 +1,2 @@
 CONFIG_FIRMWARE_UPGRADE_URL="FROM_STDIN"
 CONFIG_FIRMWARE_UPGRADE_URL="FROM_STDIN"
+CONFIG_SKIP_COMMON_NAME_CHECK=y