crypto: mcryptd - Check mcryptd algorithm compatibility
authortim <tim.c.chen@linux.intel.com>
Mon, 5 Dec 2016 19:46:31 +0000 (11:46 -0800)
committerMateusz Majewski <m.majewski2@samsung.com>
Tue, 28 May 2024 08:28:21 +0000 (10:28 +0200)
commit242593efad04ba50654ebdb475a0e2bc1cfda2d9
treeb611f79d557c0ec36f534a9f884212874c22c3ab
parent1a75c1659a9af2396f41450a327037ad61a67f63
crypto: mcryptd - Check mcryptd algorithm compatibility

Algorithms not compatible with mcryptd could be spawned by mcryptd
with a direct crypto_alloc_tfm invocation using a "mcryptd(alg)" name
construct.  This causes mcryptd to crash the kernel if an arbitrary
"alg" is incompatible and not intended to be used with mcryptd.  It is
an issue if AF_ALG tries to spawn mcryptd(alg) to expose it externally.
But such algorithms must be used internally and not be exposed.

We added a check to enforce that only internal algorithms are allowed
with mcryptd at the time mcryptd is spawning an algorithm.

Link: http://marc.info/?l=linux-crypto-vger&m=148063683310477&w=2
Cc: stable@vger.kernel.org
Reported-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/mcryptd.c