<!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/tatsuhiro-t">Tatsuhiro Tsujikawa</a> created an issue <a href="https://gitlab.com/gnutls/gnutls/-/issues/1146">#1146</a>:
</p>
<div></div>
<h2 dir="auto">
<a id="user-content-description-of-problem" class="anchor" href="#description-of-problem" aria-hidden="true"></a>Description of problem:</h2>
<p dir="auto">GnuTLS client sends TLSv1.3 early data after receiving Server Hello.
That is, sending early data with weaker cryptographic property after 1RTT.</p>
<p dir="auto">RFC 8446 says early data are sent along with Client Hello without waiting for Server first flight:</p>
<pre class="code highlight js-syntax-highlight plaintext" lang="plaintext" v-pre="true"><code><span id="LC1" class="line" lang="plaintext">         Client                                               Server</span>
<span id="LC2" class="line" lang="plaintext"></span>
<span id="LC3" class="line" lang="plaintext">         ClientHello</span>
<span id="LC4" class="line" lang="plaintext">         + early_data</span>
<span id="LC5" class="line" lang="plaintext">         + key_share*</span>
<span id="LC6" class="line" lang="plaintext">         + psk_key_exchange_modes</span>
<span id="LC7" class="line" lang="plaintext">         + pre_shared_key</span>
<span id="LC8" class="line" lang="plaintext">         (Application Data*)     --------></span>
<span id="LC9" class="line" lang="plaintext">                                                         ServerHello</span>
<span id="LC10" class="line" lang="plaintext">                                                    + pre_shared_key</span>
<span id="LC11" class="line" lang="plaintext">                                                        + key_share*</span>
<span id="LC12" class="line" lang="plaintext">                                               {EncryptedExtensions}</span>
<span id="LC13" class="line" lang="plaintext">                                                       + early_data*</span>
<span id="LC14" class="line" lang="plaintext">                                                          {Finished}</span>
<span id="LC15" class="line" lang="plaintext">                                 <--------       [Application Data*]</span>
<span id="LC16" class="line" lang="plaintext">         (EndOfEarlyData)</span>
<span id="LC17" class="line" lang="plaintext">         {Finished}              --------></span>
<span id="LC18" class="line" lang="plaintext">         [Application Data]      <------->        [Application Data]</span></code></pre>
<p dir="auto"><a href="https://tools.ietf.org/html/rfc8446#section-2.3" rel="nofollow noreferrer noopener" target="_blank">https://tools.ietf.org/html/rfc8446#section-2.3</a></p>
<p dir="auto">gnutls-cli debug output shows that EARLY KEY and IV are generated after receiving Server Hello.
I used wireshark capture and observed that gnutls-cli sent early data and EOED after receiving Server first flight.</p>
<h2 dir="auto">
<a id="user-content-version-of-gnutls-used" class="anchor" href="#version-of-gnutls-used" aria-hidden="true"></a>Version of gnutls used:</h2>
<p dir="auto">3.7.0</p>
<h2 dir="auto">
<a id="user-content-distributor-of-gnutls-eg-ubuntu-fedora-rhel" class="anchor" href="#distributor-of-gnutls-eg-ubuntu-fedora-rhel" aria-hidden="true"></a>Distributor of gnutls (e.g., Ubuntu, Fedora, RHEL)</h2>
<p dir="auto">Debian</p>
<h2 dir="auto">
<a id="user-content-how-reproducible" class="anchor" href="#how-reproducible" aria-hidden="true"></a>How reproducible:</h2>
<p dir="auto">Steps to Reproduce:</p>
<ul dir="auto">
<li>gnutls-cli --port 443 -d 9999 -r --earlydata http.txt ANY-SITE-WHICH-ENABLES-EARLY-DATA</li>
<li>http.txt contains HTTP/1.1 request</li>
</ul>
<h2 dir="auto">
<a id="user-content-actual-results" class="anchor" href="#actual-results" aria-hidden="true"></a>Actual results:</h2>
<p dir="auto">Early data are sent after receiving Server Hello.</p>
<h2 dir="auto">
<a id="user-content-expected-results" class="anchor" href="#expected-results" aria-hidden="true"></a>Expected results:</h2>
<p dir="auto">Early data should send along with Client Hello without waiting for Server Hello.</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/1146">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/4e908ce4f67549f655397c47b319cce2/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/1146"}}</script>


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