summaryrefslogtreecommitdiffstats
path: root/sm/gpgsm.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2021-06-02 11:03:55 +0200
committerWerner Koch <wk@gnupg.org>2021-06-02 11:03:55 +0200
commit4980fb3c6dde8c1dda975e8a36d6086c8456a631 (patch)
treed5a1dd07d15256549159f8a20b1617fc6ee7122a /sm/gpgsm.c
parenttests: Rename subdir gpgsm to cms and move sample dirs. (diff)
downloadgnupg2-4980fb3c6dde8c1dda975e8a36d6086c8456a631.tar.xz
gnupg2-4980fb3c6dde8c1dda975e8a36d6086c8456a631.zip
sm: Support AES-GCM decryption.
* tests/cms/samplemsgs/: Add sample messages. * sm/gpgsm.c (main): Use gpgrt_fcancel on decryption error. * sm/decrypt.c (decrypt_gcm_filter): New. (gpgsm_decrypt): Use this filter if requested. Check authtag. -- Note that the sample message pwri-sample.gcm.p7m is broken: The authtag is duplicated to the authEncryptedContentInfo. I used a temporary code during testing hack to that test message out.
Diffstat (limited to 'sm/gpgsm.c')
-rw-r--r--sm/gpgsm.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sm/gpgsm.c b/sm/gpgsm.c
index f488eb5e8..3c6fe9c76 100644
--- a/sm/gpgsm.c
+++ b/sm/gpgsm.c
@@ -2065,13 +2065,16 @@ main ( int argc, char **argv)
set_binary (stdin);
if (!argc)
- gpgsm_decrypt (&ctrl, 0, fp); /* from stdin */
+ err = gpgsm_decrypt (&ctrl, 0, fp); /* from stdin */
else if (argc == 1)
- gpgsm_decrypt (&ctrl, open_read (*argv), fp); /* from file */
+ err = gpgsm_decrypt (&ctrl, open_read (*argv), fp); /* from file */
else
wrong_args ("--decrypt [filename]");
- es_fclose (fp);
+ if (err)
+ gpgrt_fcancel (fp);
+ else
+ es_fclose (fp);
}
break;