]> granicus.if.org Git - esp-idf/commitdiff
bootloader: Don't enable secure boot or flash encryption for 3/4 Coding Scheme
authorAngus Gratton <angus@espressif.com>
Wed, 26 Sep 2018 06:57:44 +0000 (16:57 +1000)
committerAngus Gratton <gus@projectgus.com>
Wed, 26 Sep 2018 08:26:06 +0000 (18:26 +1000)
components/bootloader_support/src/flash_encrypt.c
components/bootloader_support/src/secure_boot.c

index e04945daec3e424e344de5abd2bac0d8a4cbfc06..8768d5a6c71bbabb12b49a0271eb52a02f750b4a 100644 (file)
@@ -63,6 +63,11 @@ esp_err_t esp_flash_encrypt_check_and_update(void)
 
 static esp_err_t initialise_flash_encryption(void)
 {
+    if (REG_READ(EFUSE_BLK0_RDATA6_REG) & EFUSE_CODING_SCHEME_M) {
+        ESP_LOGE(TAG, "Flash Encryption is currently not supported on hardware with 3/4 Coding Scheme (CODING_SCHEME efuse set)");
+        return ESP_ERR_NOT_SUPPORTED;
+    }
+
     /* Before first flash encryption pass, need to initialise key & crypto config */
 
     /* Generate key */
index ef9744ffc8bf57419be78f12e71c75295c5b3312..6355bcd7c530b3f1cf027e71016ff00a90ce9839 100644 (file)
@@ -111,6 +111,11 @@ esp_err_t esp_secure_boot_permanently_enable(void) {
         return ESP_OK;
     }
 
+    if (REG_READ(EFUSE_BLK0_RDATA6_REG) & EFUSE_CODING_SCHEME_M) {
+        ESP_LOGE(TAG, "Secure Boot is currently not supported on hardware with 3/4 Coding Scheme (CODING_SCHEME efuse set)");
+        return ESP_ERR_NOT_SUPPORTED;
+    }
+
     err = esp_image_verify_bootloader(&image_len);
     if (err != ESP_OK) {
         ESP_LOGE(TAG, "bootloader image appears invalid! error %d", err);