aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2020-12-02 11:11:47 +0100
committerWerner Koch <wk@gnupg.org>2020-12-02 11:14:19 +0100
commit63ed2054a1f3cfbdff5cda390952f10a512dab83 (patch)
treefa5c673a550b02e1dd7a58b23a78d3750a1bcb83
parent4f9ac5dac093300ac18fd3732bffdd2a3fc38776 (diff)
downloadgnupg-63ed2054a1f3cfbdff5cda390952f10a512dab83.tar.gz
kbx: Better error message in case of a crippled Libgcrypt.
* kbx/keybox-openpgp.c (keygrip_from_keyparm): Detect missing curve.
-rw-r--r--kbx/keybox-openpgp.c12
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);