1 // Copyright 2021 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. 14 15 /******************************************************************************* 16 * NOTICE 17 * The HAL is not public api, don't use in application code. 18 * See readme.md in hal/include/hal/readme.md 19 ******************************************************************************/ 20 21 // The HAL layer for SPI Flash Encryption 22 23 #include "hal/spi_flash_encrypted_ll.h" 24 25 /** 26 * @brief Enable the flash encryption 27 */ 28 void spi_flash_encryption_hal_enable(void); 29 30 /** 31 * @brief Disable the flash encryption 32 */ 33 void spi_flash_encryption_hal_disable(void); 34 35 /** 36 * Prepare flash encryption before operation. 37 * 38 * @param address The destination address in flash for the write operation. 39 * @param buffer Data for programming 40 * @param size Size to program. 41 * 42 * @note address and buffer must be 8-word aligned. 43 */ 44 void spi_flash_encryption_hal_prepare(uint32_t address, const uint32_t* buffer, uint32_t size); 45 46 /** 47 * @brief flash data encryption operation is done. 48 */ 49 void spi_flash_encryption_hal_done(void); 50 51 /** 52 * Destroy encrypted result 53 */ 54 void spi_flash_encryption_hal_destroy(void); 55 56 /** 57 * Check if is qualified to encrypt the buffer 58 * 59 * @param address the address of written flash partition. 60 * @param length Buffer size. 61 */ 62 bool spi_flash_encryption_hal_check(uint32_t address, uint32_t length); 63