From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 17245C43600 for ; Thu, 1 Apr 2021 11:12:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DDF1D610CC for ; Thu, 1 Apr 2021 11:12:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234387AbhDALL6 (ORCPT ); Thu, 1 Apr 2021 07:11:58 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:39606 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234325AbhDALLt (ORCPT ); Thu, 1 Apr 2021 07:11:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617275508; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wJkEd7cUvYTeRV/iEXpdtoXis6pieALRjw6SuJS8/i8=; b=A1RbMyYg3Z/NB2zvaikMd3nQgYX6zQiKbuhbLxbT2aUt0MrOFTraZJ4DQXlf6uTgwogRhH 8kpslVCetd9LJh1iZb65t0ZINLpyoNmJY25yZ3XHDgah6S98QLWX1mdMxVsKSTIBCMVOH2 8LBUDjRR+UfE6uTkWRlqsmA3Fslr34M= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-598-IzKQ3i9nNnm-EJNdcp740A-1; Thu, 01 Apr 2021 07:11:46 -0400 X-MC-Unique: IzKQ3i9nNnm-EJNdcp740A-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 984C6107ACCA; Thu, 1 Apr 2021 11:11:43 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-112-58.rdu2.redhat.com [10.10.112.58]) by smtp.corp.redhat.com (Postfix) with ESMTP id 39BBD5D9CA; Thu, 1 Apr 2021 11:11:39 +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: References: To: Richard Weinberger Cc: dhowells@redhat.com, Ahmad Fatoum , Jarkko Sakkinen , =?UTF-8?Q?Horia_Geant=C4=83?= , Mimi Zohar , Aymen Sghaier , Herbert Xu , "David S. Miller" , James Bottomley , kernel@pengutronix.de, James Morris , "Serge E. Hallyn" , Steffen Trumtrar , Udit Agarwal , Jan Luebbe , David Gstir , Franck LENORMAND , Sumit Garg , linux-integrity@vger.kernel.org, keyrings@vger.kernel.org, Linux Crypto Mailing List , LKML , LSM Subject: Re: [PATCH v1 0/3] KEYS: trusted: Introduce support for NXP CAAM-based trusted keys MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3714193.1617275498.1@warthog.procyon.org.uk> Content-Transfer-Encoding: quoted-printable Date: Thu, 01 Apr 2021 12:11:38 +0100 Message-ID: <3714194.1617275498@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Richard Weinberger wrote: > On Wed, Mar 17, 2021 at 3:08 PM Ahmad Fatoum w= rote: > > keyctl add trusted $KEYNAME "load $(cat ~/kmk.blob)" @s > > Is there a reason why we can't pass the desired backend name in the > trusted key parameters? > e.g. > keyctl add trusted $KEYNAME "backendtype caam load $(cat ~/kmk.blob)" @s I wonder... Does it make sense to add a new variant of the add_key() and keyctl_instantiate() syscalls that takes an additional parameter string, separate from the payload blob? key_serial_t add_key2(const char *type, const char *description, const char *params, const void *payload, size_t plen, key_serial_t keyring); which could then by used, say: keyctl add --payload=3D~/kmk.blob trusted $KEYNAME "backendtype caam load= " @s This would then appear in struct key_preparsed_payload { const char *orig_description; char *description; char *params; <--- union key_payload payload; const void *data; size_t datalen; size_t quotalen; time64_t expiry; }; params would then be NULL for add_key(). If add_key2() is not available, the --payload param gets concatenated to t= he parameters string. Might be too complicated, I guess. Though it might make sense just to do = the concatenation inside the keyctl program. David