[PATCH v2 08/19] rsatoc: remove unnecessary error check

Ahmad Fatoum a.fatoum at pengutronix.de
Mon Aug 5 02:56:25 PDT 2024


On 01.08.24 07:57, Sascha Hauer wrote:
> In rsa_get_exponent() 'e' will always be a non NULL argument, no need to
> check for it.
> 
> Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>

Reviewed-by: Ahmad Fatoum <a.fatoum at pengutronix.de>

> ---
>  scripts/rsatoc.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/scripts/rsatoc.c b/scripts/rsatoc.c
> index 22f0318298..afef6212d0 100644
> --- a/scripts/rsatoc.c
> +++ b/scripts/rsatoc.c
> @@ -163,15 +163,10 @@ static int engine_get_pub_key(const char *key_id, EVP_PKEY **key)
>  static int rsa_get_exponent(RSA *key, uint64_t *e)
>  {
>  	int ret;
> -	BIGNUM *bn_te;
> +	BIGNUM *bn_te = NULL;
>  	const BIGNUM *key_e;
>  	uint64_t te;
>  
> -	bn_te = NULL;
> -
> -	if (!e)
> -		goto cleanup;
> -
>  	RSA_get0_key(key, NULL, &key_e, NULL);
>  	if (BN_num_bits(key_e) > 64) {
>  		ret = -EINVAL;

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |




More information about the barebox mailing list