All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC 0/3] Making a secure hash function avaiable during early boot?
@ 2019-07-30 12:38 Hans de Goede
  2019-07-30 12:38 ` [RFC 1/3] crypto/sha256: Factor out the parts of base API that don't use shash_desc Hans de Goede
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Hans de Goede @ 2019-07-30 12:38 UTC (permalink / raw)
  To: Herbert Xu, David S . Miller; +Cc: Hans de Goede, Andy Lutomirski, linux-crypto

Hi All,

During the first half of 2018 I wrote a patch series to the Linux EFI
and firmware-loader code, which allows loading peripheral firmware
which is embedded/hidden inside the EFI firmware through the standard
firmware-loading mechanism.

The main motivation for this is to get the touchscreen to work OOTB
on various cheap x86 tablets which come with a touchscreen controller
which need to have device(model)-specific firmware loaded; and we have
been unable to acquire permission to re-distribute this firmware-s
in linux-firmware.

This patch series works by extending the per model touchscreen data which
we already built into the kernel in drivers/platform/x86/touchscreen_dmi.c
with some extra info: a 8 byte header to search for, the lenght of the
firmware image and a the expected hash of the firmware for that model.

During boot, after setting up memory management (so that kmalloc work)
and before calling all the various init functions such as subsys_init calls
from rest_init, the EFI code does a DMI check and if the system in question
is in the list of systems with EFI embedded fw which we want i tgoes over
all EFI_BOOT_SERVICES_CODE sections searching for the described firmware.

After 6 revisions this series stalled on the lack of a hash algorithm which
can be used during early boot.

The plan was to wait for the zinc crypto code to get used and use a hash
algorithm from that, but that still has not happened, which is my main
reason for sending out this email.

For the last couple of revisions of the patch set I've been using a set
of patches by Andy Lutomirski which make the sha256-generic code usable
without calling crypto_alloc_shash() etc. Using crypto_alloc_shash() is
not possible because that depends on crypto_register_shash having been
called which is done as a subsys_initcall() and thus too late.

I cannot move the efi_check_for_embedded_firmwares() call later for 2
reasons:
1) Some of the subsys_init calls may rely on some of the embedded firmwares
2) It needs to be one before efi_free_boot_services() gets called, which is
not something which can safely / easily be moved to a later stage.

So my question is, would it be possible for the patches from Andy (which
I'm sending together with this email) to get merged so that there is a
generic secure hash available before subsys_initcall() time; or do you
(the crypto maintainers) have any other idea how to solve this?

Note I'm open to changing to a different hash function, the hashes are
embedded into drivers/platform/x86/touchscreen_dmi.c and I've access to
dumps of all firmwares for which I want to initially add support so I
can calculate another hash for the files.

Regards,

Hans



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2019-07-31 10:58 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-30 12:38 [RFC 0/3] Making a secure hash function avaiable during early boot? Hans de Goede
2019-07-30 12:38 ` [RFC 1/3] crypto/sha256: Factor out the parts of base API that don't use shash_desc Hans de Goede
2019-07-30 12:38 ` [RFC 2/3] crypto/sha256: Export a sha256_{init,update,final}_direct() API Hans de Goede
2019-07-30 12:38 ` [RFC 3/3] crypto/sha256: Build the SHA256 core separately from the crypto module Hans de Goede
2019-07-30 13:15   ` Stephan Mueller
2019-07-30 13:20     ` Hans de Goede
2019-07-30 16:03     ` Eric Biggers
2019-07-30 16:07       ` Hans de Goede
2019-07-30 20:07         ` Eric Biggers
2019-07-31  8:19           ` Hans de Goede
2019-07-31 10:57             ` Herbert Xu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.