Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1275765

Re: [RFC PATCH 0/2] Crypto kernel TLS socket

From Hannes Frederic Sowa <hannes@stressinduktion.org>
Newsgroups linux.kernel
Subject Re: [RFC PATCH 0/2] Crypto kernel TLS socket
Date 2015-11-23 20:20 +0100
Message-ID <qy4OB-65O-3@gated-at.bofh.it> (permalink)
References <qy3pw-51A-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hello,

On Mon, Nov 23, 2015, at 18:42, Dave Watson wrote:
> An approach for a kernel TLS socket.
> 
> Only the symmetric encryption / decryption is done in-kernel, as well
> as minimal framing handling.  The handshake is kept in userspace, and
> the negotiated cipher / keys / IVs are then set on the algif_tls
> socket, which is then hooked in to a tcp socket using
> sk_write_space/sk_data_ready hooks.
> 
> If a non application-data TLS record is seen, it is left on the TCP
> socket and an error is returned on the ALG socket, and the record is
> left for userspace to manage. Userspace can't ignore the message, but
> could just close the socket.
> 
> TLS could potentially also be done directly on the TCP socket, but
> seemed a bit harder to work with the OOB data for non application_data
> messages, and the sockopts / CMSGS already exist for ALG sockets.  The
> flip side is having to manage two fds in userspace.
> 
> Some reasons we're looking at this:
> 
> 1) Access to sendfile/splice for CDN-type applications.  We were
>    inspired by Netflix exploring this in FreeBSD
> 
>    https://people.freebsd.org/~rrs/asiabsd_2015_tls.pdf
> 
>    For perf, this patch is almost on par with userspace OpenSSL.
>    Currently there are some copies and allocs to support
>    scatter/gather in aesni-intel_glue.c, but with some extra work to
>    remove those (not included here), a sendfile() is faster than the
>    equivalent userspace read/SSL_write using a 128k buffer by 2~7%.

This argument is mood:

We already have mmap+vmsplice working on TCP sockets and ERR_MSGQUEUE
notifications are already send when to advance the window. Please
provide a benchmark using those already existing facilities.

I am pretty sure you at least need one data copy (as stated in the
referred paper). Linux kernel can do this in user space already. FreeBSD
only implements sendfile, thus this was the easier way for them to go.

> 2) Access to the unencrypted bytes in kernelspace.  For example, Tom
>    Herbert's kcm would need this
> 
>    https://lwn.net/Articles/657999/
> 
> 3) NIC offload. To support running aesni routines on the NIC instead
>    of the processor, we would probably need enough of the framing
>    interface put in kernel.

This would require adding TOE offloading. The kernel community was a
strong opponent to TOE offloading.

Bye,
Hannes
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[RFC PATCH 0/2] Crypto kernel TLS socket Dave Watson <davejwatson@fb.com> - 2015-11-23 18:50 +0100
  [RFC PATCH 1/2] Crypto support aesni rfc5288 Dave Watson <davejwatson@fb.com> - 2015-11-23 18:50 +0100
    Re: [RFC PATCH 1/2] Crypto support aesni rfc5288 Herbert Xu <herbert@gondor.apana.org.au> - 2015-11-24 11:40 +0100
  [RFC PATCH 2/2] Crypto kernel tls socket Dave Watson <davejwatson@fb.com> - 2015-11-23 18:50 +0100
    Re: [RFC PATCH 2/2] Crypto kernel tls socket Sowmini Varadhan <sowmini.varadhan@oracle.com> - 2015-11-23 20:30 +0100
      Re: [RFC PATCH 2/2] Crypto kernel tls socket Dave Watson <davejwatson@fb.com> - 2015-11-23 22:50 +0100
        Re: [RFC PATCH 2/2] Crypto kernel tls socket Sowmini Varadhan <sowmini.varadhan@oracle.com> - 2015-11-23 23:00 +0100
    Re: [RFC PATCH 2/2] Crypto kernel tls socket Herbert Xu <herbert@gondor.apana.org.au> - 2015-11-24 11:40 +0100
      Re: [RFC PATCH 2/2] Crypto kernel tls socket Stephan Mueller <smueller@chronox.de> - 2015-11-24 12:10 +0100
        Re: [RFC PATCH 2/2] Crypto kernel tls socket Hannes Frederic Sowa <hannes@stressinduktion.org> - 2015-11-24 12:30 +0100
          Re: [RFC PATCH 2/2] Crypto kernel tls socket Phil Sutter <phil@nwl.cc> - 2015-11-24 13:00 +0100
            Re: [RFC PATCH 2/2] Crypto kernel tls socket Stephan Mueller <smueller@chronox.de> - 2015-11-24 13:40 +0100
          Re: [RFC PATCH 2/2] Crypto kernel tls socket Sowmini Varadhan <sowmini.varadhan@oracle.com> - 2015-11-24 13:00 +0100
          Re: [RFC PATCH 2/2] Crypto kernel tls socket Stephan Mueller <smueller@chronox.de> - 2015-11-24 13:40 +0100
  Re: [RFC PATCH 0/2] Crypto kernel TLS socket Hannes Frederic Sowa <hannes@stressinduktion.org> - 2015-11-23 20:20 +0100

csiph-web