]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
x509/output: print the extension name of TLSFeatures
authorNikos Mavrogiannopoulos <nmav@redhat.com>
Mon, 30 May 2016 08:45:46 +0000 (10:45 +0200)
committerNikos Mavrogiannopoulos <nmav@redhat.com>
Mon, 30 May 2016 08:45:46 +0000 (10:45 +0200)
lib/extensions.c
lib/extensions.h
lib/x509/output.c

index b498e5efb0f788632178a56b7b095c3abe57d4c0..a2bc732e88ed2eb19297ede2606ed857e3a25053 100644 (file)
@@ -136,7 +136,7 @@ static gnutls_ext_unpack_func _gnutls_ext_func_unpack(uint16_t type)
 }
 
 
-static const char *_gnutls_extension_get_name(uint16_t type)
+const char *_gnutls_extension_get_name(uint16_t type)
 {
        size_t i;
 
index 7ef1b647829683903cadf5490c156e7cade800dc..bd78c2e06953b4a2289a8df2020e0db5cb543a34 100644 (file)
@@ -88,4 +88,6 @@ typedef struct {
 
 int _gnutls_ext_register(extension_entry_st *);
 
+const char *_gnutls_extension_get_name(uint16_t type);
+
 #endif
index e63ca2d6d3c5eb2f50c1ac6c158aec04b22c6816..9258225e82475da2c6e9f67da152877a41c9ed4c 100644 (file)
@@ -33,6 +33,7 @@
 #include <extras/randomart.h>
 #include <c-ctype.h>
 #include <gnutls-idna.h>
+#include "extensions.h"
 
 #ifdef HAVE_INET_NTOP
 # include <arpa/inet.h>
@@ -885,6 +886,7 @@ static void print_tlsfeatures(gnutls_buffer_st * str, const char *prefix, const
        int err;
        int seq;
        gnutls_x509_tlsfeatures_t features;
+       const char *name;
        unsigned int feature;
 
        err = gnutls_x509_tlsfeatures_init(&features);
@@ -908,7 +910,11 @@ static void print_tlsfeatures(gnutls_buffer_st * str, const char *prefix, const
                        goto cleanup;
                }
 
-               addf(str, "%s\t\t\t%u\n", prefix, feature);
+               name = _gnutls_extension_get_name(feature);
+               if (name == NULL)
+                       addf(str, "%s\t\t\t%u\n", prefix, feature);
+               else
+                       addf(str, "%s\t\t\t%s(%u)\n", prefix, name, feature);
        }
 
 cleanup: