<!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">The routine gnutls_certificate_set_x509_trust_file() fails if the valid certificate <a href="https://crt.sh/?q=d6dc2aaea926ff94854e7d3eb310c6349714e8e6" rel="nofollow noreferrer noopener" target="_blank">SSL Blindado PRO EV</a> is in the specified file.</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.6.tar.xz</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">Built from source.</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>Compile this program:</li>
</ul>
<pre class="code highlight js-syntax-highlight plaintext" lang="plaintext" v-pre="true"><code><span id="LC1" class="line" lang="plaintext">#include <gnutls/gnutls.h></span>
<span id="LC2" class="line" lang="plaintext">#include <gnutls/x509.h></span>
<span id="LC3" class="line" lang="plaintext">#include <stdio.h></span>
<span id="LC4" class="line" lang="plaintext"></span>
<span id="LC5" class="line" lang="plaintext">int main(int argc, char **argv)</span>
<span id="LC6" class="line" lang="plaintext">{</span>
<span id="LC7" class="line" lang="plaintext"> gnutls_certificate_credentials_t cred;</span>
<span id="LC8" class="line" lang="plaintext"> int count;</span>
<span id="LC9" class="line" lang="plaintext"> gnutls_global_init();</span>
<span id="LC10" class="line" lang="plaintext"> gnutls_certificate_allocate_credentials(&cred);</span>
<span id="LC11" class="line" lang="plaintext"> count = gnutls_certificate_set_x509_trust_file(cred, "cafile.pem", GNUTLS_X509_FMT_PEM);</span>
<span id="LC12" class="line" lang="plaintext"> fprintf(stderr, "GnuTLS processed %d roots\n", count);</span>
<span id="LC13" class="line" lang="plaintext"> gnutls_certificate_free_credentials(cred);</span>
<span id="LC14" class="line" lang="plaintext"> return 0;</span>
<span id="LC15" class="line" lang="plaintext">}</span></code></pre>
<p dir="auto"><code>$ gcc $(pkg-config --cflags --libs gnutls) testcase.c</code></p>
<ul dir="auto">
<li>Download the certificate: <code>$ wget -O cafile.pem https://crt.sh/?d=12730101</code>
</li>
<li>Observe error code: <code>$ ./a.out</code>
</li>
</ul>
<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">$ ./a.out </span>
<span id="LC2" class="line" lang="plaintext">GnuTLS processed -43 roots</span></code></pre>
<h2 dir="auto">
<a id="user-content-expected-results" class="anchor" href="#expected-results" aria-hidden="true"></a>Expected results:</h2>
<pre class="code highlight js-syntax-highlight plaintext" lang="plaintext" v-pre="true"><code><span id="LC1" class="line" lang="plaintext">$ ./a.out </span>
<span id="LC2" class="line" lang="plaintext">GnuTLS processed 1 roots</span>
<span id="LC3" class="line" lang="plaintext"></span></code></pre>
</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/693">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/49fe67b69f50dc92c23efac600f1d35d/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/693"}}</script>
</p>
</div>
</body>
</html>