summaryrefslogtreecommitdiffstats
path: root/g10/pubkey-enc.c
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@g10code.com>2015-11-03 23:15:27 +0100
committerNeal H. Walfield <neal@g10code.com>2015-11-04 13:19:52 +0100
commite16d7168c54e5f7bc2f0037806ee4f730930eaf0 (patch)
tree8cf75fb29648d091e01533506d6377e645451123 /g10/pubkey-enc.c
parentscd: Fix error handling with libusb-compat library. (diff)
downloadgnupg2-e16d7168c54e5f7bc2f0037806ee4f730930eaf0.tar.xz
gnupg2-e16d7168c54e5f7bc2f0037806ee4f730930eaf0.zip
gpg: Allow multiple --default-key options. Take the last available key.
* g10/getkey.c (parse_def_secret_key): New function. (get_seckey_default): Add parameter ctrl. Update callers. Use parse_def_secret_key to get the default secret key, if any. (getkey_byname): Likewise. (enum_secret_keys): Likewise. * g10/options.h (opt): Change def_secret_key's type from a char * to a strlist_t. * g10/gpg.c (main): When processing --default-key, add the key to OPT.DEF_SECRET_KEY. * g10/gpgv.c (get_session_key): Add parameter ctrl. Update callers. * g10/mainproc.c (proc_pubkey_enc): Likewise. (do_proc_packets): Likewise. * g10/pkclist.c (default_recipient): Likewise. * g10/pubkey-enc.c (get_session_key): Likewise. * g10/sign.c (clearsign_file): Likewise. (sign_symencrypt_file): Likewise. * g10/skclist.c (build_sk_list): Likewise. * g10/test-stubs.c (get_session_key): Likewise. -- Signed-off-by: Neal H. Walield <neal@g10code.com> GnuPG-bug-id: 806
Diffstat (limited to 'g10/pubkey-enc.c')
-rw-r--r--g10/pubkey-enc.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/g10/pubkey-enc.c b/g10/pubkey-enc.c
index fd7f81277..23a447315 100644
--- a/g10/pubkey-enc.c
+++ b/g10/pubkey-enc.c
@@ -72,7 +72,7 @@ is_algo_in_prefs (kbnode_t keyblock, preftype_t type, int algo)
* which should have been allocated in secure memory by the caller.
*/
gpg_error_t
-get_session_key (PKT_pubkey_enc * k, DEK * dek)
+get_session_key (ctrl_t ctrl, PKT_pubkey_enc * k, DEK * dek)
{
PKT_public_key *sk = NULL;
int rc;
@@ -102,7 +102,7 @@ get_session_key (PKT_pubkey_enc * k, DEK * dek)
{
free_public_key (sk);
sk = xmalloc_clear (sizeof *sk);
- rc = enum_secret_keys (&enum_context, sk);
+ rc = enum_secret_keys (ctrl, &enum_context, sk);
if (rc)
{
rc = GPG_ERR_NO_SECKEY;
@@ -127,7 +127,7 @@ get_session_key (PKT_pubkey_enc * k, DEK * dek)
else if (gpg_err_code (rc) == GPG_ERR_FULLY_CANCELED)
break; /* Don't try any more secret keys. */
}
- enum_secret_keys (&enum_context, NULL); /* free context */
+ enum_secret_keys (ctrl, &enum_context, NULL); /* free context */
}
leave: