Changeset 59
- Timestamp:
- 04/20/05 17:47:26
- Files:
-
- openpgpsdk/trunk/src/packet-dump.c (modified) (2 diffs)
- openpgpsdk/trunk/src/packet-parse.c (modified) (3 diffs)
- openpgpsdk/trunk/src/packet-parse.h (modified) (1 diff)
- openpgpsdk/trunk/src/packet.h (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
openpgpsdk/trunk/src/packet-dump.c
r58 r59 26 26 { 27 27 const ops_parser_content_union_t *content=&content_->content; 28 28 int i=0; /* loop counter */ 29 29 30 switch(content_->tag) 30 31 { … … 137 138 break; 138 139 140 case OPS_PTAG_SS_PREFERRED_SKA: 141 printf(" preferred symmetric algorithms="); 142 for (i=0; i<content->ss_preferred_ska.len; i++) { 143 switch (content->ss_preferred_ska.data[i]) { 144 case OPS_SKA_PLAINTEXT: 145 printf("Plaintext "); 146 break; 147 case OPS_SKA_IDEA: 148 printf("IDEA "); 149 break; 150 case OPS_SKA_TRIPLEDES: 151 printf("TripleDES "); 152 break; 153 case OPS_SKA_CAST5: 154 printf("CAST5 "); 155 break; 156 case OPS_SKA_BLOWFISH: 157 printf("Blowfish "); 158 break; 159 case OPS_SKA_AES_128: 160 printf("AES(128-bit) "); 161 break; 162 case OPS_SKA_AES_192: 163 printf("AES(192-bit) "); 164 break; 165 case OPS_SKA_AES_256: 166 printf("AES(256-bit) "); 167 break; 168 case OPS_SKA_TWOFISH: 169 printf("Twofish "); 170 break; 171 default: 172 printf("Unknown SKA: %d ",content->ss_preferred_ska.data[i]); 173 } 174 } 175 printf ("\n"); 176 break; 177 139 178 default: 140 179 fprintf(stderr,"unknown tag=%d\n",content_->tag); openpgpsdk/trunk/src/packet-parse.c
r55 r59 17 17 # include <dmalloc.h> 18 18 #endif 19 19 20 20 static void init_subregion(ops_region_t *subregion,ops_region_t *region) 21 21 { … … 177 177 /** Read a scalar. 178 178 * 179 * Read a Big Endian scalar of length bytes, respec ing packet boundaries (by calling #limited_read to read the raw179 * Read a Big Endian scalar of length bytes, respecting packet boundaries (by calling #limited_read to read the raw 180 180 * data). 181 181 * … … 684 684 break; 685 685 686 case OPS_PTAG_SS_PREFERRED_SKA: 687 /* should this be malloc-ed? or done as fixed array? 688 * use fixed arraysize for now. Ben? - Rachel */ 689 690 C.ss_preferred_ska.len = subregion.length - subregion.length_read; 691 if (!ops_limited_read(C.ss_preferred_ska.data, 692 C.ss_preferred_ska.len, &subregion, opt)) 693 return 0; 694 break; 695 686 696 default: 687 697 if(opt->ss_parsed[t8]&t7) openpgpsdk/trunk/src/packet-parse.h
r55 r59 65 65 OPS_PARSE_RAW, 66 66 OPS_PARSE_PARSED, 67 OPS_PARSE_IGNORE 67 OPS_PARSE_IGNORE 68 68 }; 69 69 openpgpsdk/trunk/src/packet.h
r55 r59 144 144 OPS_PTAG_SS_EXPIRATION_TIME =0x200+3, /*!< signature expiration time */ 145 145 OPS_PTAG_SS_TRUST =0x200+5, /*!< trust signature */ 146 OPS_PTAG_SS_PREFERRED_SKA = 0x200+11, /*!< preferred symmetric algorithms */ 146 147 OPS_PTAG_SS_ISSUER_KEY_ID =0x200+16, 147 148 }; … … 171 172 * OpenPGP assigns a unique Algorithm Number to each algorithm that is part of OpenPGP. 172 173 * 173 * This lists algorith numbers for public key algorithms.174 * This lists algorithm numbers for public key algorithms. 174 175 * 175 176 * \see RFC2440bis-12 9.1 … … 225 226 } ops_public_key_union_t; 226 227 227 /** Stru ture to hold one pgp public key */228 /** Structure to hold one pgp public key */ 228 229 typedef struct 229 230 { … … 238 239 } ops_public_key_t; 239 240 240 /** Struture to hold one user id */ 241 /** Symmetric Key Algorithm Numbers. 242 * OpenPGP assigns a unique Algorithm Number to each algorithm that is part of OpenPGP. 243 * 244 * This lists algorithm numbers for symmetric key algorithms. 245 * 246 * \see RFC2440bis-12 9.2 247 */ 248 typedef enum 249 { 250 OPS_SKA_PLAINTEXT =0, /*!< Plaintext or unencrypted data */ 251 OPS_SKA_IDEA =1, /*!< IDEA */ 252 OPS_SKA_TRIPLEDES =2, /*!< TripleDES */ 253 OPS_SKA_CAST5 =3, /*!< CAST5 */ 254 OPS_SKA_BLOWFISH =4, /*!< Blowfish */ 255 OPS_SKA_AES_128 =7, /*!< AES with 128-bit key (AES) */ 256 OPS_SKA_AES_192 =8, /*!< AES with 192-bit key */ 257 OPS_SKA_AES_256 =9, /*!< AES with 256-bit key */ 258 OPS_SKA_TWOFISH =10, /*!< Twofish with 256-bit key (TWOFISH) */ 259 260 } ops_symmetric_key_algorithm_t; 261 262 /** Structure to hold one user id */ 241 263 typedef struct 242 264 { … … 292 314 * OpenPGP assigns a unique Algorithm Number to each algorithm that is part of OpenPGP. 293 315 * 294 * This lists algorith numbers for hash algorithms.295 * 296 * \see RFC2440bis-12 9. 1316 * This lists algorithm numbers for hash algorithms. 317 * 318 * \see RFC2440bis-12 9.4 297 319 */ 298 320 typedef enum … … 373 395 unsigned char key_id[OPS_KEY_ID_SIZE]; 374 396 } ops_ss_key_id_t; 397 398 /* MAX PREFERRED ALGORITHMS is defined to provide an upper bound 399 * on the size of array to be used to stored the array given in the 400 * Preferred Symmetric Algorithms signature sub-packet. 401 * The value has been arbitrarily chosen to allow for an array 402 * which includes each SKA currently defined in rfc2440bis 403 */ 404 405 #define MAX_PREFERRED_SKA 22 406 typedef struct 407 { 408 size_t len; /* must use a length field in structure to 409 determine where the algorithms stop. 410 The value 0 may represent the plaintext algorithm 411 so we cannot expect a null-terminated list */ 412 unsigned char data[MAX_PREFERRED_SKA]; 413 } ops_ss_preferred_ska_t; 375 414 376 415 typedef struct … … 419 458 ops_compressed_t compressed; 420 459 ops_one_pass_signature_t one_pass_signature; 460 ops_ss_preferred_ska_t ss_preferred_ska; 421 461 } ops_parser_content_union_t; 422 462
