From patchwork Mon Mar 3 08:44:49 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13998319 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 62B3B1EFFB8 for ; Mon, 3 Mar 2025 08:45:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740991521; cv=none; b=HcmaYBh8h38zq4WuucYRZaGnwmffhRwvG3i1wMuyQj0pM63AFgVNfmNkgWJKZPYCTMsc56wK7UM235eJST3rptb19e9saDugDvpSAHu/yIpWb/CghQO3mQK+c+lqH7LRKk1oLzk6zg0tuPxzCSzfXhEAaLbFPu1NC8mMYu6SYpc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740991521; c=relaxed/simple; bh=bUWqoIF0RSWTyZWSv8LwMFKJPtmJiM+TMfHwuR+g940=; h=From:To:cc:Subject:MIME-Version:Content-Type:Date:Message-ID; b=koAXy6hVpWvQRZw0xDtHZ/D/FxjRyNcPwYfBO9ue1YVUJP1flvi/Lop9uxr2EKu9gTXsGk0ZuY2L02+PZuKsaVn7sS/0k70gZHa8i2eK1VhwHLiepsM3P4Jzj9HT/i+WQjf89H/iuOvVhWsotqwkt4IsciCZ8ZHlDpROkeoBdDo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=P3tWTBYp; arc=none smtp.client-ip=170.10.133.124 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="P3tWTBYp" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1740991518; 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=Mzc0zyxynm1zLc8lCgBdxcnpn7S2dpYemCwQOpKEfuk=; b=P3tWTBYpUlNVmbjlyMNMmsShnvEvjp7RM53F2rCL9xbY756/PxnuD3dWD3R2DoEQGUziaI qsGxJtjH0MP+Vb51XM0/SqUwV0XeCynymTWWmfkFlBtD73VfX/YY7MrmryeCUBidGfJsUJ XevjPvyIHODagrymeXjRwG2nKmqTDoE= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-306-7wrT26BSMJ6P7gbEEUKlQA-1; Mon, 03 Mar 2025 03:45:00 -0500 X-MC-Unique: 7wrT26BSMJ6P7gbEEUKlQA-1 X-Mimecast-MFC-AGG-ID: 7wrT26BSMJ6P7gbEEUKlQA_1740991498 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (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 mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 1D019180087C; Mon, 3 Mar 2025 08:44:57 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.44.32.200]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E569819560AA; Mon, 3 Mar 2025 08:44:50 +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 cc: David Howells , Marc Dionne , Jakub Kicinski , "David S. Miller" , Eric Dumazet , Paolo Abeni , Simon Horman , Trond Myklebust , Chuck Lever , Eric Biggers , Ard Biesheuvel , linux-crypto@vger.kernel.org, linux-afs@lists.infradead.org, linux-nfs@vger.kernel.org, netdev@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [GIT PULL v2] crypto: Add Kerberos crypto lib Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-ID: <3709377.1740991489.1@warthog.procyon.org.uk> Date: Mon, 03 Mar 2025 08:44:49 +0000 Message-ID: <3709378.1740991489@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 Hi Herbert, Could you pull this into the crypto tree please? v2 is just a rebase onto your cryptodev/master branch. It does a couple of things: (1) Provide an AEAD crypto driver, krb5enc, that mirrors the authenc driver, but that hashes the plaintext, not the ciphertext. This was made a separate module rather than just being a part of the authenc driver because it has to do all of the constituent operations in the opposite order - which impacts the async op handling. Testmgr data is provided for AES+SHA2 and Camellia combinations of authenc and krb5enc used by the krb5 library. AES+SHA1 is not provided as the RFCs don't contain usable test vectors. (2) Provide a Kerberos 5 crypto library. This is an extract from the sunrpc driver as that code can be shared between sunrpc/nfs and rxrpc/afs. This provides encryption, decryption, get MIC and verify MIC routines that use and wrap the crypto functions, along with some functions to provide layout management. This supports AES+SHA1, AES+SHA2 and Camellia encryption types. Self-testing is provided that goes further than is possible with testmgr, doing subkey derivation as well. The patches were previously posted here: https://lore.kernel.org/r/20250203142343.248839-1-dhowells@redhat.com/ as part of a larger series, but the networking guys would prefer these to go through the crypto tree. If you want them reposting independently, I can do that. David --- The following changes since commit 17ec3e71ba797cdb62164fea9532c81b60f47167: crypto: lib/Kconfig - Hide arch options from user (2025-03-02 15:21:47 +0800) are available in the Git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git tags/crypto-krb5-20250303 for you to fetch changes up to fc0cf10c04f49ddba1925b630467f49ea993569e: crypto/krb5: Implement crypto self-testing (2025-03-02 21:56:47 +0000) ---------------------------------------------------------------- crypto: Add Kerberos crypto lib ---------------------------------------------------------------- David Howells (17): crypto/krb5: Add API Documentation crypto/krb5: Add some constants out of sunrpc headers crypto: Add 'krb5enc' hash and cipher AEAD algorithm crypto/krb5: Test manager data crypto/krb5: Implement Kerberos crypto core crypto/krb5: Add an API to query the layout of the crypto section crypto/krb5: Add an API to alloc and prepare a crypto object crypto/krb5: Add an API to perform requests crypto/krb5: Provide infrastructure and key derivation crypto/krb5: Implement the Kerberos5 rfc3961 key derivation crypto/krb5: Provide RFC3961 setkey packaging functions crypto/krb5: Implement the Kerberos5 rfc3961 encrypt and decrypt functions crypto/krb5: Implement the Kerberos5 rfc3961 get_mic and verify_mic crypto/krb5: Implement the AES enctypes from rfc3962 crypto/krb5: Implement the AES enctypes from rfc8009 crypto/krb5: Implement the Camellia enctypes from rfc6803 crypto/krb5: Implement crypto self-testing Documentation/crypto/index.rst | 1 + Documentation/crypto/krb5.rst | 262 +++++++++++++ crypto/Kconfig | 13 + crypto/Makefile | 3 + crypto/krb5/Kconfig | 26 ++ crypto/krb5/Makefile | 18 + crypto/krb5/internal.h | 247 ++++++++++++ crypto/krb5/krb5_api.c | 452 ++++++++++++++++++++++ crypto/krb5/krb5_kdf.c | 145 +++++++ crypto/krb5/rfc3961_simplified.c | 797 +++++++++++++++++++++++++++++++++++++++ crypto/krb5/rfc3962_aes.c | 115 ++++++ crypto/krb5/rfc6803_camellia.c | 237 ++++++++++++ crypto/krb5/rfc8009_aes2.c | 362 ++++++++++++++++++ crypto/krb5/selftest.c | 544 ++++++++++++++++++++++++++ crypto/krb5/selftest_data.c | 291 ++++++++++++++ crypto/krb5enc.c | 504 +++++++++++++++++++++++++ crypto/testmgr.c | 16 + crypto/testmgr.h | 351 +++++++++++++++++ include/crypto/authenc.h | 2 + include/crypto/krb5.h | 160 ++++++++ 20 files changed, 4546 insertions(+) create mode 100644 Documentation/crypto/krb5.rst create mode 100644 crypto/krb5/Kconfig create mode 100644 crypto/krb5/Makefile create mode 100644 crypto/krb5/internal.h create mode 100644 crypto/krb5/krb5_api.c create mode 100644 crypto/krb5/krb5_kdf.c create mode 100644 crypto/krb5/rfc3961_simplified.c create mode 100644 crypto/krb5/rfc3962_aes.c create mode 100644 crypto/krb5/rfc6803_camellia.c create mode 100644 crypto/krb5/rfc8009_aes2.c create mode 100644 crypto/krb5/selftest.c create mode 100644 crypto/krb5/selftest_data.c create mode 100644 crypto/krb5enc.c create mode 100644 include/crypto/krb5.h