summaryrefslogtreecommitdiffstats
path: root/g10/build-packet.c
diff options
context:
space:
mode:
authorJustus Winter <justus@g10code.com>2016-04-07 13:55:42 +0200
committerJustus Winter <justus@g10code.com>2016-04-07 13:55:42 +0200
commit02cf1357dd5ee34a57371f55b9d312b8b9e3a7e8 (patch)
tree9ff1a83d19b02f7066eabbae1c8bcc47f257068e /g10/build-packet.c
parentg10: Fix typo. (diff)
downloadgnupg2-02cf1357dd5ee34a57371f55b9d312b8b9e3a7e8.tar.xz
gnupg2-02cf1357dd5ee34a57371f55b9d312b8b9e3a7e8.zip
g10: Fix exporting secret keys of certain sizes.
* g10/build-packet.c (do_key): Do not use the header length specified by the public key packet from the keyring, but let 'write_header2' compute the required length. -- Specifically exporting RSA keys of length 1024 failed, as the encoded public key packet requires 141 bytes a length that fits into one byte, but the secret key is significantly larger, making the export fail. GnuPG-bug-id: 2307 Signed-off-by: Justus Winter <justus@g10code.com>
Diffstat (limited to 'g10/build-packet.c')
-rw-r--r--g10/build-packet.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/g10/build-packet.c b/g10/build-packet.c
index 40c466b9d..e244bda38 100644
--- a/g10/build-packet.c
+++ b/g10/build-packet.c
@@ -486,7 +486,7 @@ do_key (iobuf_t out, int ctb, PKT_public_key *pk)
/* Build the header of the packet - which we must do after
writing all the other stuff, so that we know the length of
the packet */
- write_header2 (out, ctb, iobuf_get_temp_length(a), pk->hdrbytes);
+ write_header2 (out, ctb, iobuf_get_temp_length(a), 0);
/* And finally write it out to the real stream. */
err = iobuf_write_temp (out, a);
}