Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp3402008pxu; Mon, 19 Oct 2020 11:07:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxYHZbE6xyaVtq6CM6mNPQpNmlJF4W94rCDHb06gShxgbLbFsatNqgPZ0PvnNm69eA6k5Vy X-Received: by 2002:a50:fe93:: with SMTP id d19mr985411edt.323.1603130865241; Mon, 19 Oct 2020 11:07:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603130865; cv=none; d=google.com; s=arc-20160816; b=BT44zicPliTbdQMrcUhJZRXwo/1dyGDthMxPGr3hhZHUyleUVL9m4EzGHThHY+qJdX z5v1R8f73SmwshKfVsIrh411T9wd0yOp7EU86S9cYHiXtSgF1sKIoprJm9SRdN4nv+KI GHTwAzcl1rvRA42HF5gPmfG8YPoxQQ+K5OWUdpUCkjSO9s9rB14DPFJpmzfFX2FpHvdp ZP2zuD8WQ06WyqEFHfN0i5hm0MSoWkibpmaSyhy2n+uc5IMvXJ5OCg/y9N2b50vOWF4U Cncvs1FqbtTPp3WlenVMtFBQAJnblBeIWjDCCqJ18Uz0WO7zLNkbDiwiotGShAtzjsSX BsPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:from:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:date :dkim-signature:dkim-filter; bh=dco/WybpU/EqfvSvsH+XSa82NSYyQWrMNtM8NHtAqo8=; b=TuuYMtoFv7TYO//iQiJV68SDQhvr2jnNESRRW52jdo//dHZzqlyAKA8My5/2IVYUCu PhO7pXvLJ1AphAJ71Uc0d+6Ggds+BduYcU1bBqrJ1xoh8/798h4zR72mj8m7/pm32JAx xjbV0tLJv1SSStn53hyrCqTFWLAHkJrUGY1h2m+T59hSR8gFNAxPt5dikyZXXPyjjGOF SiNYlP0MJhb2Lq2lonokzYMDWTrmssA2IB8IEHIJyBq9ZVvBcVMlccxamsdOpAUtnNpH DOUv4mzShqD1cK4qUwDN7Q6ecNAozcaGYtLoJx3knVzPHZ1ZMos0RkEftJurU3iAXKAm ZCeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fieldses.org header.s=default header.b=GwREMXbU; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t24si522298ejd.39.2020.10.19.11.07.20; Mon, 19 Oct 2020 11:07:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@fieldses.org header.s=default header.b=GwREMXbU; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727681AbgJSSHP (ORCPT + 99 others); Mon, 19 Oct 2020 14:07:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727293AbgJSSHP (ORCPT ); Mon, 19 Oct 2020 14:07:15 -0400 Received: from fieldses.org (fieldses.org [IPv6:2600:3c00:e000:2f7::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88715C0613CE; Mon, 19 Oct 2020 11:07:15 -0700 (PDT) Received: by fieldses.org (Postfix, from userid 2815) id 8F970AAD; Mon, 19 Oct 2020 14:07:14 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.11.0 fieldses.org 8F970AAD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fieldses.org; s=default; t=1603130834; bh=dco/WybpU/EqfvSvsH+XSa82NSYyQWrMNtM8NHtAqo8=; h=Date:To:Cc:Subject:References:In-Reply-To:From:From; b=GwREMXbUFIGpSf1Gsl88oP+3JCO5ZoWbw+JFj+3z86HxybGd/ID9RSNytKwfe4S3N F7CHbMAgHPKgbcKjzJ8K1aYF9zD3lRddWW+NDiuuWfS9k8tFHbc2dUMZAii+dIZBSC uDXzZ/mhfEqceOj0kg247FrZYqStB7yW+3H/a68M= Date: Mon, 19 Oct 2020 14:07:14 -0400 To: David Howells Cc: herbert@gondor.apana.org.au, davem@davemloft.net, trond.myklebust@hammerspace.com, linux-crypto@vger.kernel.org, linux-nfs@vger.kernel.org, linux-afs@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: gssapi, crypto and afs/rxrpc Message-ID: <20201019180714.GA6692@fieldses.org> References: <1444464.1602865106@warthog.procyon.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1444464.1602865106@warthog.procyon.org.uk> User-Agent: Mutt/1.5.21 (2010-09-15) From: bfields@fieldses.org (J. Bruce Fields) Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Fri, Oct 16, 2020 at 05:18:26PM +0100, David Howells wrote: > Hi Herbert, Dave, Trond, > > I've written basic gssapi-derived security support for AF_RXRPC: > > https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git/log/?h=rxrpc-rxgk > > I've borrowed some bits from net/sunrpc/auth_gss/ but there's a lot in there > that is quite specific to the sunrpc module that makes it hard to use for > rxrpc (dprintk, struct xdr_buf). > > Further, I've implemented some more enctypes that aren't supported yet by > gssapi (AES with sha256/sha384 and Camellia), and that requires some changes > to the handling as AES with sha384 has a 24-byte checksum size and a 24-byte > calculated key size for Kc and Ki but a 32-byte Ke. > > Should I pull the core out and try to make it common? If so, should I move it > to crypto/ or lib/, or perhaps put it in net/gssapi/? > > There are two components to it: > > (1) Key derivation steps. > > My thought is to use xdr_netobj or something similar for to communicate > between the steps (though I'd prefer to change .data to be a void* rather > than u8*). > > (2) Encryption/checksumming. > > My thought is to make this interface use scattergather lists[*] since > that's what the crypto encryption API requires (though not the hash API). > > If I do this, should I create a "kerberos" crypto API for the data wrapping > functions? I'm not sure that it quite matches the existing APIs because the > size of the input data will likely not match the size of the output data and > it's "one shot" as it needs to deal with a checksum. > > Or I can just keep my implementation separate inside net/rxrpc/. I'd love to share whatever we can, though I'm not really sure what's involved. Certainly some careful testing at least. It's been about 15 years since I really worked on that code. I remember struggling with struct xdr_buf. The client and server support zero-copy, so requests and replies are represented by a combination of a couple of linear buffers plus an array of pages. My memory is that the (undocumented) meanings of the fields of the xdr_buf were different for request and replies and for server and client, and getting them right took some trial and error. --b.