if (!partition->encrypted) {
return spi_flash_read(partition->address + src_offset, dst, size);
} else {
+#if CONFIG_FLASH_ENCRYPTION_ENABLED
/* Encrypted partitions need to be read via a cache mapping */
const void *buf;
spi_flash_mmap_handle_t handle;
memcpy(dst, buf, size);
spi_flash_munmap(handle);
return ESP_OK;
+#else
+ return ESP_ERR_NOT_SUPPORTED;
+#endif // CONFIG_FLASH_ENCRYPTION_ENABLED
}
}
return ESP_ERR_INVALID_SIZE;
}
dst_offset = partition->address + dst_offset;
- if (partition->encrypted) {
- return spi_flash_write_encrypted(dst_offset, src, size);
- } else {
+ if (!partition->encrypted) {
return spi_flash_write(dst_offset, src, size);
+ } else {
+#if CONFIG_FLASH_ENCRYPTION_ENABLED
+ return spi_flash_write_encrypted(dst_offset, src, size);
+#else
+ return ESP_ERR_NOT_SUPPORTED;
+#endif // CONFIG_FLASH_ENCRYPTION_ENABLED
}
}