Re: [PATCH v2 3/4] crypto: ecdsa - Fix enc/dec size reported by KEYCTL_PKEY_QUERY

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Feb 09, 2025 at 05:58:07PM +0800, Herbert Xu wrote:
> On Sun, Feb 02, 2025 at 08:00:53PM +0100, Lukas Wunner wrote:
> > KEYCTL_PKEY_QUERY system calls for ecdsa keys return the key size as
> > max_enc_size and max_dec_size, even though such keys cannot be used for
> > encryption/decryption.  They're exclusively for signature generation or
> > verification.
> > 
> > Only rsa keys with pkcs1 encoding can also be used for encryption or
> > decryption.
> > 
> > Return 0 instead for ecdsa keys (as well as ecrdsa keys).
> 
> I think we should discuss who is using these user-space APIs
> before doing any more work on them.  The in-kernel asymmetric
> crypto code is not safe against side-channel attacks.  As there
> are no in-kernel users of private-key functionality, we should
> consider getting rid of private key support completely.
> 
> As it stands the only user is this user-space API.

Personally I am not using this user-space API, so I don't really
have a dog in this fight.  I just noticed the incorrect output
for KEYCTL_PKEY_QUERY and thought it might be better if it's fixed.

One user of this API is the Embedded Linux Library, which in turn
is used by Intel Wireless Daemon:

https://git.kernel.org/pub/scm/libs/ell/ell.git/tree/ell/key.c
https://git.kernel.org/pub/scm/network/wireless/iwd.git/tree/src/eap-tls.c

Basically IWD seems to be invoking the kernel's Key Retention Service for
EAP authentication.  It's still maintained and known to have active users,
so removing the user-space keyctl ABI would definitely cause breakage.

I've just checked for other reverse dependencies of the "libell0" package
on Debian, it lists "bluez" and "mptcpd" but looking at their source code
reveals they're not using the l_key_*() functions, so they would not be
affected by removal.

There's a keyring package for go, so I suppose there may be go applications
out there using it:

https://pkg.go.dev/pault.ag/go/keyring

Then there's the keyutils library...

https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/keyutils.git

...and listing the reverse dependencies for "libkeyutils1" on Debian
reveals a slew of packages which are using it:

  gdm3 samba-libs sssd-common python3-keyutils nfs-common ndctl
  mokutil kstart libkrb5-3 kafs-client ima-evm-utils ceph-common
  libecryptfs1 ecryptfs-utils cifs-utils

And "python3-keyutils" in turn has this reverse dependency:

  udiskie

Finally, folks at cloudflare praised the kernel's Key Retention Service
and encouraged everyone to use it... :)

https://blog.cloudflare.com/the-linux-kernel-key-retention-service-and-why-you-should-use-it-in-your-next-application/

In short, it doesn't seem trivial to drop this user-space API.

Thanks,

Lukas




[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]
  Powered by Linux