From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.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 02D35303C8F for ; Fri, 7 Nov 2025 10:34:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762511661; cv=none; b=GWISlEwyNeS1Jgs2YxXu1AGsbbhSmpogohNP/YgAqHil0YOiv6/qN06IqYlhUb8ETpoIJ67BYo6H6WmHguoHLCfmrijbPwu2eO2hbhiudsK/ffdFAXaENHkpFw79of1dBhobGinBPtYxOZyHyTdtYLKKg+arNSbL//dpGVkKb4E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762511661; c=relaxed/simple; bh=cOCGVKmVEovJesU3WW8kK1oX09gBBIpX3J0LJkfvNN8=; h=From:In-Reply-To:References:To:Cc:Subject:MIME-Version: Content-Type:Date:Message-ID; b=slkhFrDs1RsYgg7ZYL8VPfs4kAvC8pNZHTIZEBUOWUDfe2akPhshBQOZ+xObm6cokWSDfaYR0U1hyIympzpuhMmzjpPyq8qFubdgz6xgXRxopJUpI7Ck6Qr541ZkUndayDY5OZqVYL+qra/5f0yd42hmqQmbefsU3K1jKlNaPmw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine 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=b2h8pSgL; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine 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="b2h8pSgL" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1762511658; 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: in-reply-to:in-reply-to:references:references; bh=mRnffMyHiAhteHPeQJ+/psTcXTA9GHmSEDbZPxSCiXA=; b=b2h8pSgLbJZUcAiQlD4pqOb12uqBpe9zoyH9EvyW9VaJGgC974SjPriVZwSCIJcQVfu5Zn vSHqC/+homiJXyQYju1uyoRJvbOIsPZep8bmjV20mD3IdI14//y+gQjfQkp1FqvfaFq3Cw jQDzK623Prtb+5nCWuez5FHW8ovS3dw= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-633-kFb5TB9lMOqKe88aYlyBOA-1; Fri, 07 Nov 2025 05:34:17 -0500 X-MC-Unique: kFb5TB9lMOqKe88aYlyBOA-1 X-Mimecast-MFC-AGG-ID: kFb5TB9lMOqKe88aYlyBOA_1762511655 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 24E7E1956063; Fri, 7 Nov 2025 10:34:15 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.6]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 9EC2B1945110; Fri, 7 Nov 2025 10:34:10 +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: <20251106192016.GA3318@quark> References: <20251106192016.GA3318@quark> <20251106174456.31818-1-dhowells@redhat.com> <20251106174456.31818-3-dhowells@redhat.com> To: Eric Biggers Cc: dhowells@redhat.com, Herbert Xu , Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , "Jason A . Donenfeld" , Ard Biesheuvel , Stephan Mueller , Lukas Wunner , Ignat Korchagin , linux-crypto@vger.kernel.org, keyrings@vger.kernel.org, linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v7 2/8] crypto: Add ML-DSA/Dilithium verify support Precedence: bulk X-Mailing-List: linux-modules@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <62629.1762511649.1@warthog.procyon.org.uk> Content-Transfer-Encoding: quoted-printable Date: Fri, 07 Nov 2025 10:34:09 +0000 Message-ID: <62630.1762511649@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 Eric Biggers wrote: > On Thu, Nov 06, 2025 at 05:44:46PM +0000, David Howells wrote: > > The interface to this code is through the crypto_sig API as the PKCS#7= code > > wants to use that rather than calling it directly. As such, I've plac= ed it > > in crypto/ rather than lib/crypto/. Only the verification hooks are > > implemented; the signing hooks return an error. > = > As I mentioned before > (https://lore.kernel.org/linux-crypto/20250613170456.GA1284@sol/), this > code should go in lib/crypto/. There seems to be a clean API in > crypto/ml_dsa/dilithium.h already. Just make that the library API. Fine. Is it ever likely to be used directly, I wonder? There is a downside of moving stuff to lib/crypto/: dynamically loadable algorithms now need two modules instead of one. For initial module signin= g, granted, the algorithms for that must be built in. > If "crypto_sig" support is really needed too, then put that in > crypto/ml-dsa.c, built on top of the library API. It's not clear the > crypto_sig support is very useful, though. For one, you had to add > ML-DSA specific logic to the calling code anyway (see "pkcs7: Allow the > signing algo to calculate the digest itself"). The actual signature check still goes through the same code path as everyt= hing else, so crypto_sig will remain the API. Otherwise I have to basically reimplement crypto_sig inside crypto/asymmetric_keys/, including the on-de= mand algorithm loading. David