Changeset 166
- Timestamp:
- 06/15/05 10:44:14
- Files:
-
- openpgpsdk/trunk/doc/doxygen-user.cfg (modified) (1 diff)
- openpgpsdk/trunk/examples/packet-dump.c (modified) (3 diffs)
- openpgpsdk/trunk/src/accumulate.c (modified) (1 diff)
- openpgpsdk/trunk/src/create.c (modified) (4 diffs)
- openpgpsdk/trunk/src/fingerprint.c (modified) (1 diff)
- openpgpsdk/trunk/src/keyring.c (modified) (1 diff)
- openpgpsdk/trunk/src/packet-parse.c (modified) (4 diffs)
- openpgpsdk/trunk/src/packet-show.c (modified) (12 diffs)
- openpgpsdk/trunk/src/signature.c (modified) (6 diffs)
- openpgpsdk/trunk/src/util.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
openpgpsdk/trunk/doc/doxygen-user.cfg
r135 r166 108 108 # to NO the shortest path that makes the file name unique will be used. 109 109 110 FULL_PATH_NAMES = YES110 FULL_PATH_NAMES = NO 111 111 112 112 # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag openpgpsdk/trunk/examples/packet-dump.c
r165 r166 104 104 } 105 105 106 static void printhex(const unsigned char *src,size_t length) 107 { 108 while(length--) 109 printf("%02X",*src++); 110 } 111 106 112 static void print_hexdump( char *name, 107 113 const unsigned char *data, … … 111 117 112 118 printf("len=%d, data=0x", len); 113 hexdump(data,len);119 printhex(data,len); 114 120 printf("\n"); 115 121 } … … 122 128 123 129 printf("0x"); 124 hexdump(data,len);130 printhex(data,len); 125 131 printf("\n"); 126 132 } openpgpsdk/trunk/src/accumulate.c
r135 r166 264 264 265 265 /*! \todo descr for ops_parse_and_accumulate */ 266 /** 267 * \ingroup Parse 268 * 269 * ops_parse_and_accumulate() calls ops_parse() with accumulate_cb() to do 270 * something I'm not clear what. It then calls dump_key_data() on the keyring, 271 * and validates all signatures on it. 272 * \param keyring 273 * \param opt 274 * \todo Get Ben to shed some light on this darkness 275 */ 276 266 277 void ops_parse_and_accumulate(ops_keyring_t *keyring,ops_parse_options_t *opt) 267 278 { openpgpsdk/trunk/src/create.c
r138 r166 82 82 // the safe (i.e. non _fast_) version will, and so will also need to 83 83 // be freed. 84 85 /** 86 * \ingroup Create 87 * 88 * ops_fast_create_user_id() sets #id->user_id to the given #user_id. 89 * This is fast because it is only copying a char*. However, if #user_id 90 * is changed or freed in the future, this could have injurious results. 91 * \param id 92 * \param user_id 93 */ 94 84 95 void ops_fast_create_user_id(ops_user_id_t *id,char *user_id) 85 96 { … … 87 98 } 88 99 100 /** 101 * \ingroup Create 102 * 103 * Writes a User Id from the information held in #id and #opt 104 * 105 * \param id 106 * \param opt 107 * \return Return value from ops_write() unless call to ops_write_ptag() or ops_write_length() failed before it was called, in which case returns 0 108 * \todo tidy up that return value description! 109 */ 89 110 ops_boolean_t ops_write_struct_user_id(ops_user_id_t *id, 90 111 ops_create_options_t *opt) … … 175 196 } 176 197 198 /** 199 * \ingroup Create 200 * 201 * Writes a Public Key from the information held in #key and #opt 202 * 203 * \param key 204 * \param opt 205 * \return Return value from write_public_key_body() unless call to ops_write_ptag() or ops_write_length() failed before it was called, in which case returns 0 206 * \todo tidy up that return value description! 207 */ 177 208 ops_boolean_t ops_write_struct_public_key(const ops_public_key_t *key, 178 209 ops_create_options_t *opt) … … 185 216 } 186 217 218 /** 219 * \ingroup Create 220 * 221 * Writes an RSA public key. 222 * 223 * \param time 224 * \param n 225 * \param e 226 * \param opt 227 * 228 * \return result from ops_write_struct_public_key() 229 * 230 * \todo get better definition of return values 231 * \todo get better description of usage. What writers are provided? When do they get setup? How are you supposed to use this? 232 */ 233 187 234 ops_boolean_t ops_write_rsa_public_key(time_t time,const BIGNUM *n, 188 235 const BIGNUM *e, openpgpsdk/trunk/src/fingerprint.c
r135 r166 66 66 } 67 67 68 /** 69 * \ingroup Utils 70 * 71 * Not sure what this does 72 * 73 * \param keyid 74 * \param key 75 * 76 * \todo Get descr from Ben what this does 77 */ 78 68 79 void ops_keyid(unsigned char keyid[8],const ops_public_key_t *key) 69 80 { openpgpsdk/trunk/src/keyring.c
r135 r166 41 41 } 42 42 43 /** 44 * \ingroup Memory 45 * 46 * ops_keyring_free() frees the memory used in one ops_keyring_t structure 47 * \param keyring Keyring to be freed. 48 */ 43 49 void ops_keyring_free(ops_keyring_t *keyring) 44 50 { openpgpsdk/trunk/src/packet-parse.c
r158 r166 1 1 /** \file 2 2 * \brief Parser for OpenPGP packets 3 */ 4 5 /** @defgroup PublicAPI Public API 6 * These functions are public and available for external use. 7 * @{ 8 */ 9 /** 10 * @defgroup Parse Parse 11 * These functions allow an OpenPGP object (for example, an OpenPGP message or keyring) to be parsed. 12 * @ingroup PublicAPI 13 */ 14 /** 15 * @defgroup Create Create 16 * These functions allow an OpenPGP object to be created. 17 * @ingroup PublicAPI 18 */ 19 /** 20 * @defgroup Memory Memory 21 * These functions relate to memory usage. 22 * @ingroup PublicAPI 23 */ 24 /** 25 * @defgroup Show Show 26 * These functions allow the contents to be displayed in human-readable form. 27 * @ingroup PublicAPI 28 */ 29 /** 30 * @defgroup Utils Utils 31 * These functions are of general utility 32 * @ingroup PublicAPI 33 */ 34 /** 35 * @} 3 36 */ 4 37 … … 1437 1470 } 1438 1471 1472 /** 1473 * \ingroup Memory 1474 * 1475 * ops_secret_key_free() frees the memory associated with #key. Note that 1476 * the key itself is not freed. 1477 * 1478 * \param key 1479 */ 1480 1439 1481 void ops_secret_key_free(ops_secret_key_t *key) 1440 1482 { … … 1626 1668 } 1627 1669 1628 /** Parse packets. 1629 * 1670 /** 1671 * \ingroup Parse 1672 * 1630 1673 * Parses packets calling #ops_parse_one_packet until an error occurs or until EOF (which is just another error anyway). 1631 1674 * … … 1643 1686 } 1644 1687 1645 /* XXX: Make all packet types optional, not just subpackets */1646 1688 /** 1647 * Setup packet options, depending on packet tag and parsing type 1689 * \ingroup Parse 1690 * 1691 * ops_parse_options() sets up the packet options in #*opt, depending on 1692 * the packet tag #tag and the parsing type #type 1693 * \param opt Pointer to previously allocated structure 1694 * \param tag Packet tag 1695 * \param type Parse type 1696 * \todo XXX: Make all packet types optional, not just subpackets 1648 1697 */ 1649 1698 void ops_parse_options(ops_parse_options_t *opt, openpgpsdk/trunk/src/packet-show.c
r165 r166 325 325 } 326 326 327 /*! generic function to free memory used by ops_text_t structure */ 327 /** 328 * \ingroup Memory 329 * 330 * ops_text_free() frees the memory used by an ops_text_t structure 331 * 332 * \param text Pointer to a previously allocated structure. This structure and its contents will be freed. 333 */ 328 334 void ops_text_free(ops_text_t *text) 329 335 { … … 475 481 } 476 482 477 /*! returns string derived from the type of the Signature Sub-Packet */ 483 /** 484 * \ingroup Show 485 * 486 * ops_show_ss_type() returns a string pointer which 487 * represents the type of the Signature Sub-Packet 488 * \param ss_type Signature Sub-Packet type 489 * \return string or "Unknown" 490 */ 478 491 char *ops_show_ss_type(ops_ss_type_t ss_type) 479 492 { … … 481 494 } 482 495 483 /*! returns string derived from the type of the SS Revocation Reaspon */ 496 /** 497 * \ingroup Show 498 * 499 * ops_show_rr_code() returns a pointer to a string which 500 * represents the Revocation Reason code 501 * \param ss_rr_code Revocation Reason code 502 * \todo add reference 503 * \todo make typesafe 504 * \return string or "Unknown" 505 */ 484 506 char *ops_show_ss_rr_code(ops_ss_rr_code_t ss_rr_code) 485 507 { … … 493 515 } 494 516 495 /*! returns all text derived from this signature sub-packet type */ 517 /** 518 * \ingroup Show 519 * 520 * ops_showall_ss_preferred_compression() returns a pointer to an ops_text_t 521 * structure which contains strings representing the Compression Algorithms 522 * in the preferred list 523 * \param ss_preferred_compression Array of Preferred Compression Algorithms 524 * \return NULL if cannot allocate memory or other error 525 * \return pointer to structure, if no error 526 * \todo make typesafe 527 */ 496 528 ops_text_t *ops_showall_ss_preferred_compression(ops_ss_preferred_compression_t ss_preferred_compression) 497 529 { … … 501 533 502 534 503 /*! returns string derived from a single octet in this field */ 504 char *ops_show_hash_algorithm(unsigned char octet) 505 { 506 return(str_from_map(octet,hash_algorithm_map)); 507 } 508 509 /*! returns all text derived from this signature sub-packet type */ 535 /** 536 * \ingroup Show 537 * 538 * ops_show_hash_algorithm() returns a pointer to a string which 539 * represents the Hash Algorithm type 540 * \param hash Hash Algorithm type 541 * \todo add reference 542 * \todo make typesafe 543 * \return string or "Unknown" 544 */ 545 char *ops_show_hash_algorithm(unsigned char hash) 546 { 547 return(str_from_map(hash,hash_algorithm_map)); 548 } 549 550 /** 551 * \ingroup Show 552 * 553 * ops_showall_ss_preferred_hash() returns a pointer to an ops_text_t 554 * structure which contains strings representing the Hash Algorithms 555 * in the preferred list 556 * \param ss_preferred_hash Array of Preferred Hash Algorithms 557 * \return NULL if cannot allocate memory or other error 558 * \return pointer to structure, if no error 559 * \todo make typesafe 560 */ 510 561 ops_text_t *ops_showall_ss_preferred_hash(ops_ss_preferred_hash_t ss_preferred_hash) 511 562 { … … 514 565 } 515 566 516 /*! returns string derived from signature type value */ 567 /** 568 * \ingroup Show 569 * 570 * ops_show_sig_type() returns a pointer to a string which 571 * represents the Signature type 572 * \param sig_type Signature type 573 * \todo add reference 574 * \return string or "Unknown" 575 */ 517 576 char *ops_show_sig_type(ops_sig_type_t sig_type) 518 577 { … … 520 579 } 521 580 522 /*! returns string derived from PKA type */ 581 /** 582 * \ingroup Show 583 * 584 * ops_show_pka() returns a pointer to a string which 585 * represents the Public Key Algorithm 586 * \param pka Public Key Algorithm type 587 * \todo add reference 588 * \return string or "Unknown" 589 */ 523 590 char *ops_show_pka(ops_public_key_algorithm_t pka) 524 591 { … … 532 599 } 533 600 534 /*! returns all text derived from this signature sub-packet type */ 601 /** 602 * \ingroup Show 603 * 604 * ops_showall_ss_preferred_ska() returns a pointer to an ops_text_t structure 605 * which contains strings representing the Secret Key Algorithms 606 * in the preferred list 607 * \param ss_preferred_ska Array of Preferred Secret Key Algorithms 608 * \return NULL if cannot allocate memory or other error 609 * \return pointer to structure, if no error 610 * \todo make typesafe 611 */ 535 612 ops_text_t *ops_showall_ss_preferred_ska(ops_ss_preferred_ska_t ss_preferred_ska) 536 613 { … … 545 622 } 546 623 547 /*! returns all text derived from this signature sub-packet type */ 624 /** 625 * \ingroup Show 626 * 627 * ops_showall_ss_features() returns a pointer to an ops_text_t 628 * structure which contains strings representing the 629 * Signature Sub-Packet Features given in #ss_features 630 * \param ss_features Signature Sub-Packet Features 631 * \return NULL if cannot allocate memory or other error 632 * \return pointer to structure, if no error 633 * \todo make typesafe 634 * \todo add reference 635 */ 548 636 ops_text_t *ops_showall_ss_features(ops_ss_features_t ss_features) 549 637 { … … 575 663 } 576 664 577 /*! returns all text derived from this signature sub-packet type */ 665 /** 666 * \ingroup Show 667 * 668 * ops_showall_ss_notation_data_flags() returns a pointer to an ops_text_t 669 * structure containing strings representing the 670 * Signature Sub-Packet Notation Data Flags given in #ss_notation_data 671 * \param ss_notation_data Signature Sub-Packet Notation Data 672 * \return NULL if cannot allocate memory or other error 673 * \return pointer to structure, if no error 674 * \todo make typesafe 675 * \todo add reference 676 */ 578 677 ops_text_t *ops_showall_ss_notation_data_flags(ops_ss_notation_data_t ss_notation_data) 579 678 { … … 587 686 } 588 687 589 /*! returns all text derived from this signature sub-packet type */ 688 /** 689 * \ingroup Show 690 * 691 * ops_showall_ss_key_flags() returns a pointer to an ops_text_t 692 * structure which contains strings representing the Key Flags 693 * in the preferred list 694 * \param ss_key_flags Array of Key Flags 695 * \return NULL if cannot allocate memory or other error 696 * \return pointer to structure, if no error 697 * \todo make typesafe 698 */ 590 699 ops_text_t *ops_showall_ss_key_flags(ops_ss_key_flags_t ss_key_flags) 591 700 { … … 617 726 } 618 727 619 /*! returns string derived from one bitfield in this signature-subpacket type */ 620 char *ops_show_ss_key_server_prefs(unsigned char octet, bit_map_t *map) 621 { 622 return(str_from_bitfield(octet,map)); 728 /** 729 * \ingroup Show 730 * 731 * ops_show_ss_key_server_prefs() returns a string pointer 732 * which represents the user's preferences that should be 733 * observed by the key server. 734 * 735 * \param prefs Byte containing bitfield of preferences 736 * \param map 737 * \return string or "Unknown" 738 * \todo add reference 739 * \todo make typesafe 740 */ 741 char *ops_show_ss_key_server_prefs(unsigned char prefs, bit_map_t *map) 742 { 743 return(str_from_bitfield(prefs,map)); 623 744 } 624 745 openpgpsdk/trunk/src/signature.c
r142 r166 247 247 } 248 248 249 /** 250 * \ingroup Create 251 * 252 * ops_signature_start() creates a V4 signature with a SHA1 hash. 253 * 254 * \param sig 255 * \param key 256 * \param id 257 * \param type 258 * \todo Expand description. 259 */ 249 260 void ops_signature_start(ops_create_signature_t *sig, 250 261 const ops_public_key_t *key, … … 285 296 } 286 297 298 /** 299 * \ingroup Create 300 * 301 * Mark the end of the hashed subpackets in the signature 302 * 303 * \param sig 304 */ 305 287 306 void ops_signature_hashed_subpackets_end(ops_create_signature_t *sig) 288 307 { … … 295 314 } 296 315 316 /** 317 * \ingroup Create 318 * 319 * Write out a signature 320 * 321 * \param sig 322 * \param key 323 * \param skey 324 * \param opt 325 * 326 * \todo get a better description of how/when this is used 327 */ 328 297 329 void ops_write_signature(ops_create_signature_t *sig,ops_public_key_t *key, 298 330 ops_secret_key_t *skey,ops_create_options_t *opt) … … 321 353 } 322 354 355 /** 356 * \ingroup Create 357 * 358 * ops_signature_add_creation_time() adds a creation time to the signature. 359 * 360 * \param sig 361 * \param when 362 */ 323 363 void ops_signature_add_creation_time(ops_create_signature_t *sig,time_t when) 324 364 { … … 327 367 } 328 368 369 /** 370 * \ingroup Create 371 * 372 * Adds issuer's key ID to the signature 373 * 374 * \param sig 375 * \param keyid 376 */ 377 329 378 void ops_signature_add_issuer_key_id(ops_create_signature_t *sig, 330 379 const unsigned char keyid[OPS_KEY_ID_SIZE]) … … 334 383 } 335 384 385 /** 386 * \ingroup Create 387 * 388 * Adds primary user ID to the signature 389 * 390 * \param sig 391 * \param keyid 392 */ 336 393 void ops_signature_add_primary_user_id(ops_create_signature_t *sig, 337 394 ops_boolean_t primary) openpgpsdk/trunk/src/util.c
r135 r166 16 16 } 17 17 18 /** 19 * \ingroup Utils 20 * 21 * ops_init() just calls ops_crypto_init() 22 * \todo Ask Ben why we need this extra layer 23 */ 24 18 25 void ops_init(void) 19 26 { 20 27 ops_crypto_init(); 21 28 } 29 30 /** 31 * \ingroup Utils 32 * 33 * ops_finish() just calls ops_crypto_finish() 34 * \todo Ask Ben why we need this extra layer 35 */ 22 36 23 37 void ops_finish(void) … … 26 40 } 27 41 42 /** 43 * \ingroup Parse 44 * 45 * ops_reader_fd() attempts to read up to #plength bytes from the file 46 * descriptor in #arg_ into the buffer starting at #dest using the 47 * rules contained in #flags 48 * 49 * \param dest Pointer to previously allocated buffer 50 * \param plength Number of bytes to try to read 51 * \param flags Rules about reading to use 52 * \param arg_ Gets cast to #ops_reader_fd_arg_t 53 * 54 * \return OPS_R_EOF if no bytes read 55 * \return OPS_R_PARTIAL_READ if not enough bytes read, and OPS_RETURN_LENGTH set in #flags 56 * \return OPS_R_EARLY_EOF if not enough bytes read, and OPS_RETURN_LENGTH not set in #flags 57 * \return OPS_R_OK if expected length read 58 * \todo change arg_ to typesafe? 59 */ 28 60 ops_reader_ret_t ops_reader_fd(unsigned char *dest,unsigned *plength, 29 61 ops_reader_flags_t flags,void *arg_) … … 53 85 } 54 86 87 /** 88 * \ingroup Create 89 * 90 * ops_writer_fd() attempts to write up to #length bytes 91 * to the file descriptor in #arg_ from the buffer #src 92 * using the rules contained in #flags 93 * 94 * \param src 95 * \param length Number of bytes to try to write 96 * \param flags Rules to use 97 * \param arg_ Gets cast to #ops_writer_fd_arg_t 98 * 99 * \return OPS_W_ERROR if not enough bytes written 100 * \return OPS_W_OK if all bytes written 101 * \todo change arg_ to typesafe? 102 */ 55 103 ops_writer_ret_t ops_writer_fd(const unsigned char *src,unsigned length, 56 104 ops_writer_flags_t flags,void *arg_)
