diff options
author | NIIBE Yutaka <[email protected]> | 2021-05-28 02:30:02 +0000 |
---|---|---|
committer | NIIBE Yutaka <[email protected]> | 2021-05-28 02:34:56 +0000 |
commit | 5b1806454c03b3b493222f405ffced80a5d430ad (patch) | |
tree | 648189d260544147c54da83c177f07df8cf211f8 /scd/app-openpgp.c | |
parent | gpg: Ed448 and X448 are only for v5 for --full-gen-key. (diff) | |
download | gnupg-5b1806454c03b3b493222f405ffced80a5d430ad.tar.gz gnupg-5b1806454c03b3b493222f405ffced80a5d430ad.zip |
scd: Fix zero-byte handling in ECC.
* scd/app-openpgp.c (ecc_writekey): Don't remove zero-byte.
--
Fixes-commit: a25c99b156ca9acaa7712e9c09a6df0a7a23c833
GnuPG-bug-id: 5163
Signed-off-by: NIIBE Yutaka <[email protected]>
Diffstat (limited to 'scd/app-openpgp.c')
-rw-r--r-- | scd/app-openpgp.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/scd/app-openpgp.c b/scd/app-openpgp.c index 506b58232..81f99432f 100644 --- a/scd/app-openpgp.c +++ b/scd/app-openpgp.c @@ -4577,12 +4577,11 @@ ecc_writekey (app_t app, ctrl_t ctrl, { const unsigned char **buf2; size_t *buf2len; - int native = flag_djb_tweak; switch (*tok) { case 'q': buf2 = &ecc_q; buf2len = &ecc_q_len; break; - case 'd': buf2 = &ecc_d; buf2len = &ecc_d_len; native = 0; break; + case 'd': buf2 = &ecc_d; buf2len = &ecc_d_len; break; default: buf2 = NULL; buf2len = NULL; break; } if (buf2 && *buf2) @@ -4594,11 +4593,6 @@ ecc_writekey (app_t app, ctrl_t ctrl, goto leave; if (tok && buf2) { - if (!native) - /* Strip off leading zero bytes and save. */ - for (;toklen && !*tok; toklen--, tok++) - ; - *buf2 = tok; *buf2len = toklen; } @@ -4658,11 +4652,9 @@ ecc_writekey (app_t app, ctrl_t ctrl, err = gpg_error (GPG_ERR_INV_VALUE); goto leave; } - if (flag_djb_tweak && keyno != 1) - algo = PUBKEY_ALGO_EDDSA; - else if (keyno == 1) + if (keyno == 1) algo = PUBKEY_ALGO_ECDH; - else if (!strcmp (curve, "Ed448")) + else if (!strcmp (curve, "Ed25519") || !strcmp (curve, "Ed448")) algo = PUBKEY_ALGO_EDDSA; else algo = PUBKEY_ALGO_ECDSA; |