Rate This Document
Findability
Accuracy
Completeness
Readability

Creating an RSA Context and Block Memory Pool

You can also skip the following and use the wd_send/wd_recv interface to send/receive RSA messages based on q. However, you need to fill in messages according to the algorithm message structure requirements. In addition, the input and key must use the memory reserved by the WD based on q. The interface is described in Memory Reservation Interface.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
memset(&psetup, 0, sizeof(psetup));
psetup.block_size = key_size;
psetup.block_num = 64;
psetup.align_size = 64;/*block buffer start address 64bytes align */
pool = wd_blkpool_create(q, psetup);

        struct wcrypto_rsa_ctx_setup setup;
struct wd_blkpool_setup psetup;
        void *ctx = NULL, *pool = NULL;
        memset(&setup, 0, sizeof(setup));
        setup.is_crt = true;/* RSA CRT mode */
        setup.key_bits = 2048; /* Key width is 2048 bits */
        setup.ops.alloc = (void *)wd_alloc_blk;
        setup.ops.free = (void *)wd_free_blk;
        setup.ops.dma_map = (void *)wd_blk_iova_map;
        setup.ops.dma_unmap = (void *)wd_blk_iova_unmap;
        setup.ops.usr = pool;
        ctx = wcrypto_create_rsa_ctx(q, &setup);