diff options
author | Alexandru Gagniuc <mr.nuke.me@gmail.com> | 2021-07-15 01:05:46 +0300 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2021-07-16 22:39:29 +0300 |
commit | b9826bf0c16ec225042c3fa760f8e22e6d9bc329 (patch) | |
tree | 8bb0fb5a707f666b93b31f4e5cfd6081ba8b05cd | |
parent | 8387dba471de8d8668123ca0e158ab3f4f4bf81e (diff) | |
download | u-boot-b9826bf0c16ec225042c3fa760f8e22e6d9bc329.tar.xz |
image: Add support for relocating crypto_algos in linker lists
Function pointers from crypto_algos array are relocated, when
NEEDS_MANUAL_RELOC is set. This relocation doesn't happen if the algo
is placed in a linker list. Implement this relocation.
Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Michal Simek <michal.simek@xilinx.com>
-rw-r--r-- | common/image-sig.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/common/image-sig.c b/common/image-sig.c index d680bf7d98..fb0035524e 100644 --- a/common/image-sig.c +++ b/common/image-sig.c @@ -97,6 +97,19 @@ struct crypto_algo *image_get_crypto_algo(const char *full_name) struct crypto_algo *crypto, *end; const char *name; +#if defined(CONFIG_NEEDS_MANUAL_RELOC) + static bool done; + + if (!done) { + crypto = ll_entry_start(struct crypto_algo, cryptos); + end = ll_entry_end(struct crypto_algo, cryptos); + for (; crypto < end; crypto++) { + crypto->name += gd->reloc_off; + crypto->verify += gd->reloc_off; + } + } +#endif + /* Move name to after the comma */ name = strchr(full_name, ','); if (!name) |