[PATCH RFC 04/10] [UNTESTED] image: Add support for relocating crypto_algos in linker lists

Alexandru Gagniuc mr.nuke.me at gmail.com
Fri May 14 21:45:56 CEST 2021


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 at gmail.com>
---
 common/image-sig.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/common/image-sig.c b/common/image-sig.c
index 2b7e23f99a..b750751144 100644
--- a/common/image-sig.c
+++ b/common/image-sig.c
@@ -120,6 +120,13 @@ struct crypto_algo *image_get_crypto_algo(const char *full_name)
 			crypto_algos[i].name += gd->reloc_off;
 			crypto_algos[i].verify += gd->reloc_off;
 		}
+
+		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
 
-- 
2.31.1



More information about the U-Boot mailing list