All of lore.kernel.org
 help / color / mirror / Atom feed
* Problems with cbc(aes) and do_alg0test()
@ 2016-08-23 22:44 Michael McKay
  2016-08-25  0:45 ` Stephan Mueller
  0 siblings, 1 reply; 2+ messages in thread
From: Michael McKay @ 2016-08-23 22:44 UTC (permalink / raw)
  To: linux-crypto

We are writing a device driver with kernel v3.14, and trying to encrypt some data using the Linux kernel algorithm “cbc(aes)”. Our /proc/crypto shows the following is loaded: driver “cbc-aes-aesni”, module “aesni_intel”, and type “ablkcipher”. But crypto_has_alg() gives us an error indicating the algo is not loaded. So knowing we have the algo string correct, most likely the problem is with the two other input variables: mask or type.
 
Since AESNI is in use, we have a decent guess at the types by looking at the .cra_flags field in aensi-Intel_glue.c (which has “CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC”). That leaves just a few mask fields to guess at, but CRYPTO_ALG_TYPE_BLKCIPHER_MASK and CRYPTO_ALG_TYPE_MASK don’t work (not does OR’ing them together). 

What are the correct mask and type values for AESNI, and can you point me to any documentation? What else might we be doing wrong? Is /proc/crypto giving us relevant information? Thanks,

Michael McKay
mmckay@vmware.com



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

* Re: Problems with cbc(aes) and do_alg0test()
  2016-08-23 22:44 Problems with cbc(aes) and do_alg0test() Michael McKay
@ 2016-08-25  0:45 ` Stephan Mueller
  0 siblings, 0 replies; 2+ messages in thread
From: Stephan Mueller @ 2016-08-25  0:45 UTC (permalink / raw)
  To: Michael McKay; +Cc: linux-crypto

Am Dienstag, 23. August 2016, 22:44:39 CEST schrieb Michael McKay:

Hi Michael,

> We are writing a device driver with kernel v3.14, and trying to encrypt some
> data using the Linux kernel algorithm “cbc(aes)”. Our /proc/crypto shows
> the following is loaded: driver “cbc-aes-aesni”, module “aesni_intel”, and
> type “ablkcipher”. But crypto_has_alg() gives us an error indicating the
> algo is not loaded. So knowing we have the algo string correct, most likely
> the problem is with the two other input variables: mask or type.
 
> Since AESNI is in use, we have a decent guess at the types by looking at the
> .cra_flags field in aensi-Intel_glue.c (which has
> “CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC”). That leaves just a few
> mask fields to guess at, but CRYPTO_ALG_TYPE_BLKCIPHER_MASK and
> CRYPTO_ALG_TYPE_MASK don’t work (not does OR’ing them together). 
 
> What are the correct mask and type values for AESNI, and can you point me to
> any documentation? What else might we be doing wrong? Is /proc/crypto
> giving us relevant information? Thanks,

You can only use the cbc-aes-aesni code with the ablkcipher API. Using it with 
the blkcipher API will not work.

So, a simple crypto_alloc_ablkcipher("cbc-aes-aesni", 0, 0) should work. If 
not, what is the return code?

Ciao
Stephan

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

end of thread, other threads:[~2016-08-25  6:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-23 22:44 Problems with cbc(aes) and do_alg0test() Michael McKay
2016-08-25  0:45 ` 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.