gpg: Fix hash detection for ECDSA.
authorWerner Koch <wk@gnupg.org>
Wed, 19 Nov 2014 09:34:32 +0000 (10:34 +0100)
committerWerner Koch <wk@gnupg.org>
Thu, 20 Nov 2014 19:09:17 +0000 (20:09 +0100)
* g10/sign.c (sign_file): Use DSA or ECDSA and not DSA|EdDSA.
--

This error was introduced with
commit b7f8dec6325f1c80640f878ed3080bbc194fbc78
while separating EdDSA from ECDSA.

Found due to a related bug report from Brian Minton.

Signed-off-by: Werner Koch <wk@gnupg.org>
g10/sign.c

index e7d4a68..2e62f04 100644 (file)
@@ -899,13 +899,12 @@ sign_file (ctrl_t ctrl, strlist_t filenames, int detached, strlist_t locusr,
            for (sk_rover = sk_list; sk_rover; sk_rover = sk_rover->next )
              {
                if (sk_rover->pk->pubkey_algo == PUBKEY_ALGO_DSA
-                    || (sk_rover->pk->pubkey_algo == PUBKEY_ALGO_EDDSA
-                        && !openpgp_oid_is_ed25519 (sk_rover->pk->pkey[1])))
+                    || sk_rover->pk->pubkey_algo == PUBKEY_ALGO_ECDSA)
                  {
                    int temp_hashlen = (gcry_mpi_get_nbits
                                         (sk_rover->pk->pkey[1]));
 
-                   if (sk_rover->pk->pubkey_algo == PUBKEY_ALGO_EDDSA)
+                   if (sk_rover->pk->pubkey_algo == PUBKEY_ALGO_ECDSA)
                      temp_hashlen = ecdsa_qbits_from_Q (temp_hashlen);
                    temp_hashlen = (temp_hashlen+7)/8;
 
@@ -915,7 +914,7 @@ sign_file (ctrl_t ctrl, strlist_t filenames, int detached, strlist_t locusr,
                    if (hint.digest_length<temp_hashlen)
                      hint.digest_length=temp_hashlen;
                  }
-                /* FIXME: need toall gpg-agent */
+                /* FIXME: need to check gpg-agent for this. */
                /* else if (sk_rover->pk->is_protected */
                 /*          && sk_rover->pk->protect.s2k.mode == 1002) */
                /*   smartcard = 1;  */