From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 99073C79FB7 for ; Mon, 5 Jan 2026 19:05:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Subject:Cc:To: From:Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=l+T85xG7RFn5rLmFPcEnHN9rx8p/ELEmXn/p/BMRsk4=; b=oUaRxfSsalIfL0kbKHHhwP3HDQ 5LO7/sbKlsHBkBd2GdKXE8no6URwBX92qAHXOq8w81TVr3ZL4nivJ7UlS71QhJFwrqSO8PJ8sbOOC 0W7vaZIixSanmwNFGL74jSSeuCw7Dk3pD9hgtmJKhuP9mCnbZrG44/W0EF397vSnftu8tT/Dn738G zXFpz2f9MOXxGRiAZu39P9q/UQkJBH9P1NALvpKwP39FoYr+MVodesoPWjHKuJ7bd03qmgT77dLwq rUHPlsx06OKZAVNr3DkcSQT270q1O3SLUWLfRpzFErjWNbTvMgLt5/O9KnKVeNX0wbmYUKtjeVhDA xSaCOcTg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1vcptB-0000000Bx4w-1ZAS; Mon, 05 Jan 2026 19:05:13 +0000 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1vcpt5-0000000Bx47-3bDv for linux-arm-kernel@lists.infradead.org; Mon, 05 Jan 2026 19:05:11 +0000 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-4775895d69cso1431055e9.0 for ; Mon, 05 Jan 2026 11:05:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1767639906; x=1768244706; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=l+T85xG7RFn5rLmFPcEnHN9rx8p/ELEmXn/p/BMRsk4=; b=cf82Qq/iLJzlOFNCojcZ1HQ8f70Ag3LGC5bXN22WjDRIwj9cS+0jC8yJ0FGStdWZnf RTmkCtlNheqMz8xfawzOnBSRcNFxYmnyg10KLIobwYodBnUAyMheOUhqNJq5XCdJC5c/ IkAYdeJNbyJV82+8ziZDhDAzRmlUBG0/RHwMTasNrt2+RWcg1SFgSZhBDv/s2zvQpWQq n5RonQD0zB+V+kJlaC7p6nck6grv4YvQdmxYbRju47nDuRbjeeBT3Tr0YxLbcdLoVjlD s3xPjtkJy7QERDBc2Kd8gD69M19LjVVof4FS/iBGbA++dUswG7kKrIJ00E3fEx1Pz0Ns dRvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767639906; x=1768244706; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=l+T85xG7RFn5rLmFPcEnHN9rx8p/ELEmXn/p/BMRsk4=; b=rMLcsJ6NVqw0UIy5j3Ez3gR7bayJf70zl9PI4cX7d1MkkcyUuW0fROrkYy3wReG1ZA 1G8Hkfvf2+gmHMo9GkAJA+6qPo+uKppgN90sNG4wUpTFPvSD7ae16vkbP7mJ6U2g4pYQ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ESg== X-Received: by 2002:a05:600c:4f93:b0:46e:53cb:9e7f with SMTP id 5b1f17b1804b1-47d7f0929c2mr4085365e9.18.1767639905594; Mon, 05 Jan 2026 11:05:05 -0800 (PST) Received: from pumpkin (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-47d7f41eb3bsm2991115e9.7.2026.01.05.11.05.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jan 2026 11:05:05 -0800 (PST) Date: Mon, 5 Jan 2026 19:05:03 +0000 From: David Laight To: Andrew Cooper Cc: ebiggers@kernel.org, Jason@zx2c4.com, ardb@kernel.org, dengler@linux.ibm.com, freude@linux.ibm.com, herbert@gondor.apana.org.au, linux-arm-kernel@lists.infradead.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, sparclinux@vger.kernel.org, x86@kernel.org Subject: Re: [PATCH 19/36] Bluetooth: SMP: Use new AES library API Message-ID: <20260105190503.53cc31dd@pumpkin> In-Reply-To: <859377de-cb72-4e87-8ee5-97f8c58a5720@citrix.com> References: <20260105051311.1607207-20-ebiggers@kernel.org> <859377de-cb72-4e87-8ee5-97f8c58a5720@citrix.com> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; arm-unknown-linux-gnueabihf) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260105_110507_914746_D09C4209 X-CRM114-Status: GOOD ( 12.07 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, 5 Jan 2026 15:40:22 +0000 Andrew Cooper wrote: > > /* Most significant octet of plaintextData corresponds to data[0] */ > > swap_buf(r, data, 16); > > =20 > > - aes_encrypt(&ctx, data, data); + aes_encrypt_new(&aes, data, data); = =20 >=20 > One thing you might want to consider, which reduces the churn in the seri= es. >=20 > You can use _Generic() to do type-based dispatch on the first pointer.=C2= =A0 > Something like this: >=20 > void aes_encrypt(const struct crypto_aes_ctx *ctx, u8 *out, const u8 *in); > void aes_encrypt_new(aes_encrypt_arg key, u8 out[at_least AES_BLOCK_SIZE], > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = const u8 in[at_least AES_BLOCK_SIZE]); >=20 > #define aes_encrypt(ctx, out, in)=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 \ > =C2=A0=C2=A0=C2=A0 _Generic(ctx,=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 \ > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = const struct crypto_aes_ctx *: aes_encrypt(ctx, out, in),=C2=A0 \ > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = aes_encrypt_arg: aes_encrypt_new(ctx, out, in)) >=20 >=20 > i.e. it keeps the _new()-ism in a single header, without needing to > change the drivers a second time. You'll need to cast the 'ctx' argument in both calls. All the code in an _Generic() must compile cleanly in all the cases. (Totally annoying....) David >=20 > ~Andrew >=20