aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--g10/ChangeLog14
-rw-r--r--g10/keyedit.c8
-rw-r--r--g10/keylist.c12
-rw-r--r--g10/packet.h3
-rw-r--r--g10/parse-packet.c27
-rw-r--r--g10/tdbio.c2
-rw-r--r--g10/tdbio.h1
7 files changed, 56 insertions, 11 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog
index 75e750840..dea2de16f 100644
--- a/g10/ChangeLog
+++ b/g10/ChangeLog
@@ -1,3 +1,17 @@
+2002-10-29 David Shaw <[email protected]>
+
+ * keyedit.c (print_and_check_one_sig, show_key_and_fingerprint,
+ menu_addrevoker), keylist.c (list_keyblock_print,
+ print_fingerprint): Show "T" or the trust depth for trust
+ signatures, and add spaces to some strings to make room for it.
+
+ * packet.h, parse-packet.c (dump_sig_subpkt, parse_one_sig_subpkt,
+ parse_signature): Parse trust signature values.
+
+ * tdbio.h, tdbio.c (tdbio_read_record, tdbio_write_record):
+ Reserve a byte for the minimum ownertrust value (for use with
+ trust signatures).
+
2002-10-29 Stefan Bellon <[email protected]>
* build-packet.c (calc_plaintext, do_plaintext): Removed RISC OS
diff --git a/g10/keyedit.c b/g10/keyedit.c
index 71d2858b7..d0295766b 100644
--- a/g10/keyedit.c
+++ b/g10/keyedit.c
@@ -129,7 +129,7 @@ print_and_check_one_sig( KBNODE keyblock, KBNODE node,
break;
}
if( sigrc != '?' || print_without_key ) {
- tty_printf("%s%c%c %c%c%c%c%c %08lX %s ",
+ tty_printf("%s%c%c %c%c%c%c%c%c %08lX %s ",
is_rev? "rev":"sig",sigrc,
(sig->sig_class-0x10>0 &&
sig->sig_class-0x10<4)?'0'+sig->sig_class-0x10:' ',
@@ -138,6 +138,8 @@ print_and_check_one_sig( KBNODE keyblock, KBNODE node,
sig->flags.policy_url?'P':' ',
sig->flags.notation?'N':' ',
sig->flags.expired?'X':' ',
+ (sig->trust_depth>9)?'T':
+ (sig->trust_depth>0)?'0'+sig->trust_depth:' ',
(ulong)sig->keyid[1], datestr_from_sig(sig));
if( sigrc == '%' )
tty_printf("[%s] ", g10_errstr(rc) );
@@ -1925,7 +1927,7 @@ show_key_and_fingerprint( KBNODE keyblock )
for( node = keyblock; node; node = node->next ) {
if( node->pkt->pkttype == PKT_PUBLIC_KEY ) {
pk = node->pkt->pkt.public_key;
- tty_printf("pub %4u%c/%08lX %s ",
+ tty_printf("pub %4u%c/%08lX %s ",
nbits_from_pk( pk ),
pubkey_letter( pk->pubkey_algo ),
(ulong)keyid_from_pk(pk,NULL),
@@ -2375,7 +2377,7 @@ menu_addrevoker( KBNODE pub_keyblock, KBNODE sec_keyblock, int sensitive )
keyid_from_pk(revoker_pk,keyid);
- tty_printf("\npub %4u%c/%08lX %s ",
+ tty_printf("\npub %4u%c/%08lX %s ",
nbits_from_pk( revoker_pk ),
pubkey_letter( revoker_pk->pubkey_algo ),
(ulong)keyid[1], datestr_from_pk(pk) );
diff --git a/g10/keylist.c b/g10/keylist.c
index e33f000dd..b45bfca0f 100644
--- a/g10/keylist.c
+++ b/g10/keylist.c
@@ -476,7 +476,7 @@ list_keyblock_print ( KBNODE keyblock, int secret, int fpr, void *opaque )
pk = node->pkt->pkt.public_key;
sk = NULL;
keyid_from_pk( pk, keyid );
- printf("pub %4u%c/%08lX %s ", nbits_from_pk( pk ),
+ printf("pub %4u%c/%08lX %s ", nbits_from_pk( pk ),
pubkey_letter( pk->pubkey_algo ),
(ulong)keyid[1],
datestr_from_pk( pk ) );
@@ -528,7 +528,7 @@ list_keyblock_print ( KBNODE keyblock, int secret, int fpr, void *opaque )
}
keyid_from_pk( pk2, keyid2 );
- printf("sub %4u%c/%08lX %s", nbits_from_pk( pk2 ),
+ printf("sub %4u%c/%08lX %s", nbits_from_pk( pk2 ),
pubkey_letter( pk2->pubkey_algo ),
(ulong)keyid2[1],
datestr_from_pk( pk2 ) );
@@ -620,7 +620,7 @@ list_keyblock_print ( KBNODE keyblock, int secret, int fpr, void *opaque )
}
fputs( sigstr, stdout );
- printf("%c%c %c%c%c%c%c %08lX %s ",
+ printf("%c%c %c%c%c%c%c%c %08lX %s ",
sigrc,(sig->sig_class-0x10>0 &&
sig->sig_class-0x10<4)?'0'+sig->sig_class-0x10:' ',
sig->flags.exportable?' ':'L',
@@ -628,6 +628,8 @@ list_keyblock_print ( KBNODE keyblock, int secret, int fpr, void *opaque )
sig->flags.policy_url?'P':' ',
sig->flags.notation?'N':' ',
sig->flags.expired?'X':' ',
+ (sig->trust_depth>9)?'T':
+ (sig->trust_depth>0)?'0'+sig->trust_depth:' ',
(ulong)sig->keyid[1], datestr_from_sig(sig));
if( sigrc == '%' )
printf("[%s] ", g10_errstr(rc) );
@@ -1073,11 +1075,11 @@ print_fingerprint (PKT_public_key *pk, PKT_secret_key *sk, int mode )
}
else if (mode == 3) {
fp = NULL; /* use tty */
- text = _(" Key fingerprint =");
+ text = _(" Key fingerprint =");
}
else {
fp = stdout;
- text = _(" Key fingerprint =");
+ text = _(" Key fingerprint =");
}
if (sk)
diff --git a/g10/packet.h b/g10/packet.h
index fdca455a1..a2e710c4c 100644
--- a/g10/packet.h
+++ b/g10/packet.h
@@ -140,6 +140,9 @@ typedef struct {
byte pubkey_algo; /* algorithm used for public key scheme */
/* (PUBKEY_ALGO_xxx) */
byte digest_algo; /* algorithm used for digest (DIGEST_ALGO_xxxx) */
+ byte trust_depth;
+ byte trust_value;
+ const byte *trust_regexp;
struct revocation_key **revkey;
int numrevkeys;
subpktarea_t *hashed; /* all subpackets with hashed data (v4 only) */
diff --git a/g10/parse-packet.c b/g10/parse-packet.c
index bce3ce308..f15f412ef 100644
--- a/g10/parse-packet.c
+++ b/g10/parse-packet.c
@@ -778,13 +778,13 @@ dump_sig_subpkt( int hashed, int type, int critical,
break;
case SIGSUBPKT_TRUST:
if(length!=2)
- p="[invalid trust signature]";
+ p="[invalid trust subpacket]";
else
- printf("trust signature of level %d, amount %d",buffer[0],buffer[1]);
+ printf("trust signature of depth %d, amount %d",buffer[0],buffer[1]);
break;
case SIGSUBPKT_REGEXP:
if(!length)
- p="[invalid regexp]";
+ p="[invalid regexp subpacket]";
else
printf("regular expression: \"%s\"",buffer);
break;
@@ -933,6 +933,7 @@ parse_one_sig_subpkt( const byte *buffer, size_t n, int type )
case SIGSUBPKT_PREF_COMPR:
case SIGSUBPKT_POLICY:
case SIGSUBPKT_FEATURES:
+ case SIGSUBPKT_REGEXP:
return 0;
case SIGSUBPKT_EXPORTABLE:
case SIGSUBPKT_REVOCABLE:
@@ -955,6 +956,10 @@ parse_one_sig_subpkt( const byte *buffer, size_t n, int type )
if ( n != 1 )
break;
return 0;
+ case SIGSUBPKT_TRUST:
+ if ( n != 2 )
+ break;
+ return 0;
case SIGSUBPKT_PRIV_VERIFY_CACHE:
/* We used this in gpg 1.0.5 and 1.0.6 to cache signature
* verification results - it is no longer used.
@@ -1247,6 +1252,7 @@ parse_signature( IOBUF inp, int pkttype, unsigned long pktlen,
if( is_v4 && sig->pubkey_algo ) { /*extract required information */
const byte *p;
+ size_t len;
/* set sig->flags.unknown_critical if there is a
* critical bit set for packets which we do not understand */
@@ -1288,6 +1294,21 @@ parse_signature( IOBUF inp, int pkttype, unsigned long pktlen,
if(p && *p==0)
sig->flags.revocable=0;
+ p=parse_sig_subpkt(sig->hashed,SIGSUBPKT_TRUST,&len);
+ if(p && len==2)
+ {
+ sig->trust_depth=p[0];
+ sig->trust_value=p[1];
+
+ sig->trust_regexp=
+ parse_sig_subpkt(sig->hashed,SIGSUBPKT_REGEXP,&len);
+
+ /* If the regular expression is of 0 length, there is no
+ regular expression. */
+ if(len==0)
+ sig->trust_regexp=NULL;
+ }
+
/* We accept the exportable subpacket from either the hashed
or unhashed areas as older versions of gpg put it in the
unhashed area. In theory, anyway, we should never see this
diff --git a/g10/tdbio.c b/g10/tdbio.c
index 62ff26774..6da1021cd 100644
--- a/g10/tdbio.c
+++ b/g10/tdbio.c
@@ -1197,6 +1197,7 @@ tdbio_read_record( ulong recnum, TRUSTREC *rec, int expected )
rec->r.trust.depth = *p++;
p += 2;
rec->r.trust.validlist = buftoulong(p); p += 4;
+ rec->r.trust.min_ownertrust = *p++;
break;
case RECTYPE_VALID:
memcpy( rec->r.valid.namehash, p, 20); p+=20;
@@ -1275,6 +1276,7 @@ tdbio_write_record( TRUSTREC *rec )
*p++ = rec->r.trust.depth;
p += 2;
ulongtobuf( p, rec->r.trust.validlist); p += 4;
+ *p++ = rec->r.trust.min_ownertrust;
break;
case RECTYPE_VALID:
diff --git a/g10/tdbio.h b/g10/tdbio.h
index f2c6bec1b..6a28edc5a 100644
--- a/g10/tdbio.h
+++ b/g10/tdbio.h
@@ -77,6 +77,7 @@ struct trust_record {
byte ownertrust;
byte depth;
ulong validlist;
+ byte min_ownertrust;
} trust;
struct {
byte namehash[20];