2009-05-12 09:21:44

by Sergey Mironov

[permalink] [raw]
Subject: understanding concept, async block ciphers

Hello. I'm developing driver for our crypto platform-device on
arm-realview arch. Could you please help with understanding some
CryptoAPI concepts?

Our device is hw implementation of 3DES/AES cipher. it allows:
- encrypt/decrypt 64-bit words (slave mode, data exchange via
registers, CBC/ECB controlled by driver)
- encrypt/decrypt blocks of data (master mode, data exchange via DMA
transfers, CBC/ECB controlled by device)

I've implemented CRYPTO_ALG_TYPE_CIPHER driver for "slave" mode (just
as i in geode-aes driver). CBC and ECB templates are working fine. But
for "master" mode i have a questions:

1. Whats the difference between async crypto_alg's with
.cra_type = CRYPTO_ALG_TYPE_BLKCIPHER | CRYPTO_ALG_ASYNC
and
.cra_type = CRYPTO_ALG_TYPE_ABLKCIPHER

Seems, that both are async. What is typical use-cases for them?

2. What are the rules for naming my alorithms?
I looked in code, and think, that name is constructed like
template_name1 ( template_name2 ( ... ( algorithm_name ) ... )

For example (as i saw in tcrypt.c), if my crypto_alg has
.cra_flags = CRYPTO_ALG_TYPE_CIPHER ,
.cra_name = "des3_ede"
then it is possible to alloc CRYPTO_ALG_TYPE_BLKCIPHER request by
names "cbc(des3_ede)" or "ecb(des3_ede)" and
CRYPTO_ALG_TYPE_BLKCIPHER | CRYPTO_ALG_ASYNC request with
"cryptd(cbc(des3_ede)))" ? Am i right ?

Thanks.

--
Sergey


2009-05-17 01:38:15

by Herbert Xu

[permalink] [raw]
Subject: Re: understanding concept, async block ciphers

Сергей Миронов <[email protected]> wrote:
>
> 1. Whats the difference between async crypto_alg's with
> .cra_type = CRYPTO_ALG_TYPE_BLKCIPHER | CRYPTO_ALG_ASYNC
> and
> .cra_type = CRYPTO_ALG_TYPE_ABLKCIPHER
>
> Seems, that both are async. What is typical use-cases for them?

No, only the latter is async.

> 2. What are the rules for naming my alorithms?
> I looked in code, and think, that name is constructed like
> template_name1 ( template_name2 ( ... ( algorithm_name ) ... )
>
> For example (as i saw in tcrypt.c), if my crypto_alg has
> .cra_flags = CRYPTO_ALG_TYPE_CIPHER ,
> .cra_name = "des3_ede"
> then it is possible to alloc CRYPTO_ALG_TYPE_BLKCIPHER request by
> names "cbc(des3_ede)" or "ecb(des3_ede)" and
> CRYPTO_ALG_TYPE_BLKCIPHER | CRYPTO_ALG_ASYNC request with
> "cryptd(cbc(des3_ede)))" ? Am i right ?

Yes, that's the correct algorithm name. Each implementation
has two names, the algorithm and an implementation-specific
driver name. The driver name is the unique identifier for that
implementation and/or device.

Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt