]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
exported function to convert TLS extension numbers to strings
authorNikos Mavrogiannopoulos <nmav@redhat.com>
Mon, 30 May 2016 08:50:38 +0000 (10:50 +0200)
committerNikos Mavrogiannopoulos <nmav@redhat.com>
Mon, 30 May 2016 08:51:59 +0000 (10:51 +0200)
The exported function is gnutls_ext_get_name()

lib/extensions.c
lib/extensions.h
lib/includes/gnutls/gnutls.h.in
lib/libgnutls.map
lib/x509/output.c

index a2bc732e88ed2eb19297ede2606ed857e3a25053..988d9a4627230f6f61d472b8c96bffbc69cf5cf4 100644 (file)
@@ -1,5 +1,6 @@
 /*
- * Copyright (C) 2001-2012 Free Software Foundation, Inc.
+ * Copyright (C) 2001-2016 Free Software Foundation, Inc.
+ * Copyright (C) 2015-2016 Red Hat, Inc.
  *
  * Author: Nikos Mavrogiannopoulos, Simon Josefsson
  *
@@ -136,12 +137,21 @@ static gnutls_ext_unpack_func _gnutls_ext_func_unpack(uint16_t type)
 }
 
 
-const char *_gnutls_extension_get_name(uint16_t type)
+/**
+ * gnutls_ext_get_name:
+ * @ext: is a TLS extension numeric ID
+ *
+ * Convert a TLS extension numeric ID to a printable string.
+ *
+ * Returns: a pointer to a string that contains the name of the
+ *   specified cipher, or %NULL.
+ **/
+const char *gnutls_ext_get_name(unsigned int ext)
 {
        size_t i;
 
        for (i = 0; extfunc[i] != NULL; i++)
-               if (extfunc[i]->type == type)
+               if (extfunc[i]->type == ext)
                        return extfunc[i]->name;
 
        return NULL;
@@ -184,7 +194,7 @@ _gnutls_parse_extensions(gnutls_session_t session,
                        _gnutls_handshake_log
                            ("EXT[%d]: expecting extension '%s'\n",
                             session,
-                            _gnutls_extension_get_name(session->internals.
+                            gnutls_ext_get_name(session->internals.
                                                        extensions_sent
                                                        [i]));
                }
@@ -223,14 +233,14 @@ _gnutls_parse_extensions(gnutls_session_t session,
                if (ext_recv == NULL) {
                        _gnutls_handshake_log
                            ("EXT[%p]: Found extension '%s/%d'\n", session,
-                            _gnutls_extension_get_name(type), type);
+                            gnutls_ext_get_name(type), type);
 
                        continue;
                }
 
                _gnutls_handshake_log
                    ("EXT[%p]: Parsing extension '%s/%d' (%d bytes)\n",
-                    session, _gnutls_extension_get_name(type), type,
+                    session, gnutls_ext_get_name(type), type,
                     size);
 
                if ((ret = ext_recv(session, sdata, size)) < 0) {
index bd78c2e06953b4a2289a8df2020e0db5cb543a34..7ef1b647829683903cadf5490c156e7cade800dc 100644 (file)
@@ -88,6 +88,4 @@ typedef struct {
 
 int _gnutls_ext_register(extension_entry_st *);
 
-const char *_gnutls_extension_get_name(uint16_t type);
-
 #endif
index 3c6bd5be9d7f32d4efd1baf4639b03589bdac42d..0f35358d4066010b30b38923fb78ed5faa244258 100644 (file)
@@ -2515,6 +2515,8 @@ int gnutls_ext_register(const char *name, int type, gnutls_ext_parse_type_t pars
                                gnutls_ext_deinit_data_func deinit_func, gnutls_ext_pack_func pack_func,
                                gnutls_ext_unpack_func unpack_func);
 
+const char *gnutls_ext_get_name(unsigned int ext);
+
 /* Public supplemental data related functions */
 
 typedef int (*gnutls_supp_recv_func) (gnutls_session_t session,
index 32c9353a375b2afa9b2c6f6560f3a9e7f18b943b..1416504936f43dc109c7c18b3e804c37c0040c1e 100644 (file)
@@ -1096,6 +1096,7 @@ GNUTLS_3_4
        gnutls_x509_crt_set_tlsfeatures;
        gnutls_x509_crq_get_tlsfeatures;
        gnutls_x509_crq_set_tlsfeatures;
+       gnutls_ext_get_name;
  local:
        *;
 };
index 9258225e82475da2c6e9f67da152877a41c9ed4c..eeeb6e999b1b8525a5882369322a5087041c8711 100644 (file)
@@ -910,7 +910,7 @@ static void print_tlsfeatures(gnutls_buffer_st * str, const char *prefix, const
                        goto cleanup;
                }
 
-               name = _gnutls_extension_get_name(feature);
+               name = gnutls_ext_get_name(feature);
                if (name == NULL)
                        addf(str, "%s\t\t\t%u\n", prefix, feature);
                else