summaryrefslogtreecommitdiffstats
path: root/g10/build-packet.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2002-09-11 09:27:54 +0200
committerWerner Koch <wk@gnupg.org>2002-09-11 09:27:54 +0200
commitc5445cc3239e7654fbaf145c6e697de54093892f (patch)
treefb8e0b6e5018951bd13aade5f46b3444d2fe005c /g10/build-packet.c
parent* exec.c (expand_args): Remove loop left over from earlier implementation. (diff)
downloadgnupg2-c5445cc3239e7654fbaf145c6e697de54093892f.tar.xz
gnupg2-c5445cc3239e7654fbaf145c6e697de54093892f.zip
* g10.c, options.h: Removed option --emulate-checksum-bug.
* misc.c (checksum_u16_nobug): Removed. (checksum_u16): Removed the bug emulation. (checksum_mpi): Ditto. (checksum_mpi_counted_nbits): Removed and replaced all calls with checksum_mpi. * parse-packet.c (read_protected_v3_mpi): New. (parse_key): Use it here to store it as an opaque MPI. * seckey-cert.c (do_check): Changed the v3 unprotection to the new why to store these keys. (protect_secret_key): Likewise. * build-packet.c (do_secret_key): And changed the writing.
Diffstat (limited to 'g10/build-packet.c')
-rw-r--r--g10/build-packet.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/g10/build-packet.c b/g10/build-packet.c
index c4508116c..da1cbbe39 100644
--- a/g10/build-packet.c
+++ b/g10/build-packet.c
@@ -390,7 +390,7 @@ do_secret_key( IOBUF out, int ctb, PKT_secret_key *sk )
iobuf_put(a, sk->protect.algo );
if( sk->protect.s2k.mode >= 1000 ) {
/* These modes are not possible in OpenPGP, we use them
- to implement our extesnsions, 101 can ve views as a
+ to implement our extensions, 101 can be seen as a
private/experimental extension (this is not
specified in rfc2440 but the same scheme is used
for all other algorithm identifiers) */
@@ -426,8 +426,20 @@ do_secret_key( IOBUF out, int ctb, PKT_secret_key *sk )
p = mpi_get_opaque( sk->skey[npkey], &i );
iobuf_write(a, p, i );
}
+ else if( sk->is_protected ) {
+ /* The secret key is protected te old v4 way. */
+ for( ; i < nskey; i++ ) {
+ byte *p;
+ int ndata;
+
+ assert (mpi_is_opaque (sk->skey[i]));
+ p = mpi_get_opaque (sk->skey[i], &ndata);
+ iobuf_write (a, p, ndata);
+ }
+ write_16(a, sk->csum );
+ }
else {
- /* v3 way - same code for protected and non- protected key */
+ /* non-protected key */
for( ; i < nskey; i++ )
mpi_write(a, sk->skey[i] );
write_16(a, sk->csum );