From c771963140cad7c1c25349bcde27e427effc0058 Mon Sep 17 00:00:00 2001 From: NIIBE Yutaka Date: Tue, 19 May 2015 10:32:07 +0900 Subject: [PATCH] g10: detects public key encryption packet error properly. g10/mainproc.c (proc_pubkey_enc): Only allow relevant algorithms for encryption. --- g10/mainproc.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/g10/mainproc.c b/g10/mainproc.c index e72d07640..c90b9e333 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.