mbox series

[U-Boot,RFC,0/3] rsa: extend rsa_verify() for UEFI secure boot

Message ID 20190906070808.1198-1-takahiro.akashi@linaro.org
Headers show
Series rsa: extend rsa_verify() for UEFI secure boot | expand


AKASHI Takahiro Sept. 6, 2019, 7:08 a.m. UTC
The current rsa_verify() requires five parameters for a RSA public key
for efficiency while RSA, in theory, requires only two. In addition,
those parameters are expected to come from FIT image.

So this function won't fit very well when we want to use it for the purpose
of implementing UEFI secure boot, in particular, image authentication
as well as variable authentication, where the essential two parameters
are set to be retrieved from one of X509 certificates in signature

So, in this patch, additional three parameters will be calculated
on the fly when rsa_verify() is called without fdt which should contain
parameters above.

This calculation heavily relies on "big-number (or multi-precision)
library." Therefore some routines from BearSSL[1] under MIT license are
imported in this implementation. See Patch#2.
# Please let me know if this is not appropriate.

# Checkpatch will complain with lots of warnings/errors, but
# I intentionally don't fix them for maximum maintainability.

  [1] https://bearssl.org/

AKASHI Takahiro (3):
  lib: rsa: decouple rsa from FIT image verification
  lib: rsa: generate additional parameters for public key
  lib: rsa: add rsa_verify_with_pkey()

 include/u-boot/rsa-mod-exp.h |   3 +
 lib/rsa/Kconfig              |  14 +
 lib/rsa/Makefile             |   3 +-
 lib/rsa/rsa-keyprop.c        | 631 +++++++++++++++++++++++++++++++++++
 lib/rsa/rsa-verify.c         |  63 +++-
 5 files changed, 705 insertions(+), 9 deletions(-)
 create mode 100644 lib/rsa/rsa-keyprop.c