Changeset 345

Show
Ignore:
Timestamp:
01/30/06 16:33:42
Author:
ben
Message:

Actually, the checksum is encrypted, too.

Files:

Legend:

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

    r344 r345  
    19361936        decrypt.set_key(&decrypt,key); 
    19371937 
    1938         /* We need to prevent the decrypter from reading the trailing 
    1939            checksum */ 
    1940         region->length-=checksum_length; 
    19411938        ops_reader_push_decrypt(parse_info,&decrypt,region); 
    19421939 
    19431940        /* Since all known encryption for PGP doesn't compress, we can 
    1944            limit to the same length as the current region (for now), 
    1945            allowing for the trailing checksum. 
     1941           limit to the same length as the current region (for now). 
    19461942        */ 
    19471943 
     
    19771973        } 
    19781974 
    1979     if(saved_region) 
     1975    if(ret) 
     1976        { 
     1977        // XXX: check the checksum 
     1978 
     1979        if(C.secret_key.s2k_usage == OPS_S2KU_ENCRYPTED_AND_HASHED) 
     1980            { 
     1981            if(!limited_read(C.secret_key.checkhash,20,region,parse_info)) 
     1982                return 0; 
     1983            } 
     1984        else 
     1985            { 
     1986            if(!limited_read_scalar(&C.secret_key.checksum,2,region, 
     1987                                    parse_info)) 
     1988                return 0; 
     1989            } 
     1990        } 
     1991 
     1992    if(C.secret_key.s2k_usage == OPS_S2KU_ENCRYPTED 
     1993       || C.secret_key.s2k_usage == OPS_S2KU_ENCRYPTED_AND_HASHED) 
    19801994        { 
    19811995        ops_reader_pop_decrypt(parse_info); 
    19821996        assert(region->length_read == region->length); 
    1983         region=saved_region; 
    1984         /* put back checksum data */ 
    1985         region->length+=checksum_length; 
    19861997        } 
    19871998 
    19881999    if(!ret) 
    19892000        return 0; 
    1990  
    1991     // XXX: check the checksum 
    1992  
    1993     if(C.secret_key.s2k_usage == OPS_S2KU_ENCRYPTED_AND_HASHED) 
    1994         { 
    1995         if(!limited_read(C.secret_key.checkhash,20,region,parse_info)) 
    1996             return 0; 
    1997         } 
    1998     else 
    1999         { 
    2000         if(!limited_read_scalar(&C.secret_key.checksum,2,region,parse_info)) 
    2001             return 0; 
    2002         } 
    20032001 
    20042002    CBP(parse_info,OPS_PTAG_CT_SECRET_KEY,&content);