summaryrefslogtreecommitdiffstats
path: root/g10/mainproc.c
diff options
context:
space:
mode:
Diffstat (limited to 'g10/mainproc.c')
-rw-r--r--g10/mainproc.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/g10/mainproc.c b/g10/mainproc.c
index 5689d73a8..d2ceec2fd 100644
--- a/g10/mainproc.c
+++ b/g10/mainproc.c
@@ -615,6 +615,14 @@ static void
proc_encrypted (CTX c, PACKET *pkt)
{
int result = 0;
+ int early_plaintext = literals_seen;
+
+ if (early_plaintext)
+ {
+ log_info (_("WARNING: multiple plaintexts seen\n"));
+ write_status_errcode ("decryption.early_plaintext", GPG_ERR_BAD_DATA);
+ /* We fail only later so that we can print some more info first. */
+ }
if (!opt.quiet)
{
@@ -734,6 +742,10 @@ proc_encrypted (CTX c, PACKET *pkt)
if (!result)
result = decrypt_data (c->ctrl, c, pkt->pkt.encrypted, c->dek );
+ /* Trigger the deferred error. */
+ if (!result && early_plaintext)
+ result = gpg_error (GPG_ERR_BAD_DATA);
+
if (result == -1)
;
else if (!result