diff options
author | NIIBE Yutaka <gniibe@fsij.org> | 2020-11-02 07:34:03 +0100 |
---|---|---|
committer | NIIBE Yutaka <gniibe@fsij.org> | 2020-11-02 07:34:03 +0100 |
commit | 8211d0bc3ba5ed15d0668050c08a6e28228b08a4 (patch) | |
tree | 405acd0c8dc48e591b905655892c2fc3be687e57 /kbx/keybox-openpgp.c | |
parent | gpg: Fix debug output for key_check_all_keysigs with opaque MPI. (diff) | |
download | gnupg2-8211d0bc3ba5ed15d0668050c08a6e28228b08a4.tar.xz gnupg2-8211d0bc3ba5ed15d0668050c08a6e28228b08a4.zip |
kbx: Don't put zero-byte for ECC.
* kbx/keybox-openpgp.c (parse_key): Only put zero for non-ECC.
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
Diffstat (limited to 'kbx/keybox-openpgp.c')
-rw-r--r-- | kbx/keybox-openpgp.c | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/kbx/keybox-openpgp.c b/kbx/keybox-openpgp.c index 0835909e6..43e811215 100644 --- a/kbx/keybox-openpgp.c +++ b/kbx/keybox-openpgp.c @@ -369,23 +369,24 @@ parse_key (const unsigned char *data, size_t datalen, /* Note: Starting here we need to jump to leave on error. */ - /* Make sure the MPIs are unsigned. */ - for (i=0; i < npkey; i++) - { - if (!keyparm[i].len || (keyparm[i].mpi[0] & 0x80)) - { - helpmpibuf[i] = xtrymalloc (1+keyparm[i].len); - if (!helpmpibuf[i]) - { - err = gpg_error_from_syserror (); - goto leave; - } - helpmpibuf[i][0] = 0; - memcpy (helpmpibuf[i]+1, keyparm[i].mpi, keyparm[i].len); - keyparm[i].mpi = helpmpibuf[i]; - keyparm[i].len++; - } - } + /* For non-ECC, make sure the MPIs are unsigned. */ + if (!is_ecc) + for (i=0; i < npkey; i++) + { + if (!keyparm[i].len || (keyparm[i].mpi[0] & 0x80)) + { + helpmpibuf[i] = xtrymalloc (1+keyparm[i].len); + if (!helpmpibuf[i]) + { + err = gpg_error_from_syserror (); + goto leave; + } + helpmpibuf[i][0] = 0; + memcpy (helpmpibuf[i]+1, keyparm[i].mpi, keyparm[i].len); + keyparm[i].mpi = helpmpibuf[i]; + keyparm[i].len++; + } + } err = keygrip_from_keyparm (algorithm, keyparm, ki->grip); if (err) |