Eric Biggers <[email protected]> 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 placed 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 signing, 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 everything else, so crypto_sig will remain the API. Otherwise I have to basically reimplement crypto_sig inside crypto/asymmetric_keys/, including the on-demand algorithm loading. David
