Skip to contentSkip to conversation

Async Crypto API

DISCUSSION Dmitry Kasatkin 2 participants 9 messages Jan 22, 2010 – Feb 9, 2010 Crypto API

lore
Share & tools
lore
#0 lore raw

Hello,

I have one question about async api.

I work on AHASH driver and wonder about one thing.

while calculating hash, client might call many times

ahash_request_set_crypt(req, &sg, sha1, len);
crypto_ahash_update(req);
..
..
ahash_request_set_crypt(req, &sg, sha1, len);
crypto_ahash_finup(req);

right?

But because it is async and driver does not wait_for_completion,
previous request may not be completed before client will call next update.

But what should be the behavior of the driver?

Thanks,
Dmitry

maintainer
#1 lore raw
Quoted 15 lines · Dmitry Kasatkin

Hello,

I have one question about async api.

I work on AHASH driver and wonder about one thing.

while calculating hash, client might call many times

ahash_request_set_crypt(req, &sg, sha1, len);
crypto_ahash_update(req);
..
..
ahash_request_set_crypt(req, &sg, sha1, len);
crypto_ahash_finup(req);

Quoted 6 lines

right?

But because it is async and driver does not wait_for_completion, previous request may not be completed before client will call next update.

But what should be the behavior of the driver?

If any async operation returns EINPROGRESS, the client must not proceed until that operation has completed.

Cheers,

Signature · 4 lines
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
#2 lore raw

Hi,

1 more question.

Quoted 1 line

From what context "crypto_completion_t" can be called?

irq/tasklet/process
or something else?

Thanks,
Dmitry

Quoted 30 lines · ext Herbert Xu
Quoted 15 lines · Dmitry Kasatkin

Hello,

I have one question about async api.

I work on AHASH driver and wonder about one thing.

while calculating hash, client might call many times

ahash_request_set_crypt(req, &sg, sha1, len);
crypto_ahash_update(req);
..
..
ahash_request_set_crypt(req, &sg, sha1, len);
crypto_ahash_finup(req);

Quoted 7 lines

right?

But because it is async and driver does not wait_for_completion, previous request may not be completed before client will call next update.

But what should be the behavior of the driver?

If any async operation returns EINPROGRESS, the client must not proceed until that operation has completed.

Cheers,

maintainer
#3 lore raw
Quoted 7 lines · Dmitry Kasatkin

Hi,

1 more question.

Quoted 1 line

From what context "crypto_completion_t" can be called?

irq/tasklet/process
or something else?

tasklet or process with BH off.

Cheers,

Signature · 4 lines
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
#4 lore raw
In reply to Herbert Xu

Hi,

In the case when finup() is not used, just update/update/../final driver finalize calculation from the final function.

It takes a time and if it may not sleep, can final() also return EINPROGRESS?

Thanks,
Dmitry

Quoted 30 lines · ext Herbert Xu
Quoted 15 lines · Dmitry Kasatkin

Hello,

I have one question about async api.

I work on AHASH driver and wonder about one thing.

while calculating hash, client might call many times

ahash_request_set_crypt(req, &sg, sha1, len);
crypto_ahash_update(req);
..
..
ahash_request_set_crypt(req, &sg, sha1, len);
crypto_ahash_finup(req);

Quoted 7 lines

right?

But because it is async and driver does not wait_for_completion, previous request may not be completed before client will call next update.

But what should be the behavior of the driver?

If any async operation returns EINPROGRESS, the client must not proceed until that operation has completed.

Cheers,

#5 lore raw

Hi,

It actually would not make sense as final() suppose to cleanup everything and in the case of EINPROGRESS we can not do it.

So the question how then to "wait for completion" of the hash by HW if not to use finup()

- Dmitry

Quoted 51 lines · Kasatkin Dmitry (Nokia-D/Helsinki)

Hi,

In the case when finup() is not used, just update/update/../final driver finalize calculation from the final function.

It takes a time and if it may not sleep, can final() also return EINPROGRESS?

Thanks,
Dmitry

Quoted 23 lines · ext Herbert Xu
Quoted 20 lines · Dmitry Kasatkin

Hello,

I have one question about async api.

I work on AHASH driver and wonder about one thing.

while calculating hash, client might call many times

ahash_request_set_crypt(req, &sg, sha1, len);
crypto_ahash_update(req);
..
..
ahash_request_set_crypt(req, &sg, sha1, len);
crypto_ahash_finup(req);

right?

But because it is async and driver does not wait_for_completion, previous request may not be completed before client will call next update.

Quoted 9 lines
Quoted 3 lines

But what should be the behavior of the driver?

If any async operation returns EINPROGRESS, the client must not proceed until that operation has completed.

Cheers,

--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#6 lore raw

in sync API final() does not have any data.

Is async driver also should ignore req->src in final() call?

- Dmitry

Quoted 74 lines · Kasatkin Dmitry (Nokia-D/Helsinki)

Hi,

It actually would not make sense as final() suppose to cleanup everything and in the case of EINPROGRESS we can not do it.

So the question how then to "wait for completion" of the hash by HW if not to use finup()

- Dmitry

Quoted 46 lines · Kasatkin Dmitry (Nokia-D/Helsinki)

Hi,

In the case when finup() is not used, just update/update/../final driver finalize calculation from the final function.

It takes a time and if it may not sleep, can final() also return EINPROGRESS?

Thanks,
Dmitry

Quoted 31 lines · ext Herbert Xu
Quoted 15 lines · Dmitry Kasatkin

Hello,

I have one question about async api.

I work on AHASH driver and wonder about one thing.

while calculating hash, client might call many times

ahash_request_set_crypt(req, &sg, sha1, len);
crypto_ahash_update(req);
..
..
ahash_request_set_crypt(req, &sg, sha1, len);
crypto_ahash_finup(req);

Quoted 9 lines

right?

But because it is async and driver does not wait_for_completion, previous request may not be completed before client will call next update.

But what should be the behavior of the driver?

If any async operation returns EINPROGRESS, the client must not proceed until that operation has completed.

Quoted 10 lines
Quoted 4 lines

Cheers,

--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

maintainer
#8 lore raw
In reply to Dmitry Kasatkin
Quoted 7 lines · Dmitry Kasatkin

Hi,

In the case when finup() is not used, just update/update/../final driver finalize calculation from the final function.

It takes a time and if it may not sleep, can final() also return EINPROGRESS?

Sure, final can certainly return EINPROGRESS.

Signature · 4 lines
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
maintainer
#7 lore raw
In reply to Dmitry Kasatkin
Quoted 3 lines · Dmitry Kasatkin

in sync API final() does not have any data.

Is async driver also should ignore req->src in final() call?

Yes req->src can be ignored in final.

Cheers,

Signature · 4 lines
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