From patchwork Wed Jan 3 19:16:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 10142877 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 43B8F601A1 for ; Wed, 3 Jan 2018 19:18:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 348D126247 for ; Wed, 3 Jan 2018 19:18:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 296B7290FA; Wed, 3 Jan 2018 19:18:37 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI 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 CF83D26247 for ; Wed, 3 Jan 2018 19:18:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751078AbeACTSf (ORCPT ); Wed, 3 Jan 2018 14:18:35 -0500 Received: from mail-io0-f193.google.com ([209.85.223.193]:33792 "EHLO mail-io0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750865AbeACTSb (ORCPT ); Wed, 3 Jan 2018 14:18:31 -0500 Received: by mail-io0-f193.google.com with SMTP id q188so3162496iod.1 for ; Wed, 03 Jan 2018 11:18:31 -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=Etn6AD/v+sBALh//BBsl0aYjtLDQBGAEe8GeK+0kuqY=; b=nItAX3vhukmHhVhd6yslnBu/NA8xgq9lDMYZWH7F0yzJ6BTMGpPz+Mr5RcEgTt9uHi qV81KyFNyyYOc98Azhn09jtWivAT9+2KuQl+aCgP6/rSfUTqcHoswbgUMSvboVrnlP4i 8ktj6RSQI4M++i/xUgENZdqzvxkCHjBCrVWkwl+nVMdCEfaAQOQ+UffJl3N9Io0qcTUx Pndg9AzI24bPNbl4VSrV9JzVHGINr2FTGhueiHVj7TmxYX+WXtCXjEnL1fx2SOzRJAWl d/ICOprxikvM+X6sy/1KXADSpMNR35G0rGX6RtqH4TRNkRxq8CYU2HRvUZLH6w+kARlo tCFA== 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=Etn6AD/v+sBALh//BBsl0aYjtLDQBGAEe8GeK+0kuqY=; b=U0uFb00TmbZ6sF61zb2rfTrZiJ2c9aGtMGgoDb0MXynWtOdJ76ITjAxdhOMTUWfuQ1 BvqPzopjUdBkimXtHaCzEhp9H0MJPogIMs0zUnWAIMyn4FukibpNG7NZalDjSBitag9G Or1WV3yQKL4Ag0rAdGPwfvgN5uqcxihfS24kD9UbASIwMMQnBer6LzoiPL+EUU7RLhS2 Yiju3exgbyiNzmjbT+32H07DKL6Z2M+aBCtftbs/VKxndRtvU5TCnnZMEc9D1d21xkq6 veZKGa9ubrClE+gnFxp9hAXQ2y+KMi5VIPO+kBxR6arAHNGrw4/69Vz1QwBxbKICyjOH 6R0g== X-Gm-Message-State: AKGB3mIaugiRQPa/W6tLZebSRnhfFgXiQyduVcs31kAFoCO2AG2dtPT5 v10rVmypaYpKfzm4skXwTK2XU4e6 X-Google-Smtp-Source: ACJfBot/G9RJKdlrNwTKOaiKmzBURzH1cjiIM7Ya1NZXgXF7bGQ408yVNU1Fq+/2lPS5mW+Ze+2b/w== X-Received: by 10.107.141.213 with SMTP id p204mr2540023iod.271.1515007111026; Wed, 03 Jan 2018 11:18:31 -0800 (PST) Received: from ebiggers-linuxstation.kir.corp.google.com ([100.66.175.88]) by smtp.gmail.com with ESMTPSA id o66sm944386iod.87.2018.01.03.11.18.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 03 Jan 2018 11:18:30 -0800 (PST) From: Eric Biggers To: linux-crypto@vger.kernel.org Cc: Herbert Xu , "David S . Miller" , Eric Biggers Subject: [RFC PATCH 7/9] crypto: ghash - remove checks for key being set Date: Wed, 3 Jan 2018 11:16:28 -0800 Message-Id: <20180103191630.79917-8-ebiggers3@gmail.com> X-Mailer: git-send-email 2.15.1.620.gb9897f4670-goog In-Reply-To: <20180103191630.79917-1-ebiggers3@gmail.com> References: <20180103191630.79917-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 Now that the crypto API prevents a keyed hash from being used without setting the key, there's no need for GHASH to do this check itself. Signed-off-by: Eric Biggers --- crypto/ghash-generic.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/crypto/ghash-generic.c b/crypto/ghash-generic.c index 12ad3e3a84e3..1bffb3f712dd 100644 --- a/crypto/ghash-generic.c +++ b/crypto/ghash-generic.c @@ -56,9 +56,6 @@ static int ghash_update(struct shash_desc *desc, struct ghash_ctx *ctx = crypto_shash_ctx(desc->tfm); u8 *dst = dctx->buffer; - if (!ctx->gf128) - return -ENOKEY; - if (dctx->bytes) { int n = min(srclen, dctx->bytes); u8 *pos = dst + (GHASH_BLOCK_SIZE - dctx->bytes); @@ -111,9 +108,6 @@ static int ghash_final(struct shash_desc *desc, u8 *dst) struct ghash_ctx *ctx = crypto_shash_ctx(desc->tfm); u8 *buf = dctx->buffer; - if (!ctx->gf128) - return -ENOKEY; - ghash_flush(ctx, dctx); memcpy(dst, buf, GHASH_BLOCK_SIZE);