public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Stefan Roese <sr@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] autoboot.c: Add feature to stop autobooting via SHA256 encrypted password
Date: Fri, 13 Mar 2015 08:15:12 +0100	[thread overview]
Message-ID: <55028E80.1050304@denx.de> (raw)
In-Reply-To: <CAPnjgZ3xP=O+Ad=OoODzX=TBHL-5WoP2C48fMu=Wdo6RRk3K3g@mail.gmail.com>

Hi Simon,

On 13.03.2015 03:48, Simon Glass 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>
>>
>> This is certainly interesting but I think brings us back to a point
>> Simon made a long while back about needing to factor out this code
>> better.  Especially since this adds big long #if-#else-#endif blocks.
>> Can we re-do this so at least have some functions be called out instead?
>> Thanks!
>>
>
> Also if these CONFIG options are in Kconfig (as they should be) then we can use
>
> if (IS_ENABLED(CONFIG_AUTOBOOT_STOP_STR_SHA256))
>
> instead of #ifdef which may improve the code.

Right. I also thought about this. But the resulting code has all the 
functionality extracted into 2 functions:

#if defined(CONFIG_AUTOBOOT_STOP_STR_SHA256)
static int passwd_abort(uint64_t etime)
{
	const char *sha_env_str = getenv("bootstopkeysha256");
	...
}
#else
static int passwd_abort(uint64_t etime)
{
	int abort = 0;
	...
}
#endif

And this function is now called unconditionally:

	...
	abort = passwd_abort(etime);

So there is nothing here that could be simplified by using IS_ENABLED().

I could of course just add this new config option to Kconfig. But with 
all the other related options not in Kconfig (CONFIG_AUTOBOOT_KEYED, 
CONFIG_AUTOBOOT_DELAY_STR...), this doesn't make much sense. So at some 
point all those config options should be moved to Kconfig. Unfortunately 
I don't have the time for this right now. But I'll add it to my list to 
do this at a later time.

Thanks,
Stefan

  reply	other threads:[~2015-03-13  7:15 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-11  8:51 [U-Boot] [PATCH] autoboot.c: Add feature to stop autobooting via SHA256 encrypted password Stefan Roese
2015-03-11  8:51 ` [U-Boot] [PATCH] bootcount: Add dcache flush to bootcount_store() Stefan Roese
2015-03-11 14:39   ` Tom Rini
2015-03-13 13:48   ` [U-Boot] " Tom Rini
2015-03-13 14:34     ` Tom Rini
2015-03-15 18:30       ` Tom Rini
2015-03-16 15:57         ` York Sun
2015-03-16 17:05           ` Tom Rini
2015-03-16 17:11             ` York Sun
2015-03-16 17:22               ` Tom Rini
2015-03-17  9:00       ` Holger Brunck
2015-03-27 13:18         ` Stefan Roese
2015-03-27 13:42           ` Nitin Garg
2015-03-27 15:07             ` [U-Boot] [RFC] powerpc: add 2 common dcache assembly functions Valentin Longchamp
2015-03-28 18:07               ` Tom Rini
2015-05-05 16:35               ` [U-Boot] [U-Boot, RFC] " York Sun
2015-03-11  8:51 ` [U-Boot] [PATCH] cmd_led: Extend led command to support blinking and more leds Stefan Roese
2015-03-11 14:38   ` Tom Rini
2015-04-23 22:02   ` [U-Boot] " Tom Rini
2015-03-11  8:51 ` [U-Boot] [PATCH] misc: led: Add PCA9551 LED driver Stefan Roese
2015-03-11 14:40   ` Tom Rini
2015-03-11 14:46   ` Fabio Estevam
2015-03-11 14:36 ` [U-Boot] [PATCH] autoboot.c: Add feature to stop autobooting via SHA256 encrypted password Tom Rini
2015-03-12  8:39   ` Stefan Roese
2015-03-13  2:48   ` Simon Glass
2015-03-13  7:15     ` Stefan Roese [this message]
2015-03-23 20:28       ` Simon Glass
2015-05-05 15:06         ` Stefan Roese
2015-05-05 15:12           ` Simon Glass

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=55028E80.1050304@denx.de \
    --to=sr@denx.de \
    --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