I inherited an ESP-32 firmware project based on AmazonFreeRTOS. I know how to build it but I'm not extremely familiar with this kind of programming.
The other developer never created a signing key intended for production, but there is a "developkey.pem" file in with the source code. Unfortunately the company has already distributed units of the project built with this key. I need to validate that we can perform OTA updates.
Whenever I try to send such an update, the device receives it but won't install it. The error says "Signature verification failed".
In my source code there are two build scripts, one that is supposed to build a signed version and one unsigned. Initially I was building the signed version and sending that. Later I tried building the unsigned version and signing it with the AWS signer using a code signing certificate (one that is unrelated to the rest of the project). Both things failed.
I know that the failure occurs in a function called "CRYPTO_SignatureVerificationFinal" but I don't know why.
I'm probably missing some fundamental concept here. Does a new build need to be code signed with the same certificate as the old build, or does it just require a valid code signature? Is the failure message even due to the code signing or is it objecting to something else? Does a build even need to be signed in order to be delivered this way?
It's possible that the 'developkey.pem' file I have is not the same one that was used to make the build that ended up on the units. However, I have been able to take one of my updated builds and load it onto the device through the serial port, which I think means that the signature is good, otherwise the secure bootloader wouldn't accept it (I might be wrong about how this works though).
Thanks for your help.