From 465ea9116d1f9467814143ed35b515034a849e86 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Wed, 5 Jun 2024 10:00:38 +0200 Subject: gpg: Autoload designated revoker key and ADSK when needed. * g10/options.h (opt): Move the definition of struct akl to global scope. * g10/keydb.h (enum get_pubkey_modes): Add GET_PUBKEY_TRY_LDAP. * g10/getkey.c (get_pubkey_byname): Implement GET_PUBKEY_BYNAME. * g10/keygen.c (prepare_desig_revoker): Use it here. (prepare_adsk): and here. -- The revoker key is required before we create it along with a new key. This is because the we need to know the algo and also to make sure that the key really exists. GnuPG-bug-id: 7133 --- g10/options.h | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) (limited to 'g10/options.h') diff --git a/g10/options.h b/g10/options.h index 3edcf2f21..053af915f 100644 --- a/g10/options.h +++ b/g10/options.h @@ -41,6 +41,26 @@ struct keyserver_spec }; typedef struct keyserver_spec *keyserver_spec_t; +/* The --auto-key-locate mechanisms object. */ +struct akl +{ + enum { + AKL_NODEFAULT, + AKL_LOCAL, + AKL_CERT, + AKL_PKA, + AKL_DANE, + AKL_WKD, + AKL_LDAP, + AKL_NTDS, + AKL_KEYSERVER, + AKL_SPEC + } type; + keyserver_spec_t spec; + struct akl *next; +}; + + /* Global options for GPG. */ EXTERN_UNLESS_MAIN_MODULE @@ -290,23 +310,7 @@ struct /* Linked list of ways to find a key if the key isn't on the local keyring. */ - struct akl - { - enum { - AKL_NODEFAULT, - AKL_LOCAL, - AKL_CERT, - AKL_PKA, - AKL_DANE, - AKL_WKD, - AKL_LDAP, - AKL_NTDS, - AKL_KEYSERVER, - AKL_SPEC - } type; - keyserver_spec_t spec; - struct akl *next; - } *auto_key_locate; + struct akl *auto_key_locate; /* The value of --key-origin. See parse_key_origin(). */ int key_origin; @@ -327,6 +331,7 @@ struct unsigned int compat_flags; } opt; + /* CTRL is used to keep some global variables we currently can't avoid. Future concurrent versions of gpg will put it into a per request structure CTRL. */ -- cgit v1.2.3