[U-Boot] [PATCH v2 4/4] autoboot.c: Add feature to stop autobooting via SHA256 encrypted password
Andreas Bießmann
andreas.devel at googlemail.com
Mon May 11 09:16:24 CEST 2015
Hi Stefan,
On 05/08/2015 09:52 AM, Stefan Roese wrote:
> This patch adds the feature to only stop the autobooting, and therefor
> boot into the U-Boot prompt, when the input string / password matches
> a values that is encypted via a SHA256 hash and saved in the environment.
>
> This feature is enabled by defined these config options:
> CONFIG_AUTOBOOT_KEYED
> CONFIG_AUTOBOOT_STOP_STR_SHA256
>
> Signed-off-by: Stefan Roese <sr at denx.de>
> Cc: Simon Glass <sjg at chromium.org>
> Cc: Magnus Lilja <lilja.magnus at gmail.com>
> ---
> v2:
> - AUTOBOOT_STOP_STR_SHA256 is a string and not bool
> - Add input key length check as suggested by Magnus
> - Add "constant-length" time compare function as suggested
> by Magnus
>
> common/Kconfig | 20 +++++++--
> common/autoboot.c | 132 +++++++++++++++++++++++++++++++++++++++++++++---------
> 2 files changed, 128 insertions(+), 24 deletions(-)
[snip]
> @@ -42,7 +108,9 @@ static int abortboot_keyed(int bootdelay)
> }
> delaykey[] = {
> { .str = getenv("bootdelaykey"), .retry = 1 },
> + { .str = getenv("bootdelaykey2"), .retry = 1 },
> { .str = getenv("bootstopkey"), .retry = 0 },
> + { .str = getenv("bootstopkey2"), .retry = 0 },
> };
>
> char presskey[MAX_DELAY_STOP_STR];
> @@ -50,26 +118,21 @@ static int abortboot_keyed(int bootdelay)
> u_int presskey_max = 0;
> u_int i;
>
> -#ifndef CONFIG_ZERO_BOOTDELAY_CHECK
> - if (bootdelay == 0)
> - return 0;
> -#endif
> -
> -# ifdef CONFIG_AUTOBOOT_PROMPT
> - /*
> - * CONFIG_AUTOBOOT_PROMPT includes the %d for all boards.
> - * To print the bootdelay value upon bootup.
> - */
> - printf(CONFIG_AUTOBOOT_PROMPT, bootdelay);
> -# endif
> -
> # ifdef CONFIG_AUTOBOOT_DELAY_STR
> if (delaykey[0].str == NULL)
> delaykey[0].str = CONFIG_AUTOBOOT_DELAY_STR;
> # endif
> -# ifdef CONFIG_AUTOBOOT_STOP_STR
> +# ifdef CONFIG_AUTOBOOT_DELAY_STR2
> if (delaykey[1].str == NULL)
> - delaykey[1].str = CONFIG_AUTOBOOT_STOP_STR;
> + delaykey[1].str = CONFIG_AUTOBOOT_DELAY_STR2;
> +# endif
> +# ifdef CONFIG_AUTOBOOT_STOP_STR
> + if (delaykey[2].str == NULL)
> + delaykey[2].str = CONFIG_AUTOBOOT_STOP_STR;
> +# endif
> +# ifdef CONFIG_AUTOBOOT_STOP_STR2
> + if (delaykey[3].str == NULL)
> + delaykey[3].str = CONFIG_AUTOBOOT_STOP_STR2;
> # endif
>
> for (i = 0; i < sizeof(delaykey) / sizeof(delaykey[0]); i++) {
isn't this part removed before in 2/4 'autoboot.c: Remove
CONFIG_AUTOBOOT_STOP_STR2 and CONFIG_AUTOBOOT_DELAY_STR2'?
Andreas
More information about the U-Boot
mailing list