From patchwork Thu Jan 25 03:10:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 10183529 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 B7BBA60388 for ; Thu, 25 Jan 2018 03:10:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA1AB28A18 for ; Thu, 25 Jan 2018 03:10:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A8B6228A25; Thu, 25 Jan 2018 03:10:14 +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 937F22885C for ; Thu, 25 Jan 2018 03:10:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933065AbeAYDKM (ORCPT ); Wed, 24 Jan 2018 22:10:12 -0500 Received: from mail-pg0-f68.google.com ([74.125.83.68]:44410 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932956AbeAYDKM (ORCPT ); Wed, 24 Jan 2018 22:10:12 -0500 Received: by mail-pg0-f68.google.com with SMTP id m20so4173422pgc.11 for ; Wed, 24 Jan 2018 19:10:12 -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; bh=22czI5kuL3Wpg9fAB5VZeGNu9B/bQUVaNFh54joi56k=; b=exDteTOCKZ4U4gYiOW2fDHYxOL6/OyypHi93AOJuRpB8RKq4XHAxBNQL7krSWLrEJm qg3SGzJlnddiSTGLCJj42Pp7rX1xb5Xxxqo83AfUy7104yLKINNXKq76BkUBnfJA6Fpd gZjXsEOwRwUZiVyOqzrm/SNiWXO1lVxjoo6TsgaoFqduaIeSoVW59OB1IIO/OOMKlb0b LH/Ydq8YMnANbTi+nolkf/Jac+vaW2phOwJlPC1/jLAVl1rAJe8OWBwL/G/4ifj/grXI 4Cw6Oay7ybJm9nEBAMVMwWDnh9d4IQcqhMTNxiE+WLgQC1pjwVbvcDB+S6XHsCiK24WA p6TQ== 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; bh=22czI5kuL3Wpg9fAB5VZeGNu9B/bQUVaNFh54joi56k=; b=A4q5DL5xWNPmv/Naugd3fBwJFOxm378peWeAC5hiMFl1yuvvf05TOB6tORLVaUtd60 +V0bK6NjaoU/fgV5cpBO1blA4Z4fmn4ieH57DDIv/Tb3Ud+mWmRdj7h1+Dltonm64xQk rlRd8GPc6TMdVv6O9TNpenifIaheSm2Mizy+mx2tglC6KQMABa0+qJnixmUmi1BzjbDo J0iidh8crgETsyRDX62uwU0pRmlZRuSBgtyeULbX/mjl9sp3EgEFzHtJnPmYwMk0NUys 00D9anjMr2JEiCGjJJqRNwlwwojZJt8y0dNgESSyUxDoD+dql4q09eFF/3KM2gaiPkNp 2fbg== X-Gm-Message-State: AKwxytewdl5XBGViShgkO5cGm7xT4dUTrAy/W8Ni4kcwEWFwrD2Tryeb oWeWjoLJE65IzsC2A1oKDblB438x X-Google-Smtp-Source: AH8x226cehlKKRkdEACxsm7Nmz9xz9wAU5Dl7mmGC0QodhbtZZfdH0dy4FAB6eQRvBE52VEHClXDmA== X-Received: by 10.98.202.84 with SMTP id n81mr14663188pfg.226.1516849811450; Wed, 24 Jan 2018 19:10:11 -0800 (PST) Received: from zzz.localdomain (c-67-185-97-198.hsd1.wa.comcast.net. [67.185.97.198]) by smtp.gmail.com with ESMTPSA id y14sm10039877pfl.77.2018.01.24.19.10.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Jan 2018 19:10:11 -0800 (PST) From: Eric Biggers To: linux-crypto@vger.kernel.org, Herbert Xu Cc: "David S . Miller" , Tim Chen , Eric Biggers Subject: [PATCH] crypto: sha1-mb - remove HASH_FIRST flag Date: Wed, 24 Jan 2018 19:10:08 -0800 Message-Id: <20180125031008.778-1-ebiggers3@gmail.com> X-Mailer: git-send-email 2.16.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: Eric Biggers The HASH_FIRST flag is never set. Remove it. Signed-off-by: Eric Biggers --- arch/x86/crypto/sha1-mb/sha1_mb.c | 28 +++------------------------- arch/x86/crypto/sha1-mb/sha1_mb_ctx.h | 8 +++----- 2 files changed, 6 insertions(+), 30 deletions(-) diff --git a/arch/x86/crypto/sha1-mb/sha1_mb.c b/arch/x86/crypto/sha1-mb/sha1_mb.c index acf9fdf01671..e17655ffde79 100644 --- a/arch/x86/crypto/sha1-mb/sha1_mb.c +++ b/arch/x86/crypto/sha1-mb/sha1_mb.c @@ -106,13 +106,6 @@ static asmlinkage struct job_sha1* (*sha1_job_mgr_flush) static asmlinkage struct job_sha1* (*sha1_job_mgr_get_comp_job) (struct sha1_mb_mgr *state); -static inline void sha1_init_digest(uint32_t *digest) -{ - static const uint32_t initial_digest[SHA1_DIGEST_LENGTH] = {SHA1_H0, - SHA1_H1, SHA1_H2, SHA1_H3, SHA1_H4 }; - memcpy(digest, initial_digest, sizeof(initial_digest)); -} - static inline uint32_t sha1_pad(uint8_t padblock[SHA1_BLOCK_SIZE * 2], uint64_t total_len) { @@ -244,11 +237,8 @@ static struct sha1_hash_ctx *sha1_ctx_mgr_submit(struct sha1_ctx_mgr *mgr, uint32_t len, int flags) { - if (flags & (~HASH_ENTIRE)) { - /* - * User should not pass anything other than FIRST, UPDATE, or - * LAST - */ + if (flags & ~(HASH_UPDATE | HASH_LAST)) { + /* User should not pass anything other than UPDATE or LAST */ ctx->error = HASH_CTX_ERROR_INVALID_FLAGS; return ctx; } @@ -259,24 +249,12 @@ static struct sha1_hash_ctx *sha1_ctx_mgr_submit(struct sha1_ctx_mgr *mgr, return ctx; } - if ((ctx->status & HASH_CTX_STS_COMPLETE) && !(flags & HASH_FIRST)) { + if (ctx->status & HASH_CTX_STS_COMPLETE) { /* Cannot update a finished job. */ ctx->error = HASH_CTX_ERROR_ALREADY_COMPLETED; return ctx; } - - if (flags & HASH_FIRST) { - /* Init digest */ - sha1_init_digest(ctx->job.result_digest); - - /* Reset byte counter */ - ctx->total_length = 0; - - /* Clear extra blocks */ - ctx->partial_block_buffer_length = 0; - } - /* * If we made it here, there were no errors during this call to * submit diff --git a/arch/x86/crypto/sha1-mb/sha1_mb_ctx.h b/arch/x86/crypto/sha1-mb/sha1_mb_ctx.h index 13590ccf965c..9454bd16f9f8 100644 --- a/arch/x86/crypto/sha1-mb/sha1_mb_ctx.h +++ b/arch/x86/crypto/sha1-mb/sha1_mb_ctx.h @@ -57,11 +57,9 @@ #include "sha1_mb_mgr.h" #define HASH_UPDATE 0x00 -#define HASH_FIRST 0x01 -#define HASH_LAST 0x02 -#define HASH_ENTIRE 0x03 -#define HASH_DONE 0x04 -#define HASH_FINAL 0x08 +#define HASH_LAST 0x01 +#define HASH_DONE 0x02 +#define HASH_FINAL 0x04 #define HASH_CTX_STS_IDLE 0x00 #define HASH_CTX_STS_PROCESSING 0x01