u-boot/lib/rsa
Heiko Stuebner fdf0819afb rsa: fix alignment issue when getting public exponent
To fill the exponent field of the rsa_public_key struct, rsa_mod_exp_sw
did a cast to uint64_t of the key_prop->public_exponent field.
But that alignment is not guaranteed in all cases.

This came to light when in my spl-fit-signature the key-name exceeded
a certain length and with it the verification then started failing.
(naming it "integrity" worked fine, "integrity-uboot" failed)

key_prop.public_exponent itself is actually a void-pointer, fdt_getprop()
also just returns such a void-pointer and inside the devicetree the 64bit
exponent is represented as 2 32bit numbers, so assuming a 64bit alignment
can lead to false reads.

So just use the already existing rsa_convert_big_endian() to do the actual
conversion from the dt's big-endian to the needed uint64 value.

Fixes: fc2f4246b4 ("rsa: Split the rsa-verify to separate the modular exponentiation")
Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2020-05-07 09:01:42 -04:00
..
Kconfig lib: rsa: generate additional parameters for public key 2020-03-12 08:20:39 -04:00
Makefile lib: rsa: generate additional parameters for public key 2020-03-12 08:20:39 -04:00
rsa-checksum.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
rsa-keyprop.c lib: rsa: generate additional parameters for public key 2020-03-12 08:20:39 -04:00
rsa-mod-exp.c rsa: fix alignment issue when getting public exponent 2020-05-07 09:01:42 -04:00
rsa-sign.c image: Use constants for 'required' and 'key-name-hint' 2020-04-01 07:45:09 -06:00
rsa-verify.c lib: rsa: add rsa_verify_with_pkey() 2020-03-12 08:20:39 -04:00