[PATCH] g10: detects public key encryption packet error properly
    NIIBE Yutaka 
    gniibe at fsij.org
       
    Fri May  8 04:26:06 CEST 2015
    
    
  
Hello,
I come up to this fix while looking the bug report:
https://bugs.debian.org/638619
The detection of public key encryption packet error should be done
earlier in mainproc.c.
I think that in gpg14/gpg20 we had the line:
             || enc->pubkey_algo == PUBKEY_ALGO_DSA
and simply it was extended it to ECDSA and EDDSA, but those algorithms
are irrelevant for encryption.
diff --git a/g10/mainproc.c b/g10/mainproc.c
index e72d076..c90b9e3 100644
--- a/g10/mainproc.c
+++ b/g10/mainproc.c
@@ -406,12 +406,10 @@ proc_pubkey_enc (CTX c, PACKET *pkt)
           c->dek = NULL;
 	}
     }
-  else if (is_ELGAMAL(enc->pubkey_algo)
-           || enc->pubkey_algo == PUBKEY_ALGO_DSA
-           || enc->pubkey_algo == PUBKEY_ALGO_ECDSA
-           || enc->pubkey_algo == PUBKEY_ALGO_EDDSA
+  else if (enc->pubkey_algo == PUBKEY_ALGO_ELGAMAL_E
            || enc->pubkey_algo == PUBKEY_ALGO_ECDH
-           || is_RSA (enc->pubkey_algo)
+           || enc->pubkey_algo == PUBKEY_ALGO_RSA
+           || enc->pubkey_algo == PUBKEY_ALGO_RSA_E
            || enc->pubkey_algo == PUBKEY_ALGO_ELGAMAL)
     {
       /* Note that we also allow type 20 Elgamal keys for decryption.
-- 
    
    
More information about the Gnupg-devel
mailing list