Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753309Ab3H0M4f (ORCPT ); Tue, 27 Aug 2013 08:56:35 -0400 Received: from smtp.nue.novell.com ([195.135.221.5]:47885 "EHLO smtp.nue.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752877Ab3H0M4d (ORCPT ); Tue, 27 Aug 2013 08:56:33 -0400 Subject: Re: [PATCH 17/18] Hibernate: introduced SNAPSHOT_SIG_HASH config for select hash algorithm From: joeyli To: Pavel Machek Cc: linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, linux-efi@vger.kernel.org, linux-pm@vger.kernel.org, linux-crypto@vger.kernel.org, opensuse-kernel@opensuse.org, David Howells , "Rafael J. Wysocki" , Matthew Garrett , Len Brown , Josh Boyer , Vojtech Pavlik , Matt Fleming , James Bottomley , Greg KH , JKosina@suse.com, Rusty Russell , Herbert Xu , "David S. Miller" , "H. Peter Anvin" , Michal Marek , Gary Lin , Vivek Goyal In-Reply-To: <20130827113044.GB20527@amd.pavel.ucw.cz> References: <1377169317-5959-1-git-send-email-jlee@suse.com> <1377169317-5959-18-git-send-email-jlee@suse.com> <20130825164329.GL5171@amd.pavel.ucw.cz> <1377598937.20140.12.camel@linux-s257.site> <20130827113044.GB20527@amd.pavel.ucw.cz> Content-Type: text/plain; charset="UTF-8" Date: Tue, 27 Aug 2013 20:54:57 +0800 Message-ID: <1377608097.20140.30.camel@linux-s257.site> Mime-Version: 1.0 X-Mailer: Evolution 2.28.2 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2958 Lines: 72 於 二,2013-08-27 於 13:30 +0200,Pavel Machek 提到: > On Tue 2013-08-27 18:22:17, joeyli wrote: > > 於 日,2013-08-25 於 18:43 +0200,Pavel Machek 提到: > > > On Thu 2013-08-22 19:01:56, Lee, Chun-Yi wrote: > > > > This patch introduced SNAPSHOT_SIG_HASH config for user to select which > > > > hash algorithm will be used during signature generation of snapshot. > > > > > > > > v2: > > > > Add define check of oCONFIG_SNAPSHOT_VERIFICATION in snapshot.c before > > > > declare pkey_hash(). > > > > > > > > Reviewed-by: Jiri Kosina > > > > Signed-off-by: Lee, Chun-Yi > > > > --- > > > > kernel/power/Kconfig | 46 ++++++++++++++++++++++++++++++++++++++++++++++ > > > > kernel/power/snapshot.c | 27 ++++++++++++++++++++++----- > > > > 2 files changed, 68 insertions(+), 5 deletions(-) > > > > > > > > diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig > > > > index b592d88..79b34fa 100644 > > > > --- a/kernel/power/Kconfig > > > > +++ b/kernel/power/Kconfig > > > > @@ -78,6 +78,52 @@ config SNAPSHOT_VERIFICATION > > > > dependent on UEFI environment. EFI bootloader should generate the > > > > key-pair. > > > > > > > > +choice > > > > + prompt "Which hash algorithm should snapshot be signed with?" > > > > + depends on SNAPSHOT_VERIFICATION > > > > + help > > > > + This determines which sort of hashing algorithm will be used during > > > > + signature generation of snapshot. This algorithm _must_ be built into > > > > + the kernel directly so that signature verification can take place. > > > > + It is not possible to load a signed snapshot containing the algorithm > > > > + to check the signature on that module. > > > > > > Like if 1000 ifdefs you already added to the code are not enough, you > > > make some new ones? > > > Pavel > > > > > > > This SNAPSHOT_SIG_HASH kernel config is to select which SHA algorithms > > used for generate digest of snapshot. The configuration will captured by > > a const char* in code: > > > > +static const char *snapshot_hash = CONFIG_SNAPSHOT_SIG_HASH; > > + > > +static int pkey_hash(void) > > > > So, there doesn't have any ifdef block derived from this new config. > > I'd say select one hash function, and use it. There's no need to make > it configurable. > Pavel There have better performance when SHA algorithm output shorter hash result. On the other hand, longer hash result provide better security. And, on 64-bits system, the SHA512 has better performance then SHA256. Due to user have different use case and different hardware, why not give them this option to make decision? Thanks a lot! Joey LEe -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/