Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2421441pxu; Mon, 7 Dec 2020 06:17:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJwUGYoUOBOf4ROUuHvQIasrnq+Q1jED7ibRvnVsnZsv34aQ86WmHQfYvFus8yWLaWewm6Bj X-Received: by 2002:a17:907:c10:: with SMTP id ga16mr9079575ejc.43.1607350630920; Mon, 07 Dec 2020 06:17:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607350630; cv=none; d=google.com; s=arc-20160816; b=C5a44YLaWgCviCTUmEYyOBcqaCGAsI7LiPHPveg8glf8FmUSw9CoIvgZn1zeD4OjqS XQedhk+mw6gHdwgrdnlAFHof3WeAXb9XWWKVyM/Ry9nkzCi6lyxdqUQKllwjOrXxI6cq b6mkgodtykutsISWwa6rh7lTAjPdcCPOHUrAJLae99qORPpNQ7bZr21TnrQ5njjcpi/Z 9VOQI54hXBbUTcC4JuRbI4+RwsHUGCKyVUhlGGud4ZiazPu7GrdlNfrE5oKQFfFAlsyI f44fGesBR++W32P8P/orq0Y12cGg7iDJDB8N5JkY0lBE9CV2ubOD/wqgsB9PQGdlAxP4 O/qA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:content-id:mime-version:subject :cc:to:references:in-reply-to:from:organization:dkim-signature; bh=MgTQnfyHDBIlg0aW7LHURku9NdTnw1Wvewb97jbt5cc=; b=gSsrsCib9AdFkXuFfCjHGgvGUB+qBih36RuATROoZ5JZneJDrTUKR/8OM2yMq5W/ea 6uQ54NTvq6FCstfl1rMm+iVKAQ7/BlLKHNaeIPsIKJOzdJctJjwXtqWHV1O6NYb5zOFU isHnLZ3o2Y/RryWRds7PMvm1rzTmNLrRZrKQ0g+9V82nvCLnSbNN5A2uUDi9lRB78OmW pRZ8PSyFRbx5s+yymBgoHExai6gWCfbyZKRLPe193YfqSDu9BcPRxmyWjO/F+ApQZYDS Tu4lQTMTt6McUPqx31Oo4EDjPxYYK6XsOP3XFPt7DFAirq4e12XSIHb9n5VpVX5zjGQV cUTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=TtlqS1QZ; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u19si6439776eja.544.2020.12.07.06.16.39; Mon, 07 Dec 2020 06:17:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto-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=@redhat.com header.s=mimecast20190719 header.b=TtlqS1QZ; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726112AbgLGOQe (ORCPT + 99 others); Mon, 7 Dec 2020 09:16:34 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:23538 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725770AbgLGOQe (ORCPT ); Mon, 7 Dec 2020 09:16:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607350507; 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: in-reply-to:in-reply-to:references:references; bh=MgTQnfyHDBIlg0aW7LHURku9NdTnw1Wvewb97jbt5cc=; b=TtlqS1QZlEQ5xRIhrDDn7ELQQQKyAt1LhZFf3YzjTBzJMJnH5oW1iK+33s5FrcPtsJkeSq ttNSeOQMtf4PImWgp14FTFx3pHakoccfm4UT30BhR2Xqz2PGdf0SCUnxEPBXtjarqwoUrV WHSJWvqtCMyFXpN3nDXSK6aDjiFRGgg= 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-333-YhyV3gt5MI-mqE0CMyDmIA-1; Mon, 07 Dec 2020 09:15:05 -0500 X-MC-Unique: YhyV3gt5MI-mqE0CMyDmIA-1 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 28400DF8A7; Mon, 7 Dec 2020 14:15:03 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-116-67.rdu2.redhat.com [10.10.116.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id CE5C719C45; Mon, 7 Dec 2020 14:15:00 +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: <20201204154626.GA26255@fieldses.org> <2F96670A-58DC-43A6-A20E-696803F0BFBA@oracle.com> <160518586534.2277919.14475638653680231924.stgit@warthog.procyon.org.uk> <118876.1607093975@warthog.procyon.org.uk> <122997.1607097713@warthog.procyon.org.uk> <20201204160347.GA26933@fieldses.org> <125709.1607100601@warthog.procyon.org.uk> <127458.1607102368@warthog.procyon.org.uk> <468625.1607342512@warthog.procyon.org.uk> To: Ard Biesheuvel Cc: dhowells@redhat.com, Bruce Fields , Chuck Lever , CIFS , Linux NFS Mailing List , Herbert Xu , "open list:BPF JIT for MIPS (32-BIT AND 64-BIT)" , Linux Kernel Mailing List , Trond Myklebust , Linux Crypto Mailing List , linux-fsdevel@vger.kernel.org, linux-afs@lists.infradead.org Subject: Re: Why the auxiliary cipher in gss_krb5_crypto.c? MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <482242.1607350500.1@warthog.procyon.org.uk> Date: Mon, 07 Dec 2020 14:15:00 +0000 Message-ID: <482243.1607350500@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Ard Biesheuvel wrote: > > I wonder if it would help if the input buffer and output buffer didn't > > have to correspond exactly in usage - ie. the output buffer could be used > > at a slower rate than the input to allow for buffering inside the crypto > > algorithm. > > > > I don't follow - how could one be used at a slower rate? I mean that the crypto algorithm might need to buffer the last part of the input until it has a block's worth before it can write to the output. > > The hashes corresponding to the kerberos enctypes I'm supporting are: > > > > HMAC-SHA1 for aes128-cts-hmac-sha1-96 and aes256-cts-hmac-sha1-96. > > > > HMAC-SHA256 for aes128-cts-hmac-sha256-128 > > > > HMAC-SHA384 for aes256-cts-hmac-sha384-192 > > > > CMAC-CAMELLIA for camellia128-cts-cmac and camellia256-cts-cmac > > > > I'm not sure you can support all of those with the instructions available. > > It depends on whether the caller can make use of the authenc() > pattern, which is a type of AEAD we support. Interesting. I didn't realise AEAD was an API. > There are numerous implementations of authenc(hmac(shaXXX),cbc(aes)), > including h/w accelerated ones, but none that implement ciphertext > stealing. So that means that, even if you manage to use the AEAD layer to > perform both at the same time, the generic authenc() template will perform > the cts(cbc(aes)) and hmac(shaXXX) by calling into skciphers and ahashes, > respectively, which won't give you any benefit until accelerated > implementations turn up that perform the whole operation in one pass over > the input. And even then, I don't think the performance benefit will be > worth it. Also, the rfc8009 variants that use AES with SHA256/384 hash the ciphertext, not the plaintext. For the moment, it's probably not worth worrying about, then. If I can manage to abstract the sunrpc bits out into a krb5 library, we can improve the library later. David