* Question about async operations
@ 2010-03-04 17:38 Dimitrios Siganos
2010-03-05 7:33 ` Herbert Xu
0 siblings, 1 reply; 2+ messages in thread
From: Dimitrios Siganos @ 2010-03-04 17:38 UTC (permalink / raw)
To: linux-crypto
Hi,
I have a question about the asynchronous characteristics of the crypto api.
1) crypto_alloc_hash("sha1", 0, CRYPTO_ALG_ASYNC), does this code create
an asynchronous sha1 transform?
2) crypto_alloc_hash("sha1", 0, 0), does this code create a synchronous
sha1 transform?
3) Is synchronous taken to mean the follwoing? When the function returns
(and is successful) the result is already computed and placed at the
destination.
4) Is asynchronous taken to mean the following? "When the function
returns (and is successful) we know that a request has been posted for
the operation to take place but we have no guarantees that the operation
has completed.
5) If the answer to the above is yes then how can the following style of
code work? I see such code in many places:
crypto_alloc_hash("sha1", 0, CRYPTO_ALG_ASYNC);
crypto_hash_init(&desc);
rc = crypto_hash_update(&desc, &sg, len);
rc = crypto_hash_final(&desc, dst);
now_use_dst(dst);
How can we know that the dst has the right contents when we call
"now_use_dst(dst)"? Is there something that I am missing?
Regards,
Dimitris
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Question about async operations
2010-03-04 17:38 Question about async operations Dimitrios Siganos
@ 2010-03-05 7:33 ` Herbert Xu
0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2010-03-05 7:33 UTC (permalink / raw)
To: Dimitrios Siganos; +Cc: linux-crypto
Dimitrios Siganos <dimitris@siganos.org> wrote:
> Hi,
>
> I have a question about the asynchronous characteristics of the crypto api.
>
> 1) crypto_alloc_hash("sha1", 0, CRYPTO_ALG_ASYNC), does this code create
> an asynchronous sha1 transform?
crypto_alloc_hash is obsolete. New code should either use shash
or ahash. Only the latter supports async operations.
You can look at crypto/authenc.c for an example of how it's used.
Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-03-05 7:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-04 17:38 Question about async operations Dimitrios Siganos
2010-03-05 7:33 ` Herbert Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).