1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-01-18 14:17:03 +01:00

gpg: Remove unused parameter.

* g10/pkclist.c (build_pk_list): Remove parameter use, which is always
called set to PUBKEY_USAGE_ENC.  Update callers.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
This commit is contained in:
Neal H. Walfield 2015-12-18 13:26:40 +01:00
parent 4103850c2e
commit ffe0b7a6dd
4 changed files with 17 additions and 18 deletions

View File

@ -500,7 +500,7 @@ encrypt_crypt (ctrl_t ctrl, int filefd, const char *filename,
pk_list = provided_keys; pk_list = provided_keys;
else else
{ {
if ((rc = build_pk_list (ctrl, remusr, &pk_list, PUBKEY_USAGE_ENC))) if ((rc = build_pk_list (ctrl, remusr, &pk_list)))
{ {
release_progress_context (pfx); release_progress_context (pfx);
return rc; return rc;

View File

@ -373,8 +373,7 @@ void show_revocation_reason( PKT_public_key *pk, int mode );
int check_signatures_trust( PKT_signature *sig ); int check_signatures_trust( PKT_signature *sig );
void release_pk_list (PK_LIST pk_list); void release_pk_list (PK_LIST pk_list);
int build_pk_list (ctrl_t ctrl, int build_pk_list (ctrl_t ctrl, strlist_t rcpts, PK_LIST *ret_pk_list);
strlist_t rcpts, PK_LIST *ret_pk_list, unsigned use);
gpg_error_t find_and_check_key (ctrl_t ctrl, gpg_error_t find_and_check_key (ctrl_t ctrl,
const char *name, unsigned int use, const char *name, unsigned int use,
int mark_hidden, pk_list_t *pk_list_addr); int mark_hidden, pk_list_t *pk_list_addr);

View File

@ -893,15 +893,12 @@ find_and_check_key (ctrl_t ctrl, const char *name, unsigned int use,
Bit 0 (PK_LIST_ENCRYPT_TO): This is an encrypt-to recipient. Bit 0 (PK_LIST_ENCRYPT_TO): This is an encrypt-to recipient.
Bit 1 (PK_LIST_HIDDEN) : This is a hidden recipient. Bit 1 (PK_LIST_HIDDEN) : This is a hidden recipient.
USE is the desired use for the key - usually PUBKEY_USAGE_ENC.
On success a list of keys is stored at the address RET_PK_LIST; the On success a list of keys is stored at the address RET_PK_LIST; the
caller must free this list. On error the value at this address is caller must free this list. On error the value at this address is
not changed. not changed.
*/ */
int int
build_pk_list (ctrl_t ctrl, build_pk_list (ctrl_t ctrl, strlist_t rcpts, PK_LIST *ret_pk_list)
strlist_t rcpts, PK_LIST *ret_pk_list, unsigned int use )
{ {
PK_LIST pk_list = NULL; PK_LIST pk_list = NULL;
PKT_public_key *pk=NULL; PKT_public_key *pk=NULL;
@ -938,12 +935,12 @@ build_pk_list (ctrl_t ctrl,
compliance_failure(); compliance_failure();
} }
} }
else if ( (use & PUBKEY_USAGE_ENC) && !opt.no_encrypt_to ) else if (!opt.no_encrypt_to)
{ {
/* Encryption has been requested and --encrypt-to has not /* --encrypt-to has not been disabled. Check this
been disabled. Check this encrypt-to key. */ encrypt-to key. */
pk = xmalloc_clear( sizeof *pk ); pk = xmalloc_clear( sizeof *pk );
pk->req_usage = use; pk->req_usage = PUBKEY_USAGE_ENC;
/* We explicitly allow encrypt-to to an disabled key; thus /* We explicitly allow encrypt-to to an disabled key; thus
we pass 1 for the second last argument and 1 as the last we pass 1 for the second last argument and 1 as the last
@ -956,7 +953,8 @@ build_pk_list (ctrl_t ctrl,
send_status_inv_recp (0, rov->d); send_status_inv_recp (0, rov->d);
goto fail; goto fail;
} }
else if ( !(rc=openpgp_pk_test_algo2 (pk->pubkey_algo, use)) ) else if ( !(rc=openpgp_pk_test_algo2 (pk->pubkey_algo,
PUBKEY_USAGE_ENC)) )
{ {
/* Skip the actual key if the key is already present /* Skip the actual key if the key is already present
* in the list. Add it to our list if not. */ * in the list. Add it to our list if not. */
@ -1084,11 +1082,12 @@ build_pk_list (ctrl_t ctrl,
/* Get and check key for the current name. */ /* Get and check key for the current name. */
free_public_key (pk); free_public_key (pk);
pk = xmalloc_clear( sizeof *pk ); pk = xmalloc_clear( sizeof *pk );
pk->req_usage = use; pk->req_usage = PUBKEY_USAGE_ENC;
rc = get_pubkey_byname (ctrl, NULL, pk, answer, NULL, NULL, 0, 0 ); rc = get_pubkey_byname (ctrl, NULL, pk, answer, NULL, NULL, 0, 0 );
if (rc) if (rc)
tty_printf(_("No such user ID.\n")); tty_printf(_("No such user ID.\n"));
else if ( !(rc=openpgp_pk_test_algo2 (pk->pubkey_algo, use)) ) else if ( !(rc=openpgp_pk_test_algo2 (pk->pubkey_algo,
PUBKEY_USAGE_ENC)) )
{ {
if ( have_def_rec ) if ( have_def_rec )
{ {
@ -1157,14 +1156,15 @@ build_pk_list (ctrl_t ctrl,
{ {
/* We are in batch mode and have only a default recipient. */ /* We are in batch mode and have only a default recipient. */
pk = xmalloc_clear( sizeof *pk ); pk = xmalloc_clear( sizeof *pk );
pk->req_usage = use; pk->req_usage = PUBKEY_USAGE_ENC;
/* The default recipient is allowed to be disabled; thus pass 1 /* The default recipient is allowed to be disabled; thus pass 1
as second last argument. We also don't want an AKL. */ as second last argument. We also don't want an AKL. */
rc = get_pubkey_byname (ctrl, NULL, pk, def_rec, NULL, NULL, 1, 1); rc = get_pubkey_byname (ctrl, NULL, pk, def_rec, NULL, NULL, 1, 1);
if (rc) if (rc)
log_error(_("unknown default recipient \"%s\"\n"), def_rec ); log_error(_("unknown default recipient \"%s\"\n"), def_rec );
else if ( !(rc=openpgp_pk_test_algo2(pk->pubkey_algo, use)) ) else if ( !(rc=openpgp_pk_test_algo2(pk->pubkey_algo,
PUBKEY_USAGE_ENC)) )
{ {
/* Mark any_recipients here since the default recipient /* Mark any_recipients here since the default recipient
would have been used if it wasn't already there. It would have been used if it wasn't already there. It
@ -1199,7 +1199,7 @@ build_pk_list (ctrl_t ctrl,
if ( (remusr->flags & PK_LIST_ENCRYPT_TO) ) if ( (remusr->flags & PK_LIST_ENCRYPT_TO) )
continue; /* encrypt-to keys are already handled. */ continue; /* encrypt-to keys are already handled. */
rc = find_and_check_key (ctrl, remusr->d, use, rc = find_and_check_key (ctrl, remusr->d, PUBKEY_USAGE_ENC,
!!(remusr->flags&PK_LIST_HIDDEN), !!(remusr->flags&PK_LIST_HIDDEN),
&pk_list); &pk_list);
if (rc) if (rc)

View File

@ -773,7 +773,7 @@ sign_file (ctrl_t ctrl, strlist_t filenames, int detached, strlist_t locusr,
goto leave; goto leave;
if (encryptflag if (encryptflag
&& (rc=build_pk_list (ctrl, remusr, &pk_list, PUBKEY_USAGE_ENC))) && (rc=build_pk_list (ctrl, remusr, &pk_list)))
goto leave; goto leave;
/* prepare iobufs */ /* prepare iobufs */