From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=165.173.180.16 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796194243; b=dJgavggM/CbCEITZCMx41JSvxCOg0B4wPA0ydRc0GN3+3n8kh/eAVUjBI1ynjrsWexCC jMZnWmYh6neVFJefxoWCU4keNmxdqR2EVhWlNHKoHZkYvRu9pPqWSi12JkNEXpsBZx6r5 wABFTP8/WJ2iwJPHIXeGjZRarTch6Su57Os9PvN38/c+8PT2WTs1NCI40CA8iAB74KqVL IuxJLS9DnKWmEOIOwTzqXY4FBsV5Rirm4XOQCPmg4rDxe8hN9PDEEkpAF4IuUYRQFkxCT +HKafWF8tYQXjyb6GQirEHQGsDekT9zuFK3l8oxyU6pxxIQJkPyG/H8LHEy8K/A4tsw== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796194243; h=DMARC-Filter:DKIM-Signature:Received:From:To:Cc:Subject:Date: Message-ID:X-Mailer:MIME-Version:Content-Transfer-Encoding: X-ZohoMailClient; bh=YKPs96VFVmZUU3/ShTmThEhMVRJA85kNmNpXeha8qek=; b=YsVT+cZP1Uu8OV2jQWlwERP5fVJq3ZMxTosJDyXCxqznae9Qd29k/vHDYJO7Od9dOlTz yushEOWIdG56gpYMKHhwGLtq+YmbdTgDOBdFabKZCiK6uAfDOKkLG+sPgqagHhXyNca4Y npa7SufNfeOrwXQGnKX+zK9sOWcY5DxuVny49wina3l1ZoCFeFuO94k5OdwhJpMqM5pIS woTugBevwp4Ti/TdDYM59xkcVE5tJ45r/6JaDBi/0GVq9ATBIjKUL8Y7jfroMBa+/N5Tv 2vamWBiu7sNSCVN+zaIxjEYkjrvjLKrofOmW1ipwg1w5FGqW3jBQM4M0RIcduKaGQHw== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=none header.from=laveeshbansal.com; spf=pass smtp.mailfrom=laveeshbansal.com; dkim=pass header.d=laveeshbansal.com header.i=@laveeshbansal.com header.a=rsa-sha256 header.s=zoho header.b=avyWlk2w; arc=pass header.oldest-pass=0 smtp.remote-ip=165.173.180.16 Received: from sender6-op-o16.zoho.com (sender6-op-o16.zoho.com [165.173.180.16]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 433B7606A323; Wed, 2 Dec 2026 06:50:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 433B7606A323 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=laveeshbansal.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=laveeshbansal.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=laveeshbansal.com header.i=@laveeshbansal.com header.a=rsa-sha256 header.s=zoho header.b=avyWlk2w ARC-Seal: i=1; a=rsa-sha256; t=1796194228; cv=none; d=zohomail.com; s=zohoarc; b=n+lPw+whvKbNUcX6hkKEeHel80y5I7dweph5R4rCzsKgE5BS0tkJJ/hItWw1DotoDZV5ht7y+5gzwqamUIDOjRSOQVDVp6ESp2vqtlUjQjmskE421byptS+8JAQnnB+ejY48pZ23I95sIM3k/s64INytAdUqudW5Rnu2+Ix2nx4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1796194228; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=YKPs96VFVmZUU3/ShTmThEhMVRJA85kNmNpXeha8qek=; b=FNSfp3jidC9iFS8qEBXGyxp4pvS+WzU/U/jrywPE5xx6cSZqV3dJymkVa+r/dVjxhUFcR6VQkHTxutjMpY3qcv4gb6caz6Gg+67tuWlYZambYtX4ATzeQa9nxsChZ5nLwJ3LdmQEkn4eY7edECIIyJixHlRmeTqS/ld4CGoTSQY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=laveeshbansal.com; spf=pass smtp.mailfrom=laveeshb@laveeshbansal.com; dmarc=pass header.from= DKIM-Signature: a=rsa-sha256; b=avyWlk2w77v1yKkw5UhZPIV0L6NwVBB6LnRQKIUzwW0aoKhqf9Zha4c/OFvKo8pkt+Cse1+MBybaU/GF8V2zsmtzK80RQXFOpiBIPEiKUGDh+A+/IeE3QL9e3dV9TEAFgtGxTDZJKOH6EB8bSAyEhxIf2nhN/2OtiBkN8VCZRbk=; c=relaxed/relaxed; s=zoho; d=laveeshbansal.com; v=1; bh=YKPs96VFVmZUU3/ShTmThEhMVRJA85kNmNpXeha8qek=; h=Content-Description:Content-ID:Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Resent-Sender:Resent-Cc:Resent-Date:Resent-To:Reply-To:Resent-Message-ID:Resent-From:Sender:Subject:To:Date:From:Message-Id:Reply-To:Subject:To:Cc; Received: by smtp.zohomail.com with SMTPS id 1796194225395733.4252420530917; Tue, 1 Dec 2026 22:50:25 -0800 (PST) From: Laveesh Bansal To: Eric Biggers Cc: Herbert Xu , "David S. Miller" , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 0/2] crypto: adiantum - Use the ChaCha library Date: Tue, 1 Dec 2026 22:50:20 -0800 Message-ID: <20261202065022.46893-1-laveeshb@laveeshbansal.com> X-Mailer: git-send-email 2.54.0 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-ZohoMailClient: External This series makes adiantum call the ChaCha library directly instead of going through a crypto_skcipher child. This came out of a conversation on another patch: https://lore.kernel.org/all/20261127184407.GB1974@quark/ v1: https://lore.kernel.org/all/20261130055539.8278-1-laveeshb@laveeshbansal.com/ v2: https://lore.kernel.org/all/20261201043945.50022-1-laveeshb@laveeshbansal.com/ v3: https://lore.kernel.org/all/20261201080825.56171-1-laveeshb@laveeshbansal.com/ I used an LLM for research, the first draft, review and tests. I did the final code changes and reviews myself. Changes in v4: I addressed feedback on v3. https://lore.kernel.org/all/20261202022124.GB2427638@google.com/ https://lore.kernel.org/all/20261202023013.GC2427638@google.com/ Patch 1: - Replaced the 145-byte test vectors with 175-byte ones. - Sorted the vectors by length. Patch 2: - Added . - Updated adiantum_xchacha_init() to take only the 24-byte nonce and start at stream position 0. - Removed 'keylen' from adiantum_setkey(). - Added __aligned(sizeof(long)) to the bounce buffer in adiantum_stream_xor(). - Moved the stream_len calculation under 'if (bulk_len)'. - Declared 'state' inside the 'if (bulk_len)' block. - Used the 'nrounds' argument directly in adiantum_setkey(). Changes in v3: I addressed feedback on v2. https://lore.kernel.org/all/20261201051752.GB7060@sol/ - Dropped select CRYPTO_MANAGER and sorted the selects in Kconfig. - Made 'iv' in adiantum_setkey() static const. - Moved the stream cipher step under 'if (bulk_len)'; also used the src and dst local variables there. - Set .base.cra_reqsize in the skcipher_alg instead of calling crypto_skcipher_set_reqsize() and moved setting tctx->nrounds into adiantum_setkey(). - Wrote the two skcipher_alg structs instead of using a macro. Changes in v2: I addressed feedback on v1. https://lore.kernel.org/all/20261130194303.GB16775@google.com/ https://lore.kernel.org/all/20261130194012.GA16775@google.com/ - Merged patches 2 and 3. - Updated adiantum to not be a template. It registers two skcipher algorithms -- adiantum(xchacha12,aes) and adiantum(xchacha20,aes). - In-place requests under CONFIG_HIGHMEM map the memory only once. - 'buf' is zeroized. - Based on the current cryptodev master because the base in v1 -- commit 9fb9278d13dca -- is no longer in it. Laveesh Bansal (2): crypto: testmgr - Add Adiantum vectors with a partial last ChaCha block crypto: adiantum - Use the ChaCha library crypto/Kconfig | 4 +- crypto/adiantum.c | 415 +++++++++++++---------------- crypto/testmgr.h | 656 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 836 insertions(+), 239 deletions(-) This series applies on top of the following: - setkey: https://lore.kernel.org/all/20261125013553.94480-1-ebiggers@kernel.org/ - aeslib: https://lore.kernel.org/all/20261125032407.126634-1-ebiggers@kernel.org/ base-commit: e1ec0b1e859b0f2261d64b3db95991c2da627af4 prerequisite-patch-id: 5268ec1436ad909487f950765a39a0cc6eac0c6a prerequisite-patch-id: 0edefdce5d51065803ab84e3492634dcb9e0e53e -- 2.43.0