aboutsummaryrefslogtreecommitdiffstats
path: root/g10/pkclist.c
diff options
context:
space:
mode:
Diffstat (limited to 'g10/pkclist.c')
-rw-r--r--g10/pkclist.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/g10/pkclist.c b/g10/pkclist.c
index 581cae407..6ec5537f5 100644
--- a/g10/pkclist.c
+++ b/g10/pkclist.c
@@ -1468,9 +1468,12 @@ select_algo_from_prefs(PK_LIST pk_list, int preftype,
support. All this doesn't mean IDEA is actually
available, of course. */
implicit=CIPHER_ALGO_3DES;
-
break;
+ case PREFTYPE_AEAD:
+ /* No implicit algo. */
+ break;
+
case PREFTYPE_HASH:
/* While I am including this code for completeness, note
that currently --pgp2 mode locks the hash at MD5, so this
@@ -1553,6 +1556,8 @@ select_algo_from_prefs(PK_LIST pk_list, int preftype,
prefs=NULL;
if(preftype==PREFTYPE_SYM && opt.personal_cipher_prefs)
prefs=opt.personal_cipher_prefs;
+ else if(preftype==PREFTYPE_AEAD && opt.personal_aead_prefs)
+ prefs=opt.personal_aead_prefs;
else if(preftype==PREFTYPE_HASH && opt.personal_digest_prefs)
prefs=opt.personal_digest_prefs;
else if(preftype==PREFTYPE_ZIP && opt.personal_compress_prefs)
@@ -1646,6 +1651,32 @@ 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 the AEAD to be used or 0
+ * if AEAD shall not be used. */
+aead_algo_t
+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 default_aead_algo (); /* Yes, AEAD 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)