Skip to content

Commit

Permalink
crypto: dh - Remove pointless checks for NULL 'p' and 'g'
Browse files Browse the repository at this point in the history
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: Eric Biggers <ebiggers@google.com>
Reviewed-by: Tudor Ambarus <tudor.ambarus@microchip.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
  • Loading branch information
ebiggers authored and herbertx committed Nov 10, 2017
1 parent 5829cc8 commit ced6a58
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 6 deletions.
3 changes: 0 additions & 3 deletions crypto/dh.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
if (unlikely(!params->p || !params->g))
return -EINVAL;

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

Expand Down
3 changes: 0 additions & 3 deletions drivers/crypto/qat/qat_common/qat_asym_algs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 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))
return -EINVAL;

Expand Down

0 comments on commit ced6a58

Please sign in to comment.