crypto: dh - Remove pointless checks for NULL 'p' and 'g'
authorEric Biggers <ebiggers@google.com>
Mon, 6 Nov 2017 02:30:48 +0000 (18:30 -0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 10 Nov 2017 11:20:22 +0000 (19:20 +0800)
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>
crypto/dh.c
drivers/crypto/qat/qat_common/qat_asym_algs.c

index aadaf36fb56f902805140e56586b43a46882967c..5659fe7f446d930973059422b1177d79f29b8451 100644 (file)
@@ -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;
 
index 7655fdb499de5a948453eff1f15888ae81d0a116..13c52d6bf630d8fd03a2827b00645bc8bfab538d 100644 (file)
@@ -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;