aboutsummaryrefslogtreecommitdiffstats
path: root/g10/export.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2011-04-26 18:33:46 +0000
committerWerner Koch <[email protected]>2011-04-26 18:39:09 +0000
commit817f07173cda59565c179bde6c3edcf2508bbc98 (patch)
treec6aa504d8e1154f23ebbdc2f544703de21ec962b /g10/export.c
parentFix regression in gpg's mail address parsing. (diff)
downloadgnupg-817f07173cda59565c179bde6c3edcf2508bbc98.tar.gz
gnupg-817f07173cda59565c179bde6c3edcf2508bbc98.zip
Fixed regression in OpenPGP secret key export.
The protection used in the exported key used a different iteration count than given in the S2K field. Thus all OpenPGP keys exported from GnuPG 2.1-beta can't be imported again. Given that the actual secret key material is kept in private-keys-v1.d/ the can be re-exported with this fixed version.
Diffstat (limited to '')
-rw-r--r--g10/export.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/g10/export.c b/g10/export.c
index 9f4959e61..2e35eea9f 100644
--- a/g10/export.c
+++ b/g10/export.c
@@ -626,10 +626,9 @@ transfer_format_to_openpgp (gcry_sexp_t s_pgp, PKT_public_key *pk)
}
/* Do some sanity checks. */
- if (s2k_count <= 1024)
+ if (s2k_count > 255)
{
- /* The count must be larger so that encode_s2k_iterations does
- not fall into a backward compatibility mode. */
+ /* We expect an already encoded S2K count. */
err = gpg_error (GPG_ERR_INV_DATA);
goto leave;
}
@@ -682,7 +681,7 @@ transfer_format_to_openpgp (gcry_sexp_t s_pgp, PKT_public_key *pk)
ski->s2k.hash_algo = s2k_algo;
assert (sizeof ski->s2k.salt == sizeof s2k_salt);
memcpy (ski->s2k.salt, s2k_salt, sizeof s2k_salt);
- ski->s2k.count = encode_s2k_iterations (s2k_count);
+ ski->s2k.count = s2k_count;
assert (ivlen <= sizeof ski->iv);
memcpy (ski->iv, iv, ivlen);
ski->ivlen = ivlen;