From patchwork Mon Nov 6 02:30:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 10042533 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EDA3A601EB for ; Mon, 6 Nov 2017 02:31:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 05A7E28D7A for ; Mon, 6 Nov 2017 02:31:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ED63B28EF9; Mon, 6 Nov 2017 02:31:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 96CF028D7A for ; Mon, 6 Nov 2017 02:31:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751704AbdKFCb3 (ORCPT ); Sun, 5 Nov 2017 21:31:29 -0500 Received: from mail-pf0-f195.google.com ([209.85.192.195]:51001 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751405AbdKFCb0 (ORCPT ); Sun, 5 Nov 2017 21:31:26 -0500 Received: by mail-pf0-f195.google.com with SMTP id b6so6629144pfh.7; Sun, 05 Nov 2017 18:31:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=on7YtUGK/8p6t2WmMe2u4vRdGSzAFHzwr6o4thsEgLI=; b=VdRkZuYeaj4xcC6riZ1tyFOBOz/BYw9byAKtgWWm03DpY6zDZjcaiwXqHykWfcrlh7 doGTu0hYdKYtgnva8MD3nEXmT33kGfUe2EsuSY3IsO/gzSe2bLVOuvDUq2LsOZsMQEvw q8T7ekzLgIt2kargfEE1dloaTeiRATTE5t9xJYleABpj0FStvl09L+FG+98uk6IMWnnG NU/zb1bJf3d1UTxaFANMMGNwT5y5+w14COiiikNvZfTkFEwc+aA1Vha8GPqtL6zVznc9 d5xej9ukt615oRUNSO37mmcbgCaT0K5YXJXgV1xFIWmk3VnEGUvX6XBJGPb16sl7p0yq pHgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=on7YtUGK/8p6t2WmMe2u4vRdGSzAFHzwr6o4thsEgLI=; b=F0/2y7rS6ngqMhhBpZIXM7Xa41oL+HspCBiNrskc+IHUcsCdWjGrdBSoF4UL/ahCer 3wJHSXCQwEh3Dv9qJchwgSXYAGs/xdtdzx4Knb+UxAHpZj07k10MkP/LVvlwrjgNRMpk 0xWw4N2cnmeVRNaaBpRtuuikAtW0QMoaolDXPKz2pxBd1PA72A7gf5LmPpkAkxBkp3pv PUzNA1DkZ9vs3kGE3YYU2P7H+CHPvrl8Wg6Ecg9m5eyFphZdKPsL4eDdh3RsMu3AdAkK JqvDdC0zOl07n0nqJB/mW6rZpZnT/GmVzZrXEM8/kKQraIYX34uY3MQMSn0bouXifsFn xLPw== X-Gm-Message-State: AMCzsaVkZQ9i4hJcgcWoPB/UBsURmR13pOvCI013jHDR0/Q3wjPNVomM 22Vx8xez8CQ1KtQUd/ziQfVSBaeT X-Google-Smtp-Source: ABhQp+RrA0yqyJhEtbs/G+MpTkLFV2DWD21yzT0XAwQq5ZD/HznMVHgWrkNZjsW4uuoYaqL4OOyHag== X-Received: by 10.98.72.198 with SMTP id q67mr15301542pfi.110.1509935485547; Sun, 05 Nov 2017 18:31:25 -0800 (PST) Received: from zzz.hsd1.wa.comcast.net (c-67-185-97-198.hsd1.wa.comcast.net. [67.185.97.198]) by smtp.gmail.com with ESMTPSA id e71sm23012520pfk.55.2017.11.05.18.31.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 05 Nov 2017 18:31:24 -0800 (PST) From: Eric Biggers To: linux-crypto@vger.kernel.org, Herbert Xu Cc: Giovanni Cabiddu , Salvatore Benedetto , Tudor-Dan Ambarus , Mat Martineau , Stephan Mueller , qat-linux@intel.com, keyrings@vger.kernel.org, Eric Biggers Subject: [PATCH v2 5/5] crypto: dh - Remove pointless checks for NULL 'p' and 'g' Date: Sun, 5 Nov 2017 18:30:48 -0800 Message-Id: <20171106023048.8067-6-ebiggers3@gmail.com> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171106023048.8067-1-ebiggers3@gmail.com> References: <20171106023048.8067-1-ebiggers3@gmail.com> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Eric Biggers 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 Reviewed-by: Tudor Ambarus --- crypto/dh.c | 3 --- drivers/crypto/qat/qat_common/qat_asym_algs.c | 3 --- 2 files changed, 6 deletions(-) diff --git a/crypto/dh.c b/crypto/dh.c index aadaf36fb56f..5659fe7f446d 100644 --- a/crypto/dh.c +++ b/crypto/dh.c @@ -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; diff --git a/drivers/crypto/qat/qat_common/qat_asym_algs.c b/drivers/crypto/qat/qat_common/qat_asym_algs.c index 7655fdb499de..13c52d6bf630 100644 --- a/drivers/crypto/qat/qat_common/qat_asym_algs.c +++ b/drivers/crypto/qat/qat_common/qat_asym_algs.c @@ -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;