From: James Bottomley Subject: Re: [RFC V4 PATCH 00/15] Signature verification of hibernate snapshot Date: Wed, 25 Sep 2013 15:16:54 -0700 Message-ID: <1380147414.18835.36.camel@dabdike.int.hansenpartnership.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-15" Content-Transfer-Encoding: 7bit Cc: David Howells , "Lee, Chun-Yi" , 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, "Rafael J. Wysocki" , Matthew Garrett , Len Brown , Pavel Machek , Josh Boyer , Vojtech Pavlik , Matt Fleming , Greg KH , JKosina@suse.com, Rusty Russell , Herbert Xu , "David S. Miller" , "H. Peter Anvin" , Michal Marek , Gary Lin , Vivek Goyal , "Lee, Chun-Yi" To: Alan Stern Return-path: In-Reply-To: Sender: linux-pm-owner@vger.kernel.org List-Id: linux-crypto.vger.kernel.org On Wed, 2013-09-25 at 17:25 -0400, Alan Stern wrote: > On Wed, 25 Sep 2013, David Howells wrote: > > > I have pushed some keyrings patches that will likely affect this to: > > > > http://git.kernel.org/cgit/linux/kernel/git/dhowells/linux-fs.git/log/?h=keys-devel > > > > I intend to ask James to pull these into his next branch. If he's happy to do > > so, I can look at pulling at least your asymmetric keys patch on top of them. > > This suggests a point that I raised at the Linux Plumbers conference: > > Why are asymmetric keys used for verifying the hibernation image? It > seems that a symmetric key would work just as well. And it would be a > lot quicker to generate, because it wouldn't need any high-precision > integer computations. The reason is the desire to validate that the previous kernel created something which it passed on to the current kernel (in this case, the hibernation image) untampered with. To do that, something must be passed to the prior kernel that can be validated but *not* recreated by the current kernel. The scheme for doing this is a public/private key pair generated for each boot incarnation N as a pair P_N (public key) and K_N (private key). Then the Nth boot incarnation gets P_{N-1} and K_N (the boot environment holds P_N in inaccessible BS variables for passing into the next kernel) so the Nth kernel can validate information from the N-1th kernel using P_{N-1} and create information for passing on in a validated fashion to the next kernel using K_N. This scheme doesn't work with symmetric keys unless you have a modification I haven't seen? James