Received: by 10.223.185.82 with SMTP id b18csp115318wrg; Thu, 8 Mar 2018 20:45:08 -0800 (PST) X-Google-Smtp-Source: AG47ELvJdqBPVQKCBeFTS37mUcVrjGHSmNhSIIcQm9UbzaQYrAkuf/bQavKrvX1pp26WOX+08q48 X-Received: by 2002:a17:902:aa5:: with SMTP id 34-v6mr26650920plp.429.1520570708599; Thu, 08 Mar 2018 20:45:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520570708; cv=none; d=google.com; s=arc-20160816; b=0lDfkX1BsDBsaRrOdhV1U0Ge/WW4eXmyZdZyavA4f2m4lgWbMbK6A6lRcZS8ct/8tc CzoWX6X1xOhkQ7wndcrIF6UM4ezIzTvOnWyP/kK5Fiq0IcTTs4qShFOIPqWzAsuLFQrn 2d9Pegmi3bP/dHStIgcy+YVvyqCVGQ1LEi7/NKwV5lJ6oPIqMY2hhNLlBsZQAReyOPkM 3/fWAyKto8Tfi4Te8SOoPymclWtRNo/sr2JEte8L8ZBB68sAf/fr70vaBe3OMusRuOO/ 9/benq5r7tHDGxO0E4yfKogwF2t2Zy8K+z1zrQB5KD3rGSH5JlGUrnGJS8PS+EaM1xjo oAqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=Iqp3s17dH/p++zQ8k7BfjqE2lIxh6C2StPhW9pjM/TI=; b=z0v8I8Rc5VALH/PzBG/INMbxNMasruFO3m41NmU+G19e0tx+g8ldIiCd+pGzc2jrcK fU2AZubE9yvM2PunVL2Hd5wszpAUGdG5C1UqB6CaqSwlK4HgJ6iFLBsQ3MZpAP0CIxJb zOrnoUQcsuG5kjicDJs2TpW7oYZ8GtA+SQ77cowN61CZQT2ARqSMYOGdFaJ2KM/tr+qi PvixzN/izkD3wZL5UaaS+pXmPLRZUgMbxUXO+CAA/YVrRlTzPXAQGbsbuQ4HlKxSMPAm c4IFwbRrm5LvY0bZ3NSnTCXPxbZP1px4o4hT/uGv3su62OOc5enq2dbZFuhRfckU83mE /ftg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e5-v6si210307plk.185.2018.03.08.20.44.53; Thu, 08 Mar 2018 20:45:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751066AbeCIEoF (ORCPT + 99 others); Thu, 8 Mar 2018 23:44:05 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:45284 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750848AbeCIEoD (ORCPT ); Thu, 8 Mar 2018 23:44:03 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1F5197C6CC; Fri, 9 Mar 2018 04:44:03 +0000 (UTC) Received: from dhcp-128-65.nay.redhat.com (ovpn-12-79.pek2.redhat.com [10.72.12.79]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5A30411701C3; Fri, 9 Mar 2018 04:43:57 +0000 (UTC) Date: Fri, 9 Mar 2018 12:43:53 +0800 From: Dave Young To: Philipp Rudo Cc: kexec@lists.infradead.org, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, Eric Biederman , Vivek Goyal , Michael Ellerman , Thiago Jung Bauermann , Martin Schwidefsky , Heiko Carstens , Andrew Morton , x86@kernel.org, AKASHI Takahiro Subject: Re: [PATCH 11/11] kexec_file: Move purgatories sha256 to common code Message-ID: <20180309044353.GC3246@dhcp-128-65.nay.redhat.com> References: <20180226151620.20970-1-prudo@linux.vnet.ibm.com> <20180226151620.20970-12-prudo@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180226151620.20970-12-prudo@linux.vnet.ibm.com> User-Agent: Mutt/1.9.1 (2017-09-22) X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 09 Mar 2018 04:44:03 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 09 Mar 2018 04:44:03 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'dyoung@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/26/18 at 04:16pm, Philipp Rudo wrote: > The code to verify the new kernels sha digest are applicable for all > architectures. Move it to common code. > > Signed-off-by: Philipp Rudo > --- > arch/x86/purgatory/Makefile | 3 +++ > arch/x86/purgatory/purgatory.c | 2 +- > {arch/x86/purgatory => include/linux}/sha256.h | 10 +++++++++- > {arch/x86/purgatory => lib}/sha256.c | 4 ++-- > 4 files changed, 15 insertions(+), 4 deletions(-) > rename {arch/x86/purgatory => include/linux}/sha256.h (63%) > rename {arch/x86/purgatory => lib}/sha256.c (99%) > > diff --git a/arch/x86/purgatory/Makefile b/arch/x86/purgatory/Makefile > index 2f15a2ac4209..414eed6b5065 100644 > --- a/arch/x86/purgatory/Makefile > +++ b/arch/x86/purgatory/Makefile > @@ -6,6 +6,9 @@ purgatory-y := purgatory.o stack.o setup-x86_$(BITS).o sha256.o entry64.o string > targets += $(purgatory-y) > PURGATORY_OBJS = $(addprefix $(obj)/,$(purgatory-y)) > > +$(obj)/sha256.o: $(srctree)/lib/sha256.c > + $(call if_changed_rule,cc_o_c) > + > LDFLAGS_purgatory.ro := -e purgatory_start -r --no-undefined -nostdlib -z nodefaultlib > targets += purgatory.ro > > diff --git a/arch/x86/purgatory/purgatory.c b/arch/x86/purgatory/purgatory.c > index 470edad96bb9..025c34ac0d84 100644 > --- a/arch/x86/purgatory/purgatory.c > +++ b/arch/x86/purgatory/purgatory.c > @@ -11,9 +11,9 @@ > */ > > #include > +#include > #include > > -#include "sha256.h" > #include "../boot/string.h" > > unsigned long purgatory_backup_dest __section(.kexec-purgatory); > diff --git a/arch/x86/purgatory/sha256.h b/include/linux/sha256.h > similarity index 63% > rename from arch/x86/purgatory/sha256.h > rename to include/linux/sha256.h > index 2867d9825a57..43a20ac33688 100644 > --- a/arch/x86/purgatory/sha256.h > +++ b/include/linux/sha256.h > @@ -13,9 +13,17 @@ > #include > #include > > +/* Stand-alone implementation of the SHA256 algorithm. It is designed to > + * have as little dependencies as possible so it can be used in the > + * kexec_file purgatory. In other cases you should use the implementation in > + * crypto/. > + * > + * For details see lib/sha256.c > + */ should move to use preferred comment format: /* * Stand-alone ... * ... */ > + > extern int sha256_init(struct sha256_state *sctx); > extern int sha256_update(struct sha256_state *sctx, const u8 *input, > - unsigned int length); > + unsigned int length); > extern int sha256_final(struct sha256_state *sctx, u8 *hash); > > #endif /* SHA256_H */ > diff --git a/arch/x86/purgatory/sha256.c b/lib/sha256.c > similarity index 99% > rename from arch/x86/purgatory/sha256.c > rename to lib/sha256.c > index 548ca675a14a..4400c832e2aa 100644 > --- a/arch/x86/purgatory/sha256.c > +++ b/lib/sha256.c > @@ -16,9 +16,9 @@ > */ > > #include > +#include > +#include > #include > -#include "sha256.h" > -#include "../boot/string.h" Hmm, I'm not sure if moving to linux/string.h will have some side effects.. > > static inline u32 Ch(u32 x, u32 y, u32 z) > { > -- > 2.13.5 > Thanks Dave