[glib-networking/mcatanzaro/cipher-name] gnutls: TLS 1.3 ciphersuite names should use underscores
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib-networking/mcatanzaro/cipher-name] gnutls: TLS 1.3 ciphersuite names should use underscores
- Date: Wed, 24 Nov 2021 18:15:04 +0000 (UTC)
commit 19e08066584b0215640a2ff0f07d8bbd5a97d261
Author: Michael Catanzaro <mcatanzaro redhat com>
Date: Wed Nov 24 12:14:03 2021 -0600
gnutls: TLS 1.3 ciphersuite names should use underscores
We're so close to returning the nice IANA ciphersuite name, except the
cipher name returned by GnuTLS uses hyphens instead of underscores.
Oops.
Noticed in
https://gitlab.gnome.org/GNOME/libsoup/-/merge_requests/262#note_1319023
tls/gnutls/gtlsconnection-gnutls.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/tls/gnutls/gtlsconnection-gnutls.c b/tls/gnutls/gtlsconnection-gnutls.c
index 2b768bf0..1b607408 100644
--- a/tls/gnutls/gtlsconnection-gnutls.c
+++ b/tls/gnutls/gtlsconnection-gnutls.c
@@ -1099,6 +1099,8 @@ static gchar *
get_ciphersuite_name (gnutls_session_t session)
{
gnutls_protocol_t protocol_version = gnutls_protocol_get_version (session);
+ char *cipher_name;
+ char *result;
if (protocol_version <= GNUTLS_TLS1_2 ||
(protocol_version >= GNUTLS_DTLS0_9 && protocol_version <= GNUTLS_DTLS1_2))
@@ -1108,9 +1110,19 @@ get_ciphersuite_name (gnutls_session_t session)
gnutls_mac_get (session)));
}
- return g_strdup_printf ("TLS_%s_%s",
- gnutls_cipher_get_name (gnutls_cipher_get (session)),
- gnutls_digest_get_name (gnutls_prf_hash_get (session)));
+ cipher_name = g_strdup (gnutls_cipher_get_name (gnutls_cipher_get (session)));
+ for (char *c = cipher_name; *c != '\0'; c++)
+ {
+ if (*c == '-')
+ *c = '_';
+ }
+
+ result = g_strdup_printf ("TLS_%s_%s",
+ cipher_name,
+ gnutls_digest_get_name (gnutls_prf_hash_get (session)));
+ g_free (cipher_name);
+
+ return result;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]