public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: "Andreas Bießmann" <andreas.devel@googlemail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 4/4] autoboot.c: Add feature to stop autobooting via SHA256 encrypted password
Date: Mon, 11 May 2015 09:16:24 +0200	[thread overview]
Message-ID: <55505748.1080205@gmail.com> (raw)
In-Reply-To: <1431071533-5908-1-git-send-email-sr@denx.de>

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@denx.de>
> Cc: Simon Glass <sjg@chromium.org>
> Cc: Magnus Lilja <lilja.magnus@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

  parent reply	other threads:[~2015-05-11  7:16 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-07 12:13 [U-Boot] [PATCH v1 0/4] Add SHA256 encrypted stop string for autobooting Stefan Roese
2015-05-07 12:13 ` [U-Boot] [PATCH v1 1/4] Kconfig: Enable usage of escape char '\' in string values Stefan Roese
2015-05-07 12:41   ` Masahiro Yamada
2015-05-07 12:46     ` Stefan Roese
2015-05-07 12:53       ` Masahiro Yamada
2015-05-10 14:48   ` Simon Glass
2015-05-11  7:58     ` Stefan Roese
2015-05-11 13:27       ` Stefan Roese
2015-05-11 22:41         ` Simon Glass
2015-05-13  1:34           ` Masahiro Yamada
2015-05-15  7:13             ` Stefan Roese
2015-05-15  7:49               ` Masahiro Yamada
2015-05-07 12:13 ` [U-Boot] [PATCH v1 2/4] autoboot.c: Remove CONFIG_AUTOBOOT_STOP_STR2 and CONFIG_AUTOBOOT_DELAY_STR2 Stefan Roese
2015-05-07 23:47   ` Simon Glass
2015-05-11 12:38   ` Tom Rini
2015-05-07 12:13 ` [U-Boot] [PATCH v1 3/4] autoboot.c: Move config options to Kconfig Stefan Roese
2015-05-07 23:51   ` Simon Glass
2015-05-08  3:30     ` Masahiro Yamada
2015-05-08  6:00       ` Stefan Roese
2015-05-08  5:55     ` Stefan Roese
2015-05-10 14:49       ` Simon Glass
2015-05-07 12:13 ` [U-Boot] [PATCH v1 4/4] autoboot.c: Add feature to stop autobooting via SHA256 encrypted password Stefan Roese
2015-05-07 20:56   ` Magnus Lilja
2015-05-08  7:52   ` [U-Boot] [PATCH v2 " Stefan Roese
2015-05-10 14:49     ` Simon Glass
2015-05-11  7:16     ` Andreas Bießmann [this message]
2015-05-11  7:44       ` Stefan Roese
2015-05-15  7:44     ` Magnus Lilja
2015-05-15  8:44       ` Stefan Roese

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55505748.1080205@gmail.com \
    --to=andreas.devel@googlemail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox