From ad2bfad4cc7542f0f5ad4225ed7b765b5c626f8c Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Thu, 18 Apr 2002 08:09:56 +0000 Subject: [PATCH] * getkey.c (premerge_public_with_secret): Fixed 0x12345678! syntax for use with secret keys. * seckey-cert.c (do_check): Always calculate the old checksum for use after unprotection. * g10.c, options.skel: New option --no-escape-from. Made --escape-from and --force-v3-sigs the default and removed them from the options skeleton. --- g10/ChangeLog | 11 ++++++++++- g10/g10.c | 5 +++++ g10/getkey.c | 6 +++++- g10/options.skel | 24 ++++++++++++------------ g10/seckey-cert.c | 10 ++++++++-- 5 files changed, 40 insertions(+), 16 deletions(-) diff --git a/g10/ChangeLog b/g10/ChangeLog index f4118fa1d..a1c33f2c8 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,5 +1,14 @@ -2002-04-17 Werner Koch +2002-04-18 Werner Koch + * getkey.c (premerge_public_with_secret): Fixed 0x12345678! syntax + for use with secret keys. + + * seckey-cert.c (do_check): Always calculate the old checksum for + use after unprotection. + + * g10.c, options.skel: New option --no-escape-from. Made + --escape-from and --force-v3-sigs the default and removed them + from the options skeleton. 2002-04-16 Werner Koch diff --git a/g10/g10.c b/g10/g10.c index a070ccb65..10e157a09 100644 --- a/g10/g10.c +++ b/g10/g10.c @@ -222,6 +222,7 @@ enum cmd_and_opt_values { aNull = 0, oCharset, oNotDashEscaped, oEscapeFrom, + oNoEscapeFrom, oLockOnce, oLockMultiple, oLockNever, @@ -489,6 +490,7 @@ static ARGPARSE_OPTS opts[] = { { oEmitVersion, "emit-version", 0, "@"}, { oNotDashEscaped, "not-dash-escaped", 0, "@" }, { oEscapeFrom, "escape-from-lines", 0, "@" }, + { oNoEscapeFrom, "no-escape-from-lines", 0, "@" }, { oLockOnce, "lock-once", 0, "@" }, { oLockMultiple, "lock-multiple", 0, "@" }, { oLockNever, "lock-never", 0, "@" }, @@ -791,6 +793,8 @@ main( int argc, char **argv ) opt.marginals_needed = 3; opt.max_cert_depth = 5; opt.pgp2_workarounds = 1; + opt.force_v3_sigs = 1; + opt.escape_from = 1; #if defined (__MINGW32__) || defined (__CYGWIN32__) opt.homedir = read_w32_registry_string( NULL, "Software\\GNU\\GnuPG", "HomeDir" ); #else @@ -1183,6 +1187,7 @@ main( int argc, char **argv ) break; case oNotDashEscaped: opt.not_dash_escaped = 1; break; case oEscapeFrom: opt.escape_from = 1; break; + case oNoEscapeFrom: opt.escape_from = 0; break; case oLockOnce: opt.lock_once = 1; break; case oLockNever: disable_dotlock(); break; case oLockMultiple: diff --git a/g10/getkey.c b/g10/getkey.c index 00b458a18..33d4f03b5 100644 --- a/g10/getkey.c +++ b/g10/getkey.c @@ -1721,7 +1721,7 @@ merge_public_with_secret ( KBNODE pubblock, KBNODE secblock ) } /* This function checks that for every public subkey a corresponding - * secret subkey is avalable and deletes the public subkey otherwise. + * secret subkey is available and deletes the public subkey otherwise. * We need this function because we can't delete it later when we * actually merge the secret parts into the pubring. * The function also plays some games with the node flags. @@ -1779,6 +1779,10 @@ premerge_public_with_secret ( KBNODE pubblock, KBNODE secblock ) } } } + /* We need to copy the found bits (0 and 1) from the secret key to + the public key. This has already been done for the subkeys but + got lost on the primary key - fix it here *. */ + pubblock->flag |= (secblock->flag & 3); } diff --git a/g10/options.skel b/g10/options.skel index 14fd533cb..e22c6139f 100644 --- a/g10/options.skel +++ b/g10/options.skel @@ -51,23 +51,23 @@ $Id$ #default-recipient some-user-id #default-recipient-self - -# The next option is enabled because this one is needed for interoperation -# with PGP 5 users. To enable full OpenPGP compliance you have to remove -# this option. - -force-v3-sigs +# By default GnuPG creates version 3 signatures for data files. This +# is not OpenPGP compliant but PGP 6 requires them. To disable it, +# you may use this option or --openpgp. +#no-force-v3-sigs # Because some mailers change lines starting with "From " to ">From " # it is good to handle such lines in a special way when creating # cleartext signatures; all other PGP versions do it this way too. -# To enable full OpenPGP compliance you have to remove this option. +# To enable full OpenPGP compliance you may want to use this option. +#no-escape-from-lines -escape-from-lines - -# If you do not use the Latin-1 (ISO-8859-1) charset, you should -# tell GnuPG which is the native character set. Please check -# the man page for supported character sets. +# If you do not use the Latin-1 (ISO-8859-1) charset, you should tell +# GnuPG which is the native character set. Please check the man page +# for supported character sets. This character set is only used for +# Meta data and not for the actual message which does not undergo any +# translation. Note that future version of GnuPG will change to UTF-8 +# as default character set. #charset utf-8 diff --git a/g10/seckey-cert.c b/g10/seckey-cert.c index 77e27ae7b..ac360bbcd 100644 --- a/g10/seckey-cert.c +++ b/g10/seckey-cert.c @@ -105,8 +105,14 @@ do_check( PKT_secret_key *sk, const char *tryagain_text ) md_write (h, data, ndata - 20); md_final (h); if (!memcmp (md_read (h, DIGEST_ALGO_SHA1), - data + ndata - 20, 20) ) - csum = 0; /* digest does match */ + data + ndata - 20, 20) ) { + /* digest does match. We have to keep the old + style checksum in sk->csum, so that the + test used for unprotected keys does work. + This test gets used when we are adding new + keys. */ + sk->csum = csum = checksum (data, ndata-20); + } md_close (h); } }