From ce29272e24e7b718b8fca9b84bc728e65f3dea24 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Fri, 2 Dec 2016 19:43:36 +0100 Subject: gpg: New option --default-new-key-algo. * common/openpgp-oid.c (openpgp_is_curve_supported): Add optional arg R_ALGO and change all callers. * common/util.h (GPG_ERR_UNKNOWN_FLAG): New error code. * g10/options.h (struct opt): Add field DEF_NEW_KEY_ALGO. * g10/gpg.c (oDefaultNewKeyAlgo): New enum. (opts): New option "--default-new-key-algo". (main): Set the option. * g10/keygen.c: Remove DEFAULT_STD_ FUTURE_STD_ constants and replace them by ... (DEFAULT_STD_KEY_PARAM, FUTURE_STD_KEY_PARAM): new string constants. (get_keysize_range): Remove arg R_DEF and return that value instead. Change all callers. (gen_rsa): Use get_keysize_range instead of the removed DEFAULT_STD_KEYSIZE. (parse_key_parameter_part): New function. (parse_key_parameter_string): New function. (quick_generate_keypair): Refactor using parse_key_parameter_string. (generate_keypair): Ditto. (parse_algo_usage_expire): Ditto. -- This new option is intended to be used in the forthcoming --set-profile command of gpgconf. It allows to provide a gpg configuration with custom defaults for a new key using the simple commands which use the default algorithm set. Signed-off-by: Werner Koch --- common/util.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'common/util.h') diff --git a/common/util.h b/common/util.h index 2f82fb09b..6e437b984 100644 --- a/common/util.h +++ b/common/util.h @@ -39,6 +39,9 @@ * libgpg-error version. Define them here. * Example: (#if GPG_ERROR_VERSION_NUMBER < 0x011500 // 1.21) */ +#if GPG_ERROR_VERSION_NUMBER < 0x011a00 /* 1.26 */ +# define GPG_ERR_UNKNOWN_FLAG 309 +#endif /* Hash function used with libksba. */ @@ -210,7 +213,8 @@ int openpgp_oid_is_cv25519 (gcry_mpi_t a); const char *openpgp_curve_to_oid (const char *name, unsigned int *r_nbits); const char *openpgp_oid_to_curve (const char *oid, int canon); const char *openpgp_enum_curves (int *idxp); -const char *openpgp_is_curve_supported (const char *name, int *r_algo); +const char *openpgp_is_curve_supported (const char *name, + int *r_algo, unsigned int *r_nbits); /*-- homedir.c --*/ -- cgit v1.2.3