Rate This Document
Findability
Accuracy
Completeness
Readability

Creating a Context and Setting a Cipher Key

For details, see Creating a Context and Setting a Cipher Key. 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 _cipher_cb(void *message, void *cipher_tag)
{
struct cipher_async_tag *tag = cipher_tag;
 void *ctx = tag->ctx;
 int thread_id = tag->thread_id;
 int cnt = tag->cnt;
struct wcrypto_cipher_msg *msg = message;
if (msg->status = WD_SUCCESS)
printf("thread %d do cipher %dth time success!\n", thread_id, cnt);
else
printf("thread %d do RSA %dth time fail(status=%d)!\n", thread_id, cnt, 
msg->status);
free(cipher_tag);
}
setup.cb = (void *)_cipher_cb;
......