Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ced6a586 authored by Eric Biggers's avatar Eric Biggers Committed by Herbert Xu
Browse files

crypto: dh - Remove pointless checks for NULL 'p' and 'g'



Neither 'p' nor 'g' can be NULL, as they were unpacked using
crypto_dh_decode_key().  And it makes no sense for them to be optional.
So remove the NULL checks that were copy-and-pasted into both modules.

Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
Reviewed-by: default avatarTudor Ambarus <tudor.ambarus@microchip.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 5829cc8d
Loading
Loading
Loading
Loading
+0 −3
Original line number Original line Diff line number Diff line
@@ -53,9 +53,6 @@ static int dh_check_params_length(unsigned int p_len)


static int dh_set_params(struct dh_ctx *ctx, struct dh *params)
static int dh_set_params(struct dh_ctx *ctx, struct dh *params)
{
{
	if (unlikely(!params->p || !params->g))
		return -EINVAL;

	if (dh_check_params_length(params->p_size << 3))
	if (dh_check_params_length(params->p_size << 3))
		return -EINVAL;
		return -EINVAL;


+0 −3
Original line number Original line Diff line number Diff line
@@ -443,9 +443,6 @@ static int qat_dh_set_params(struct qat_dh_ctx *ctx, struct dh *params)
	struct qat_crypto_instance *inst = ctx->inst;
	struct qat_crypto_instance *inst = ctx->inst;
	struct device *dev = &GET_DEV(inst->accel_dev);
	struct device *dev = &GET_DEV(inst->accel_dev);


	if (unlikely(!params->p || !params->g))
		return -EINVAL;

	if (qat_dh_check_params_length(params->p_size << 3))
	if (qat_dh_check_params_length(params->p_size << 3))
		return -EINVAL;
		return -EINVAL;