[PATCH] Fix subkey curve names in --with-colons' output.

Guilhem Moulin guilhem at fripost.org
Tue Feb 2 18:39:51 CET 2016


`gpg --with-colons --list-keys` incorrectly shows the master key's curve
name (or the empty string for non EC master keys) in the 17th field of
"sub" records.

  ~$ gpg2 --list-key 0x0F67969E7F63B344 | grep '^[sp]ub\s'
  pub   rsa2048/7F63B344 2016-02-02 [SC]
  sub   ed25519/6A4AD152 2016-02-02 [S]

  ~$ gpg2 --with-colons --list-key 0x0F67969E7F63B344 | grep '^[sp]ub:'
  pub:u:2048:1:0F67969E7F63B344:1454434424:::u:::scSC:::::::
  sub:u:256:22:443734DA6A4AD152:1454434438::::::s::::::
---
 g10/keylist.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/g10/keylist.c b/g10/keylist.c
index d71bf4f..84ce61d 100644
--- a/g10/keylist.c
+++ b/g10/keylist.c
@@ -1588,11 +1588,11 @@ list_keyblock_colon (KBNODE keyblock, int secret, int has_secret, int fpr)
             }
           es_putc (':', es_stdout);	/* End of field 15. */
           es_putc (':', es_stdout);	/* End of field 16. */
-          if (pk->pubkey_algo == PUBKEY_ALGO_ECDSA
-              || pk->pubkey_algo == PUBKEY_ALGO_EDDSA
-              || pk->pubkey_algo == PUBKEY_ALGO_ECDH)
+          if (pk2->pubkey_algo == PUBKEY_ALGO_ECDSA
+              || pk2->pubkey_algo == PUBKEY_ALGO_EDDSA
+              || pk2->pubkey_algo == PUBKEY_ALGO_ECDH)
             {
-              char *curve = openpgp_oid_to_str (pk->pkey[0]);
+              char *curve = openpgp_oid_to_str (pk2->pkey[0]);
               const char *name = openpgp_oid_to_curve (curve, 0);
               if (!name)
                 name = curve;
-- 
2.7.0




More information about the Gnupg-devel mailing list