Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1790188rwi; Thu, 27 Oct 2022 22:05:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4XE7vH5IvgE3iwdm/VuXaQy54SrBv3pM/44ed6Q++xcEt6VDnkQIeD0pyuTuEySlIGSdQF X-Received: by 2002:a17:903:24f:b0:178:bf4f:fc7c with SMTP id j15-20020a170903024f00b00178bf4ffc7cmr12140592plh.124.1666933510074; Thu, 27 Oct 2022 22:05:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666933510; cv=none; d=google.com; s=arc-20160816; b=Z2Fo+DKEH9HulPoUHawZFt4pEyo5nc8z/9IeInTYvOCZQzZl+PIholytRIrCfPaNuB ZRoG3W/vc/eR+ohXC3rL4JD/7SZd2ogrMVLgAzG7BNmOdbQZT50deKEY+GAcVBPGEpZM bhNEr/MVAWbxizX8qV4OtlVe3Uym174LwOnlbxn2l8Xgc9QpHxgav1PK2f9iBk8FE/oC LflwLCGBNwT48fX+hSrYwVarTTHdZG/jRHrC1pGrA59AFolf/9YQBE1B0cx5Gqbb31Y7 0vTeXy7+swIfH3T5aI1ULBGH718XNnlTx45KYmiWK8ExEmQaa2rUHZWMhd/WJAHFPisR 3eZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=IdMysGrD7gUp/X2Aavx8PWHSgBAz8rOqlMukkH94bmw=; b=uh3tL/p/dzS+uhsdAROAh048/ZNHtKUTTJyZkpIXmivMjLTdbVrKC1WxCVBb1dUuXp hY1mICl6L4MqSbMBWeMfKtG5VhTX/wvwIhSSSD8Wx2vvDhsewRhKwirTKSA8i9DSctvp ZDIPtUBJ0wEQQfDqi/mADXugCy9RxENaBglisHEpqIvQdM6SRzz7JGbytwe0ejgw778+ kabQIQjQBoj4UUvyZUtxAdsZNUB9KJ2PP3HjDte1wk25ogSmJsfdrie1NrUPSav4596p 1WjYjZNQ2W9T4AQ2ty0V7KGc0GqVLtnGhwfFpv7SYraONWj5Rt76aNTUcgjBVNJQoZdN vhMQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c8-20020a17090a8d0800b00213517a8fadsi7772823pjo.141.2022.10.27.22.04.38; Thu, 27 Oct 2022 22:05:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229528AbiJ1FCv (ORCPT + 99 others); Fri, 28 Oct 2022 01:02:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229460AbiJ1FCv (ORCPT ); Fri, 28 Oct 2022 01:02:51 -0400 Received: from formenos.hmeau.com (helcar.hmeau.com [216.24.177.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C78E1AFA92; Thu, 27 Oct 2022 22:02:50 -0700 (PDT) Received: from loth.rohan.me.apana.org.au ([192.168.167.2]) by formenos.hmeau.com with smtp (Exim 4.94.2 #2 (Debian)) id 1ooHVI-007UvU-0h; Fri, 28 Oct 2022 13:02:37 +0800 Received: by loth.rohan.me.apana.org.au (sSMTP sendmail emulation); Fri, 28 Oct 2022 13:02:36 +0800 Date: Fri, 28 Oct 2022 13:02:36 +0800 From: Herbert Xu To: Frederick Lawler Cc: davem@davemloft.net, ebiggers@google.com, hch@lst.de, smueller@chronox.de, dhowells@redhat.com, omosnace@redhat.com, keyrings@vger.kernel.org, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, kernel-team@cloudflare.com Subject: Re: [PATCH 1/1] crypto: af_alg - Support symmetric encryption via keyring keys Message-ID: References: <20221017192500.485962-1-fred@cloudflare.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221017192500.485962-1-fred@cloudflare.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Mon, Oct 17, 2022 at 02:25:00PM -0500, Frederick Lawler wrote: > We want to leverage keyring to store sensitive keys, and then use those > keys for symmetric encryption via the crypto API. Among the key types we > wish to support are: user, logon, encrypted, and trusted. > > User key types are already able to have their data copied to user space, > but logon does not support this. Further, trusted and encrypted keys will > return their encrypted data back to user space on read, which does not > make them ideal for symmetric encryption. > > To support symmetric encryption for these key types, add a new > ALG_SET_KEY_BY_KEY_SERIAL setsockopt() option to the crypto API. This > allows users to pass a key_serial_t to the crypto API to perform > symmetric encryption. The behavior is the same as ALG_SET_KEY, but > the crypto key data is copied in kernel space from a keyring key, > which allows for the support of logon, encrypted, and trusted key types. > > Keyring keys must have the KEY_(POS|USR|GRP|OTH)_SEARCH permission set > to leverage this feature. This follows the asymmetric_key type where key > lookup calls eventually lead to keyring_search_rcu() without the > KEYRING_SEARCH_NO_CHECK_PERM flag set. > > Signed-off-by: Frederick Lawler > --- > RFC: https://lore.kernel.org/all/20221004212927.1539105-1-fred@cloudflare.com/ > > We have an idea for handling the case of leaking key data with bad > algorithms, but asymmetric keys currently have the same problem if any were > added as a akcipher type. If KEY_*_SEARCH is not good enough, we thought > of possibly implementing a KConfig such that we disable leaky algorithms > when selected, or possibly the inverse where if a leaky algorithm is > enabled, we don't allow to enable this. The problem there is now there's > a list to maintain. > --- > Documentation/crypto/userspace-if.rst | 15 ++- > crypto/af_alg.c | 135 +++++++++++++++++++++++++- > include/uapi/linux/if_alg.h | 1 + > 3 files changed, 147 insertions(+), 4 deletions(-) Patch applied. Thanks. -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt