aboutsummaryrefslogtreecommitdiffstats
path: root/scd/app-openpgp.c
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2015-12-14 05:37:18 +0000
committerNIIBE Yutaka <[email protected]>2015-12-14 05:37:18 +0000
commitd40975cbe8ff86fcc4a1b4963fdffc66ddee85ce (patch)
tree97a8370f0530a4c7dead5bff54bee437eb566055 /scd/app-openpgp.c
parentgpg: Use a regular type instead of a void* for import stats. (diff)
downloadgnupg-d40975cbe8ff86fcc4a1b4963fdffc66ddee85ce.tar.gz
gnupg-d40975cbe8ff86fcc4a1b4963fdffc66ddee85ce.zip
scd: Fix regression for generating RSA keys on card.
* scd/app-openpgp.c (do_genkey): Strip leading zeros for fingerprint computation. -- This bug is difficult to reproduce because the probability is 1/256, and key generation takes long time. The regression was introduced when we add the support for ECC. GnuPG-bug-id: 2150
Diffstat (limited to 'scd/app-openpgp.c')
-rw-r--r--scd/app-openpgp.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/scd/app-openpgp.c b/scd/app-openpgp.c
index 581c5dd17..92330ecd2 100644
--- a/scd/app-openpgp.c
+++ b/scd/app-openpgp.c
@@ -3623,6 +3623,11 @@ do_genkey (app_t app, ctrl_t ctrl, const char *keynostr, unsigned int flags,
send_status_info (ctrl, "KEY-CREATED-AT",
numbuf, (size_t)strlen(numbuf), NULL, 0);
+ for (; mlen && !*m; mlen--, m++) /* strip leading zeroes */
+ ;
+ for (; elen && !*e; elen--, e++) /* strip leading zeroes */
+ ;
+
rc = store_fpr (app, keyno, (u32)created_at, fprbuf, PUBKEY_ALGO_RSA,
m, mlen, e, elen);
if (rc)