All of lore.kernel.org
 help / color / mirror / Atom feed
* Intel GCM: __driver-gcm-aes-aesni setkey missing
@ 2015-01-17 18:23 Stephan Mueller
  2015-01-18  1:37 ` Tadeusz Struk
  0 siblings, 1 reply; 3+ messages in thread
From: Stephan Mueller @ 2015-01-17 18:23 UTC (permalink / raw)
  To: tadeusz.struk, aidan.o.mahony, gabriele.paoloni, adrian.hoban
  Cc: linux-crypto, herbert, 'LKML'

Hi Gabriele, Adrian, Tadeusz, Aidan,

during testing of my algif_aead patch with the different GCM implementations I 
am able to trigger a kernel crash from user space using __driver-gcm-aes-
aesni.

As I hope that algif_aead is going to be included, unprivileged userspace 
would then reliably crash the kernel -- with the current kernel code, 
userspace has no interface to trigger the issue.

Looking into the kernel code I think I see where the issue is. The crash 
happens when setkey is invoked. The kernel crypto API defines setkey as the 
following:

static inline int crypto_aead_setkey(struct crypto_aead *tfm, const u8 *key,
                                     unsigned int keylen)
{
        struct aead_tfm *crt = crypto_aead_crt(tfm);

        return crt->setkey(crt->base, key, keylen);
}

This means that the kernel crypto API expects that ciphers always implement a 
setkey callback.

However, __driver-gcm-aes-aesni does not implement a setkey:

                .aead = {
                        .encrypt        = __driver_rfc4106_encrypt,
                        .decrypt        = __driver_rfc4106_decrypt,
                },

As I am not sure what the purpose of __driver-gcm-aes-aesni is (only a backend 
for RFC4106 GCM or a regular cipher), I did not yet create a patch. IMHO there 
are two solutions:

- either create a valid setkey callback so that a key is set

- or create a noop setkey that returns -EOPNOTSUPP which effectively disables 
that cipher for regular consumption.

Note, if it is only a backend for the RFC4106 implementation, may I ask why 
__driver-gcm-aes-aesni is implemented as a separate cipher that is registered 
with the kernel crypto API?

-- 
Ciao
Stephan

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-01-18 18:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-17 18:23 Intel GCM: __driver-gcm-aes-aesni setkey missing Stephan Mueller
2015-01-18  1:37 ` Tadeusz Struk
2015-01-18 18:15   ` Stephan Mueller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.