All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] lib/rsa: avoid -Wdiscarded-qualifiers
@ 2022-01-09 14:39 Heinrich Schuchardt
  2022-01-10 15:00 ` Alex G.
  2022-01-10 18:47 ` Tom Rini
  0 siblings, 2 replies; 11+ messages in thread
From: Heinrich Schuchardt @ 2022-01-09 14:39 UTC (permalink / raw)
  To: Tom Rini
  Cc: Simon Glass, Alexandru Gagniuc, Donald Chan, Marc Kleine-Budde,
	u-boot, Heinrich Schuchardt

The return type of EVP_PKEY_get0_RSA() is const struct rsa_st *.
Our code drops the const qualifier leading to

In file included from tools/lib/rsa/rsa-sign.c:1:
./tools/../lib/rsa/rsa-sign.c: In function ‘rsa_add_verify_data’:
./tools/../lib/rsa/rsa-sign.c:631:13: warning:
assignment discards ‘const’ qualifier from pointer target type
[-Wdiscarded-qualifiers]
  631 |         rsa = EVP_PKEY_get0_RSA(pkey);
      |             ^

Add a type conversion.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
 lib/rsa/rsa-sign.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/rsa/rsa-sign.c b/lib/rsa/rsa-sign.c
index 44f21416ce..3b6e5f0f86 100644
--- a/lib/rsa/rsa-sign.c
+++ b/lib/rsa/rsa-sign.c
@@ -628,7 +628,7 @@ int rsa_add_verify_data(struct image_sign_info *info, void *keydest)
 	if (ret)
 		goto err_get_pub_key;
 
-	rsa = EVP_PKEY_get0_RSA(pkey);
+	rsa = (RSA *)EVP_PKEY_get0_RSA(pkey);
 	ret = rsa_get_params(rsa, &exponent, &n0_inv, &modulus, &r_squared);
 	if (ret)
 		goto err_get_params;
-- 
2.33.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-01-10 18:47 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-09 14:39 [PATCH] lib/rsa: avoid -Wdiscarded-qualifiers Heinrich Schuchardt
2022-01-10 15:00 ` Alex G.
2022-01-10 15:06   ` Tom Rini
2022-01-10 16:11     ` Heinrich Schuchardt
2022-01-10 16:12       ` Tom Rini
2022-01-10 16:22         ` Heinrich Schuchardt
2022-01-10 16:29           ` Tom Rini
2022-01-10 16:46             ` Heinrich Schuchardt
2022-01-10 16:48   ` Simon Glass
2022-01-10 16:52     ` Heinrich Schuchardt
2022-01-10 18:47 ` Tom Rini

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.