mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
gpg: Add option and preference framework for AEAD.
* common/openpgpdefs.h (aead_algo_t): New. (SIGSUBPKT_PREF_AEAD): New. * g10/gpg.c (oAEADAlgo, oPersonalAEADPreferences): New. (opts): New options --aead-algo and --personal-aead-preferences. (set_compliance_option): Clar aead algo. (main): Parse and check the new options * g10/options.h (struct opt): Add fields def_aead_algo and personal_aead_prefs. * g10/packet.h (PREFTYPE_AEAD): New enum value. (PKT_user_id): Add field flags.aead. (PKT_public_key): Add field flags.aead. * g10/pkclist.c (select_algo_from_prefs): Support PREFTYPE_AEAD. * g10/getkey.c (fixup_uidnode): Set AEAD flag. (merge_selfsigs): Ditto. * g10/kbnode.c (dump_kbnode): Show aead flag. * g10/keyedit.c (show_prefs): Ditto. (show_key_with_all_names_colon): Ditto. * g10/keygen.c (aead_presf, n_aead_prefs): New vars. (set_one_pref): Suppport PREFTYPE_AEAD. (keygen_set_std_prefs): Parse AEAD preferences. (keygen_get_std_prefs): Ditto. (add_feature_aead): New. (keygen_upd_std_prefs): Call that and build AEAD pref packet. * g10/main.h (DEFAULT_AEAD_ALGO): New const. * g10/misc.c (openpgp_aead_test_algo): New. (openpgp_aead_algo_name): New. (string_to_aead_algo): New. (default_aead_algo): New. -- This is only used in --rfc4880bis mode and not really tested. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
945381c4c2
commit
8217cd4936
11 changed files with 287 additions and 16 deletions
11
g10/getkey.c
11
g10/getkey.c
|
@ -2539,6 +2539,12 @@ fixup_uidnode (KBNODE uidnode, KBNODE signode, u32 keycreated)
|
|||
if (p && n && (p[0] & 0x01))
|
||||
uid->flags.mdc = 1;
|
||||
|
||||
/* See whether we have the AEAD feature. */
|
||||
uid->flags.aead = 0;
|
||||
p = parse_sig_subpkt (sig->hashed, SIGSUBPKT_FEATURES, &n);
|
||||
if (p && n && (p[0] & 0x01))
|
||||
uid->flags.aead = 1;
|
||||
|
||||
/* And the keyserver modify flag. */
|
||||
uid->flags.ks_modify = 1;
|
||||
p = parse_sig_subpkt (sig->hashed, SIGSUBPKT_KS_FLAGS, &n);
|
||||
|
@ -3357,6 +3363,7 @@ merge_selfsigs (ctrl_t ctrl, kbnode_t keyblock)
|
|||
PKT_public_key *main_pk;
|
||||
prefitem_t *prefs;
|
||||
unsigned int mdc_feature;
|
||||
unsigned int aead_feature;
|
||||
|
||||
if (keyblock->pkt->pkttype != PKT_PUBLIC_KEY)
|
||||
{
|
||||
|
@ -3418,7 +3425,7 @@ merge_selfsigs (ctrl_t ctrl, kbnode_t keyblock)
|
|||
* all preferences.
|
||||
* Do a similar thing for the MDC feature flag. */
|
||||
prefs = NULL;
|
||||
mdc_feature = 0;
|
||||
mdc_feature = aead_feature = 0;
|
||||
for (k = keyblock; k && k->pkt->pkttype != PKT_PUBLIC_SUBKEY; k = k->next)
|
||||
{
|
||||
if (k->pkt->pkttype == PKT_USER_ID
|
||||
|
@ -3427,6 +3434,7 @@ merge_selfsigs (ctrl_t ctrl, kbnode_t keyblock)
|
|||
{
|
||||
prefs = k->pkt->pkt.user_id->prefs;
|
||||
mdc_feature = k->pkt->pkt.user_id->flags.mdc;
|
||||
aead_feature = k->pkt->pkt.user_id->flags.aead;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -3440,6 +3448,7 @@ merge_selfsigs (ctrl_t ctrl, kbnode_t keyblock)
|
|||
xfree (pk->prefs);
|
||||
pk->prefs = copy_prefs (prefs);
|
||||
pk->flags.mdc = mdc_feature;
|
||||
pk->flags.aead = aead_feature;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue