Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp5443702imm; Tue, 18 Sep 2018 09:35:27 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaDu08H7tLi3m8P1h9tUct4bW69yH9e4HdClVSwhuX2V8iyOPbtam6d1mr8RDZUWhDNWLCi X-Received: by 2002:a62:280a:: with SMTP id o10-v6mr31571664pfo.129.1537288527429; Tue, 18 Sep 2018 09:35:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537288527; cv=none; d=google.com; s=arc-20160816; b=h6iAQUKE2rWhB+CAyMaKU8iP5yFXCmlpxGUJroZtZzUNw968LOy+jQNPo6Hb6TqHbF FcjS30H975rWiGFWlvKONrVQtnwqRKui42Klrn8xwP0jmWsymTNP+OEG20H8hm7bqSym dtsjb+nTR0HUXlW/YxNyivQlrK6L+miXZ2bMrgSNfaLiG6x7xRc28IzGbJ1jYHPu651F 6m6VJFsCDAAYcIjIV729H4DmUcT5CzWAoSCoNbGmh1U5IM4NXdWDS92kRmA20i/jluo0 ZzfnTwKdyiyT7NRd3XvLXX7PRzjJ2wp5QCHs9xvoQAcBHP1F2L3+4ktYJsE6CNuo5rw0 8AmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:content-id:mime-version :subject:cc:to:references:in-reply-to:from:organization; bh=wJnol9HzBZ0ybPhE2Rn/Mv0nawUHhV7cp01YjIdc0Cs=; b=EDGF8MTlpMcYe4pMUtQt1Nx9X0J5WIqNZVqYVnAgRxgZJBLgX4a+KRIkpzjXrD32A6 H2NbAT4OwvI/n0WvzkIZ4EY19jptQUVSRxAn3ofLpSnRDN794LIQ0V8XJvWpurqj5Me+ WlOqOEkXWOhmDvE2ajmVbA9nFesfG+ur6de9mQ4mt9mD8+ijca70jLLnlCftvKYTrgHU G54SWkpzTPPSSsYQWZP6Sjf0yEmZlYqiQ7/ErxpGn46jCipEyztkR7iQltM3mvV11x6b EOeW6QGt304K2iNXpzDjW4rfZPCELw2A6u8gcEDYVMk4RgslTAYGy7icLusp80f2VwQN nBKQ== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d128-v6si20456239pfc.211.2018.09.18.09.35.12; Tue, 18 Sep 2018 09:35:27 -0700 (PDT) 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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730298AbeIRWHE (ORCPT + 99 others); Tue, 18 Sep 2018 18:07:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:32974 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729501AbeIRWHE (ORCPT ); Tue, 18 Sep 2018 18:07:04 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 46ECE1B7B; Tue, 18 Sep 2018 16:33:43 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-123-84.rdu2.redhat.com [10.10.123.84]) by smtp.corp.redhat.com (Postfix) with ESMTP id E699616BF8; Tue, 18 Sep 2018 16:33:41 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: <0d51fca9a29458a40121df0c5380af91e3429c08.camel@infradead.org> References: <0d51fca9a29458a40121df0c5380af91e3429c08.camel@infradead.org> <153618445730.7946.10001472635835806478.stgit@warthog.procyon.org.uk> <1537253993.20009.62.camel@infradead.org> <14067.1537285833@warthog.procyon.org.uk> <745318a0-51bd-be8f-2251-44701ad75830@gmail.com> To: David Woodhouse Cc: dhowells@redhat.com, Denis Kenzior , jmorris@namei.org, keyrings@vger.kernel.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 00/22] KEYS: Support TPM-wrapped key and crypto ops MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <19246.1537288419.1@warthog.procyon.org.uk> Date: Tue, 18 Sep 2018 17:33:39 +0100 Message-ID: <19247.1537288419@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 18 Sep 2018 16:33:43 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org David Woodhouse wrote: > You are passing the raw DER to the kernel in both cases, right? I haven't put a PEM stripper and base64 decoder into the kernel, though we certainly could do that. We could even do the decode in-place in the same buffer since the resulting data would be smaller than the original. > And the kernel just happens to know that if it receives a bare OCTET-STRING > it's supposed to treat it as a TPMv1.2 key? It passes it to each parser in turn till one says it can parse it. It's not ideal, but it seems to work - so far. Better would be to annotate it in some way. I have considered annotating the type field so that the payload doesn't have to have it added: keyctl padd asymmetric.x509 "" @s