mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
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>
This commit is contained in:
parent
8217cd4936
commit
4e2ba546cd
8 changed files with 120 additions and 20 deletions
|
@ -1651,6 +1651,31 @@ select_mdc_from_pklist (PK_LIST pk_list)
|
|||
}
|
||||
|
||||
|
||||
/* Select the AEAD flag from the pk_list. We can only use AEAD if all
|
||||
* recipients support this feature. Returns true if AEAD can be used. */
|
||||
int
|
||||
select_aead_from_pklist (PK_LIST pk_list)
|
||||
{
|
||||
pk_list_t pkr;
|
||||
int aead;
|
||||
|
||||
if (!pk_list)
|
||||
return 0;
|
||||
|
||||
for (pkr = pk_list; pkr; pkr = pkr->next)
|
||||
{
|
||||
if (pkr->pk->user_id) /* selected by user ID */
|
||||
aead = pkr->pk->user_id->flags.aead;
|
||||
else
|
||||
aead = pkr->pk->flags.aead;
|
||||
if (!aead)
|
||||
return 0; /* At least one recipient does not support it. */
|
||||
}
|
||||
|
||||
return 1; /* Can be used. */
|
||||
}
|
||||
|
||||
|
||||
/* Print a warning for all keys in PK_LIST missing the MDC feature. */
|
||||
void
|
||||
warn_missing_mdc_from_pklist (PK_LIST pk_list)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue