Skip to contentSkip to conversation

module ref count

DISCUSSION Stephan Mueller 2 participants 4 messages Apr 21, 2015 – Apr 22, 2015 Crypto API

lore
Share & tools
lore
#0 lore raw

Hi Herbert,

I am currently working on the template for SP800-38F key wrapping. The module is operational and calculates what I want.

However, I have one problem I am having difficulties to track down and I am wondering whether you could point me to the right direction.

When a caller calls

	crypto_alloc_aead("kw(aes)", 0, 0);

somehow the refcount of the kernel module implementing the keywrapping is not increased. Once can see that in lsmod where the "Used by" value remains 0.

Then when the caller deallocates the cipher handle, the refcount is -1 according to lsmod. With that, a second invocation of crypto_alloc_aead will fail and I even cannot remove the module from the kernel.

Who increases the refcount on the kernel crypto API side?

Thanks a lot

Signature · 2 lines
Ciao
Stephan
#1 lore raw

Am Dienstag, 21. April 2015, 14:35:47 schrieb Stephan Mueller:

Hi Stephan,

Quoted 16 lines

Hi Herbert,

I am currently working on the template for SP800-38F key wrapping. The module is operational and calculates what I want.

However, I have one problem I am having difficulties to track down and I am wondering whether you could point me to the right direction.

When a caller calls

	crypto_alloc_aead("kw(aes)", 0, 0);

somehow the refcount of the kernel module implementing the keywrapping is not increased. Once can see that in lsmod where the "Used by" value remains 0.

Quoted 5 lines

Then when the caller deallocates the cipher handle, the refcount is -1 according to lsmod. With that, a second invocation of crypto_alloc_aead will fail and I even cannot remove the module from the kernel.

Who increases the refcount on the kernel crypto API side?

I think I hit an even bigger problem: while playing with other AEAD ciphers, I see the same thing now:

$ lsmod 
Module                  Size  Used by
ansi_cprng             12989  0 
drbg                   30255  0 
algif_rng              12753  0 
seqiv                  13003  -1 
ccm                    17731  -1 
gcm                    23371  -1

Allocation of these ciphers fail.

Quoted 2 lines

Thanks a lot

Signature · 2 lines
Ciao
Stephan
#2 lore raw

Am Dienstag, 21. April 2015, 14:56:31 schrieb Stephan Mueller:

Hi Stephan,

Quoted 40 lines

Am Dienstag, 21. April 2015, 14:35:47 schrieb Stephan Mueller:

Hi Stephan,

Quoted 18 lines

Hi Herbert,

I am currently working on the template for SP800-38F key wrapping. The module is operational and calculates what I want.

However, I have one problem I am having difficulties to track down and I am
wondering whether you could point me to the right direction.

When a caller calls

	crypto_alloc_aead("kw(aes)", 0, 0);

somehow the refcount of the kernel module implementing the keywrapping is not increased. Once can see that in lsmod where the "Used by" value remains
0.

Quoted 5 lines

Then when the caller deallocates the cipher handle, the refcount is -1 according to lsmod. With that, a second invocation of crypto_alloc_aead will fail and I even cannot remove the module from the kernel.

Who increases the refcount on the kernel crypto API side?

I think I hit an even bigger problem: while playing with other AEAD ciphers, I see the same thing now:

$ lsmod
Module                  Size  Used by
ansi_cprng             12989  0
drbg                   30255  0
algif_rng              12753  0
seqiv                  13003  -1
ccm                    17731  -1
gcm                    23371  -1
Quoted 1 line

Allocation of these ciphers fail.

After updating to the current cryptodev-2.6 tree from today, this issue vanished.

Sorry for the noise, please disregard the thread.

Quoted 2 lines
Quoted 2 lines

Thanks a lot

Signature · 2 lines
Ciao
Stephan
maintainer
#3 lore raw
Quoted 3 lines · Stephan Mueller

After updating to the current cryptodev-2.6 tree from today, this issue vanished.

I think you missed the thread where Linus's machine broke :)

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt