diff --git a/CMakeLists.txt b/CMakeLists.txt index ebe169a..12b637c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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() diff --git a/rsa_key/private.pem b/rsa_key/private_rsa_3072.pem similarity index 100% rename from rsa_key/private.pem rename to rsa_key/private_rsa_3072.pem diff --git a/source/ota_ws_update_esp_preencrypted.c b/source/ota_ws_update_esp_preencrypted.c index bc02a5c..ad964e7 100644 --- a/source/ota_ws_update_esp_preencrypted.c +++ b/source/ota_ws_update_esp_preencrypted.c @@ -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) {