gnutls-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU gnutls branch, master, updated. gnutls_3_0_9-24-ga574013


From: Nikos Mavrogiannopoulos
Subject: [SCM] GNU gnutls branch, master, updated. gnutls_3_0_9-24-ga574013
Date: Wed, 28 Dec 2011 18:41:11 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU gnutls".

http://git.savannah.gnu.org/cgit/gnutls.git/commit/?id=a5740135b13ca5bf9bfbd43ce707b59fe45bb5f4

The branch, master has been updated
       via  a5740135b13ca5bf9bfbd43ce707b59fe45bb5f4 (commit)
       via  72522be784257dfaea1e204b5a80ffa14d509dad (commit)
      from  76f2856a51f4cae238aa3117e03ac7a8204dff9f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit a5740135b13ca5bf9bfbd43ce707b59fe45bb5f4
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Wed Dec 28 20:41:03 2011 +0200

    more files to ignore

commit 72522be784257dfaea1e204b5a80ffa14d509dad
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Wed Dec 28 20:40:25 2011 +0200

    print randomart for private keys as well.

-----------------------------------------------------------------------

Summary of changes:
 .gitignore             |    1 +
 lib/extras/randomart.c |    4 ++--
 lib/extras/randomart.h |    4 ++--
 lib/gnutls_ui.c        |    2 +-
 lib/openpgp/output.c   |    4 ++--
 lib/x509/output.c      |    4 ++--
 src/certtool.c         |   27 ++++++++++++++++++++++-----
 7 files changed, 32 insertions(+), 14 deletions(-)

diff --git a/.gitignore b/.gitignore
index f06f9f3..001e106 100644
--- a/.gitignore
+++ b/.gitignore
@@ -334,6 +334,7 @@ lib/accelerated/x86/libx86.la
 lib/algorithms/libgnutls_alg.la
 lib/auth/libgnutls_auth.la
 lib/ext/libgnutls_ext.la
+lib/extras/libgnutls_extras.la
 lib/gcrypt/libcrypto.la
 lib/gnutls-api.texi
 lib/gnutls.pc
diff --git a/lib/extras/randomart.c b/lib/extras/randomart.c
index cf8d72e..bb267fc 100644
--- a/lib/extras/randomart.c
+++ b/lib/extras/randomart.c
@@ -62,8 +62,8 @@
 #define        FLDSIZE_Y       (FLDBASE + 1)
 #define        FLDSIZE_X       (FLDBASE * 2 + 1)
 char *
