Rate This Document
Findability
Accuracy
Completeness
Readability

Creating a Digest Context

For details, see Creating a Digest Context. This section adds the setting of the callback function for the poll thread to invoke after the task is complete.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
static void _digest_cb(void *message, void *digest_tag)
{
struct digest_async_tag *tag = digest_tag;
 void *ctx = tag->ctx;
 int thread_id = tag->thread_id;
 int cnt = tag->cnt;
struct wcrypto_digest_msg *msg = message;
if (msg->status = WD_SUCCESS)
printf("thread %d do digest %dth time suc cess!\n", thread_id, cnt);
else
printf("thread %d do RSA %dth time fail(status=%d)!\n", thread_id, cnt, 
msg->status);
free(digest_tag);
}
setup.cb = (void *)_digest_cb;
......