Changeset 601

Show
Ignore:
Timestamp:
08/27/08 11:22:41
Author:
rachel
Message:

Code updated to refer to latest version of OpenPGP RFC.
Thanks to Daniel Kahn Gillmor for this patch.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • openpgpsdk/trunk/include/openpgpsdk/packet.h

    r585 r601  
    4545 
    4646/************************************/ 
    47 /* Packet Tags - RFC2440bis-12, 4.2 */ 
     47/* Packet Tags - RFC4880, 4.2 */ 
    4848/************************************/ 
    4949 
     
    5252 * has bit 7 set.  This is the mask for it. 
    5353 * 
    54  * \see RFC2440bis-12 4.2 
     54 * \see RFC4880 4.2 
    5555 */ 
    5656#define OPS_PTAG_ALWAYS_SET             0x80 
     
    6161 * old format is used. 
    6262 * 
    63  * \see RFC2440bis-12 4.2 
     63 * \see RFC4880 4.2 
    6464 */ 
    6565#define OPS_PTAG_NEW_FORMAT             0x40 
     
    7272 * shift by #OPS_PTAG_OF_CONTENT_TAG_SHIFT bits. 
    7373 * 
    74  * \see RFC2440bis-12 4.2 
     74 * \see RFC4880 4.2 
    7575 */ 
    7676#define OPS_PTAG_OF_CONTENT_TAG_MASK    0x3c 
     
    8080 * out from the Packet Tag. 
    8181 * 
    82  * \see RFC2440bis-12 4.2 
     82 * \see RFC4880 4.2 
    8383 */ 
    8484#define OPS_PTAG_OF_CONTENT_TAG_SHIFT   2 
     
    8989 * See #ops_ptag_of_lt_t for the meaning of the values. 
    9090 * 
    91  * \see RFC2440bis-12 4.2 
     91 * \see RFC4880 4.2 
    9292 */ 
    9393#define OPS_PTAG_OF_LENGTH_TYPE_MASK    0x03 
     
    9898 * old packet format. 
    9999 * 
    100  * \see RFC2440bis-12 4.2.1 
     100 * \see RFC4880 4.2.1 
    101101 */ 
    102102typedef enum 
     
    115115 * shift by #OPS_PTAG_NF_CONTENT_TAG_SHIFT bits. 
    116116 * 
    117  * \see RFC2440bis-12 4.2 
     117 * \see RFC4880 4.2 
    118118 */ 
    119119#define OPS_PTAG_NF_CONTENT_TAG_MASK    0x3f 
     
    123123 * out from the Packet Tag. 
    124124 * 
    125  * \see RFC2440bis-12 4.2 
     125 * \see RFC4880 4.2 
    126126 */ 
    127127#define OPS_PTAG_NF_CONTENT_TAG_SHIFT   0 
     
    136136 * signature subpacket type values that we understand. 
    137137 * 
    138  * \see RFC2440bis-12 4.3 
    139  * \see RFC2440bis-12 5.2.3.1 
     138 * \see RFC4880 4.3 
     139 * \see RFC4880 5.2.3.1 
    140140 */ 
    141141enum ops_content_tag_t 
     
    251251 
    252252/** Structure to hold one packet tag. 
    253  * \see RFC2440bis-12 4.2 
     253 * \see RFC4880 4.2 
    254254 */ 
    255255typedef struct 
     
    269269 * This lists algorithm numbers for public key algorithms. 
    270270 *  
    271  * \see RFC2440bis-12 9.1 
     271 * \see RFC4880 9.1 
    272272 */ 
    273273typedef enum 
    274274    { 
    275275    OPS_PKA_RSA                 =1,     /*!< RSA (Encrypt or Sign) */ 
    276     OPS_PKA_RSA_ENCRYPT_ONLY    =2,     /*!< RSA Encrypt-Only (deprecated - \see RFC2440bis-12 12.4) */ 
    277     OPS_PKA_RSA_SIGN_ONLY       =3,     /*!< RSA Sign-Only (deprecated - \see RFC2440bis-12 12.4) */ 
     276    OPS_PKA_RSA_ENCRYPT_ONLY    =2,     /*!< RSA Encrypt-Only (deprecated - \see RFC4880 13.5) */ 
     277    OPS_PKA_RSA_SIGN_ONLY       =3,     /*!< RSA Sign-Only (deprecated - \see RFC4880 13.5) */ 
    278278    OPS_PKA_ELGAMAL             =16,    /*!< Elgamal (Encrypt-Only) */ 
    279279    OPS_PKA_DSA                 =17,    /*!< DSA (Digital Signature Algorithm) */ 
     
    297297/** Structure to hold one DSA public key parameters. 
    298298 * 
    299  * \see RFC2440bis-12 5.5.2 
     299 * \see RFC4880 5.5.2 
    300300 */ 
    301301typedef struct 
     
    309309/** Structure to hold on RSA public key. 
    310310 * 
    311  * \see RFC2440bis-12 5.5.2 
     311 * \see RFC4880 5.5.2 
    312312 */ 
    313313typedef struct 
     
    319319/** Structure to hold on ElGamal public key parameters. 
    320320 * 
    321  * \see RFC2440bis-12 5.5.2 
     321 * \see RFC4880 5.5.2 
    322322 */ 
    323323typedef struct 
     
    339339 * OpenPGP has two different protocol versions: version 3 and version 4. 
    340340 * 
    341  * \see RFC2440bis-12 5.2 
     341 * \see RFC4880 5.2 
    342342 */ 
    343343typedef enum 
     
    407407 * This lists algorithm numbers for symmetric key algorithms. 
    408408 *  
    409  * \see RFC2440bis-12 9.2 
     409 * \see RFC4880 9.2 
    410410 */ 
    411411typedef enum 
     
    427427 * This lists algorithm numbers for hash algorithms. 
    428428 * 
    429  * \see RFC2440bis-12 9.4 
     429 * \see RFC4880 9.4 
    430430 */ 
    431431typedef enum 
     
    503503 * subkey binding has no place on a UserID). 
    504504 * 
    505  * \see RFC2440bis-12 5.2.1 
     505 * \see RFC4880 5.2.1 
    506506 */ 
    507507typedef enum 
     
    568568/** Struct to hold a signature packet. 
    569569 * 
    570  * \see RFC2440bis-12 5.2.2 
    571  * \see RFC2440bis-12 5.2.3 
     570 * \see RFC4880 5.2.2 
     571 * \see RFC4880 5.2.3 
    572572 */ 
    573573typedef struct 
  • openpgpsdk/trunk/src/lib/packet-parse.c

    r596 r601  
    457457 * \return              1 on success, 0 on error (calls the cb with OPS_PARSER_ERROR in limited_read()). 
    458458 * 
    459  * \see RFC2440bis-12 3.1 
     459 * \see RFC4880 3.1 
    460460 */ 
    461461static int limited_read_scalar(unsigned *dest,unsigned length, 
     
    496496 * \return              1 on success, 0 on error (calls the cb with OPS_PARSER_ERROR in limited_read()). 
    497497 * 
    498  * \see RFC2440bis-12 3.1 
     498 * \see RFC4880 3.1 
    499499 */ 
    500500static int limited_read_size_t_scalar(size_t *dest,unsigned length, 
     
    530530 * \return              see limited_read_scalar() 
    531531 * 
    532  * \see RFC2440bis-12 3.5 
     532 * \see RFC4880 3.5 
    533533 */ 
    534534static int limited_read_time(time_t *dest,ops_region_t *region, 
     
    579579 *                               see comment below - the callback is called with a OPS_PARSER_ERROR in case of an error) 
    580580 * 
    581  * \see RFC2440bis-12 3.2 
     581 * \see RFC4880 3.2 
    582582 */ 
    583583static int limited_read_mpi(BIGNUM **pbn,ops_region_t *region, 
     
    620620/** Read some data with a New-Format length from reader. 
    621621 * 
    622  * \sa Internet-Draft RFC2440bis-13.txt Section 4.2.2 
     622 * \sa Internet-Draft RFC4880.txt Section 4.2.2 
    623623 * 
    624624 * \param *length       Where the decoded length will be put 
     
    682682 *                               see comment below) 
    683683 * 
    684  * \see RFC2440bis-12 4.2.2 
     684 * \see RFC4880 4.2.2 
    685685 * \see ops_ptag_t 
    686686 */ 
     
    10491049 * \return              1 on success, 0 on error 
    10501050 * 
    1051  * \see RFC2440bis-12 5.5.2 
     1051 * \see RFC4880 5.5.2 
    10521052 */ 
    10531053static int parse_public_key(ops_content_tag_t tag,ops_region_t *region, 
     
    11431143 * \return              1 on success, 0 on error 
    11441144 * 
    1145  * \see RFC2440bis-12 5.11 
     1145 * \see RFC4880 5.11 
    11461146 */ 
    11471147static int parse_user_id(ops_region_t *region,ops_parse_info_t *pinfo) 
     
    12321232 * \return              1 on success, 0 on error 
    12331233 * 
    1234  * \see RFC2440bis-12 5.2.2 
     1234 * \see RFC4880 5.2.2 
    12351235 */ 
    12361236static int parse_v3_signature(ops_region_t *region, 
     
    13291329 * \return              1 on success, 0 on error 
    13301330 * 
    1331  * \see RFC2440bis-12 5.2.3 
     1331 * \see RFC4880 5.2.3 
    13321332 */ 
    13331333static int parse_one_signature_subpacket(ops_signature_t *sig, 
     
    16131613 * \return              1 on success, 0 on error 
    16141614 * 
    1615  * \see RFC2440bis-12 5.2.3 
     1615 * \see RFC4880 5.2.3 
    16161616 */ 
    16171617static int parse_signature_subpackets(ops_signature_t *sig, 
     
    16551655 * \return              1 on success, 0 on error 
    16561656 * 
    1657  * \see RFC2440bis-12 5.2.3 
     1657 * \see RFC4880 5.2.3 
    16581658 */ 
    16591659static int parse_v4_signature(ops_region_t *region,ops_parse_info_t *pinfo)