Skip to content

Commit

Permalink
lib/rsa: avoid -Wdiscarded-qualifiers
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
xypron authored and trini committed Jan 10, 2022
1 parent 6ef836a commit 675c3cc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rsa/rsa-sign.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 675c3cc

Please sign in to comment.