From: Quentin Schulz <quentin.schulz@cherry.de>
To: Jonas Karlman <jonas@kwiboo.se>
Cc: Kever Yang <kever.yang@rock-chips.com>,
Simon Glass <sjg@chromium.org>,
Philipp Tomsich <philipp.tomsich@vrull.eu>,
Tom Rini <trini@konsulko.com>, FUKAUMI Naoki <naoki@radxa.com>,
u-boot@lists.denx.de
Subject: Re: [PATCH v4 09/10] rockchip: binman: Support use of crc32 for SPL_FIT_SIGNATURE
Date: Wed, 9 Apr 2025 18:11:48 +0200 [thread overview]
Message-ID: <887d7a5c-0ba7-4e62-bee2-8e5c159710c8@cherry.de> (raw)
In-Reply-To: <ac68b883-021c-43ac-b834-bafa54e7182b@kwiboo.se>
Hi Jonas,
On 4/9/25 5:38 PM, Jonas Karlman wrote:
> Hi Quentin,
>
> On 2025-04-09 13:06, Quentin Schulz wrote:
>> Hi Jonas,
>>
>> On 3/29/25 4:06 PM, Jonas Karlman wrote:
>>> Use of SHA256 checksum validation on ARMv7 SoCs can be very time
>>> consuming compared to ARMv8 SoCs with Crypto Extensions.
>>>
>>> Add support for use of the crc32 hash algo when SHA256 is not supported.
>>> Also use a HAS_HASH to simplify the ifdefs when no known hash algo is
>>> compiled.
>>>
>>> Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
>>
>> I don't know enough about general security but this very much looks like
>> a bad idea to me.
>>
>> https://web.archive.org/web/20170210173741/http://www.derkeiler.com/Newsgroups/sci.crypt/2003-07/1451.html
>>
>> """
>> While properly designed CRC's are good at detecting random errors in
>> the data (due to e.g. line noise), the CRC is useless as a secure
>> indicator of intentional manipulation of the data. And this is
>> because it's not hard at all to modify the data to produce any CRC
>> you desire (e.g. the same CRC as the original data, to try to
>> disguise your data manipulation).
>> """
>>
>> (yes I took the "first" link my web search engine returned me, thanks
>> confirmation bias!).
>
> I am fully aware, and the fallback to use crc32, and current primarily
> use of sha256, should not be considered a security feature. It is
> intended purely for a checksum validation of the binary blob after it
> has been loaded into memory and before U-Boot otherwise unconditionally
> jumps to and execute the loaded blob of binary code.
>
>>
>> I don't want to give people a false sense of security. If it really
>> comes down to it, I'd rather have an explicit Kconfig symbol to set this
>> value (maybe have a `choice` even) and be very clear about security
>> implications.
>
> Prior to the addition of the hash { algo=sha256 }, there was no checksum
> test and U-Boot SPL would unconditionally jump to the loaded data, even
> if it had been corrupted, was only halfway written or otherwise
> overwritten.
>
> The addition of crc32 instead of sha256 is just to allow older board
> variants with weaker SoCs to at least have some sort of checksum
> validation in use without affecting the boot time too much.
>
> On my rk3228 board, validation using sha256 could take a few seconds,
> and with crc32 it could be measured in ms.
>
> To me, having at least some default checksum validation is preferred
> over none at all.
>
Except if this confuses people into thinking they have a secure system
except they use CRC32 instead of something more appropriate like SHA256.
It seems like the "hash" node presence doesn't mean a FIT conf or image
node is signed. I also don't see many device trees with a signature
node... which is kinda odd. Looking a bit into the signature node in the
spec and binman tests, it's not clear to me if the hash node is reused
by the signature node if if exists and if their algo should match and
what exactly is checked by the signature node (like signing the hash
string contained in the hash node(s) listed in sign-images property, or
(re-)generating a hash of those and signing it at build time?
If
a) it is not possible to have a hash node's algo differ from a signature
node's algo, then I'm fine with this as crc32 won't be allowed
b) the signature node regenerates a hash regardless of the hash in the
hash node, meaning the signature will be "appropriately secure"
regardless of the algorithm listed in the hash node, then I'm fine with
it too,
c) it is possible to sign a crc32 hash, don't want it :)
@Simon, do you have some hints about this?
Cheers,
Quentin
next prev parent reply other threads:[~2025-04-09 16:11 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-29 15:06 [PATCH v4 00/10] rockchip: binman: Use a template for FIT and other improvements Jonas Karlman
2025-03-29 15:06 ` [PATCH v4 01/10] rockchip: binman: Correct the OS prop for U-Boot Jonas Karlman
2025-04-06 15:17 ` Kever Yang
2025-04-09 9:15 ` Quentin Schulz
2025-04-09 11:35 ` Jonas Karlman
2025-03-29 15:06 ` [PATCH v4 02/10] rockchip: binman: Factor out arch and compression Jonas Karlman
2025-04-06 15:18 ` Kever Yang
2025-04-09 9:28 ` Quentin Schulz
2025-04-09 11:56 ` Jonas Karlman
2025-04-09 12:27 ` Quentin Schulz
2025-04-09 15:52 ` Jonas Karlman
2025-03-29 15:06 ` [PATCH v4 03/10] rockchip: binman: Add an fdtmap Jonas Karlman
2025-04-06 15:18 ` Kever Yang
2025-04-09 9:32 ` Quentin Schulz
2025-03-29 15:06 ` [PATCH v4 04/10] rockchip: binman: Create a template for the FIT Jonas Karlman
2025-04-06 15:32 ` Kever Yang
2025-04-09 9:39 ` Quentin Schulz
2025-04-09 11:58 ` Jonas Karlman
2025-03-29 15:06 ` [PATCH v4 05/10] rockchip: binman: Un-indent the FIT template Jonas Karlman
2025-04-06 15:33 ` Kever Yang
2025-04-09 9:41 ` Quentin Schulz
2025-03-29 15:06 ` [PATCH v4 06/10] rockchip: binman: Use the FIT template in the SPI image Jonas Karlman
2025-04-06 15:33 ` Kever Yang
2025-04-09 9:42 ` Quentin Schulz
2025-03-29 15:06 ` [PATCH v4 07/10] rockchip: binman: Include a compatible string in each configuration Jonas Karlman
2025-04-06 15:33 ` Kever Yang
2025-04-09 10:02 ` Quentin Schulz
2025-04-09 13:23 ` Simon Glass
2025-04-09 15:05 ` Jonas Karlman
2025-04-09 15:26 ` Quentin Schulz
2025-03-29 15:06 ` [PATCH v4 08/10] rockchip: binman: Use the skip-at-start prop in simple-bin image Jonas Karlman
2025-04-06 15:33 ` Kever Yang
2025-04-09 10:57 ` Quentin Schulz
2025-04-09 13:22 ` Simon Glass
2025-04-09 13:32 ` Quentin Schulz
2025-04-09 13:33 ` Simon Glass
2025-04-09 13:35 ` Quentin Schulz
2025-04-09 14:30 ` Simon Glass
2025-04-14 15:09 ` Quentin Schulz
2025-04-17 21:35 ` Simon Glass
2025-04-09 15:17 ` Jonas Karlman
2025-03-29 15:06 ` [PATCH v4 09/10] rockchip: binman: Support use of crc32 for SPL_FIT_SIGNATURE Jonas Karlman
2025-04-06 15:34 ` Kever Yang
2025-04-09 11:06 ` Quentin Schulz
2025-04-09 15:38 ` Jonas Karlman
2025-04-09 16:11 ` Quentin Schulz [this message]
2025-04-09 16:35 ` Simon Glass
2025-04-09 17:02 ` Quentin Schulz
2025-04-09 17:26 ` Jonas Karlman
2025-03-29 15:06 ` [PATCH v4 10/10] rockchip: Add SPL_PAD_TO Kconfig default value Jonas Karlman
2025-04-06 15:34 ` Kever Yang
2025-04-09 11:14 ` Quentin Schulz
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=887d7a5c-0ba7-4e62-bee2-8e5c159710c8@cherry.de \
--to=quentin.schulz@cherry.de \
--cc=jonas@kwiboo.se \
--cc=kever.yang@rock-chips.com \
--cc=naoki@radxa.com \
--cc=philipp.tomsich@vrull.eu \
--cc=sjg@chromium.org \
--cc=trini@konsulko.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