[secure boot] Key generation not functional with STM32MP_KeyGen_CLI on Linux.
Hi,
I tried to follow setup for secure boot as detailed here: https://wiki.st.com/stm32mpu/wiki/STM32MP15_secure_boot
I'm working with Linux host PC running Ubuntu 18.04
The 1st thing was to try generating keys.
For this I tried to use "STM32MP_KeyGen_CLI" previously installed with STM32CubeProgrammer. (Note: STM32_Programmer_CLI installed is v2.1.0 )
A first note here, https://wiki.st.com/stm32mpu/wiki/KeyGen_tool indicates keygen tool is named "STM32AP_KeyGen_CLI.sh" and is a script whereas it is "STM32MP_KeyGen_CLI" available in STM32CubeProgrammer bin folder and it is a Linux executable.
Simply running STM32MP_KeyGen_CLI with --version gives the following ouput:
~~~~
$ ./STM32MP_KeyGen_CLI -v
-------------------------------------------------------------------
STM32MP Key Generator v1.0.0
-------------------------------------------------------------------
Version: v1.0.0
~~~~
Then, following usage fails:
~~~~
$ ./STM32MP_KeyGen_CLI -abs /home/me/stm32mpu/secure_boot/keys/ -pwd mypassword
-------------------------------------------------------------------
STM32MP Key Generator v1.0.0
-------------------------------------------------------------------
Prime256v1 curve is selected.
AES_256_cbc algorithm is selected for private key encryption
Generating Prime256v1 keys...
Error: creating Key File fails
Error occured while creating PEM file!
Error: An error occured while generating key files
~~~~
It simply creates empty "keys" subfolder and the subfolder is only writeable...
I then tried the following usage:
~~~~
$ ./STM32MP_KeyGen_CLI -pwd mypassword -pubk keys/public.pem -prvk keys/private.pem -hash keys/public_hash.bin
-------------------------------------------------------------------
STM32MP Key Generator v1.0.0
-------------------------------------------------------------------
keys
Warning: File path does not exist. Do you want to create it?
(y/n)y
Prime256v1 curve is selected.
AES_256_cbc algorithm is selected for private key encryption
Generating Prime256v1 keys...
Private key PEM file created
Public key PEM file created
public key hash file created
Keys generated successfully.
+ public key: keys/public.pem
+ private key: keys/private.pem
+ public hash key: keys/public_hash.bin
~~~~
Now this is successfull, but "public_hash.bin" is an empty file.
I'm stuck here without possibility to continue secure boot setup, e.g burning of OTP with public_hash.bin content.
Thanks in advance for any useful feedback.
Alexandre.
