<!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>
<h1 dir="auto">
<a id="user-content-1-the-documentation-for-gnutls_x509_trust_list_add_cas-is-not-correct" class="anchor" href="#1-the-documentation-for-gnutls_x509_trust_list_add_cas-is-not-correct" aria-hidden="true"></a>1) The documentation for gnutls_x509_trust_list_add_cas is not correct:</h1>
<blockquote dir="auto">
<p>If the flag GNUTLS_TL_NO_DUPLICATES is specified, then
the provided clist entries that are duplicates will not be
added to the list and will be deinitialized.</p>
<p>Returns: The number of added elements is returned.</p>
</blockquote>
<p dir="auto">The actual behavior is that the existing entries in the list will be deinitialized and replaced with the entries from clist.</p>
<p dir="auto">The return value includes both added <em>and</em> replaced entries.</p>
<p dir="auto">The documentation does not mention that this behavior also applies to GNUTLS_TL_NO_DUPLICATE_KEY.</p>
<blockquote dir="auto">
<p>The list of CAs must not be deinitialized during this structure's lifetime.</p>
</blockquote>
<p dir="auto">I find this misleading, I suggest rewording it to "The CAs in clist must not be deinitialized during the lifetime of list."</p>
<p dir="auto">Also this needs to be added: "If either the flags GNUTLS_TL_NO_DUPLICATES or GNUTLS_TL_NO_DUPLICATE_KEY are given, it required gnutls_x509_trust_list_deinit will be called with all=1.</p>
<h1 dir="auto">
<a id="user-content-2-the-documentation-for-gnutls_x509_trust_list_add_crls-is-not-correct" class="anchor" href="#2-the-documentation-for-gnutls_x509_trust_list_add_crls-is-not-correct" aria-hidden="true"></a>2) The documentation for gnutls_x509_trust_list_add_crls is not correct:</h1>
<p dir="auto">Similarly to add_cas, gnutls_x509_trust_list_add_crls can replace existing crls and returns the sum of added and replaced entries when the GNUTLS_TL_NO_DUPLICATES flag is passed, though it depends which crl is newer.</p>
<p dir="auto">Likewise, the lifetime remark is misleading here as well.</p>
<h1 dir="auto">
<a id="user-content-3-wrong-return-value-in-gnutls_x509_trust_list_add_cas" class="anchor" href="#3-wrong-return-value-in-gnutls_x509_trust_list_add_cas" aria-hidden="true"></a>3) Wrong return value in gnutls_x509_trust_list_add_cas:</h1>
<p dir="auto">If the GNUTLS_TL_USE_IN_TLS flag is given and add_new_ca_to_rdn_seq fails, the CA already got added to the list, but the return value does not include it.</p>
<h1 dir="auto">
<a id="user-content-4-memory-leak-in-gnutls_x509_trust_list_add_trust_mem" class="anchor" href="#4-memory-leak-in-gnutls_x509_trust_list_add_trust_mem" aria-hidden="true"></a>4) Memory leak in gnutls_x509_trust_list_add_trust_mem:</h1>
<p dir="auto">If gnutls_x509_trust_list_add_cas returns less than clist_size, the extra certificates not added will never be freed. Compare with gnutls_x509_trust_list_add_crls which does not have this problem.</p>

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

<br>
Reply to this email directly or <a href="https://gitlab.com/gnutls/gnutls/issues/552">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/568d085b21cf30d8f664468ca266ae49/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/552"}}</script>
</p>
</div>
</body>
</html>