aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Shaw <[email protected]>2002-12-03 23:31:48 +0000
committerDavid Shaw <[email protected]>2002-12-03 23:31:48 +0000
commite357092285709f24f84a76f25022b5761157eb4d (patch)
tree8d9d9b26246e2ed19f770d012c297351494aeeb8
parentMarked unused slots in the trustdb. (diff)
downloadgnupg-e357092285709f24f84a76f25022b5761157eb4d.tar.gz
gnupg-e357092285709f24f84a76f25022b5761157eb4d.zip
* options.h, g10.c (main), encode.c (write_pubkey_enc_from_list),
pkclist.c (algo_available), revoke.c (gen_revoke): Add --pgp8 mode. This is basically identical to --pgp7 in all ways except that signing subkeys, v4 data sigs (including expiration), and SK comments are allowed. * getkey.c (finish_lookup): Comment. * main.h, keylist.c (reorder_keyblock), keyedit.c (keyedit_menu): Reorder user ID display in the --edit-key menu to match that of the --list-keys display. * g10.c (add_notation_data): Fix initialization.
Diffstat (limited to '')
-rw-r--r--g10/ChangeLog16
-rw-r--r--g10/encode.c8
-rw-r--r--g10/g10.c36
-rw-r--r--g10/getkey.c3
-rw-r--r--g10/keyedit.c1
-rw-r--r--g10/keylist.c2
-rw-r--r--g10/main.h1
-rw-r--r--g10/options.h4
-rw-r--r--g10/pkclist.c38
-rw-r--r--g10/revoke.c2
10 files changed, 74 insertions, 37 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog
index 72fbf2d04..ae9bdcb1b 100644
--- a/g10/ChangeLog
+++ b/g10/ChangeLog
@@ -1,3 +1,19 @@
+2002-12-03 David Shaw <[email protected]>
+
+ * options.h, g10.c (main), encode.c (write_pubkey_enc_from_list),
+ pkclist.c (algo_available), revoke.c (gen_revoke): Add --pgp8
+ mode. This is basically identical to --pgp7 in all ways except
+ that signing subkeys, v4 data sigs (including expiration), and SK
+ comments are allowed.
+
+ * getkey.c (finish_lookup): Comment.
+
+ * main.h, keylist.c (reorder_keyblock), keyedit.c (keyedit_menu):
+ Reorder user ID display in the --edit-key menu to match that of
+ the --list-keys display.
+
+ * g10.c (add_notation_data): Fix initialization.
+
2002-12-01 David Shaw <[email protected]>
* keyedit.c (menu_expire): Don't lose key flags when changing the
diff --git a/g10/encode.c b/g10/encode.c
index 5550af4a7..e705a6fad 100644
--- a/g10/encode.c
+++ b/g10/encode.c
@@ -708,16 +708,16 @@ write_pubkey_enc_from_list( PK_LIST pk_list, DEK *dek, IOBUF out )
keyid_from_pk( pk, enc->keyid );
enc->throw_keyid = (opt.throw_keyid || (pk_list->flags&1));
- if(opt.throw_keyid && (opt.pgp2 || opt.pgp6 || opt.pgp7))
+ if(opt.throw_keyid && (opt.pgp2 || opt.pgp6 || opt.pgp7 || opt.pgp8))
{
log_info(_("you may not use %s while in %s mode\n"),
"--throw-keyid",
- opt.pgp2?"--pgp2":opt.pgp6?"--pgp6":"--pgp7");
+ opt.pgp2?"--pgp2":opt.pgp6?"--pgp6":opt.pgp7?"--pgp7":"--pgp8");
log_info(_("this message may not be usable by %s\n"),
- opt.pgp2?"PGP 2.x":opt.pgp6?"PGP 6.x":"PGP 7.x");
+ opt.pgp2?"PGP 2.x":opt.pgp6?"PGP 6.x":opt.pgp7?"PGP 7.x":"PGP 8.x");
- opt.pgp2=opt.pgp6=opt.pgp7=0;
+ opt.pgp2=opt.pgp6=opt.pgp7=opt.pgp8=0;
}
/* Okay, what's going on: We have the session key somewhere in
diff --git a/g10/g10.c b/g10/g10.c
index e7173f48f..0b699c5a1 100644
--- a/g10/g10.c
+++ b/g10/g10.c
@@ -175,6 +175,8 @@ enum cmd_and_opt_values { aNull = 0,
oNoPGP6,
oPGP7,
oNoPGP7,
+ oPGP8,
+ oNoPGP8,
oCipherAlgo,
oDigestAlgo,
oCertDigestAlgo,
@@ -458,6 +460,8 @@ static ARGPARSE_OPTS opts[] = {
{ oNoPGP6, "no-pgp6", 0, "@"},
{ oPGP7, "pgp7", 0, "@"},
{ oNoPGP7, "no-pgp7", 0, "@"},
+ { oPGP8, "pgp8", 0, "@"},
+ { oNoPGP8, "no-pgp8", 0, "@"},
{ oS2KMode, "s2k-mode", 1, N_("|N|use passphrase mode N")},
{ oS2KDigest, "s2k-digest-algo",2,
N_("|NAME|use message digest algorithm NAME for passphrases")},
@@ -1526,6 +1530,8 @@ main( int argc, char **argv )
case oNoPGP6: opt.pgp6 = 0; break;
case oPGP7: opt.pgp7 = 1; break;
case oNoPGP7: opt.pgp7 = 0; break;
+ case oPGP8: opt.pgp8 = 1; break;
+ case oNoPGP8: opt.pgp8 = 0; break;
case oEmuMDEncodeBug: opt.emulate_bugs |= EMUBUG_MDENCODE; break;
case oCompressSigs: opt.compress_sigs = 1; break;
case oRunAsShmCP:
@@ -1846,9 +1852,9 @@ main( int argc, char **argv )
set_debug();
/* Do these after the switch(), so they can override settings. */
- if(opt.pgp2 && (opt.pgp6 || opt.pgp7))
+ if(opt.pgp2 && (opt.pgp6 || opt.pgp7 || opt.pgp8))
log_error(_("%s not allowed with %s!\n"),
- "--pgp2",opt.pgp6?"--pgp6":"--pgp7");
+ "--pgp2",opt.pgp6?"--pgp6":opt.pgp7?"--pgp7":"--pgp8");
else
{
if(opt.pgp2)
@@ -1929,20 +1935,28 @@ main( int argc, char **argv )
opt.def_compress_algo = 1;
}
}
-
- if(opt.pgp6 || opt.pgp7)
+ else if(opt.pgp6)
{
opt.sk_comments=0;
opt.escape_from=1;
opt.force_v3_sigs=1;
opt.ask_sig_expire=0;
opt.def_compress_algo=1;
-
- if(opt.pgp6) /* pgp7 has MDC */
- {
- opt.force_mdc=0;
- opt.disable_mdc=1;
- }
+ opt.force_mdc=0;
+ opt.disable_mdc=1;
+ }
+ else if(opt.pgp7)
+ {
+ opt.sk_comments=0;
+ opt.escape_from=1;
+ opt.force_v3_sigs=1;
+ opt.ask_sig_expire=0;
+ opt.def_compress_algo=1;
+ }
+ else if(opt.pgp8)
+ {
+ opt.escape_from=1;
+ opt.def_compress_algo=1;
}
}
@@ -2830,7 +2844,7 @@ add_notation_data( const char *string, int which )
for( s=string ; *s != '='; s++ )
{
if( *s=='@')
- saw_at=0;
+ saw_at=1;
if( !*s || (*s & 0x80) || (!isgraph(*s) && !isspace(*s)) )
{
diff --git a/g10/getkey.c b/g10/getkey.c
index 93ef8b04f..ffd5042bc 100644
--- a/g10/getkey.c
+++ b/g10/getkey.c
@@ -2056,7 +2056,8 @@ finish_lookup (GETKEY_CTX ctx)
unsigned int req_usage = ( ctx->req_usage & USAGE_MASK );
/* Request the primary if we're certifying another key, and also
if signing data while --pgp6 or --pgp7 is on since pgp 6 and 7
- do not understand signatures made by a signing subkey. */
+ do not understand signatures made by a signing subkey. PGP 8
+ does. */
int req_prim = (ctx->req_usage & PUBKEY_USAGE_CERT) ||
((opt.pgp6 || opt.pgp7) && (ctx->req_usage & PUBKEY_USAGE_SIG));
u32 latest_date;
diff --git a/g10/keyedit.c b/g10/keyedit.c
index f06c91886..8373a7f2c 100644
--- a/g10/keyedit.c
+++ b/g10/keyedit.c
@@ -1112,6 +1112,7 @@ keyedit_menu( const char *username, STRLIST locusr, STRLIST commands,
modified++;
if( collapse_uids( &keyblock ) )
modified++;
+ reorder_keyblock(keyblock);
if( !sign_mode ) {/* see whether we have a matching secret key */
PKT_public_key *pk = keyblock->pkt->pkt.public_key;
diff --git a/g10/keylist.c b/g10/keylist.c
index c77ec2df5..177890673 100644
--- a/g10/keylist.c
+++ b/g10/keylist.c
@@ -955,7 +955,7 @@ list_keyblock_colon( KBNODE keyblock, int secret, int fpr )
* Reorder the keyblock so that the primary user ID (and not attribute
* packet) comes first. Fixme: Replace this by a generic sort
* function. */
-static void
+void
reorder_keyblock (KBNODE keyblock)
{
KBNODE primary = NULL, primary0 = NULL, primary2 = NULL;
diff --git a/g10/main.h b/g10/main.h
index 2162d0cc2..94ee0df9f 100644
--- a/g10/main.h
+++ b/g10/main.h
@@ -204,6 +204,7 @@ void release_revocation_reason_info( struct revocation_reason_info *reason );
/*-- keylist.c --*/
void public_key_list( STRLIST list );
void secret_key_list( STRLIST list );
+void reorder_keyblock (KBNODE keyblock);
void list_keyblock( KBNODE keyblock, int secret, int fpr, void *opaque );
void print_fingerprint (PKT_public_key *pk, PKT_secret_key *sk, int mode);
void show_policy_url(PKT_signature *sig,int indent);
diff --git a/g10/options.h b/g10/options.h
index d2f39077c..9917a4a61 100644
--- a/g10/options.h
+++ b/g10/options.h
@@ -92,8 +92,8 @@ struct {
unsigned int force_ownertrust;
int pgp2;
int pgp6;
- int pgp7; /* if we get any more of these, it's time to look at a
- special emulate_pgp variable... */
+ int pgp7;
+ int pgp8;
int rfc1991;
int rfc2440;
int pgp2_workarounds;
diff --git a/g10/pkclist.c b/g10/pkclist.c
index a175049a1..3444870c0 100644
--- a/g10/pkclist.c
+++ b/g10/pkclist.c
@@ -1103,19 +1103,20 @@ build_pk_list( STRLIST rcpts, PK_LIST *ret_pk_list, unsigned use )
/* In pgp6 mode, disallow all ciphers except IDEA (1), 3DES (2), and
CAST5 (3), all hashes except MD5 (1), SHA1 (2), and RIPEMD160 (3),
- and all compressions except none (0) and ZIP (1). pgp7 mode
- expands the cipher list to include AES128 (7), AES192 (8), AES256
- (9), and TWOFISH (10). For a true PGP key all of this is unneeded
- as they are the only items present in the preferences subpacket,
- but checking here covers the weird case of encrypting to a key that
- had preferences from a different implementation which was then used
- with PGP. I am not completely comfortable with this as the right
- thing to do, as it slightly alters the list of what the user is
- supposedly requesting. It is not against the RFC however, as the
- preference chosen will never be one that the user didn't specify
- somewhere ("The implementation may use any mechanism to pick an
- algorithm in the intersection"), and PGP has no mechanism to fix
- such a broken preference list, so I'm including it. -dms */
+ and all compressions except none (0) and ZIP (1). pgp7 and pgp8
+ mode expands the cipher list to include AES128 (7), AES192 (8),
+ AES256 (9), and TWOFISH (10). For a true PGP key all of this is
+ unneeded as they are the only items present in the preferences
+ subpacket, but checking here covers the weird case of encrypting to
+ a key that had preferences from a different implementation which
+ was then used with PGP. I am not completely comfortable with this
+ as the right thing to do, as it slightly alters the list of what
+ the user is supposedly requesting. It is not against the RFC
+ however, as the preference chosen will never be one that the user
+ didn't specify somewhere ("The implementation may use any mechanism
+ to pick an algorithm in the intersection"), and PGP has no
+ mechanism to fix such a broken preference list, so I'm including
+ it. -dms */
static int
algo_available( int preftype, int algo, void *hint )
@@ -1124,8 +1125,9 @@ algo_available( int preftype, int algo, void *hint )
if( opt.pgp6 && ( algo != 1 && algo != 2 && algo != 3) )
return 0;
- if( opt.pgp7 && (algo != 1 && algo != 2 && algo != 3 &&
- algo != 7 && algo != 8 && algo != 9 && algo != 10) )
+ if( (opt.pgp7 || opt.pgp8)
+ && (algo != 1 && algo != 2 && algo != 3
+ && algo != 7 && algo != 8 && algo != 9 && algo != 10) )
return 0;
return algo && !check_cipher_algo( algo );
@@ -1139,13 +1141,15 @@ algo_available( int preftype, int algo, void *hint )
if(bits && (bits != md_digest_length(algo)))
return 0;
- if( (opt.pgp6 || opt.pgp7 ) && ( algo != 1 && algo != 2 && algo != 3) )
+ if( (opt.pgp6 || opt.pgp7 || opt.pgp8 )
+ && ( algo != 1 && algo != 2 && algo != 3) )
return 0;
return algo && !check_digest_algo( algo );
}
else if( preftype == PREFTYPE_ZIP ) {
- if ( ( opt.pgp6 || opt.pgp7 ) && ( algo !=0 && algo != 1) )
+ if ( ( opt.pgp6 || opt.pgp7 || opt.pgp8 )
+ && ( algo !=0 && algo != 1) )
return 0;
return !check_compress_algo( algo );
diff --git a/g10/revoke.c b/g10/revoke.c
index 662487901..5e66090c4 100644
--- a/g10/revoke.c
+++ b/g10/revoke.c
@@ -521,7 +521,7 @@ gen_revoke( const char *uname )
goto leave;
}
- if(opt.pgp2 || opt.pgp6 || opt.pgp7)
+ if(opt.pgp2 || opt.pgp6 || opt.pgp7 | opt.pgp8)
{
/* Use a minimal pk for PGPx mode, since PGP can't import bare
revocation certificates. */