From: joeyli Subject: Re: [PATCH 17/18] Hibernate: introduced SNAPSHOT_SIG_HASH config for select hash algorithm Date: Tue, 27 Aug 2013 18:22:17 +0800 Message-ID: <1377598937.20140.12.camel__12894.0435046845$1377599040$gmane$org@linux-s257.site> 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> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-security-module-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-crypto-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, opensuse-kernel-stAJ6ESoqRxg9hUCZPvPmw@public.gmane.org, David Howells , "Rafael J. Wysocki" , Matthew Garrett , Len Brown , Josh Boyer , Vojtech Pavlik , Matt Fleming , James Bottomley , Greg KH , JKosina-IBi9RG/b67k@public.gmane.org, Rusty Russell , Herbert Xu , "David S. Miller" , "H. Peter Anvin" , Michal Marek , Gary Lin , Vivek Goyal To: Pavel Machek Return-path: In-Reply-To: <20130825164329.GL5171-tWAi6jLit6GreWDznjuHag@public.gmane.org> Sender: linux-efi-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: linux-crypto.vger.kernel.org =E6=96=BC =E6=97=A5=EF=BC=8C2013-08-25 =E6=96=BC 18:43 +0200=EF=BC=8CPa= vel Machek =E6=8F=90=E5=88=B0=EF=BC=9A > On Thu 2013-08-22 19:01:56, Lee, Chun-Yi wrote: > > This patch introduced SNAPSHOT_SIG_HASH config for user to select w= hich > > hash algorithm will be used during signature generation of snapshot= =2E > >=20 > > v2: > > Add define check of oCONFIG_SNAPSHOT_VERIFICATION in snapshot.c bef= ore > > declare pkey_hash(). > >=20 > > 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(-) > >=20 > > 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 t= he > > key-pair. > > =20 > > +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 pla= ce. > > + It is not possible to load a signed snapshot containing the alg= orithm > > + to check the signature on that module. >=20 > Like if 1000 ifdefs you already added to the code are not enough, you > make some new ones? > Pavel >=20 This SNAPSHOT_SIG_HASH kernel config is to select which SHA algorithms used for generate digest of snapshot. The configuration will captured b= y a const char* in code: +static const char *snapshot_hash =3D CONFIG_SNAPSHOT_SIG_HASH; + +static int pkey_hash(void) So, there doesn't have any ifdef block derived from this new config. Thanks a lot! Joey Lee