diff options
author | Werner Koch <wk@gnupg.org> | 2018-01-10 17:07:11 +0100 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2018-01-10 17:07:11 +0100 |
commit | 4e2ba546cdccbbc6d3e29867ee5671fd44d74e67 (patch) | |
tree | ed822c35d3c88ba22a4754e2765a02a928e1a6ef /g10/sign.c | |
parent | gpg: Add option and preference framework for AEAD. (diff) | |
download | gnupg2-4e2ba546cdccbbc6d3e29867ee5671fd44d74e67.tar.xz gnupg2-4e2ba546cdccbbc6d3e29867ee5671fd44d74e67.zip |
gpg: New option --force-aead
* g10/dek.h (DEK): Turn fields use_mdc, algo_printed and symmetric
into single bit vars. Make sure they are always set to 1 or 0.
(DEK): New field use_aead.
* g10/options.h (struct opt): New field force_aead.
* g10/pkclist.c (select_aead_from_pklist): New.
* g10/gpg.c (oForceAEAD): New const.
(opts): New options "--force-aead".
(main): Set new option.
* g10/encrypt.c (use_aead): New.
(encrypt_simple): Implement new flags DEK.use_aead.
(encrypt_crypt): Ditto.
(encrypt_filter): Ditto.
* g10/sign.c (sign_symencrypt_file): Ditto.
--
This patch should be enough to detect whether AEAD can be used.
Not tested.
Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'g10/sign.c')
-rw-r--r-- | g10/sign.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/g10/sign.c b/g10/sign.c index 4cf0cd39a..f8a1241a6 100644 --- a/g10/sign.c +++ b/g10/sign.c @@ -1337,7 +1337,10 @@ sign_symencrypt_file (ctrl_t ctrl, const char *fname, strlist_t locusr) goto leave; } - cfx.dek->use_mdc = use_mdc (NULL, cfx.dek->algo); + if (use_aead (NULL, cfx.dek->algo)) + cfx.dek->use_aead = 1; + else + cfx.dek->use_mdc = !!use_mdc (NULL, cfx.dek->algo); /* now create the outfile */ rc = open_outfile (-1, fname, opt.armor? 1:0, 0, &out); @@ -1381,7 +1384,7 @@ sign_symencrypt_file (ctrl_t ctrl, const char *fname, strlist_t locusr) /* Push the compress filter */ if (default_compress_algo()) { - if (cfx.dek && cfx.dek->use_mdc) + if (cfx.dek && (cfx.dek->use_mdc || cfx.dek->use_aead)) zfx.new_ctb = 1; push_compress_filter (out, &zfx,default_compress_algo() ); } |