<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<meta content="text/html; charset=US-ASCII" http-equiv="Content-Type">
<title>
GitLab
</title>


<style>img {
max-width: 100%; height: auto;
}
</style>
</head>
<body>
<div class="content">

<p class="details" style="font-style: italic; color: #666;">
<a href="https://gitlab.com/juaristi">Ander Juaristi</a> created an issue <a href="https://gitlab.com/gnutls/gnutls/-/issues/1113">#1113</a>:
</p>
<div></div>
<p dir="auto">The Linux kernel has been supporting KTLS for some time now.</p>
<p dir="auto">This is basically a kernel-side TLS record encryption offloading. The kernel receives plaintext data on the socket descriptor via <code>write()</code> and it builds a valid TLS record around it. The same happens when data is read with <code>read()</code>: a TLS record is expected, then decrypted and the plaintext it contains returned.</p>
<p dir="auto">After a successful TLS handshake (this happens normally on userland), you need to obtain the TLS secrets. You do this with <code>gnutls_record_get_state()</code>.</p>
<p dir="auto">Then you enable KTLS on a connected TCP socket with <code>setsockopt</code>:</p>
<pre class="code highlight js-syntax-highlight plaintext" lang="plaintext" v-pre="true"><code><span id="LC1" class="line" lang="plaintext">setsockopt(sockfd, SOL_TCP, TCP_ULP, "tls", sizeof("tls");</span></code></pre>
<p dir="auto">And finally you copy the TLS master secret to the kernel so that it can build the read and write keys.</p>
<p dir="auto">I think GnuTLS should transparently use KTLS if it's available, when either <code>gnutls_record_recv()</code> or <code>gnutls_record_write()</code> are called.</p>
<p dir="auto">If it's not available, fall back to userland encryption using Nettle, just like now.</p>

</div>
<div class="footer" style="margin-top: 10px;">
<p style="font-size: small; color: #666;">

<br>
Reply to this email directly or <a href="https://gitlab.com/gnutls/gnutls/-/issues/1113">view it on GitLab</a>.
<br>
You're receiving this email because of your account on gitlab.com.
If you'd like to receive fewer emails, you can
<a href="https://gitlab.com/-/sent_notifications/51f743125cda48172d6ab2ce198e5b58/unsubscribe">unsubscribe</a>
from this thread or
adjust your notification settings.
<script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","action":{"@type":"ViewAction","name":"View Issue","url":"https://gitlab.com/gnutls/gnutls/-/issues/1113"}}</script>


</p>
</div>
</body>
</html>