Changeset 64

Show
Ignore:
Timestamp:
04/25/05 13:01:56
Author:
rachel
Message:

Changes in revision r60 repplied without reformatting
Signature sub-packet types: primary user id and revocation key added

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • openpgpsdk/trunk/src/packet-parse.c

    r63 r64  
    637637    unsigned t8,t7; 
    638638    ops_boolean_t read=ops_true; 
     639    unsigned char bool; 
    639640 
    640641    init_subregion(&subregion,region); 
     
    687688 
    688689        C.ss_preferred_ska.len = subregion.length - subregion.length_read;        
     690        /* Do sanity check on length */ 
     691        if (C.ss_preferred_ska.len > MAX_PREFERRED_SKA) 
     692            { 
     693            ERR1 
     694                ("Warning: Truncated Preferred Symmetric Algorithm - subpacket %d octets", 
     695                 C.ss_preferred_ska.len); 
     696            C.ss_preferred_ska.len = MAX_PREFERRED_SKA; 
     697            } 
    689698        if (!ops_limited_read(C.ss_preferred_ska.data, 
    690699                              C.ss_preferred_ska.len, &subregion, opt)) 
     
    692701        break; 
    693702                                 
     703    case OPS_PTAG_SS_PRIMARY_USER_ID: 
     704        if (!ops_limited_read (&bool, 1, &subregion, opt)) 
     705            return 0; 
     706        C.ss_primary_user_id.primary_user_id = !!bool; 
     707        break; 
     708  
     709    case OPS_PTAG_SS_REVOCATION_KEY: 
     710        printf ("Sizeof struct is %d\n", sizeof (ops_ss_revocation_key_t)); 
     711  
     712        /* octet 0 = class. Bit 0x80 must be set */ 
     713        if (!ops_limited_read (&C.ss_revocation_key.class, 1, &subregion, opt)) 
     714            return 0; 
     715        if (!(C.ss_revocation_key.class & 0x80)) 
     716            { 
     717            printf 
     718                ("Warning: OPS_PTAG_SS_REVOCATION_KEY class: Bit 0x80 should be set\n"); 
     719            return 0; 
     720            } 
     721  
     722        /* octet 1 = algid */ 
     723        if (!ops_limited_read (&C.ss_revocation_key.algid, 1, &subregion, opt)) 
     724            return 0; 
     725  
     726        /* octets 2-21 = fingerprint */ 
     727        if (!ops_limited_read 
     728            ((unsigned char *) &C.ss_revocation_key.fingerprint, 20, &subregion, 
     729             opt)) 
     730            return 0; 
     731        break; 
     732  
    694733    default: 
    695734        if(opt->ss_parsed[t8]&t7)