1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-01-24 15:17:02 +01:00

* parse-packet.c (dump_sig_subpkt, parse_one_sig_subpkt,

can_handle_critical): Parse and display 0x19 signatures.
This commit is contained in:
David Shaw 2004-04-22 00:54:30 +00:00
parent 36e6975ac9
commit 2bdb01e2e7
2 changed files with 91 additions and 74 deletions

View File

@ -1,3 +1,8 @@
2004-04-21 David Shaw <dshaw@jabberwocky.com>
* parse-packet.c (dump_sig_subpkt, parse_one_sig_subpkt,
can_handle_critical): Parse and display 0x19 signatures.
2004-04-20 David Shaw <dshaw@jabberwocky.com> 2004-04-20 David Shaw <dshaw@jabberwocky.com>
* keyserver.c (parse_keyserver_uri): Do not accept "http" as an * keyserver.c (parse_keyserver_uri): Do not accept "http" as an

View File

@ -949,6 +949,17 @@ dump_sig_subpkt( int hashed, int type, int critical,
for( i=0; i < length; i++ ) for( i=0; i < length; i++ )
printf(" %02x", buffer[i] ); printf(" %02x", buffer[i] );
break; break;
case SIGSUBPKT_SIGNATURE:
fputs("signature: ",stdout);
if(length<17)
p="[too short]";
else
printf("v%d, class 0x%02X, algo %d, digest algo %d",
buffer[0],
buffer[0]==3?buffer[2]:buffer[1],
buffer[0]==3?buffer[15]:buffer[2],
buffer[0]==3?buffer[16]:buffer[3]);
break;
default: default:
if(type>=100 && type<=110) if(type>=100 && type<=110)
p="experimental / private subpacket"; p="experimental / private subpacket";
@ -969,89 +980,90 @@ dump_sig_subpkt( int hashed, int type, int critical,
int int
parse_one_sig_subpkt( const byte *buffer, size_t n, int type ) parse_one_sig_subpkt( const byte *buffer, size_t n, int type )
{ {
switch( type ) { switch( type )
case SIGSUBPKT_REV_KEY: {
if(n < 22) case SIGSUBPKT_REV_KEY:
break; if(n < 22)
return 0; break;
case SIGSUBPKT_SIG_CREATED: return 0;
case SIGSUBPKT_SIG_EXPIRE: case SIGSUBPKT_SIG_CREATED:
case SIGSUBPKT_KEY_EXPIRE: case SIGSUBPKT_SIG_EXPIRE:
if( n < 4 ) case SIGSUBPKT_KEY_EXPIRE:
break; if( n < 4 )
return 0; break;
case SIGSUBPKT_KEY_FLAGS: return 0;
case SIGSUBPKT_KS_FLAGS: case SIGSUBPKT_KEY_FLAGS:
case SIGSUBPKT_PREF_SYM: case SIGSUBPKT_KS_FLAGS:
case SIGSUBPKT_PREF_HASH: case SIGSUBPKT_PREF_SYM:
case SIGSUBPKT_PREF_COMPR: case SIGSUBPKT_PREF_HASH:
case SIGSUBPKT_POLICY: case SIGSUBPKT_PREF_COMPR:
case SIGSUBPKT_PREF_KS: case SIGSUBPKT_POLICY:
case SIGSUBPKT_FEATURES: case SIGSUBPKT_PREF_KS:
case SIGSUBPKT_REGEXP: case SIGSUBPKT_FEATURES:
return 0; case SIGSUBPKT_REGEXP:
case SIGSUBPKT_EXPORTABLE: return 0;
case SIGSUBPKT_REVOCABLE: case SIGSUBPKT_SIGNATURE:
if( !n ) case SIGSUBPKT_EXPORTABLE:
break; case SIGSUBPKT_REVOCABLE:
return 0; case SIGSUBPKT_REVOC_REASON:
case SIGSUBPKT_ISSUER: /* issuer key ID */ if( !n )
if( n < 8 ) break;
break; return 0;
return 0; case SIGSUBPKT_ISSUER: /* issuer key ID */
case SIGSUBPKT_NOTATION: if( n < 8 )
if( n < 8 ) /* minimum length needed */ break;
break; return 0;
return 0; case SIGSUBPKT_NOTATION:
case SIGSUBPKT_REVOC_REASON: if( n < 8 ) /* minimum length needed */
if( !n ) break;
break; return 0;
return 0; case SIGSUBPKT_PRIMARY_UID:
case SIGSUBPKT_PRIMARY_UID: if ( n != 1 )
if ( n != 1 ) break;
break; return 0;
return 0; case SIGSUBPKT_TRUST:
case SIGSUBPKT_TRUST: if ( n != 2 )
if ( n != 2 ) break;
break; return 0;
return 0; default: return -1;
default: return -1;
} }
return -3; return -3;
} }
static int static int
can_handle_critical( const byte *buffer, size_t n, int type ) can_handle_critical( const byte *buffer, size_t n, int type )
{ {
switch( type ) { switch( type )
case SIGSUBPKT_NOTATION: {
if( n >= 8 && (*buffer & 0x80) ) case SIGSUBPKT_NOTATION:
return 1; /* human readable is handled */ if( n >= 8 && (*buffer & 0x80) )
return 0; return 1; /* human readable is handled */
return 0;
case SIGSUBPKT_SIG_CREATED: case SIGSUBPKT_SIGNATURE:
case SIGSUBPKT_SIG_EXPIRE: case SIGSUBPKT_SIG_CREATED:
case SIGSUBPKT_KEY_EXPIRE: case SIGSUBPKT_SIG_EXPIRE:
case SIGSUBPKT_EXPORTABLE: case SIGSUBPKT_KEY_EXPIRE:
case SIGSUBPKT_REVOCABLE: case SIGSUBPKT_EXPORTABLE:
case SIGSUBPKT_REV_KEY: case SIGSUBPKT_REVOCABLE:
case SIGSUBPKT_ISSUER:/* issuer key ID */ case SIGSUBPKT_REV_KEY:
case SIGSUBPKT_PREF_SYM: case SIGSUBPKT_ISSUER:/* issuer key ID */
case SIGSUBPKT_PREF_HASH: case SIGSUBPKT_PREF_SYM:
case SIGSUBPKT_PREF_COMPR: case SIGSUBPKT_PREF_HASH:
case SIGSUBPKT_KEY_FLAGS: case SIGSUBPKT_PREF_COMPR:
case SIGSUBPKT_PRIMARY_UID: case SIGSUBPKT_KEY_FLAGS:
case SIGSUBPKT_FEATURES: case SIGSUBPKT_PRIMARY_UID:
case SIGSUBPKT_TRUST: case SIGSUBPKT_FEATURES:
case SIGSUBPKT_REGEXP: case SIGSUBPKT_TRUST:
/* Is it enough to show the policy or keyserver? */ case SIGSUBPKT_REGEXP:
case SIGSUBPKT_POLICY: /* Is it enough to show the policy or keyserver? */
case SIGSUBPKT_PREF_KS: case SIGSUBPKT_POLICY:
return 1; case SIGSUBPKT_PREF_KS:
return 1;
default: default:
return 0; return 0;
} }
} }