diff options
author | Werner Koch <wk@gnupg.org> | 2020-12-02 11:11:47 +0100 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2020-12-02 11:14:19 +0100 |
commit | 63ed2054a1f3cfbdff5cda390952f10a512dab83 (patch) | |
tree | fa5c673a550b02e1dd7a58b23a78d3750a1bcb83 /kbx/keybox-openpgp.c | |
parent | doc: Add parameters for batch generation of ECC keys. (diff) | |
download | gnupg2-63ed2054a1f3cfbdff5cda390952f10a512dab83.tar.xz gnupg2-63ed2054a1f3cfbdff5cda390952f10a512dab83.zip |
kbx: Better error message in case of a crippled Libgcrypt.
* kbx/keybox-openpgp.c (keygrip_from_keyparm): Detect missing curve.
Diffstat (limited to '')
-rw-r--r-- | kbx/keybox-openpgp.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/kbx/keybox-openpgp.c b/kbx/keybox-openpgp.c index 43e811215..f5bd1b641 100644 --- a/kbx/keybox-openpgp.c +++ b/kbx/keybox-openpgp.c @@ -240,8 +240,16 @@ keygrip_from_keyparm (int algo, struct keyparm_s *kp, unsigned char *grip) if (!err && !gcry_pk_get_keygrip (s_pkey, grip)) { - log_info ("kbx: error computing keygrip\n"); - err = gpg_error (GPG_ERR_GENERAL); + /* Some Linux distributions remove certain curves from Libgcrypt + * but not from GnuPG and thus the keygrip can't be computed. + * Emit a better error message for this case. */ + if (!gcry_pk_get_curve (s_pkey, 0, NULL)) + err = gpg_error (GPG_ERR_UNKNOWN_CURVE); + else + { + log_info ("kbx: error computing keygrip\n"); + err = gpg_error (GPG_ERR_GENERAL); + } } gcry_sexp_release (s_pkey); |