io_uring and crypto
Subsystems (2)
Hi Jens,
I was wondering if it might be possible to adapt io_uring to make crypto requests as io_uring primitives rather than just having io_uring call sendmsg and recvmsg on an AF_ALG socket.
The reason I think this might make sense is that for the certain crypto ops we need to pass two buffers, one input and one output (encrypt, decrypt, sign) or two input (verify) and this could directly translate to an async crypto request.
Or possibly we should have a sendrecv socket call (RPC sort of thing) and have io_uring drive that.
The tricky bit is that it would require two buffers and io_uring seems geared around one.
David
Quoted 11 lines · David Howells
Hi Jens,
I was wondering if it might be possible to adapt
io_uringto make crypto requests asio_uringprimitives rather than just havingio_uringcall sendmsg and recvmsg on anAF_ALGsocket.The reason I think this might make sense is that for the certain crypto ops we need to pass two buffers, one input and one output (encrypt, decrypt, sign) or two input (verify) and this could directly translate to an async crypto request.
Quoted 7 lines
Or possibly we should have a sendrecv socket call (RPC sort of thing) and have
io_uringdrive that.The tricky bit is that it would require two buffers and
io_uringseems geared around one.David
What problem are you trying to solve that can't be solved with a userspace crypto library?
- Eric
Jens Axboe
maintainerQuoted 6 lines · David Howells
Hi Jens,
I was wondering if it might be possible to adapt
io_uringto make crypto requests asio_uringprimitives rather than just havingio_uringcall sendmsg and recvmsg on anAF_ALGsocket.
Quoted 7 lines
The reason I think this might make sense is that for the certain crypto ops we need to pass two buffers, one input and one output (encrypt, decrypt, sign) or two input (verify) and this could directly translate to an async crypto request.
Or possibly we should have a sendrecv socket call (RPC sort of thing) and have
io_uringdrive that.
You could certainly wire it up via io_uring in either way. I don't know the crypto API, but ideally you need something where you the issue and completions ide split, rather than just a boring sync syscall type thing. For the latter, io_uring can't really help you outside of punting to a thread. Having a reliable way to do non-blocking issue and then poll for readiness if non-blocking failed would suffice, ideally you want a way to issue/start the operation and get a callback when it completes.
Quoted 2 lines
The tricky bit is that it would require two buffers and
io_uringseems geared around one.
io_uring doesn't care, it's just a transport in that sense. You can define what the SQE looks like entirely for your opcode, and have 3 buffers per operation if you like.
Signature · 1 line
Jens Axboe