<!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/TheRealMichaelCatanzaro">Michael Catanzaro</a> created an issue: <a href="https://gitlab.com/gnutls/gnutls/-/issues/1291">#1291</a>
</p>
<div></div>
<h2 dir="auto">
<a id="user-content-description-of-the-feature" class="anchor" href="#description-of-the-feature" aria-hidden="true"></a>Description of the feature:</h2>
<p dir="auto">It would be nice if GnuTLS had an easy way to get the name of the current ciphersuite in use by a gnutls_session_t (<a href="https://gitlab.gnome.org/GNOME/glib-networking/-/merge_requests/194#note_1321126" rel="nofollow noreferrer noopener" target="_blank">suggested by Daiki</a>).</p>
<h2 dir="auto">
<a id="user-content-applications-that-this-feature-may-be-relevant-to" class="anchor" href="#applications-that-this-feature-may-be-relevant-to" aria-hidden="true"></a>Applications that this feature may be relevant to:</h2>
<p dir="auto">glib-networking would use this.</p>
<h2 dir="auto">
<a id="user-content-is-this-feature-implemented-in-other-libraries-and-which" class="anchor" href="#is-this-feature-implemented-in-other-libraries-and-which" aria-hidden="true"></a>Is this feature implemented in other libraries (and which)</h2>
<p dir="auto">The current glib-networking implementation does:</p>
<pre class="code highlight js-syntax-highlight language-plaintext" lang="plaintext" v-pre="true"><code><span id="LC1" class="line" lang="plaintext">static gchar *</span>
<span id="LC2" class="line" lang="plaintext">get_ciphersuite_name (gnutls_session_t session)</span>
<span id="LC3" class="line" lang="plaintext">{</span>
<span id="LC4" class="line" lang="plaintext">  gnutls_protocol_t protocol_version = gnutls_protocol_get_version (session);</span>
<span id="LC5" class="line" lang="plaintext">  char *cipher_name;</span>
<span id="LC6" class="line" lang="plaintext">  char *result;</span>
<span id="LC7" class="line" lang="plaintext"></span>
<span id="LC8" class="line" lang="plaintext">  if (protocol_version <= GNUTLS_TLS1_2 ||</span>
<span id="LC9" class="line" lang="plaintext">      (protocol_version >= GNUTLS_DTLS0_9 && protocol_version <= GNUTLS_DTLS1_2))</span>
<span id="LC10" class="line" lang="plaintext">    {</span>
<span id="LC11" class="line" lang="plaintext">      return g_strdup (gnutls_cipher_suite_get_name (gnutls_kx_get (session),</span>
<span id="LC12" class="line" lang="plaintext">                                                     gnutls_cipher_get (session),</span>
<span id="LC13" class="line" lang="plaintext">                                                     gnutls_mac_get (session)));</span>
<span id="LC14" class="line" lang="plaintext">    }</span>
<span id="LC15" class="line" lang="plaintext"></span>
<span id="LC16" class="line" lang="plaintext">  cipher_name = g_strdup (gnutls_cipher_get_name (gnutls_cipher_get (session)));</span>
<span id="LC17" class="line" lang="plaintext">  for (char *c = cipher_name; *c != '\0'; c++)</span>
<span id="LC18" class="line" lang="plaintext">    {</span>
<span id="LC19" class="line" lang="plaintext">      if (*c == '-')</span>
<span id="LC20" class="line" lang="plaintext">        *c = '_';</span>
<span id="LC21" class="line" lang="plaintext">    }</span>
<span id="LC22" class="line" lang="plaintext"></span>
<span id="LC23" class="line" lang="plaintext">  result = g_strdup_printf ("TLS_%s_%s",</span>
<span id="LC24" class="line" lang="plaintext">                            cipher_name,</span>
<span id="LC25" class="line" lang="plaintext">                            gnutls_digest_get_name (gnutls_prf_hash_get (session)));</span>
<span id="LC26" class="line" lang="plaintext">  g_free (cipher_name);</span>
<span id="LC27" class="line" lang="plaintext"></span>
<span id="LC28" class="line" lang="plaintext">  return result;</span>
<span id="LC29" class="line" lang="plaintext">}</span></code></pre>
<p dir="auto">Ideally we would replace all that with one call to GnuTLS.</p>
<p dir="auto">Additionally, for TLS 1.2, that returns the "GnuTLS" name of the ciphersuite, which is different from the standard IANA names. The new API should probably always return the standard, IANA-style ciphersuite names.</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/1291">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/f7e6298ec2222803f38102ca2f6b1ba7/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/1291"}}</script>


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