我要评分
获取效率
正确性
完整性
易理解

Creating an RSA Context and Block Memory Pool

For details about how to create an RSA context and block memory pool, see Creating an RSA Context and Block Memory Pool. 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
17
18
static void _rsa_cb(void *message, void *rsa_tag)
{
struct rsa_async_tag *tag = rsa_tag;
 void *ctx = tag->ctx;
 int thread_id = tag->thread_id;
 int cnt = tag->cnt;
struct wd_rsa_msg *msg = message;
if (msg->status = WD_SUCCESS)
printf("thread %d do RSA %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(rsa_tag);
wd_free_blk(pool, (void *)msg->in);
wd_free_blk(pool, (void *)msg->out);
}
setup.cb = (void *)_rsa_cb;
......