Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753914AbbG3QU7 (ORCPT ); Thu, 30 Jul 2015 12:20:59 -0400 Received: from mga01.intel.com ([192.55.52.88]:52984 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753076AbbG3QU5 (ORCPT ); Thu, 30 Jul 2015 12:20:57 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,577,1432623600"; d="scan'208";a="758528396" Message-ID: <1438273246.11322.14.camel@intel.com> Subject: Re: [RFC PATCH 06/16] x86/efi: Generating random HMAC key for siging hibernate image From: Matt Fleming To: "Lee, Chun-Yi" CC: , , , "Rafael J. Wysocki" , "Matthew Garrett" , Len Brown , Pavel Machek , Josh Boyer , "Vojtech Pavlik" , Jiri Kosina , "H. Peter Anvin" , "Lee, Chun-Yi" Date: Thu, 30 Jul 2015 17:20:46 +0100 In-Reply-To: <1437056730-15247-7-git-send-email-jlee@suse.com> References: <1437056730-15247-1-git-send-email-jlee@suse.com> <1437056730-15247-7-git-send-email-jlee@suse.com> Organization: Intel Corporation (UK) Ltd. - Registered No. 1134945 - Pipers Way, Swindon SN3 1RJ Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.12.11 (3.12.11-1.fc21) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Originating-IP: [163.33.239.181] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1493 Lines: 37 On Thu, 2015-07-16 at 22:25 +0800, Lee, Chun-Yi wrote: > This patch adds codes in EFI stub for generating and storing the > HMAC key in EFI boot service variable for signing hibernate image. > > Per rcf2104, the length of HMAC-SHA1 hash result is 20 bytes, and > it recommended the length of key the same with hash rsult, means > also 20 bytes. Using longer key would not significantly increase > the function strength. Due to the nvram space is limited in some > UEFI machines, so using the minimal recommended length 20 bytes > key that will stored in boot service variable. > > For generating a messy number as a 20 bytes key, the codes in EFI > stub gets u32 random number five time and every random number is > rolling that last u32 random number as entropy. > > The HMAC key stored in EFI boot service variable, the GUID is > S4SignKey-fe141863-c070-478e-b8a3-878a5dc9ef21. [...] > @@ -1383,6 +1384,60 @@ free_mem_map: > return status; > } > > +#ifdef CONFIG_HIBERNATE_VERIFICATION > +#define SWSUSP_KEY \ > + ((efi_char16_t [10]) { 'S', 'W', 'S', 'U', 'S', 'P', 'K', 'e', 'y', 0 }) > +#define SWSUSP_KEY_ATTRIBUTE (EFI_VARIABLE_NON_VOLATILE | \ > + EFI_VARIABLE_BOOTSERVICE_ACCESS) You mean "SWSUSPKey" not "S4SignKey" right? -- 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/