2022-01-11 08:04:20

by Stephan Müller

[permalink] [raw]
Subject: CRYPTO_NOLOAD

Hi Herbert,

I am experimenting with additional flags like CRYPTO_NOLOAD. When I allocate
an skcipher with this flag (crypto_alloc_skcipher("name", 0, CRYPTO_NOLOAD)),
a loading of new modules is performed, in particular for subordinated algos
(e.g. I try to load ctr(aes) which then in turn tries to resolve the AESNI
implementation which in turn loads the cryptd() implementation).

The reason for this is function crypto_find_alg which clears out all flags
that are not in maskset or maskclear.

For skcipher, this is defined as

.maskclear = ~CRYPTO_ALG_TYPE_MASK,
.maskset = CRYPTO_ALG_TYPE_MASK,

Thus, the CRYPTO_NOLOAD flag is removed. How would I be able to allocate an
algorithm without attempting to load modules?

Or phrasing the question differently: is there an issue to add CRYPTO_NOLOAD
to the .maskclear and .maskset definitions, which would allocate the
subordinate algos also with the NOLOAD flag?

Thanks a lot
Stephan