Skip to contentSkip to conversation

aead: driver side documentation

DISCUSSION Phil Sutter 3 participants 7 messages Apr 4, 2011 – Apr 15, 2011 Crypto API

lore
Share & tools
lore
#0 lore raw

Dear list,

I would like to enhance drivers/crypto/mv_cesa.c by an AEAD algorithm (at least authenc(hmac(sha1),cbc(aes))), since the driver is able to do both operations in one go.

Unfortunately, I have found little information about this task in Documentation/ or the web. Am I missing something? It would be really great if you could point me to the right direction here.

Greetings, Phil

#1 lore raw
Quoted 7 lines · On Mon, 4 Apr 2011 19:03:37 +0200 Phil Sutter <[email protected]> wrote:

I would like to enhance drivers/crypto/mv_cesa.c by an AEAD algorithm (at least authenc(hmac(sha1),cbc(aes))), since the driver is able to do both operations in one go.

Unfortunately, I have found little information about this task in Documentation/ or the web. Am I missing something? It would be really great if you could point me to the right direction here.

use existing drivers for guidance. The following drivers implement those types of algorithms:

drivers/crypto/caam/caamalg.c*
drivers/crypto/ixp4xx_crypto.c
drivers/crypto/picoxcell_crypto.c
drivers/crypto/talitos.c

Kim

* only available in Herbert's cryptodev-2.6 tree

#2 lore raw

Hi,

Quoted 7 lines · Kim Phillips
Quoted 4 lines · On Mon, 4 Apr 2011 19:03:37 +0200 Phil Sutter <[email protected]> wrote:

I would like to enhance drivers/crypto/mv_cesa.c by an AEAD algorithm (at least authenc(hmac(sha1),cbc(aes))), since the driver is able to do both operations in one go.

Quoted 6 lines
Quoted 3 lines

Unfortunately, I have found little information about this task in Documentation/ or the web. Am I missing something? It would be really great if you could point me to the right direction here.

use existing drivers for guidance. The following drivers implement those types of algorithms:

Thanks for the hint, although I've already found the "sample code". ;) Was rather looking for something telling me what is crucial and what options there are. Concrete code tends to just show the solution of a specific problem. (My five cents to the question why code is often, but seldomly good documentation.)

Grepping reveals IPSec (i.e., esp{4,6}.c) as the only user of AEAD so far. Is this correct?

Greetings, Phil

#3 lore raw
Quoted 17 lines · On Tue, 5 Apr 2011 15:04:35 +0200 Phil Sutter <[email protected]> wrote:

Hi,

Quoted 7 lines · Kim Phillips
Quoted 4 lines · On Mon, 4 Apr 2011 19:03:37 +0200 Phil Sutter <[email protected]> wrote:

I would like to enhance drivers/crypto/mv_cesa.c by an AEAD algorithm (at least authenc(hmac(sha1),cbc(aes))), since the driver is able to do both operations in one go.

Quoted 6 lines
Quoted 3 lines

Unfortunately, I have found little information about this task in Documentation/ or the web. Am I missing something? It would be really great if you could point me to the right direction here.

use existing drivers for guidance. The following drivers implement those types of algorithms:

Quoted 8 lines

Thanks for the hint, although I've already found the "sample code". ;) Was rather looking for something telling me what is crucial and what options there are. Concrete code tends to just show the solution of a specific problem. (My five cents to the question why code is often, but seldomly good documentation.)

Grepping reveals IPSec (i.e., esp{4,6}.c) as the only user of AEAD so far. Is this correct?

yep.

I started to add test vectors from [1] to crypto/testmgr.c, but it required that drivers not assume associated data, iv, and cipher data were contiguous in memory, and since some of them do, I don't know if such a contribution would be acceptable upstream.

then there's the rtnetlink dependencies I mention in [2] that also make drivers fail AEAD testmgr tests in their setkey() implementations, IIRC, because testmgr keys aren't RTA_OK.

Kim

[1] http://grouper.ieee.org/groups/1619/email/msg01966.html
[2] http://www.mail-archive.com/[email protected]/msg05533.html

maintainer
#4 lore raw
Quoted 5 lines · Kim Phillips

I started to add test vectors from [1] to crypto/testmgr.c, but it required that drivers not assume associated data, iv, and cipher data were contiguous in memory, and since some of them do, I don't know if such a contribution would be acceptable upstream.

Such drivers are broken and should be fixed.

Quoted 3 lines

then there's the rtnetlink dependencies I mention in [2] that also make drivers fail AEAD testmgr tests in their setkey() implementations, IIRC, because testmgr keys aren't RTA_OK.

Can you elaborate on this problem?

Thanks,

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
#5 lore raw
Quoted 8 lines · On Fri, 8 Apr 2011 08:55:33 +0800 Herbert Xu <[email protected]>…
Quoted 5 lines · Kim Phillips

I started to add test vectors from [1] to crypto/testmgr.c, but it required that drivers not assume associated data, iv, and cipher data were contiguous in memory, and since some of them do, I don't know if such a contribution would be acceptable upstream.

Such drivers are broken and should be fixed.

ok.

Quoted 5 lines
Quoted 3 lines

then there's the rtnetlink dependencies I mention in [2] that also make drivers fail AEAD testmgr tests in their setkey() implementations, IIRC, because testmgr keys aren't RTA_OK.

Can you elaborate on this problem?

the following conditions in a driver setkey fail:

        if (!RTA_OK(rta, keylen))
                goto badkey;

        if (rta->rta_type != CRYPTO_AUTHENC_KEYA_PARAM)
                goto badkey;

because testmgr keys are plain strings, not rtattr structs.

Kim

maintainer
#6 lore raw
Quoted 9 lines · Kim Phillips

the following conditions in a driver setkey fail:

        if (!RTA_OK(rta, keylen))
                goto badkey;

        if (rta->rta_type != CRYPTO_AUTHENC_KEYA_PARAM)
                goto badkey;

because testmgr keys are plain strings, not rtattr structs.

There is no reason why an authenc test vector can't use an rtattr. The key value is a char *, so you can point it to a struct quite easily.

Cheers,

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