Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp629174imu; Wed, 9 Jan 2019 03:49:35 -0800 (PST) X-Google-Smtp-Source: ALg8bN5fadz4RujV9YUTtgUkpLNZAxzY2DExbCE4FXlzsN/ZaTPySLmJ/JIHOSnw1NmuHUF4a80Z X-Received: by 2002:a17:902:9f93:: with SMTP id g19mr5609879plq.195.1547034575557; Wed, 09 Jan 2019 03:49:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547034575; cv=none; d=google.com; s=arc-20160816; b=CP2TvrLRyy5quLBJwhMtZtmOA/UmXwkI3qDUtrlgsLbPBplqtPYzU6Mh24UR022Wp9 hx4iPtpDhARWLs+HrlzoX0W3aDkzkY1hRxdNFoVPpiPjHWgBi875TO/QMdJoKwFZHNdV vmTtRnn+zRHdm/ebOwadNpZvv7CrlAObEIgyLFPEhBR4QC/HolsReOIO2dIggi6CiFRs QVBf4QSsnKJciUDV+IpDrjmSOuN1P3QsIosXUi4/Kdv/YYVwHKIGYCEnASWigQQKbS8b IsCcxHLFNYyA3LuQW4K+uOMGYyntjal1RUnSKHrlJ3xgBN9SknwwNBgHgRcp+7tZFAJ6 c/Rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=8Gpp2jSMjw9TDIVQ8ToVBHpCNa7x4sUYs9CLaHwsbeo=; b=a7MeUz9Yfg2Stq6SX3pG+EFiy9LBrtIT8QgCYiip21UmJo5pkMil/rCrK3OGnJTqSv Ej5ZCXpzI4BdK7fsUBtHH2tO/JaKko6TYykePrPi99qYSbJYh7yMr8q5fiFV8bVGq+rw mShDsyZX9DhreML8b8COigJfK8PDUfSrLJFiPYGh4RkGz6+5yirZkxi2TC0caOMPO75a Uhn019XjZgKHryFqvWDYJsQNdD1Bqf+01B/H0hEyB2wiS+hT+BZ4iwt83HHEmClP32ao pPgBOzEIKBDAAGibFzlR1eCNEJjfVV7pdjOehXsXdXtvB46Hc0xoSJZ3cNg6jKdRaTnn XDYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@chronox.de header.s=strato-dkim-0002 header.b=p+yQ60WG; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 44si15633964plb.57.2019.01.09.03.49.19; Wed, 09 Jan 2019 03:49:35 -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; dkim=fail header.i=@chronox.de header.s=strato-dkim-0002 header.b=p+yQ60WG; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730309AbfAIKSV (ORCPT + 99 others); Wed, 9 Jan 2019 05:18:21 -0500 Received: from mo4-p01-ob.smtp.rzone.de ([81.169.146.166]:26017 "EHLO mo4-p01-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730303AbfAIKSU (ORCPT ); Wed, 9 Jan 2019 05:18:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1547029095; s=strato-dkim-0002; d=chronox.de; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=8Gpp2jSMjw9TDIVQ8ToVBHpCNa7x4sUYs9CLaHwsbeo=; b=p+yQ60WG1fr6sW+UXfAh2M9cGjaQTTGC+JVTEZCujEPnkf7xI9a2EVFE3mP1DHwh08 /Df5zFE9oFTOGtmLK0VWfFObZxalPGshkiNDocGpt7MP5Su/xifZufLFYINjuasbN/7f Lle233JAriSQmvo88YV+LHK3NIBNUprJUOdMKrRuJoGOq5Ooj2J308YnTVbof+7bPBKV dr3DXAcdLhb7ywfvjSIC1NaOQ6SDcV5/guO8qox0SILG7dqxL0Hf+g3zOX2/xUzwN2eA 2N8FAvexEt2fujVc/TgJZGhTZ0qFZb1IUHSXSgrMOsmgNW1DEkHhWb98Zl5T1+OXgv0t 1UXQ== X-RZG-AUTH: ":P2ERcEykfu11Y98lp/T7+hdri+uKZK8TKWEqNyiHySGSa9k9x24dNoX176cAx2h1qXJ5" X-RZG-CLASS-ID: mo00 Received: from tauon.chronox.de by smtp.strato.de (RZmta 44.9 SBL|AUTH) with ESMTPSA id 309bcfv09AHoPOB (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Wed, 9 Jan 2019 11:17:50 +0100 (CET) From: Stephan Mueller To: Eric Biggers Cc: James Bottomley , Andy Lutomirski , Herbert Xu , "Lee, Chun-Yi" , "Rafael J . Wysocki" , Pavel Machek , linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, keyrings@vger.kernel.org, "Rafael J. Wysocki" , Chen Yu , Oliver Neukum , Ryan Chen , David Howells , Giovanni Gherdovich , Randy Dunlap , Jann Horn , Andy Lutomirski Subject: Re: [PATCH 1/5 v2] PM / hibernate: Create snapshot keys handler Date: Wed, 09 Jan 2019 11:17:45 +0100 Message-ID: <2344329.gmPllosFfp@tauon.chronox.de> In-Reply-To: <20190109082103.GA8586@sol.localdomain> References: <20190103143227.9138-1-jlee@suse.com> <1894062.aDvIuj92vB@tauon.chronox.de> <20190109082103.GA8586@sol.localdomain> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am Mittwoch, 9. Januar 2019, 09:21:04 CET schrieb Eric Biggers: Hi Eric, > > FWIW, it's been very slow going since I've been working on other projects > and I also need to be very sure to get the API changes right, but I still > plan to change the KDF in fscrypt (a.k.a. ext4/f2fs/ubifs encryption) to > HKDF-SHA512 as part of a larger set of improvements to how fscrypt > encryption keys are managed. I sent the last patchset a year ago > (https://marc.info/?l=linux-fsdevel&m=150879493206257) but I'm working to > revive it. In the work-in-progress version in my git tree, this is the > commit that adds a HKDF implementation as fs/crypto/hkdf.c: > https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git/commit/?i > d=e8a78767131c9717ee838f0c4e307948d65a4427 It basically just wraps a > crypto_shash for "hmac(sha512)". > > I'd be fine with using a common implementation instead, provided that it > gives the same functionality, including supporting user-specified salt and > application-specific info strings, and isn't slower or more complex to use. > > (This comment is solely on the tangential discussion about KDF > implementations; I've not looked at the hibernation image encryption stuff > yet.) Thanks for the clarification. I have started a generic HKDF implementation for the kernel crypto API which lead to the questions above. I would then also try to provide a HKDF proposal. To use the (H)KDF, I currently envision 2 calls apart from alloc/free. The following code would serve as an example. * Example without proper error handling: * char *keying_material = "\x00\x11\x22\x33\x44\x55\x66\x77"; * char *label_context = "\xde\xad\xbe\xef\x00\xde\xad\xbe\xef"; * kdf = crypto_alloc_rng(name, 0, 0); * crypto_rng_reset(kdf, keying_material, 8); * crypto_rng_generate(kdf, label_context, 9, outbuf, outbuflen); That hopefully should be simple enough. For HKDF, as mentioned, I would envision to use a struct instead of a char * for the label_context to communicate IKM, Salt, and the label/info information. Ciao Stephan