-key_fingerprint_randomart (uint8_t * dgst_raw, u_int dgst_raw_len,
-                           const char *key_type, unsigned int key_size)
+_gnutls_key_fingerprint_randomart (uint8_t * dgst_raw, u_int dgst_raw_len,
+                                   const char *key_type, unsigned int key_size)
 {
   /*
    * Chars to be used after each other every time the worm
diff --git a/lib/extras/randomart.h b/lib/extras/randomart.h
index 77d912b..51875ac 100644
--- a/lib/extras/randomart.h
+++ b/lib/extras/randomart.h
@@ -1,3 +1,3 @@
 char *
-key_fingerprint_randomart (uint8_t * dgst_raw, u_int dgst_raw_len,
-                           const char *key_type, unsigned int key_size);
+_gnutls_key_fingerprint_randomart (uint8_t * dgst_raw, u_int dgst_raw_len,
+                                   const char *key_type, unsigned int 
key_size);
diff --git a/lib/gnutls_ui.c b/lib/gnutls_ui.c
index 6205a91..87b9f99 100644
--- a/lib/gnutls_ui.c
+++ b/lib/gnutls_ui.c
@@ -60,7 +60,7 @@ int gnutls_random_art (gnutls_random_art_t type,
   if (type != GNUTLS_RANDOM_ART_OPENSSH)
     return gnutls_assert_val(GNUTLS_E_INVALID_REQUEST);
 
-  art->data = key_fingerprint_randomart(fpr, fpr_size, key_type, key_size);
+  art->data = _gnutls_key_fingerprint_randomart(fpr, fpr_size, key_type, 
key_size);
   if (art->data == NULL)
     return gnutls_assert_val(GNUTLS_E_MEMORY_ERROR);
   
diff --git a/lib/openpgp/output.c b/lib/openpgp/output.c
index defcf95..af1dd3b 100644
--- a/lib/openpgp/output.c
+++ b/lib/openpgp/output.c
@@ -123,11 +123,11 @@ print_key_fingerprint (gnutls_buffer_st * str, 
gnutls_openpgp_crt_t cert)
   if (name == NULL)
     return;
 
-  p = key_fingerprint_randomart(fpr, fpr_size, name, bits);
+  p = _gnutls_key_fingerprint_randomart(fpr, fpr_size, name, bits);
   if (p == NULL)
     return;
   
-  adds (str, _("\trandomart:\n"));
+  adds (str, _("\tpublic key's randomart:\n"));
   adds (str, p);
   adds (str, "\n");
 
diff --git a/lib/x509/output.c b/lib/x509/output.c
index 204c7bd..1f97b9b 100644
--- a/lib/x509/output.c
+++ b/lib/x509/output.c
@@ -1375,11 +1375,11 @@ print_fingerprint (gnutls_buffer_st * str, 
gnutls_x509_crt_t cert,
   if (name == NULL)
     return;
 
-  p = key_fingerprint_randomart(buffer, size, name, bits);
+  p = _gnutls_key_fingerprint_randomart(buffer, size, name, bits);
   if (p == NULL)
     return;
   
-  adds (str, _("\trandomart:\n"));
+  adds (str, _("\tpublic key's randomart:\n"));
   adds (str, p);
   adds (str, "\n\n");
 
diff --git a/src/certtool.c b/src/certtool.c
index 110fdeb..89131b8 100644
--- a/src/certtool.c
+++ b/src/certtool.c
@@ -1618,7 +1618,7 @@ crq_info (void)
 
 static void privkey_info_int (gnutls_x509_privkey_t key)
 {
-int ret;
+int ret, key_type, bits = 0;
 size_t size;
 const char *cprint;
 
@@ -1628,14 +1628,16 @@ const char *cprint;
   ret = gnutls_x509_privkey_get_pk_algorithm (key);
   fprintf (outfile, "\tPublic Key Algorithm: ");
 
-  cprint = gnutls_pk_algorithm_get_name (ret);
+  key_type = ret;
+
+  cprint = gnutls_pk_algorithm_get_name (key_type);
   fprintf (outfile, "%s\n", cprint ? cprint : "Unknown");
   fprintf (outfile, "\tKey Security Level: %s\n\n",
            gnutls_sec_param_get_name (gnutls_x509_privkey_sec_param (key)));
 
   /* Print the raw public and private keys
    */
-  if (ret == GNUTLS_PK_RSA)
+  if (key_type == GNUTLS_PK_RSA)
     {
       gnutls_datum_t m, e, d, p, q, u, exp1, exp2;
 
@@ -1648,6 +1650,8 @@ const char *cprint;
       else
         {
           print_rsa_pkey (&m, &e, &d, &p, &q, &u, &exp1, &exp2);
+          bits = m.size * 8;
+
           gnutls_free (m.data);
           gnutls_free (e.data);
           gnutls_free (d.data);
@@ -1658,7 +1662,7 @@ const char *cprint;
           gnutls_free (exp2.data);
         }
     }
-  else if (ret == GNUTLS_PK_DSA)
+  else if (key_type == GNUTLS_PK_DSA)
     {
       gnutls_datum_t p, q, g, y, x;
 
@@ -1669,6 +1673,8 @@ const char *cprint;
       else
         {
           print_dsa_pkey (&x, &y, &p, &q, &g);
+          bits = y.size * 8;
+
           gnutls_free (x.data);
           gnutls_free (y.data);
           gnutls_free (p.data);
@@ -1676,7 +1682,7 @@ const char *cprint;
           gnutls_free (g.data);
         }
     }
-  else if (ret == GNUTLS_PK_ECC)
+  else if (key_type == GNUTLS_PK_ECC)
     {
       gnutls_datum_t y, x, k;
       gnutls_ecc_curve_t curve;
@@ -1688,6 +1694,8 @@ const char *cprint;
       else
         {
           print_ecc_pkey (curve, &k, &x, &y);
+          bits = gnutls_ecc_curve_get_size(curve);
+
           gnutls_free (x.data);
           gnutls_free (y.data);
           gnutls_free (k.data);
@@ -1704,7 +1712,16 @@ const char *cprint;
     }
   else
     {
+      gnutls_datum_t art;
+
       fprintf (outfile, "Public Key ID: %s\n", raw_to_string (buffer, size));
+      
+      ret = gnutls_random_art(GNUTLS_RANDOM_ART_OPENSSH, cprint, bits, buffer, 
size, &art);
+      if (ret >= 0)
+        {
+          fprintf (outfile, "public key's randomart:\n%s\n", art.data);
+          gnutls_free(art.data);
+        }
     }
   fprintf (outfile, "\n");
 


hooks/post-receive
-- 
GNU gnutls



reply via email to

[Prev in Thread] Current Thread [Next in Thread]