GNUPG-1-9-BRANCH gnupg/agent (ChangeLog command-ssh.c)

cvs user mo cvs at cvs.gnupg.org
Thu May 5 16:39:36 CEST 2005


    Date: Thursday, May 5, 2005 @ 16:57:59
  Author: mo
    Path: /cvs/gnupg/gnupg/agent
     Tag: GNUPG-1-9-BRANCH

Modified: ChangeLog command-ssh.c

2005-05-05  Moritz Schulte  <moritz at g10code.com>

	* command-ssh.c: Use ssh_key_grip(), where
        gcry_pk_get_keygrip() has been used before.
	(ssh_handler_sign_request): Removed unusued variable P.


---------------+
 ChangeLog     |    3 ++
 command-ssh.c |   60 +++++++++++++++++++++++++++-----------------------------
 2 files changed, 32 insertions(+), 31 deletions(-)


Index: gnupg/agent/ChangeLog
diff -u gnupg/agent/ChangeLog:1.59.2.76 gnupg/agent/ChangeLog:1.59.2.77
--- gnupg/agent/ChangeLog:1.59.2.76	Thu May  5 16:49:53 2005
+++ gnupg/agent/ChangeLog	Thu May  5 16:57:59 2005
@@ -3,6 +3,9 @@
 	* command-ssh.c (ssh_key_to_buffer): Rename to ...
 	(ssh_key_to_protected_buffer): ... this; change callers.
 	Improved documentation.
+	Use ssh_key_grip(), where gcry_pk_get_keygrip() has been used
+	before.
+	(ssh_handler_sign_request): Removed unusued variable P.
 
 2005-04-20  Moritz Schulte  <moritz at g10code.com>
 
Index: gnupg/agent/command-ssh.c
diff -u gnupg/agent/command-ssh.c:1.1.4.19 gnupg/agent/command-ssh.c:1.1.4.20
--- gnupg/agent/command-ssh.c:1.1.4.19	Thu May  5 16:49:54 2005
+++ gnupg/agent/command-ssh.c	Thu May  5 16:57:59 2005
@@ -1531,6 +1531,26 @@
 
 
 
+/* This function calculates the key grip for the key contained in the
+   S-Expression KEY and writes it to BUFFER, which must be large
+   enough to hold it.  Returns usual error code.  */
+static gpg_error_t
+ssh_key_grip (gcry_sexp_t key, char *buffer)
+{
+  gpg_error_t err;
+  char *p;
+
+  /* FIXME: unsigned vs. signed.  */
+  
+  p = gcry_pk_get_keygrip (key, buffer);
+  if (! p)
+    err = gpg_error (GPG_ERR_INTERNAL);	/* FIXME?  */
+  else
+    err = 0;
+
+  return err;
+}
+
 /* Converts the secret key KEY_SECRET into a public key, storing it in
    KEY_PUBLIC.  SPEC is the according key specification.  Returns zero
    on success or an error code.  */
@@ -1643,14 +1663,16 @@
       xfree (serialno);
       return err;
     }
-  
-  if ( !gcry_pk_get_keygrip (s_pk, grip) )
+
+  err = ssh_key_grip (s_pk, grip);
+  if (err)
     {
-      log_debug ("error computing keygrip from received card key\n");
+      log_debug ("error computing keygrip from received card key: %s\n",
+		 gcry_strerror (err));
       xfree (pkbuf);
       gcry_sexp_release (s_pk);
       xfree (serialno);
-      return gpg_error (GPG_ERR_INTERNAL);
+      return err;
     }
 
   if ( agent_key_available (grip) )
@@ -1941,26 +1963,6 @@
   return ret_err;
 }
 
-/* This function calculates the key grip for the key contained in the
-   S-Expression KEY and writes it to BUFFER, which must be large
-   enough to hold it.  Returns usual error code.  */
-static gpg_error_t
-ssh_key_grip (gcry_sexp_t key, char *buffer)
-{
-  gpg_error_t err;
-  char *p;
-
-  /* FIXME: unsigned vs. signed.  */
-  
-  p = gcry_pk_get_keygrip (key, buffer);
-  if (! p)
-    err = gpg_error (GPG_ERR_INTERNAL);	/* FIXME?  */
-  else
-    err = 0;
-
-  return err;
-}
-
 /* This function hashes the data contained in DATA of size DATA_N
    according to the message digest algorithm specified by MD_ALGORITHM
    and writes the message digest to HASH, which needs to large enough
@@ -2151,7 +2153,6 @@
   size_t sig_n;
   u32 data_size;
   u32 flags;
-  void *p;
   gpg_error_t err;
   gpg_error_t ret_err;
 
@@ -2192,12 +2193,9 @@
     goto out;
 
   /* Calculate key grip.  */
-  p = gcry_pk_get_keygrip (key, key_grip);
-  if (! p)
-    {
-      err = gpg_error (GPG_ERR_INTERNAL); /* FIXME?  */
-      goto out;
-    }
+  err = ssh_key_grip (key, key_grip);
+  if (err)
+    goto out;
 
   /* Sign data.  */
 




More information about the Gnupg-commits mailing list