<!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=utf-8" http-equiv="Content-Type">
<title>
GitLab
</title>
<style>img {
max-width: 100%; height: auto;
}
</style>
</head>
<body>
<div class="content">
<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">If TLS 1.2 is in use, and a server connection requires client authentication (<code>GNUTLS_CERT_REQUIRE</code> passed to <code>gnutls_certificate_server_set_request</code>), and the client connection fails to provide any authentication (by failing to fill in the <code>pcert</code>, <code>pcert_length</code>, and <code>pkey</code> parameters of its <code>gnutls_certificate_retrieve_function2</code>), then the call to <code>gnutls_handshake</code> will fail with <code>GNUTLS_E_NO_CERTIFICATE_FOUND</code>. This is the behavior glib-networking expects.</p>
<p dir="auto">But if TLS 1.3 is in use, the call to <code>gnutls_handshake</code> unexpectedly succeeds in the client. The client doesn't receive any error until it later attempts to read from the session. Then the client receives <code>GNUTLS_E_INVALID_SESSION</code> and <code>GNUTLS_E_PUSH_ERROR</code>. This results in the glib-networking testsuite failing.</p>
<p dir="auto">Is the behavior change expected? Shouldn't the handshake fail, as with TLS 1.2? Or is this different by design?</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">gnutls-3.6.4.fc29</p>
<p dir="auto">Also reproduced with <a href="https://gitlab.com/gnutls/gnutls/commit/907086568631afa552baf198496f364307de1220" data-original="907086568631afa552baf198496f364307de1220" data-link="false" data-link-reference="false" data-project="179611" data-commit="907086568631afa552baf198496f364307de1220" data-reference-type="commit" data-container="body" data-placement="bottom" title="Merge branch 'args-std-def' into 'master'" class="gfm gfm-commit has-tooltip">90708656</a> built from git</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">Fedora, also manual build from git</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>Build glib-networking (instructions tested on Fedora 29):</li>
</ul>
<pre class="code highlight js-syntax-highlight plaintext" lang="plaintext" v-pre="true"><code><span id="LC1" class="line" lang="plaintext">$ sudo dnf builddep glib-networking</span>
<span id="LC2" class="line" lang="plaintext">$ git clone https://gitlab.gnome.org/GNOME/glib-networking.git</span>
<span id="LC3" class="line" lang="plaintext">$ mkdir -p glib-networking/build</span>
<span id="LC4" class="line" lang="plaintext">$ cd glib-networking/build</span>
<span id="LC5" class="line" lang="plaintext">$ meson ..</span>
<span id="LC6" class="line" lang="plaintext">$ ninja</span></code></pre>
<ul dir="auto">
<li>Run the testsuite:</li>
</ul>
<pre class="code highlight js-syntax-highlight plaintext" lang="plaintext" v-pre="true"><code><span id="LC1" class="line" lang="plaintext">$ ninja test</span></code></pre>
<h2 dir="auto">
<a id="user-content-actual-results" class="anchor" href="#actual-results" aria-hidden="true"></a>Actual results:</h2>
<pre class="code highlight js-syntax-highlight plaintext" lang="plaintext" v-pre="true"><code><span id="LC1" class="line" lang="plaintext">5/6 connection-gnutls FAIL 1.02 s (killed by signal 6 SIGABRT)</span>
<span id="LC2" class="line" lang="plaintext"></span>
<span id="LC3" class="line" lang="plaintext">--- command ---</span>
<span id="LC4" class="line" lang="plaintext">G_TEST_SRCDIR='/home/mcatanzaro/glib-networking/tls/tests' GIO_MODULE_DIR='/home/mcatanzaro/glib-networking/build/tls/gnutls' G_TEST_BUILDDIR='/home/mcatanzaro/glib-networking/build/tls/tests' /home/mcatanzaro/glib-networking/build/tls/tests/connection-gnutls</span>
<span id="LC5" class="line" lang="plaintext">--- stdout ---</span>
<span id="LC6" class="line" lang="plaintext">/tls/connection/basic: OK</span>
<span id="LC7" class="line" lang="plaintext">/tls/connection/verified: OK</span>
<span id="LC8" class="line" lang="plaintext">/tls/connection/verified-chain: OK</span>
<span id="LC9" class="line" lang="plaintext">/tls/connection/verified-chain-with-redundant-root-cert: OK</span>
<span id="LC10" class="line" lang="plaintext">/tls/connection/verified-chain-with-duplicate-server-cert: OK</span>
<span id="LC11" class="line" lang="plaintext">/tls/connection/verified-unordered-chain: OK</span>
<span id="LC12" class="line" lang="plaintext">/tls/connection/verified-chain-with-alternative-ca-cert: OK</span>
<span id="LC13" class="line" lang="plaintext">/tls/connection/invalid-chain-with-alternative-ca-cert: OK</span>
<span id="LC14" class="line" lang="plaintext">/tls/connection/client-auth: OK</span>
<span id="LC15" class="line" lang="plaintext">/tls/connection/client-auth-rehandshake: OK</span>
<span id="LC16" class="line" lang="plaintext">/tls/connection/client-auth-failure: </span>
<span id="LC17" class="line" lang="plaintext">--- stderr ---</span>
<span id="LC18" class="line" lang="plaintext">**</span>
<span id="LC19" class="line" lang="plaintext">GLib-Net:ERROR:../tls/tests/connection.c:437:on_client_connection_close_finish: assertion failed (error == NULL): Error sending data: Broken pipe (g-io-error-quark, 44)</span>
<span id="LC20" class="line" lang="plaintext">-------</span>
<span id="LC21" class="line" lang="plaintext"></span>
<span id="LC22" class="line" lang="plaintext">Full log written to /home/mcatanzaro/glib-networking/build/meson-logs/testlog.txt</span>
<span id="LC23" class="line" lang="plaintext">FAILED: meson-test </span>
<span id="LC24" class="line" lang="plaintext">/usr/bin/meson test --no-rebuild --print-errorlogs</span>
<span id="LC25" class="line" lang="plaintext">ninja: build stopped: subcommand failed.</span></code></pre>
<p dir="auto">The test <code>/tls/connection/client-auth-failure</code> fails inside <code>on_client_connection_close_finish</code>, a function that is not expected to be reached during this test. The test expects the connection to fail earlier, during the handshake stage.</p>
<p dir="auto">The test succeeds with TLS 1.3 disabled:</p>
<pre class="code highlight js-syntax-highlight plaintext" lang="plaintext" v-pre="true"><code><span id="LC1" class="line" lang="plaintext">$ G_TLS_GNUTLS_PRIORITY="@SYSTEM:-VERS-TLS1.3" ninja test</span></code></pre>
<p dir="auto">Or:</p>
<pre class="code highlight js-syntax-highlight plaintext" lang="plaintext" v-pre="true"><code><span id="LC1" class="line" lang="plaintext">$ G_TLS_GNUTLS_PRIORITY="NORMAL:-VERS-TLS1.3" ninja test</span></code></pre>
<h2 dir="auto">
<a id="user-content-expected-results" class="anchor" href="#expected-results" aria-hidden="true"></a>Expected results:</h2>
<p dir="auto">The call to <code>gnutls_handshake</code> should fail with <code>GNUTLS_E_NO_CERTIFICATE_FOUND</code>, allowing <code>/tls/connection/client-auth-failure</code> to pass. (Right?)</p>
</div>
<div class="footer" style="margin-top: 10px;">
<p style="font-size: small; color: #777777;">
—
<br>
Reply to this email directly or <a href="https://gitlab.com/gnutls/gnutls/issues/615">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/2ae244d0036ea76cac984020cad42713/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/615"}}</script>
</p>
</div>
</body>
</html>