Skip to contentSkip to conversation

io_uring and crypto

DISCUSSION David Howells 3 participants 3 messages Oct 7, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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

#1 lore raw
Quoted 11 lines · David Howells

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.

Quoted 7 lines

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

What problem are you trying to solve that can't be solved with a userspace crypto library?

- Eric

maintainer
#2 lore raw
In reply to David Howells
Quoted 6 lines · David Howells

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.

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_uring drive 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_uring seems 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