From patchwork Thu Oct 29 07:51:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 7517031 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Original-To: patchwork-linux-crypto@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D2C3CBEEA4 for ; Thu, 29 Oct 2015 07:51:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E83A320672 for ; Thu, 29 Oct 2015 07:51:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E8E112056D for ; Thu, 29 Oct 2015 07:51:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751546AbbJ2HvO (ORCPT ); Thu, 29 Oct 2015 03:51:14 -0400 Received: from mail-wi0-f193.google.com ([209.85.212.193]:34915 "EHLO mail-wi0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751501AbbJ2HvN (ORCPT ); Thu, 29 Oct 2015 03:51:13 -0400 Received: by wicuv6 with SMTP id uv6so6374934wic.2; Thu, 29 Oct 2015 00:51:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=q7HqT/Vm9h9A1P8LmBHvjNVAfmFOMzH3JxCml9Z8XH4=; b=Nj1OVTF7dsTQd1l6ZhLZdQFJd8plMfZEIYAUp5/r2N9dfnJF+k3QwPZJUypP2PXXdD kJYQJqNIbrt9n8iO4I142Dmz5v0zbVkyQoB9RBo9/aUE5Uc/IPP2Rg2CnoeDk2Qf7itD TBcv5XArCCkKiu5ffPJsbjYWFZWTwKubP/53SsFOrCuz+rUOvU08rFYl6QMUmqG6IH6Z ToVME9ni0D6LsMVZZZ+mI1YmhGge7f769qBmN5TbyhVYTQYaKdiUGk3ALtkMDQsrj1do s9HP/eEUvIMXhmTOT8SNbmg3OVWKZwZxWAHvGBadO15BXm6gHadtaZ56wt2OJouMc6yU tbjQ== X-Received: by 10.194.57.8 with SMTP id e8mr513087wjq.32.1446105072400; Thu, 29 Oct 2015 00:51:12 -0700 (PDT) Received: from Red (cl-323.mrs-01.fr.sixxs.net. [2a01:240:fe00:142::2]) by smtp.googlemail.com with ESMTPSA id t2sm2118502wme.0.2015.10.29.00.51.10 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 29 Oct 2015 00:51:11 -0700 (PDT) Date: Thu, 29 Oct 2015 08:51:08 +0100 From: LABBE Corentin To: Tim Chen , tglx@linutronix.de Cc: ameenali023@gmail.com, bp@alien8.de, dan.carpenter@oracle.com, davem@davemloft.net, firogm@gmail.com, herbert@gondor.apana.org.au, hpa@zytor.com, mingo@redhat.com, minipli@googlemail.com, smueller@chronox.de, tglx@linutronix.de, x86@kernel.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] crypto: x86: Remove duplicate define of SHA1_DIGEST_SIZE Message-ID: <20151029075108.GA25880@Red> References: <1444850171-17931-1-git-send-email-clabbe.montjoie@gmail.com> <1445011498.14635.1.camel@schen9-desk2.jf.intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1445011498.14635.1.camel@schen9-desk2.jf.intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Fri, Oct 16, 2015 at 09:04:58AM -0700, Tim Chen wrote: > On Wed, 2015-10-14 at 21:15 +0200, LABBE Corentin wrote: > > The sha x86 crypto code use two define for the same thing: > > NUM_SHA1_DIGEST_WORDS and SHA1_DIGEST_LENGTH > > Replace them by SHA1_DIGEST_SIZE/4 > > Thanks. Acked-by: Tim Chen > > > > Signed-off-by: LABBE Corentin > Hello Thanks for your ack, but Thomas Gleixner in the same time NACK this patch. Just in case I attach the new patch, for permit you to decide which one you prefer. Regards --8<-- From 7439bc57d95de49a510c0eb5d328dec10a3c6689 Mon Sep 17 00:00:00 2001 From: LABBE Corentin Date: Wed, 14 Oct 2015 12:48:04 +0200 Subject: [PATCH] crypto: x86: Remove duplicate define of SHA1_DIGEST_SIZE The sha x86 crypto code use two define for the same thing: NUM_SHA1_DIGEST_WORDS and SHA1_DIGEST_LENGTH Replace them by SHA1_DIGEST_SIZE/4 Signed-off-by: LABBE Corentin --- arch/x86/crypto/sha-mb/sha1_mb.c | 2 +- arch/x86/crypto/sha-mb/sha_mb_ctx.h | 1 - arch/x86/crypto/sha-mb/sha_mb_mgr.h | 6 +++--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/arch/x86/crypto/sha-mb/sha1_mb.c b/arch/x86/crypto/sha-mb/sha1_mb.c index a841e97..6544ea7 100644 --- a/arch/x86/crypto/sha-mb/sha1_mb.c +++ b/arch/x86/crypto/sha-mb/sha1_mb.c @@ -104,7 +104,7 @@ static asmlinkage struct job_sha1* (*sha1_job_mgr_get_comp_job)(struct sha1_mb_m inline void sha1_init_digest(uint32_t *digest) { - static const uint32_t initial_digest[SHA1_DIGEST_LENGTH] = {SHA1_H0, + static const uint32_t initial_digest[SHA1_DIGEST_WORDS] = {SHA1_H0, SHA1_H1, SHA1_H2, SHA1_H3, SHA1_H4 }; memcpy(digest, initial_digest, sizeof(initial_digest)); } diff --git a/arch/x86/crypto/sha-mb/sha_mb_ctx.h b/arch/x86/crypto/sha-mb/sha_mb_ctx.h index e36069d..9fd36eb5 100644 --- a/arch/x86/crypto/sha-mb/sha_mb_ctx.h +++ b/arch/x86/crypto/sha-mb/sha_mb_ctx.h @@ -94,7 +94,6 @@ enum hash_ctx_error { /* Hash Constants and Typedefs */ -#define SHA1_DIGEST_LENGTH 5 #define SHA1_LOG2_BLOCK_SIZE 6 #define SHA1_PADLENGTHFIELD_SIZE 8 diff --git a/arch/x86/crypto/sha-mb/sha_mb_mgr.h b/arch/x86/crypto/sha-mb/sha_mb_mgr.h index 08ad1a9..b295e15 100644 --- a/arch/x86/crypto/sha-mb/sha_mb_mgr.h +++ b/arch/x86/crypto/sha-mb/sha_mb_mgr.h @@ -54,10 +54,10 @@ #ifndef __SHA_MB_MGR_H #define __SHA_MB_MGR_H - +#include #include -#define NUM_SHA1_DIGEST_WORDS 5 +#define SHA1_DIGEST_WORDS (SHA1_DIGEST_SIZE / sizeof(u32)) enum job_sts { STS_UNKNOWN = 0, STS_BEING_PROCESSED = 1, @@ -69,7 +69,7 @@ enum job_sts { STS_UNKNOWN = 0, struct job_sha1 { u8 *buffer; u32 len; - u32 result_digest[NUM_SHA1_DIGEST_WORDS] __aligned(32); + u32 result_digest[SHA1_DIGEST_WORDS] __aligned(32); enum job_sts status; void *user_data; };