g10: Fix exporting secret keys of certain sizes.
authorJustus Winter <justus@g10code.com>
Thu, 7 Apr 2016 11:55:42 +0000 (13:55 +0200)
committerJustus Winter <justus@g10code.com>
Thu, 7 Apr 2016 11:55:42 +0000 (13:55 +0200)
commit02cf1357dd5ee34a57371f55b9d312b8b9e3a7e8
tree9ff1a83d19b02f7066eabbae1c8bcc47f257068e
parent71040f48ef6bf88e88cb05c2aee8a77d682b2a33
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>
g10/build-packet.c