[PATCH u-boot-mvebu v2 06/18] arm: mvebu: turris_omnia: Print board ECDSA public key if available
Marek Behún
kabel at kernel.org
Mon Mar 25 18:37:35 CET 2024
On Sat, 23 Mar 2024 19:06:59 +0100
Marek Behún <kabel at kernel.org> wrote:
> If MCU supports the FEAT_CRYPTO feature, read board ECDSA public key
> from MCU and print it.
>
> Signed-off-by: Marek Behún <kabel at kernel.org>
> ---
> board/CZ.NIC/turris_omnia/turris_omnia.c | 25 +++++++++++++++++++++++-
> 1 file changed, 24 insertions(+), 1 deletion(-)
>
> diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c
> index f63640ad64..896c14bb99 100644
> --- a/board/CZ.NIC/turris_omnia/turris_omnia.c
> +++ b/board/CZ.NIC/turris_omnia/turris_omnia.c
> @@ -253,6 +253,24 @@ static int omnia_mcu_board_info(char *serial, u8 *mac, char *version)
> return 0;
> }
>
> +static int omnia_mcu_get_board_public_key(char pub_key[static 67])
> +{
> + u8 reply[34];
> + int ret;
> +
> + ret = omnia_mcu_read(CMD_CRYPTO_GET_PUBLIC_KEY, reply, sizeof(reply));
> + if (ret)
> + return ret;
> +
> + if (reply[0] != 33)
> + return -EBADMSG;
> +
> + bin2hex(pub_key, &reply[1], 33);
> + reply[66] = '\0';
Aargh, this should be pub_key[66] = '\0'.
And I noticed once more thing, so I will sent another version.
More information about the U-Boot
mailing list