All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Simek <michal.simek@xilinx.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/3] drivers: crypto: rsa_mod_exp: Add manual relocation for ops->mod_exp()
Date: Mon, 14 Oct 2019 14:56:36 +0200	[thread overview]
Message-ID: <dadba2f61317324c149f0d6b22da625f74b8f0c5.1571057794.git.michal.simek@xilinx.com> (raw)
In-Reply-To: <cover.1571057794.git.michal.simek@xilinx.com>

From: T Karthik Reddy <t.karthik.reddy@xilinx.com>

This patch adds manual relocation for Modular Exponentiation if
CONFIG_NEEDS_MANUAL_RELOC is enabled.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

 drivers/crypto/rsa_mod_exp/mod_exp_uclass.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/crypto/rsa_mod_exp/mod_exp_uclass.c b/drivers/crypto/rsa_mod_exp/mod_exp_uclass.c
index 93deaa7f51e6..e91fe644580b 100644
--- a/drivers/crypto/rsa_mod_exp/mod_exp_uclass.c
+++ b/drivers/crypto/rsa_mod_exp/mod_exp_uclass.c
@@ -13,10 +13,23 @@
 #include <asm/io.h>
 #include <linux/list.h>
 
+#if !defined(USE_HOSTCC) && defined(CONFIG_NEEDS_MANUAL_RELOC)
+DECLARE_GLOBAL_DATA_PTR;
+#endif
+
 int rsa_mod_exp(struct udevice *dev, const uint8_t *sig, uint32_t sig_len,
 		struct key_prop *node, uint8_t *out)
 {
-	const struct mod_exp_ops *ops = device_get_ops(dev);
+	struct mod_exp_ops *ops = (struct mod_exp_ops *)device_get_ops(dev);
+
+#if !defined(USE_HOSTCC) && defined(CONFIG_NEEDS_MANUAL_RELOC)
+	static bool done;
+
+	if (!done) {
+		done = true;
+		ops->mod_exp += gd->reloc_off;
+	}
+#endif
 
 	if (!ops->mod_exp)
 		return -ENOSYS;
-- 
2.17.1

  parent reply	other threads:[~2019-10-14 12:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-14 12:56 [U-Boot] [PATCH 0/3] crypto: Add manual relocation Michal Simek
2019-10-14 12:56 ` [U-Boot] [PATCH 1/3] common: hash: Manually relocate struct hash_algo Michal Simek
2019-10-14 12:56 ` Michal Simek [this message]
2019-10-14 12:56 ` [U-Boot] [PATCH 3/3] common: image-sig.c: Add manual relocation Michal Simek
2019-10-24 11:23 ` [U-Boot] [PATCH 0/3] crypto: " Michal Simek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=dadba2f61317324c149f0d6b22da625f74b8f0c5.1571057794.git.michal.simek@xilinx.com \
    --to=michal.simek@xilinx.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.