Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp1768569rdd; Thu, 11 Jan 2024 08:42:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IEu3p6pYmYuvqa0ICktgOebdGAPlI8vQB2DjTxChLHRD/jgoGst9ZBgQPqt+6igIu/gliuy X-Received: by 2002:a25:2906:0:b0:dbe:a10e:9ab with SMTP id p6-20020a252906000000b00dbea10e09abmr1504543ybp.93.1704991347916; Thu, 11 Jan 2024 08:42:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704991347; cv=none; d=google.com; s=arc-20160816; b=yGH0fpC97EV/v2M52k/UVm70bsm4w5NNgawFjnv2657z186eS5ZW6nYDDhv2cNx95k a37jDhOK8FQwlLqWFm4ugVZkEoPz2ZqS0Qtz8EJ9DC5GCS96FXo4s+GAlX8pONq8tHja 4BTZ9SSCcdd7v7HDQX+Nl1t070xT0nFfZDGXQGu1TykwrBQCSmF9kJy0FswZ0upnEs3N 5Oqy9MuYzIQWbcaCM5w5zQdN2sDyCriqIXh17AJNh2gOAL2YC4QNTl/0HSqD8q9iPmtp RlTddqHMffrUbDldatmkbXdFPGk2MP3vrmrh5/Q7D05Wzn2BE+H/2m3ZhMOFdBYxaAhf ZCcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:content-transfer-encoding:content-id:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:subject:cc:to :from:organization:dkim-signature; bh=VqrInYkNLx1NtjOqgVxpVM91IYukVc31dOGwzdzlGfI=; fh=113qDY2WOTjSONhwB40CDfLCHY3E1asNyMaliaqbJP0=; b=oj51r+vIm1S3lQqg1RbdxWdd7Xp3a9ghnDWs4Ef1ljt2ckWmF8jwuRpmBgPuOSnx2L ljNyZgOz5qfjQWx2A5AbhedGOGEvKkd6hnfcfu8lefkUuTynga8HATaLgL3kdFttYxxG 6XIuNWb8wwJ1hvczEI7gPakbCHLQSciYv00yBuxZCM81TFLLtLbX2eONWW5nmv4U9FXs K3GB8leXkXNvv/B5dkMq5Je38o7NaMK2JsCvntY5q2vd4IqU55zkJbF7akZPZnlqnxCb hC9uO1szZ43H/ci9VMW0Wh8sBOK004rNrCyW66pW8u7psu+EAF483bX0QBpKgjEY3Vm6 XEOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bcieYNXp; spf=pass (google.com: domain of linux-kernel+bounces-23882-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23882-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id b20-20020ac87fd4000000b00429834a5187si1215709qtk.787.2024.01.11.08.42.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jan 2024 08:42:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-23882-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bcieYNXp; spf=pass (google.com: domain of linux-kernel+bounces-23882-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23882-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id A329B1C23489 for ; Thu, 11 Jan 2024 16:42:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4ADE350267; Thu, 11 Jan 2024 16:42:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="bcieYNXp" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1E5EB29CFB for ; Thu, 11 Jan 2024 16:42:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704991338; 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; bh=VqrInYkNLx1NtjOqgVxpVM91IYukVc31dOGwzdzlGfI=; b=bcieYNXpRqMoVNkm5HaKE8DRiwDcnBbtKQmpOY/4l52X36j3lpwsLwGUK1K9MKDAW7tpTk 8cfbv1g58trjOLTM4/bLPknjsIkWkY3icH3yH6l6YlIn78ihO80hL58P1b2LhZlLyt7fZR QgX8CaXfIEsS4DZsBQls5sMwQ0GW/Xc= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-522-UpLrGVGfMfWuXurDF-TKjw-1; Thu, 11 Jan 2024 11:42:13 -0500 X-MC-Unique: UpLrGVGfMfWuXurDF-TKjw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EF910882321; Thu, 11 Jan 2024 16:42:11 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id E5C7A2166B31; Thu, 11 Jan 2024 16:42:08 +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 To: Herbert Xu , Chuck Lever III cc: dhowells@redhat.com, Jeff Layton , linux-afs@lists.infradead.org, linux-nfs@vger.kernel.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Rebuilding at least part of my krb5 crypto lib on crypto-aead Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2131431.1704991328.1@warthog.procyon.org.uk> Content-Transfer-Encoding: quoted-printable Date: Thu, 11 Jan 2024 16:42:08 +0000 Message-ID: <2131432.1704991328@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6 Hi Herbert, Chuck, I've been thinking more on how I might go about rebuilding at least part o= f my krb5 crypto library on top of the AEAD template. I don't think it makes sense to try and put the entirety of it in there. There are functions that completely don't fit (such as key generation) and= the catalogue of Kerberos type values and associated parameters. Also, I'm not sure it makes sense to try and squeeze the Integrity-type operations get_mic and verify_mic as AEAD. get_mic might work as AEAD, bu= t all a wrapper would add is to emplace the checksum into ciphertext buffer. The actual checksumming is handled by a SHASH algorithm perfectly well. verify_mic doesn't really make sense as it has no output other than "yes/n= o" - and so is also handled fine by a SHASH algorithm. Where it does make sense is at the core of the encrypt/decrypt ops where I have four compound ops to choose from: - encrypt-then-hash - hash-then-decrypt - hash-then-encrypt - decrypt-then-hash These can conceivably be hardware optimised to do both parts of the op simultaneously. I *think* I've seen a suggestion that x86_64 AVX has sufficient registers available to do both AES and SHA simultaneously, say. The question I then have is this: How do I parameterise the crypto algorit= hm inside AEAD? Can I do something like: cipher =3D crypto_alloc_sync_aead("enc-then-hash(cts(cbc(camellia)),cmac(= camellia))"); David