rename rsa_key

This commit is contained in:
ok-home
2023-10-10 08:25:57 +07:00
committed by GitHub
parent cd0e3ab5b2
commit 94e42aa5b8
3 changed files with 9 additions and 18 deletions

View File

@@ -30,11 +30,11 @@ if(CONFIG_OTA_PRE_ENCRYPTED_MODE)
)
if(CONFIG_OTA_PRE_ENCRYPTED_RSA_KEY_ON_COMPONENT_LOCATION)
list(APPEND embed_txt_file
${COMPONENT_DIR}/${CONFIG_OTA_PRE_ENCRYPTED_RSA_KEY_DIRECTORY}/private.pem
${COMPONENT_DIR}/${CONFIG_OTA_PRE_ENCRYPTED_RSA_KEY_DIRECTORY}/private_rsa_3072.pem
)
else()
list(APPEND embed_txt_file
${project_dir}/${CONFIG_OTA_PRE_ENCRYPTED_RSA_KEY_DIRECTORY}/private.pem
${project_dir}/${CONFIG_OTA_PRE_ENCRYPTED_RSA_KEY_DIRECTORY}/private_rsa_3072.pem
)
endif()
else()
@@ -59,15 +59,16 @@ if(CONFIG_OTA_PRE_ENCRYPTED_MODE)
#redefine ESP_IMG_GEN_TOOL_PATH
set(ESP_IMG_GEN_TOOL_PATH ${CMAKE_CURRENT_LIST_DIR}/esp_encrypted_img/tools/esp_enc_img_gen.py)
#openssl genrsa -out rsa_key/private.pem 3072
# command for generate RSA key
#openssl genrsa -out rsa_key/private_rsa_3072.pem 3072
if(CONFIG_OTA_PRE_ENCRYPTED_RSA_KEY_ON_COMPONENT_LOCATION)
# for rsa_key on components project_dir
create_esp_enc_img(${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}.bin
${COMPONENT_DIR}/${CONFIG_OTA_PRE_ENCRYPTED_RSA_KEY_DIRECTORY}/private.pem ${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}_secure.bin app)
${COMPONENT_DIR}/${CONFIG_OTA_PRE_ENCRYPTED_RSA_KEY_DIRECTORY}/private_rsa_3072.pem ${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}_secure.bin app)
else()
# for rsa_key on project dir
create_esp_enc_img(${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}.bin
${project_dir}/${CONFIG_OTA_PRE_ENCRYPTED_RSA_KEY_DIRECTORY}/private.pem ${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}_secure.bin app)
${project_dir}/${CONFIG_OTA_PRE_ENCRYPTED_RSA_KEY_DIRECTORY}/private_rsa_3072.pem ${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}_secure.bin app)
endif()
endif()

View File

@@ -6,16 +6,6 @@
CONDITIONS OF ANY KIND, either express or implied.
*/
/* cmake cmd
create_esp_enc_img(${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}.bin
${project_dir}/rsa_key/private.pem ${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}_secure.bin app)
key cmd
openssl genrsa -out rsa_key/private.pem 3072
*/
#include "esp_ota_ops.h"
#include "esp_flash_partitions.h"
#include "esp_partition.h"
@@ -36,12 +26,12 @@ static pre_enc_decrypt_arg_t enc_arg = {0}; // enc arg
// private key
// may be generate cmd
// openssl genrsa -out rsa_key/private.pem 3072
// openssl genrsa -out rsa_key/private_rsa_3072.pem 3072
// size - 3072 !!
// null terminated - use EMBED_TXTFILES in cmake.txt
extern const char rsa_private_pem_start[] asm("_binary_private_pem_start");
extern const char rsa_private_pem_end[] asm("_binary_private_pem_end");
extern const char rsa_private_pem_start[] asm("_binary_private_rsa_3072_pem_start");
extern const char rsa_private_pem_end[] asm("_binary_private_rsa_3072_pem_end");
esp_err_t start_ota_ws(void)
{