From patchwork Mon Oct 17 15:10:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 9379575 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 2D2FD600CA for ; Mon, 17 Oct 2016 15:10:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1CE4329190 for ; Mon, 17 Oct 2016 15:10:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 119B929305; Mon, 17 Oct 2016 15:10:29 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 630EA29190 for ; Mon, 17 Oct 2016 15:10:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754614AbcJQPKX (ORCPT ); Mon, 17 Oct 2016 11:10:23 -0400 Received: from mail-pa0-f68.google.com ([209.85.220.68]:33284 "EHLO mail-pa0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753104AbcJQPKW (ORCPT ); Mon, 17 Oct 2016 11:10:22 -0400 Received: by mail-pa0-f68.google.com with SMTP id hh10so9340745pac.0 for ; Mon, 17 Oct 2016 08:10:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=dNaVvjAeIM67jn5uVpxvg0En24iBEWhOq9APRNqXDZ4=; b=B6YNrEyu0mUKULLZbgMXWWnXcRW+ID8ysADVxoTJnUSSAG4o6KgQZwjlvLQSo9Y5xc tKZlP23f4XZ8SCBnZEfimKTZiN4fj0d8l3f4fE5LtyTHC76THZURr8mPk4LXuLj/e/wt 4xIF4hL8su/1CTYtVQeyYk8EEOE0NDHN24ZKYHs9xTKycm5SRD85n4eFiu/XrD9nmxlj rcTzxFsCPDjQTGKPubfK9QJ+NcUEZSdgtsi0SjK6MnOLntqGNFrFvhf4OhIsZq1rx67i 2njix9NMt9NwxlBgFDXRXk1293OGT7kwrlaerYGCXF7LAGYPxLcPg4UObTZ4Ppc1UeRm HcWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=dNaVvjAeIM67jn5uVpxvg0En24iBEWhOq9APRNqXDZ4=; b=Uoa/UquDNqTlWUBXGFu6ByaHS02h/MA4rSh2lYoIzG/1J57FsCOUvDffHqxAAg/NKu rBfxC44O2p22YuGvMzMD6UR5EO14mwkn2f68iHATFyZ4WnhxArNl1tkGDcv47PEvT6x5 qVySbgCaLaQ+Sh7K7eVxKb5A/E3fxeBHLibAWhgcIc7UGgxXirYKsPTEkwNZjgkcoKyn jHt2cd454+mricW8Ufkqx8v/ypyYIfEpSr6e5WyfMaE1vKP5+iJjrATni5JpLj2pHuj/ XFFkEJWnq/biJS81Kk7OTUuToljirLYpENnKMJtBCEcOsZgscqxk4ay9EFy5BB6pR1vl wOPQ== X-Gm-Message-State: AA6/9Rnqc0rLS2w1/AT/PYnqICRxnJThxBPPg8YACmf3bYhxkXsimKazYjJZk79XkZrBbA== X-Received: by 10.66.55.9 with SMTP id n9mr31745211pap.153.1476717021662; Mon, 17 Oct 2016 08:10:21 -0700 (PDT) Received: from 192.168.0.37 (ec2-52-192-197-227.ap-northeast-1.compute.amazonaws.com. [52.192.197.227]) by smtp.gmail.com with ESMTPSA id f1sm48901475pfa.29.2016.10.17.08.10.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Oct 2016 08:10:21 -0700 (PDT) From: Wei Yongjun To: Herbert Xu Cc: Wei Yongjun , linux-crypto@vger.kernel.org Subject: [PATCH -next] crypto: gcm - Fix error return code in crypto_gcm_create_common() Date: Mon, 17 Oct 2016 15:10:06 +0000 Message-Id: <1476717006-10086-1-git-send-email-weiyj.lk@gmail.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 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: Wei Yongjun Fix to return error code -EINVAL from the invalid alg ivsize error handling case instead of 0, as done elsewhere in this function. Signed-off-by: Wei Yongjun --- crypto/gcm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/crypto/gcm.c b/crypto/gcm.c index f624ac9..39c261d 100644 --- a/crypto/gcm.c +++ b/crypto/gcm.c @@ -672,11 +672,11 @@ static int crypto_gcm_create_common(struct crypto_template *tmpl, ctr = crypto_spawn_skcipher_alg(&ctx->ctr); /* We only support 16-byte blocks. */ + err = -EINVAL; if (crypto_skcipher_alg_ivsize(ctr) != 16) goto out_put_ctr; /* Not a stream cipher? */ - err = -EINVAL; if (ctr->base.cra_blocksize != 1) goto out_put_ctr;