AnsweredAssumed Answered

CAAM operation failure with secure memory

Question asked by Ethan Yang on Aug 2, 2016
Latest reply on Dec 1, 2016 by Yuri Muhin


When we use the linux asynchronous crypto api calls with the secure memory slots as source and destination of the operations, they complete without reporting any error, but when we examine the destination slot, its contents remain unchanged.

When we use buffers allocated using kmalloc or buffers on the stack, the destination buffers are properly updated with the desired results.


Here is how we use the secure memory with the linux crypto API:

(we don't use unit 0 when establishing keystores.)

// init.. establist keystore using secure memory api, acquire/init cipher etc.
// allocate secure memory slots for src and dst
sm_keystore_slot_alloc(ksdev, unit, size, &slot_src);
sm_keystore_slot_alloc(ksdev, unit, size, &slot_dst);
// get address of the src and dst slots
addr_src = kspriv->slot_get_address(ksdev, unit, slot_src);
addr_dst = kspriv->slot_get_address(ksdev, unit, slot_dst);
// copy data to source (addr_src)
// set src and dst scatterlists
sg_init_one(&sg_src, addr_src, size);
sg_init_one(&sg_dst, addr_dst, size);
// invoke appropriate linux async crypto api calls
ablkcipher_request_set_crypt(ablk->req, &sg_src, &sg_dst, size, iv_data);


Is this using scenario allowed with the CAAM implementation?
And how to make it work?