u-boot/lib/rsa
Alexandru Gagniuc de41f0ee0d image: rsa: Move padding_algos to linker lists
We are not guaranteed to have the padding_pkcs_15_verify symbol since
commit 92c960bc1d ("lib: rsa: Remove #ifdefs from rsa.h"), and
commit 61416fe9df ("Kconfig: FIT_SIGNATURE should not select RSA_VERIFY")

The padding_algos only make sense with RSA verification, which can now
be disabled in lieu of ECDSA. In fact this will lead to build failures
because of the missing symbol mentioned earlier.

To resolve this, move the padding_algos to a linker list, with
declarations moved to rsa_verify.c. This is consistent with commit
6909edb4ce ("image: rsa: Move verification algorithm to a linker list")

One could argue that the added #ifdef USE_HOSTCC is ugly, and should
be hidden within the U_BOOT_PADDING_ALGO() macro. However, this would
be inconsistent with the "cryptos" list. This logic for was not
previously explored:

Without knowledge of the U_BOOT_PADDING_ALGO() macro, its use is
similar to something being declared. However, should #ifndef
USE_HOSTCC be part of the macro, it would not be obvious that it
behaves differently on host code and target code. Having the #ifndef
outside the macro makes this obvious.

Also, the #ifdef is not always necessary. For example ecda-verify
makes use of U_BOOT_CRYPTO_ALGO() without any accompanying #ifdefs.
The fundamental issue is a lack of separation of host and target code
in rsa_verify. Therefore, the declaration of a padding algo with the
external #ifdef is more readable and consistent.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2021-09-14 11:46:48 -04:00
..
Kconfig lib: rsa: generate additional parameters for public key 2020-03-12 08:20:39 -04:00
Makefile lib: Rename rsa-checksum.c to hash-checksum.c 2021-04-14 15:06:08 -04:00
rsa-keyprop.c rsa: crash in br_i32_decode() called from rsa_gen_key_prop() 2020-09-14 23:28:52 +02:00
rsa-mod-exp.c xilinx: zynq: Change types from u32 to uint32_t 2020-10-27 08:13:33 +01:00
rsa-sign.c lib/rsa: don't use NULL as key_id 2021-09-14 09:07:18 -04:00
rsa-verify.c image: rsa: Move padding_algos to linker lists 2021-09-14 11:46:48 -04:00