Page MenuHomeFreeBSD

ktls: Add software support for AES-CBC decryption for TLS 1.1+.
ClosedPublic

Authored by jhb on Nov 12 2022, 12:02 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mar 14 2024, 4:42 PM
Unknown Object (File)
Mar 14 2024, 4:39 PM
Unknown Object (File)
Mar 14 2024, 4:38 PM
Unknown Object (File)
Mar 14 2024, 4:38 PM
Unknown Object (File)
Mar 11 2024, 4:33 AM
Unknown Object (File)
Jan 12 2024, 8:26 AM
Unknown Object (File)
Dec 22 2023, 10:44 PM
Unknown Object (File)
Nov 27 2023, 2:44 PM
Subscribers

Details

Summary

This is mainly intended to provide a fallback for TOE TLS which may
need to use software decryption for an initial record at the start
of a connection.

Sponsored by: Chelsio Communications

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

jhb requested review of this revision.Nov 12 2022, 12:02 AM
sys/kern/uipc_ktls.c
1262

I had tried to add a knob to not use SW here for CBC so that use of TOE or ifnet would be mandated for CBC by default. However, there's not a great way to unwind the changes made above (which both ifnet and TOE TLS need to be done first) of moving the mbufs over to sb_mtls and queuing work for the kthread, etc.

This is mainly intended to provide a fallback for TOE TLS which may need to use software decryption for an initial record at the start of a connection.

Why does it need to fall back?

sys/opencrypto/ktls_ocf.c
461

Shouldn't this logically be ntohs?

464

If you drop unnecessary parens, then this condition fits on one line.

505

You technically don't need M_ZERO here. Given how expensive this function is I'm not sure if microoptimizing makes much sense.

This revision is now accepted and ready to land.Nov 14 2022, 2:51 PM

This is mainly intended to provide a fallback for TOE TLS which may need to use software decryption for an initial record at the start of a connection.

Why does it need to fall back?

Well, there's D37351 (which is required for TLS 1.3, but also makes TOE TLS a lot less fragile and more user friendly), but also after commit d958bc7963d415d6745abf3e6829f05dabf4c9ed AES-CBC for TOE TLS hasn't worked as we allocate a software session always for both ifnet and TOE TLS for RX.

sys/opencrypto/ktls_ocf.c
505

I did it because conceivably the skip in the loop below might result in using fewer iov entries and the M_ZERO is a safety net to ensure there isn't garbage left over in the iov array in that case.

jhb marked 2 inline comments as done.Nov 14 2022, 5:49 PM
jhb added inline comments.
sys/opencrypto/ktls_ocf.c
521

I guess I could set uio.iovcnt to i here though.

jhb marked an inline comment as done.Nov 14 2022, 6:12 PM
This revision now requires review to proceed.Nov 14 2022, 6:13 PM
This revision is now accepted and ready to land.Nov 14 2022, 8:11 PM