diff --git a/g10/ChangeLog b/g10/ChangeLog index 9e6602c6e..dba73c96e 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,10025 +1,10033 @@ +2007-12-12 David Shaw (wk) + + * trustdb.c (sanitize_regexp): New. Protect against dangerous + regexps (malloc bombs) by force-commenting any characters aside + from the ones we explicitly want. + (check_regexp): Use it here before passing the regexp to + regcomp(). + 2007-12-12 Werner Koch * misc.c (map_cipher_openpgp_to_gcry): New. Used to map Camellia algorithms to Gcrypt. (openpgp_cipher_test_algo): Call new map function. Replace all remaining calls to gcry_cipher_test_algo by a call to this. (openpgp_cipher_algo_name): New. Replace all remaining calls to gcry_cipher_algo_name by a call to this. (map_cipher_gcry_to_openpgp): New. (string_to_cipher_algo): Use it. * gpg.c (main): Print a warning if Camellia support is build in. * gpg.c (print_algo_names): New. From the 1.4 branch by David. (list_config): Use it here for the "ciphername" and "digestname" config items so we can get a script-parseable list of the names. * parse-packet.c (parse_onepass_sig): Sigclass is hex, so include the 0x. * sign.c (match_dsa_hash): Remove conditional builds dending on USE_SHAxxx. We don't need this becuase it can be expected that libgcrypt provides it. However we need to runtime test for SHA244 becuase that is only available with libgcrypt 2.4. 2007-12-11 Werner Koch * mainproc.c (proc_pubkey_enc): Allow type 20 Elgamal key for decryption. 2007-12-10 Werner Koch * import.c (auto_create_card_key_stub): Do not clear the entire fingerprint. This finally makes the stub creation work. My past tests seemed to work because there was a key with a all zero fingerprint available (Elgamal signing keys). 2007-12-08 Werner Koch * misc.c (openpgp_pk_algo_usage): Allow Elgamal type 20 for encryption. 2007-12-04 Werner Koch * helptext.c (get_help_from_file): New. (display_online_help): Use it to geting the help through a file. (helptexts): Remove. 2007-12-03 Werner Koch * keygen.c (ask_key_flags): Add a translation remark and implement a workaround. * gpg.c (reopen_std): Moved to ../common and renamed to gnupg_reopen_std. * gpg.c: Remove second inclusion of fcntl.h. 2007-11-19 Werner Koch * keyedit.c (keyedit_menu): String grammar fix. 2007-11-15 Werner Koch * gpg.c (main): New option --xauthority. * call-agent.c (start_agent): Adjust changed start_new_gpg_agent. 2007-11-12 Werner Koch * cpr.c (do_get_from_fd): s/bool/getbool/ to overcome problems with Mac OS 10.5 which seems to include stdbool.h silently. 2007-11-07 Werner Koch Replace all includes of errors.h by status.h (found in common/). * status.h: Remove. * status.h: Move prototypes to main.h. * status.c: Rename to .. * cpr.c: .. this. (get_status_string): Remove. We take this now from common/. 2007-10-25 David Shaw (wk) From 1.4 (October): * gpg.c (main): Add --require-cross-certification to --openpgp/--rfc4880 mode. * gpg.c (main): Disable --rfc2440-text and --force-v3-sigs by default. Enable --require-cross-certification by default. --openpgp (--rfc4880) is the same as --rfc2440 except with "--enable-dsa2 --no-rfc2440-text --escape-from-lines". * misc.c (compliance_option_string, compliance_failure): Minor cleanup. * armor.c (is_armor_header): Comment about 4880. * options.h, gpg.c (main): Add --rfc4880, and make --openpgp an alias to it. --rfc2440 now stands alone. For now, use the old 2440 defaults for 4880. * misc.c (compliance_option_string): Ditto. * keyedit.c (keyedit_menu): Use compliance_option_string() instead of printing the compliance modes here. 2007-10-25 David Shaw (wk) From 1.4 (September): * import.c (collapse_uids): Significant speedup for de-duping user IDs. 2007-10-25 David Shaw (wk) From 1.4 (July): * armor.c (parse_header_line): Improve test so that the header test only allows "Hash" in the signed data section. * armor.c (is_armor_tag): New. Detect if an armor header matches 2440bis-21. (parse_header_line): Call it here, as bis-21 requires warning the user (but continuing to process the message) when seeing an unknown header. * encode.c (encode_crypt): Missed one call to setup_plaintext_name(). This is bug#809. * sign.c (mk_notation_policy_etc): Expect all sigs that this is called for are >=v4. (write_signature_packets, make_keysig_packet): Only call it for >=v4 sigs. This allows --force-v3-sigs and --force-v4-certs to enable or disable notations, policies, and keyserver URLs. This is bug#800. 2007-10-19 Werner Koch * passphrase.c (passphrase_get): Use new utf8 switching fucntions. 2007-09-14 Werner Koch * gpg.c (build_lib_list): New. (my_strusage): Print lib info. 2007-08-27 Werner Koch * trustdb.c (USE_INTERNAL_REGEX): Remove support. 2007-08-24 Werner Koch * keyring.c (keyring_register_filename): Use same_file_p(). 2007-08-21 Werner Koch * misc.c (openpgp_md_test_algo): Remove rfc2440bis hash algorithms. (openpgp_cipher_test_algo): Likewise for algos 5 and 6. 2007-08-02 Werner Koch * gpg.c: Include gc-opt-flags.h and remove their definition here. 2007-07-17 Werner Koch * gpg.c (gpgconf_list): Declare --encrypt-to and --default-key. * card-util.c (get_manufacturer): Add the unmanaged S/N range. 2007-07-12 Werner Koch * gpg.c (main): Use translate_sys2libc_fd_int when passing an int value. * gpgv.c (main): Ditto. 2007-07-05 Werner Koch * card-util.c (card_generate_subkey, card_store_subkey): Enable the code also for GnuPG-2. * keygen.c (make_backsig): Add arg TIMESTAMP. (write_keybinding): Add arg TIMESTAMP, pass it to make_backsig. (write_direct_sig, write_selfsigs): Add arg TIMESTAMP. (gen_elg, gen_dsa, gen_rsa): Add arg TIMESTAMP. (do_create): Ditto. (do_generate_keypair): Use the same timestamp for key creation time and all key signatures. Return an error if write_direct_sig for the secret key fails. (generate_subkeypair): Ditto. (gen_card_key): New arg TIMESTAMP. (generate_card_subkeypair): Pass current time to gen_card_key. (gen_card_key_with_backup): New arg TIMESTAMP. (read_parameter_file): Add option Creation-Date. (parse_creation_string): New. (do_generate_keypair): Use the Creation-Date if available. (save_unprotected_key_to_card): Use P for P and not D. * call-agent.c (agent_scd_genkey): Add arg CREATETIME. * keyedit.c (menu_backsign): Use the same timestamp for all backsigs. 2007-06-26 Werner Koch * openfile.c (try_make_homedir): Support W32; use standard_homedir. 2007-06-25 Werner Koch * gpg.c, gpgv.c: Include sysutils.h. (main): Replace iobuf_translate_file_handle by translate_sys2libc_fd. 2007-06-21 Werner Koch * main.h: Include util.h. * call-agent.c (start_agent): Factored almost all code out to ../common/asshelp.c. * gpg.h (ctrl_t): Remove. It is now declared in ../common/util.h. 2007-06-20 Werner Koch * misc.c (setsysinfo, trap_unaligned): Remove. It is also in common/sysutils.c. (disable_core_dumps, get_session_marker): * sign.c (sleep): Remove sleep wrapper. 2007-06-18 Marcus Brinkmann * gpg.c (gpgconf_list): Percent escape output of --gpgconf-list. 2007-06-14 Werner Koch * call-agent.c (start_agent): Use gnupg_module_name. 2007-06-12 Werner Koch * openfile.c (copy_options_file): Use gnupg_datadir. * misc.c (get_libexecdir): Remove. Changed all callers to use gnupg_libexecdir. * gpg.c (check_permissions): Use gnupg_libdir. * gpg.c (main): Replace some calls by init_common_subsystems. * gpgv.c (main): Ditto. 2007-06-11 Werner Koch * Makefile.am (needed_libs): Use libcommonstd macro. * gpgv.c (main) [W32]: Call pth_init. * gpg.c (main) [W32]: Call pth_init. 2007-06-08 Werner Koch * Makefile.am (gpg2_LDADD): Syntax fix. 2007-06-06 Werner Koch * passphrase.c (passphrase_get) [!ENABLE_NLS]: Do not define orig_codeset. * Makefile.am (gpgv2_LDADD, gpg2_LDADD): Include LDADD before libgcrypt. * plaintext.c (handle_plaintext): Replace eof by eof_seen as W32's io.h has a symbol with that name. * misc.c: Do not include dynload.h. (w32_shgetfolderpath): Remove. It is now in common/homedir.c. * gpgv.c (i18n_init): Remove. * gpg.c (i18n_init): Remove. (main): Make --load-extension a dummy 2007-05-19 Marcus Brinkmann * passphrase.c (passphrase_get): Use PACKAGE_GT, not PACKAGE. * passphrase.c (passphrase_get): Free ORIG_CODESET on error. 2007-05-16 Werner Koch * sig-check.c (check_backsig): Check the digest algorithm before using it. Fixed bug 797. 2007-05-09 Werner Koch * openfile.c (overwrite_filep, open_outfile) [W32]: Need to use just "nul". Though, I am pretty sure that some MSDOS versions grok the extra /dev/. 2007-05-07 Werner Koch * openfile.c (open_outfile, overwrite_filep) [W32]: Use "/dev/nul". 2007-05-02 David Shaw * packet.h, mainproc.c (reset_literals_seen): New function to reset the literals count. * verify.c (verify_one_file), decrypt.c (decrypt_messages): Call it here so we allow multiple literals in --multifile mode (in different files - not concatenated together). 2007-04-26 Marcus Brinkmann * passphrase.c (passphrase_to_dek): Write missing passphrase status message in case of cancellation. 2007-04-16 Werner Koch * build-packet.c (mpi_write): Made buffer a bit larger. Reported by Alexander Feigl. 2007-04-13 Werner Koch * call-agent.c (start_agent): Don't use log_error when using the fallback hack to start the agent. This is bug 782. 2007-04-05 David Shaw From STABLE-BRANCH-1-4 * parse-packet.c (parse_marker): New. Enforce that the marker contains 'P', 'G', 'P', and nothing but. (parse): Call it here. (skip_packet): No longer need to handle marker packets here. 2007-03-14 David Shaw From STABLE-BRANCH-1-4 * keyserver.c: Windows Vista doesn't grok X_OK and so fails access() tests. Previous versions interpreted X_OK as F_OK anyway, so we'll just use F_OK directly. 2007-03-09 David Shaw From STABLE-BRANCH-1-4 * parse-packet.c (parse_signature): It's hex. * getkey.c (merge_selfsigs_subkey): Avoid listing the contents of a backsig when list mode is on. Noted by Timo Schulz. 2007-03-08 Werner Koch * plaintext.c (handle_plaintext): Add two extra fflush for stdout. 2007-03-08 David Shaw (wk) * keyedit.c (keyedit_menu): If we modify the keyblock (via fix_keyblock() or collapse_uids()) make sure we reprocess the keyblock so the flags are correct. Noted by Robin H. Johnson. * getkey.c (fixup_uidnode): Properly clear flags that don't apply to us (revoked, expired) so that we can reprocess a uid. 2007-03-05 Werner Koch Converted this file to UTF-8. Ported David and my multiple messages changes from 1.4.7. * options.h, gpg.c (main), mainproc.c (check_sig_and_print): Allow multiple sig verification again as this is protected via the multiple-messages code. New option --allow-multiple-messages and --no variant. * status.h (STATUS_ERROR): New status code. * status.c (get_status_string): Ditto. * mainproc.c (proc_plaintext): Emit it if multiple messages are detected. Error out if more than one plaintext packet is encountered. * mainproc.c (literals_seen): New. 2007-02-26 Werner Koch * gpg.c (main): Add verify option show-primary-uid-only. * options.h (VERIFY_SHOW_PRIMARY_UID_ONLY): New. * mainproc.c (check_sig_and_print): Implement it. 2007-02-22 Werner Koch * encr-data.c (decrypt_data): Correctly test for unknown algorithm. * import.c (check_prefs): Ditto. * keyedit.c (show_prefs): Ditto. * mainproc.c (proc_symkey_enc): Ditto. 2007-02-06 Werner Koch * export.c (do_export_stream): Allow reset-subkey-passwd along with sexp-format. 2007-02-04 Werner Koch * parse-packet.c (parse_signature): Limit bytes read for an unknown alogorithm. Fixes Debian bug#402592. 2007-01-31 Werner Koch * verify.c (verify_signatures): Do no dereference a NULL afx. * passphrase.c (passphrase_get): Set the cancel flag on all error from the agent. Fixes a bug reported by Tom Duerbusch. 2007-01-30 Werner Koch * status.c (write_status_begin_signing): New. * sign.c (sign_file, sign_symencrypt_file): Call it. * textfilter.c (copy_clearsig_text): Call it. * call-agent.c (agent_scd_pksign): Pass --hash-rmd160 to SCD if required. * gpg.c (main): Let --no-use-agent and --gpg-agent-info print a warning. * misc.c (obsolete_option): New. 2007-01-29 Werner Koch * pkclist.c (do_we_trust_pre): Issue a user-id-hint status code. 2007-01-15 Werner Koch * parse-packet.c (read_protected_v3_mpi): Make sure to stop reading even for corrupted packets. * keygen.c (generate_user_id): Need to allocate one byte more. Reported by Felix von Leitner. 2006-12-21 Werner Koch * gpg.c (main): New command --server. * gpg.h (struct server_control_s, ctrl_t): New. * server.c: New. * verify.c (gpg_verify): New. * mainproc.c (mainproc_context): Made SIGNED_DATA a structure. (proc_signature_packets_by_fd): New. (proc_compressed_cb): Divert depending on SIGNED_DATA. * plaintext.c (hash_datafile_by_fd): New. * mainproc.c (proc_tree): Use it here. * verify.c (verify_signatures): Init AFX only when needed. Don't leak a context on error. (verify_one_file): Don't leak a context on error. 2006-12-07 Werner Koch * openfile.c (copy_options_file): Use log_info instead of log_error to avoid an error return of gpg due to a missing skeleton file. 2006-12-07 David Shaw * Makefile.am: Link to iconv for jnlib dependency. 2006-12-05 Werner Koch * passphrase.c (passphrase_to_dek): Handle a Cancel request correctly. [Bug#737] * mainproc.c (proc_symkey_enc): Removed workaround for bogus cancel processing. * encode.c (encode_simple): Distinguish error message between cancel and invalid passphrase. (setup_symkey): Ditto. * sign.c (sign_symencrypt_file): Ditto * keyedit.c (change_passphrase): Allow cancellation. * keygen.c (do_ask_passphrase): New arg R_CANCELED. (generate_keypair): Handle a passphrase cancellation. (generate_raw_key): Ditto. (generate_subkeypair): Ditto. 2006-12-04 Werner Koch * filter.h (armor_filter_context_t): New element REFCOUNT. * armor.c (armor_filter): Made static. (push_armor_filter, release_armor_context, new_armor_context): New. (armor_filter): Release the context. * gpg.c (main): Use new armor context functions and push_armor_filter. * export.c (do_export): Ditto. * encode.c (encode_simple, encode_crypt): Ditto. * decrypt.c (decrypt_message, decrypt_messages): Ditto. * dearmor.c (dearmor_file, enarmor_file): Ditto. * verify.c (verify_signatures, verify_one_file): Ditto. * sign.c (sign_file, clearsign_file, sign_symencrypt_file): Ditto. * revoke.c (gen_desig_revoke, gen_revoke): Ditto. * keyserver.c (keyserver_spawn): Ditto. * keygen.c (output_control_s): Turn AFX fields into pointers. (read_parameter_file): Allocate and release AFX fields. (do_generate_keypair): Use push_armor_filter. * import.c (import): Replace iobuf_push_filter2 hack by the new armor context stuff. 2006-12-03 Werner Koch * filter.h: New element REFCOUNT. (handle_progress): Remove prototype. * progress.c (new_progress_context, release_progress_context): New. (progress_filter): Use new function to release context. Made static. (handle_progress): Bumb reference counter. No more check for enabled progress as this is handled by new_progress_context. * verify.c (verify_signatures, verify_one_file): Replace stack based progress context by a heap based one. * sign.c (sign_file, clearsign_file, sign_symencrypt_file): Ditto. * plaintext.c (ask_for_detached_datafile, hash_datafiles): Ditto. * encode.c (encode_simple, encode_crypt): Ditto. * decrypt.c (decrypt_message, decrypt_messages): Ditto. * keyedit.c (menu_clean): Made strings translatable. 2006-12-03 David Shaw * keyedit.c (menu_clean): Show "already minimized" rather than "already clean" when a minimized key is minimized again. From Dirk Traulsen. 2006-12-02 David Shaw * options.h, gpg.c (main), passphrase.c (passphrase_to_dek): Add --passphrase-repeat option to control how many times gpg will re-prompt for a passphrase to ensure the user has typed it correctly. Defaults to 1. 2006-12-02 Werner Koch * encr-data.c: Allocate DFX context on the heap and not on the stack. Changes at several places. Fixes CVE-2006-6235. 2006-11-27 Werner Koch * openfile.c (ask_outfile_name): Fixed buffer overflow occurring if make_printable_string returns a longer string. Fixes bug 728. 2006-11-21 Werner Koch * Makefile.am (needed_libs): libgnu needs to come after libcommon. * keygen.c (ask_expire_interval): Print y2038 warning only for 32 bit time_t. (save_unprotected_key_to_card): Made RSA_N_LEN et al a size_t. Cast printf args. (get_parameter_algo): Allow "ELG" as alias for "ELG-E". * seckey-cert.c (do_check): Made NBYTES a size_t. (do_check): Made NDATA a size_t. (protect_secret_key): Made NARR a size_t. (protect_secret_key): Made NVYES a size_t. * pubkey-enc.c (get_it): Made INDATALEN a size_t. (get_it): Made NFRAME a size_t. * keyid.c (hash_public_key): Made NBITS an unsigned int. * misc.c (checksum_mpi): Made NBYTES a size_t. (openpgp_pk_test_algo2): Made USE_BUF a size_t. * seskey.c (encode_session_key): Made NFRAME a size_t. (do_encode_md): Ditto. (encode_md_value): Cast size_t argument of printf. (encode_md_value): Ditto. 2006-11-10 Werner Koch * parse-packet.c (mpi_read): Changed NREAD to size_t to match the gcry_mpi-scan prototype. (mpi_read): Fixed double increment of bytes read to correctly detect overlong MPIs. 2006-11-05 Werner Koch * gpg.c (main): Remove the default --require-cross-certification. * options.skel: Enable require-cross-certification. 2006-10-31 Werner Koch * pkclist.c (warn_missing_aes_from_pklist): New. * encode.c (encrypt_filter, encode_crypt): Use it here. 2006-10-27 Werner Koch * pkclist.c (warn_missing_mdc_from_pklist): New. * encode.c (use_mdc): Use it here. 2006-10-24 Marcus Brinkmann * Makefile.am (AM_CFLAGS): Add $(LIBASSUAN_CFLAGS). 2006-10-23 Werner Koch * gpg.c (main): New command --gpgconf-test. * Makefile.am (bzip2_source): New. 2006-10-20 Werner Koch * getkey.c (classify_user_id): Reserve '&' for search by keygrip. 2006-10-19 Werner Koch * keygen.c (get_parameter_algo): Add special case for ELG_E which is not supported by libgcrypt's mapping function. 2006-10-18 Werner Koch * keyid.c (v3_keyid): Don't use mempcy as we need to hold the keyids in the native endian format. * import.c (import_print_stats): Use log_printf. * build-packet.c (do_public_key): Care about mpi_write errors. (do_secret_key, do_pubkey_enc, do_signature): Ditto. (mpi_write): Print an extra warning on error. 2006-10-17 Werner Koch * Makefile.am (LDADD): Replaced W32LIBS by NETLIBS. 2006-10-12 David Shaw * parse-packet.c (parse_symkeyenc): Show the unpacked as well as the packed s2k iteration count. * main.h, options.h, gpg.c (encode_s2k_iterations, main), passphrase.c (hash_passphrase): Add --s2k-count option to specify the number of s2k hash iterations. 2006-10-08 Werner Koch * gpgv.c: Remove the tty stubs as we are now required to link to tty anyway (it is included in libcommand and has dependencies to other modules as well). * keyedit.c (keyedit_menu): Use keyedit_completion only if readline is available. It would be better to move this code into gpgrlhelp.c 2006-10-06 Werner Koch * Makefile.am (AM_CFLAGS): Use PTH version of libassuan. 2006-10-06 David Shaw * keyserver.c (keyserver_spawn): Write the 16-digit keyid rather than whatever key selector the user used on the command line. 2006-10-05 Werner Koch * status.c (progress_cb): Changed to libgcrypt API. (set_status_fd): Register the progress cb. * seskey.c (encode_md_value): Check that the hash algo is valid before getting the OID. 2006-10-04 Werner Koch * passphrase.c: Allow for a static passphrase in batch mode. * call-agent.c (agent_havekey): Removed. (percent_plus_escape): New. (agent_get_passphrase): New. (agent_clear_passphrase): New. * passphrase.c: Changed so that we always require the agent. (agent_send_option, agent_send_all_options, agent_open): Removed. (agent_get_passphrase): Cleaned up. Does now use the call-agent functions. Renamed to (passphrase_get): .. this. Changed all callers. (passphrase_clear_cache): Rewritten. (passphrase_to_dek, hash_passphrase): Re-indented. * gpg.c (main): Made --use-agent a dummy option. * seckey-cert.c (check_secret_key): We require the agent, so always allow for 3 tries. * gpg.c (main): Print a warning if -sat has been used. (main): Removed the special treatment of the -k option. -k is now an alias for --list-keys. (main): Removed --list-ownertrust. 2006-10-02 Werner Koch * encr-data.c (decrypt_data, mdc_decode_filter): Check the MDC right here and don't let parse-packet handle the MDC. 2006-09-29 Werner Koch * compress.c (do_uncompress): Removed use of Z_PARTIAL_FLUSH. This is outdated and old zlib versions which still require it have security problems. 2006-09-27 Werner Koch Replaced all STRLIST by strlist_t. 2006-09-21 Werner Koch * signal.c (got_fatal_signal): Replaced readline stuff by a tty function. * Makefile.am (LDADD): Include libgpgrl.a. * gpg.c (main): Call gpg_rl_initialize. * keyedit.c: Removed double inclusion of stdio.h. 2006-09-20 Werner Koch * call-agent.c: Include asshelp.h. (start_agent): Use send_pinentry_environment. 2006-09-14 Werner Koch Replaced all call gpg_error_from_errno(errno) by gpg_error_from_syserror(). 2006-09-13 Werner Koch * gpg.c (main): Made --require-cross-certification the default. 2006-09-06 Marcus Brinkmann * Makefile.am (gpg2_LDADD, gpgv2_LDADD): Replace -lassuan and -lgpg-error with $(LIBASSUAN_LIBS) and $(GPG_ERROR_LIBS). (AM_CFLAGS): Add $(LIBASSUAN_CFLAGS) and $(GPG_ERROR_CFLAGS). 2006-09-06 Werner Koch * gpg.c (main): Enable new assuan API. * call-agent.c: Changed to new Assuan API. 2006-09-01 Werner Koch * call-agent.c: Do not force using the pipe server. * gpg.c (main): Enable card related commands. 2006-08-22 Werner Koch * mainproc.c (proc_plaintext): Fixed a #warning 2006-08-21 Werner Koch * skclist.c (random_is_faked): Implemented. (is_insecure): Also test for the old uppercase version of the insecure string. * gpg.c (main): Renamed --quick-random to debug-quick-quick-random. * gpg.c (print_mds): Do not use the USE_SHA macros. * mainproc.c (proc_encrypted): Remove assign inside condition for better readibility. * packet.h: Moved consts to new header ../common/openpgpdefs.h. 2006-08-16 Werner Koch * keyserver.c (GPGKEYS_PREFIX): Rename to gpg2keys_. This is so that we can install helpers from 1.4 and 2 without conflicts and first of all don't get lost with weird bug reports. * keyid.c (serialno_and_fpr_from_sk): New. Actually lost during the last 1.4 to 1.9 merge. * gpg.c (list_config): Output ccid-reader-id only for gnupg 1. * call-agent.c (agent_scd_writekey): New. (inq_writekey_parms): New. * gpgv.c: Include call-agent.h for use by stubs. * misc.c: Include call-agent.h for use by get_signature_count. 2006-07-27 Werner Koch * parse-packet.c (parse_comment): Cap comments at 65k. (parse_gpg_control): Skip too large control packets. 2006-07-24 David Shaw (wk) * keydb.h, pkclist.c (select_algo_from_prefs, algo_available): Pass a union for preference hints rather than doing void * games. * sign.c (sign_file): Use it here. * sign.c (sign_file): When signing with multiple DSA keys, one being DSA1 and one being DSA2 and encrypting at the same time, if the recipient preferences give a hash that can work with the DSA2 key, then allow the DSA1 key to be promoted rather than giving up and using hash_for(). * pkclist.c (algo_available): Automatically enable DSA2 mode when handling a key that clearly isn't DSA1 (i.e. q!=160). 2006-06-30 Werner Koch * misc.c (checksum_mpi): No need for nbits as they are alredy included in the buffer. 2006-06-29 Werner Koch * parse-packet.c (parse_signature, parse_key): Need store the length of opaque data as number of bits. * card-util.c (card_store_subkey): Ditto. * mainproc.c (print_pkenc_list, check_sig_and_print): Replaced log_get_stream by calls to log_printf. This avoids the extra LFs inserted by the logging function. They are a bit too smart sometimes. * pkclist.c (do_show_revocation_reason): Print final LF through log_printf to avoid extra LFs. * pubkey-enc.c (get_it): Ditto. * seskey.c (encode_md_value): Fix call to gcry. 2006-06-27 Werner Koch Applied patches from 1.4.x (2006-05-22 to 2006-06-23) from David: * keygen.c (keygen_upd_std_prefs, keygen_add_std_prefs) (proc_parameter_file): Add --default-keyserver-url to specify a keyserver URL at key generation time, and "Keyserver:" keyword for doing the same through a batch file. * options.h, gpg.c (main): Ditto. * sign.c (do_sign): For now don't accept a truncated hash even for DSA1 keys (be liberal in what you accept, etc). * import.c (import_one): Add a flag (from_sk) so we don't check prefs on an autoconverted public key. The check should only happen on the sk side. Noted by Dirk Traulsen. * keygen.c (gen_card_key): Add optional argument to return a pointer (not a copy) of the stub secret key for the secret key we just generated on the card. (generate_card_subkeypair): Use it here so that the signing key on the card can use the card to generate the 0x19 backsig on the primary key. Noted by Janko Heilgeist and Jonas Oberg. * parse-packet.c (parse_user_id): Cap the user ID size at 2048 bytes. This prevents a memory allocation attack with a very large user ID. A very large packet length could even cause the allocation (a u32) to wrap around to a small number. Noted by Evgeny Legerov on full-disclosure. * keygen.c (gen_dsa): Allow generating DSA2 keys. Allow specifying sizes > 1024 when --enable-dsa2 is set. The size of q is set automatically based on the key size. (ask_keysize, generate_keypair): Ask for DSA size when --enable-dsa2 is set. * exec.c (make_tempdir) [W32]: Fix bug with a temporary directory on W32 that is over 256 bytes long. Noted by Israel G. Lugo. * gpg.c (reopen_std): New function to reopen fd 0, 1, or 2 if we are called with them closed. This is to protect our keyring/trustdb files from corruption if they get attached to one of the standard fds. Print a warning if possible that this has happened, and fail completely if we cannot reopen (should never happen). (main): Call it here. * parse-packet.c (dump_sig_subpkt, parse_signature): Fix meaning of key expiration and sig expiration subpackets - zero means "never expire" according to 2440, not "expire instantly". * build-packet.c (build_sig_subpkt_from_sig): Ditto. * getkey.c (fixup_uidnode, merge_selfsigs_main) (merge_selfsigs_subkey): Ditto. * keygen.c (keygen_add_key_expire): Ditto. * getkey.c (get_pubkey_byname) * import.c (import_one): Fix key selection problem when auto-key-locate returns a list of keys, not all of which are usable (revoked, expired, etc). Noted by Simon Josefsson. 2006-05-24 Werner Koch * keyid.c (hash_public_key): Do not double hash the length bytes, they are already included by mpi_print. * misc.c (openpgp_pk_test_algo2): Get test call right. * misc.c (string_to_cipher_algo, string_to_digest_algo): New. * keygen.c (keygen_set_std_prefs): use them here. * gpg.c (main): and here. 2006-05-23 Werner Koch * card-util.c (generate_card_keys): Removed temporary kludge for generate_keypair. * call-agent.c (agent_scd_setattr): Add arg SERIALNO. (agent_scd_genkey): Ditto. (agent_scd_change_pin): Ditto. * call-agent.h (struct agent_card_info_s): Updated to match the one of 1.4.3. * Makefile.am (LDADD): Include ZLIBS. * gpgv.c: Removed stubs not anymore useful due to libgcrypt. 2006-05-22 Werner Koch * keyserver.c (keyidlist): Replaced mpi_get_keyid by v3_keyid. * keydb.h (v3_keyid): Added. * import.c (import): Better initialize KEYBLOCK as to quiet compiler warning. * skclist.c (random_is_faked): New. * mainproc.c: Include pka.h. 2006-05-19 Werner Koch * misc.c (openpgp_pk_test_algo2): Need to use gcry_pk_algo_info directly. (string_count_chr): New. * armor.c (parse_header_line): Use renamed function length_sans_trailing_ws. * options.h, gpg.c: Option --strict is not used thus removed code but kept option. 2006-04-28 David Shaw (wk) * keyserver.c (direct_uri_map): New. (keyserver_spawn): Used here to add "_uri" to certain gpgkeys_xxx helpers when the meaning is different if a path is provided (i.e. ldap). (keyserver_import_cert): Show warning if there is a CERT fingerprint, but no --keyserver set. * keyserver.c: Fix build problem with platforms that stick libcurl in a place not in the regular include search path. * options.h, gpg.c (main): Add --enable-dsa2 and --disable-dsa2. Defaults to disable. * pkclist.c (algo_available): If --enable-dsa2 is set, we're allowed to truncate hashes to fit DSA keys. * sign.c (match_dsa_hash): New. Return the best match hash for a given q size. (do_sign, hash_for, sign_file): When signing with a DSA key, if it has q==160, assume it is an old DSA key and don't allow truncation unless --enable-dsa2 is also set. q!=160 always allows truncation since they must be DSA2 keys. (make_keysig_packet): If the user doesn't specify a --cert-digest-algo, use match_dsa_hash to pick the best hash for key signatures. * gpg.c (print_mds): Add SHA-224. * armor.c (armor_filter, parse_hash_header): Add SHA-224. * sign.c (write_plaintext_packet): Factor common literal packet setup code from here, to... * encode.c (encode_simple): .. there. * main.h, plaintext.c (setup_plaintext_name): Here. New. Make sure the literal packet filename field is UTF-8 encoded. * options.h, gpg.c (main): Make sure --set-filename is UTF-8 encoded and note when filenames are already UTF-8. * keyedit.c (menu_backsign): Give some more verbose errors when we have no need to backsign. * getkey.c (parse_auto_key_locate): Fix dupe-removal code. * keyedit.c (menu_backsign): Allow backsigning even if the secret subkey doesn't have a binding signature. * armor.c (radix64_read): Don't report EOF when reading only a pad (=) character. The EOF actually starts after the pad. * gpg.c (main): Make --export, --send-keys, --recv-keys, --refresh-keys, and --fetch-keys follow their arguments from left to right. Suggested by Peter Palfrader. 2006-04-18 Werner Koch * tdbio.c (open_db, migrate_from_v2): Removed feature to migration from old trustdb version 2. * gpg.c, mainproc.c: Removed pipemode feature. * status.c: Removed shared memory coprocess stuff Merged with current gpg 1.4.3 code. * keygen.c, keyid.c, misc.c, openfile.c, verify.c, trustdb.c * textfilter.c, tdbio.c, tdbdump.c, status.c, skclist.c, signal.c * sign.c, sig-check.c, seskey.c, seckey-cert.c, revoke.c * pubkey-enc.c, progress.c, plaintext.c, pkclist.c, photoid.c * passphrase.c, parse-packet.c, mdfilter.c, mainproc.c * keyserver.c, keyring.c, keylist.c, keyedit.c, keydb.c, kbnode.c * import.c, getkey.c, gpgv.c, helptext.c, free-packet.c * build-packet.c, cipher.c, compress.c, dearmor.c, decrypt.c * delkey.c, encr-data.c, encode.c, exec.c, export.c * gpg.c, armor.c: Updated from gnupg-1.4.3 and merged back gcry and gnupg-1.9 related changes. * trustdb.h, tdbio.h, status.h, photoid.h, packet.h, options.h * main.h, keyserver-internal.h, keyring.h, keydb.h, filter.h * exec.h: Ditto. * global.h: Removed after merging constants with gpg.h. * comment.c, pipemode.c: Removed. * card-util.c: Updated from gnupg-1.4.3. * compress-bz2.c: New. 2005-06-15 Werner Koch * g10.c (print_hashline, add_group): Fixes for signed/unsigned pointer mismatch warnings. 2005-06-01 Werner Koch * mkdtemp.c: Removed. * exec.c: Include mkdtemp.h 2004-12-21 Werner Koch * gpgv.c, g10.c (main): Use default_hoemdir (). 2004-12-18 Werner Koch * gpg.h (map_assuan_err): Define in terms of map_assuan_err_with_source. 2004-12-15 Werner Koch * Makefile.am (LDADD): Remove ZLIBS. 2004-10-22 Werner Koch * g10.c (main): Display a bit fat warning that this gpg should not be used. * card-util.c (fetch_url): Disable for gnupg 1.9 (card_generate_subkey): Ditto. (card_store_subkey): Ditto. 2004-09-30 Werner Koch * gpgv.c (i18n_init): Always use LC_ALL. * Makefile.am (LDADD): Adjusted for gettext 0.14. 2004-09-20 Werner Koch * keyedit.c (show_key_with_all_names): Print the card S/N. 2004-09-11 Moritz Schulte * openfile.c (copy_options_file): Fixed last commit (added a `+'). 2004-08-31 Werner Koch * openfile.c (copy_options_file): Use gpg-conf.skel. Better take the length of SKELEXT into account, someone might make it larger. * Makefile.am: Install options.skel as gpg-conf.skel. 2004-08-18 Marcus Brinkmann * passphrase.c (agent_get_passphrase): Fix detection of gpg-agent cancellation. 2004-07-01 Werner Koch * card-util.c (change_login): Kludge to allow reading data from a file. (card_edit): Pass ARG_STRING to change_login. (card_status): Print CA fingerprints. (change_cafpr): New. (card_edit): New command CAFPR. * call-agent.h: Add members for CA fingerprints. * call-agent.c (agent_release_card_info): Invalid them. (learn_status_cb): Store them. 2004-04-30 Werner Koch * g10.c (main) : Use gpg.conf and not /dev/null as default filename. 2004-04-28 Werner Koch * card-util.c (card_edit): Remove PIN verification. (generate_card_keys): New arg SERIALNO. Do PIN verification here after resetting forced_chv1. 2004-04-26 Werner Koch * card-util.c (change_name): Check that the NAME is not too long. (change_url): Likewise. (change_login): Likewise. 2004-03-23 Werner Koch * g10.c: New options --gpgconf-list, --debug-level and --log-file (set_debug): Add arg DEBUG_LEVEL. (main): Look at less and less version specific config files. From gnupg 1.3. 2004-02-17 Werner Koch * call-agent.c (start_agent): Ignore an empty GPG_AGENT_INFO. * passphrase.c (agent_open): Ditto. 2004-02-12 Werner Koch * gpgv.c: Removed g10defs.h. * Makefile.am: Include cmacros.am for common flags. 2004-02-11 Werner Koch * openfile.c (try_make_homedir): Use GNUPG_DEFAULT_HOMEDIR. * gpgv.c (main): Ditto. * g10.c (main): Ditto. 2004-01-19 Moritz Schulte * keygen.c (do_generate_keypair): Print member fname, instead of newfname, again. (do_generate_keypair): Don't try to execute certain pieces of code in case an error occured. (gen_card_key): Don't print out a message, which is already printed by do_generate_keypair(). 2004-01-18 Moritz Schulte * keygen.c (do_generate_keypair): Print member fname, instead of newfname. 2003-12-17 Werner Koch * card-util.c (print_name): Fixed bad format string usage. (print_isoname): Ditto. * trustdb.c (check_regexp): s/exp/expr/. * keyedit.c (trustsig_prompt): Removed a "> 255" term; it is always false due to the data type. * passphrase.c (agent_get_passphrase): Use xasprintf and avoid non-literal format strings. * tdbio.c (upd_hashtable, drop_from_hashtable, lookup_hashtable): Fixed log_error format string bugs. Kudos to the now working gcc-3.3 -Wformat-nonliteral and Florian Weimer's investigations in gnupg 1.2.3. 2003-12-15 Werner Koch * seckey-cert.c (protect_secret_key): Use gry_create_nonce for the IV; there is not need for real strong random here and it even better protect the random bits used for the key. 2003-11-16 Moritz Schulte * signal.c: Removed unused file. 2003-11-10 Moritz Schulte * Makefile.am (INCLUDES): Added: @LIBGCRYPT_CFLAGS@. 2003-10-25 Werner Koch * call-agent.c (learn_status_cb, scd_genkey_cb): Fixed faulty use of !spacep(). 2003-10-20 Werner Koch * card-util.c (card_edit): New command "passwd". Add logic to check the PIN in advance. (card_status): Add new args to return the serial number. Changed all callers. * call-agent.c (agent_scd_checkpin): New. 2003-10-08 Werner Koch * call-agent.c (agent_scd_getattr): Don't clear the passed info structure, so that it can indeed be updated. * card-util.c (fpr_is_zero): New. (generate_card_keys): New. (card_edit): New command "generate". * keygen.c (generate_keypair): New arg CARD_SERIALNO, removed call to check_smartcard. (check_smartcard,show_smartcard): Removed. (show_sha1_fpr,fpr_is_zero): Removed. 2003-10-01 Werner Koch * card-util.c: Tweaked to use this source also under 1.3. 2003-09-30 Werner Koch * keylist.c (print_card_serialno): New. (list_keyblock_print): Use it here. * card-util.c (toggle_forcesig): New. (card_edit): New command "forcesig". * card-util.c (print_name, print_isoname): Use 0 and not LF fro the max_n arg of tty_print_utf8_string2. * call-agent.c (agent_scd_getattr): New. (learn_status_cb): Release values before assignment so that it can be used by getattr to update the structure. * card-util.c (change_pin): Simplified. We now have only a PIN and an Admin PIN. 2003-09-27 Werner Koch * sign.c (do_sign): Removed disabled testcode. 2003-09-26 Timo Schulz * card_status (card_status): Do not use fputs since the fp parameter can be NULL. This fixes a segv. 2003-09-24 Werner Koch * card-util.c (print_isoname,card_status): Handle opt.with_colons. (print_sha1_fpr_colon): New. 2003-09-23 Werner Koch Merged most of David Shaw's changes in 1.3 since 2003-06-03. * Makefile.am: Include W32LIBS where appropriate. * armor.c (parse_hash_header,armor_filter): Drop TIGER/192 support. * g10.c (print_hex,print_mds): Ditto. * pkclist.c (algo_available): Ditto. * armor.c (armor_filter): Allow using --comment multiple times to get multiple Comment header lines. --no-comments resets list. * options.h, g10.c (main): Ditto. Deprecate --default-comment in favor of --no-comments. * g10.c (main): Trim --help to commonly used options. Remove -f. * g10.c (main): Add --multifile as an alias to turn --encrypt into --encrypt-files (plus --verify-files, --decrypt-files). Error out if --multifile is used with the commands that don't support it yet. * encode.c (use_mdc), g10.c (main): Use RFC1991 and RFC2440 directly to check for MDC usability. Do not set the force_mdc or disable_mdc flags since there is no point any longer. * g10.c (main): Use "keyserver-url" instead of "preferred-keyserver" for the sake of short and simple commands. (add_keyserver_url): Clarify a few strings. It's a "preferred keyserver URL". * keyedit.c (keyedit_menu): Ditto. * sign.c (mk_notation_policy_etc): Ditto. * main.h, keygen.c (keygen_add_keyserver_url): Signature callback for adding a keyserver URL. * keyedit.c (keyedit_menu, menu_set_keyserver_url): New command to set preferred keyserver to specified (or all) user IDs. * build-packet.c (build_sig_subpkt): Set preferred keyserver flag while building a preferred keyserver subpacket. * keylist.c (show_policy_url, show_keyserver_url): URLs might be UTF8. * keyedit.c (menu_addrevoker): Fix leaking a few bytes. * keyedit.c (show_key_with_all_names): Use list-option show-long-keyid in main --edit-key display. * keyedit.c (print_and_check_one_sig): Use list-option show-long-keyid in --edit-key "check" function. * passphrase.c (agent_send_all_options): Make use of $GPG_TTY. * g10.c (main): Disable use-agent if passphrase-fd is given later. Suggested by Kurt Garloff. * exec.c, g10.c, gpgv.c, passphrase.c, photoid.c: s/__MINGW32__/_WIN32/ to help building on native Windows compilers. Requested by Brian Gladman. From Werner on stable branch. * options.h, g10.c (main): Add list-option list-preferred-keyserver. * keyedit.c (change_passphrase): When responding 'no' to the blank passphrase question, re-prompt for a new passphrase. This is bug #202. * mainproc.c (check_sig_and_print): Use two different preferred keyserver displays - one if the key is not present (to tell the user where to get the key), the other if it is present (to tell the user where the key can be refreshed). * packet.h, parse-packet.c (parse_signature): Set flag if a preferred keyserver is present. * keylist.c (list_keyblock_print): Show keyserver url in listings with list-option show-keyserver-url. * mainproc.c (check_sig_and_print): Get the uid validity before printing any sig results to avoid munging the output with trustdb warnings. * g10.c (main): Don't include --show-keyring in --help as it is deprecated. * options.skel: Note that keyserver.pgp.com isn't synchronized, and explain the roundrobin a bit better. * sig-check.c (check_key_signature2), import.c (import_one, import_revoke_cert, chk_self_sigs, delete_inv_parts, collapse_uids, merge_blocks): Make much quieter during import of slightly munged, but recoverable, keys. Use log_error for unrecoverable import failures. * keyring.c (keyring_rebuild_cache): Comment. * sign.c (mk_notation_and_policy): Making a v3 signature with notations or policy urls is an error, not an info (i.e. increment the errorcount). Don't print the notation or policy url to stdout since it can be mixed into the output stream when piping and munge the stream. * packet.h, sig-check.c (signature_check2, do_check, do_check_messages): Provide a signing-key-is-revoked flag. Change all callers. * status.h, status.c (get_status_string): New REVKEYSIG status tag for a good signature from a revoked key. * mainproc.c (do_check_sig, check_sig_and_print): Use it here. * import.c (import_revoke_cert, merge_blocks, merge_sigs): Compare actual signatures on import rather than using keyid or class matching. This does not change actual behavior with a key, but does mean that all sigs are imported whether they will be used or not. * parse-packet.c (parse_signature): Don't give "signature packet without xxxx" warnings for experimental pk algorithms. An experimental algorithm may not have a notion of (for example) a keyid (i.e. PGP's x.509 stuff). * options.h, g10.c (main), keylist.c (list_keyblock_print), keyedit.c (print_and_check_one_sig): New "show-sig-expire" list-option to show signature expiration dates (if any). * options.h, g10.c (main, add_keyserver_url): Add --sig-preferred-keyserver to implant a "where to get my key" subpacket into a signature. * sign.c (mk_notation_and_policy): Rename to mk_notation_policy_etc and add preferred keyserver support for signatures. * keygen.c (do_add_key_flags): Don't set the certify flag for subkeys. (ask_algo): Provide key flags for DSA, Elgamal_e, and Elgamal subkeys. (generate_keypair): Provide key flags for the default DSA/Elgamal keys. * sig-check.c (signature_check, signature_check2, check_key_signature, check_key_signature2): Allow passing NULLs for unused parameters in the x2 form of each function to avoid the need for dummy variables. getkey.c, mainproc.c: Change all callers. * trustdb.h, trustdb.c (read_trust_options): New. Returns items from the trustdb version record. * keylist.c (public_key_list): Use it here for the new "tru" record. * gpgv.c (read_trust_options): Stub. * keyedit.c (show_key_with_all_names): Use list-option show-validity in --edit-key interface as well. * options.h, g10.c (main), mainproc.c (check_sig_and_print): Add verify-options "show-validity" and "show-long-keyid" to show trustdb validity and long keyids during (file) signature verification. * packet.h, main.h, sig-check.c (signature_check2) (check_key_signature2, do_check): If ret_pk is set, fill in the pk used to verify the signature. Change all callers in getkey.c, mainproc.c, and sig-check.c. * keylist.c (list_keyblock_colon): Use the ret_pk from above to put the fingerprint of the signing key in "sig" records during a --with-colons --check-sigs. This requires --no-sig-cache as well since we don't cache fingerprints. * parse-packet.c (parse_signature): No need to reserve 8 bytes for the unhashed signature cache any longer. * misc.c (pct_expando): Add two new expandos - signer's fingerprint (%g), and signer's primary fingerprint (%p). * g10.c (main): Add --rfc2440 alias for --openpgp since in a few months, they won't be the same thing. * keyserver.c (parse_keyserver_uri): Accept "http" as an alias for "hkp", since it is occasionally written that way. (keyserver_spawn): Use ascii_isspace to avoid locale issues. * keygen.c (ask_user_id): Make --allow-freeform-uid apply to the email field as well as the name field, and allow mixing fields when it is set. * trustdb.c (validate_one_keyblock): Certifications on revoked or expired uids do not count in the web of trust. * signal.c (init_one_signal, pause_on_sigusr, do_block): Only use sigprocmask() if we have sigset_t, and only use sigaction() if we have struct sigaction. This is for Forte c89 on Solaris which seems to define only the function call half of the two pairs by default. (pause_on_sigusr): Typo. (do_block): If we can't use sigprocmask() and sigset_t, try to get the number of signals from NSIG as well as MAXSIG, and if we can't, fail with an explanation. * signal.c, tdbio.c: Comment out the transaction code. It was not used in this version, and was causing some build problems on quasi-posix platforms (Solaris and Forte c89). * keylist.c (list_keyblock_colon): Don't include validity values when listing secret keys since they can be incorrect and/or misleading. This is a temporary kludge, and will be handled properly in 1.9/2.0. * mainproc.c (check_sig_and_print): Only show the "key available from" preferred keyserver line if the key is not currently present. * keyedit.c (sign_uids): Do not sign expired uids without --expert (same behavior as revoked uids). Do not allow signing a user ID without a self-signature. --expert overrides. Add additional prompt to the signature level question. (menu_expire): When changing expiration dates, don't replace selfsigs on revoked uids since this would effectively unrevoke them. There is also no point in replacing expired selfsigs. This is bug #181 * g10.c (add_notation_data): Make sure that only ascii is passed to iscntrl. Noted by Christian Biere. * getkey.c (classify_user_id2): Replaced isspace by spacep * keygen.c (ask_user_id): Ditto. (get_parameter_algo): Ditto. * keyedit.c (keyedit_menu): Ditto. * tdbdump.c (import_ownertrust): Ditto. s/isxdigit/hexdigitp/. * revoke.c (ask_revocation_reason): * keyserver.c (keyserver_spawn): Dito. * parse-packet.c (parse): Disallow old style partial length for all key material packets to avoid possible corruption of keyrings. * import.c (import_keys_internal): Invalidate the cache so that the file descriptor gets closed. Fixes bug reported by Juan F. Codagnone. * options.h, g10.c (main), main.h, keylist.c (show_keyserver_url), mainproc.c (check_sig_and_print), parse-packet.c (dump_sig_subpkt, parse_one_sig_subpkt, can_handle_critical): Add read-only support for preferred keyserver subpackets. They're basically policy URLs with a different name. Add a verify-option "show-preferred-keyserver" to turn them on and off (on by default, as per stable branch). * g10.c (main): Add "--set-notation" as alias to "--notation-data" this is to make things consistent with --set-policy-url meaning both sigs and certs. * options.h, g10.c (main), keylist.c (list_keyblock_print): Add "show-validity" and "show-long-keyid" list-options. * gpgv.c (get_validity, trust_value_to_string): Stubs. * g10.c (main): Use SAFE_VERSION instead of VERSION in the version-specific gpg.conf file so it can be overridden on RISCOS. * keyedit.c (show_key_with_all_names): Fix assertion failure when using toggle to see a secret key. Reported by Maxim Britov. 2003-09-22 Timo Schulz * card-util.c (card_status): Free pk in case of an error and return if the card is no OpenPGP card. 2003-09-18 Werner Koch * g10.c: New command --card-edit. * card-util.c (card_status): Use tty_fprintf for all output. (print_sha1_fpr, print_isoname): Ditto. (get_one_name,change_name, change_url, change_login,change_lang) (change_sex): New; taken from keygen.c. * keygen.c (smartcard_get_one_name, smartcard_change_name) (smartcard_change_url, smartcard_change_login_data) (smartcard_change_lang, smartcard_change_sex): Removed. (check_smartcard): Removed most menu items. 2003-09-06 Werner Koch * misc.c (openpgp_pk_algo_usage): Allow AUTH where SIGN is allowed. * keygen.c (ask_passphrase): No need to allocated S2K in secure memory. 2003-09-04 Werner Koch * keygen.c (do_add_key_flags, parse_parameter_usage) (do_generate_keypair): Add support the proposed AUTH key flag. * getkey.c (fixup_uidnode, merge_selfsigs_main) (merge_selfsigs_subkey, premerge_public_with_secret): Ditto. * keylist.c (print_capabilities): Ditto. 2003-08-25 Timo Schulz * pkglue.c (mpi_from_sexp): New. Used to factor out some common code. 2003-08-24 Werner Koch * keygen.c (do_generate_keypair): Print a reminder to use --gen-revoke. 2003-08-18 Timo Schulz * encode.c (encode_sesskey): Checked the code and removed the warning since all compatibility checks with PGP succeeded. * mainproc.c (symkey_decrypt_sesskey): Better check for the algorithm and check the return values of some functions. * mdc.c (use_mdc): Simplified. 2003-08-07 Werner Koch * pkglue.c (pk_sign): Fix last change. (pk_verify): Check for valid DATA array so that we don't segv in Libgcrypt. (pk_verify): Ditto. 2003-08-06 Werner Koch * pkglue.c (pk_sign): Allow signing using RSA. 2003-08-05 Werner Koch * Makefile.am (install-data-local): Dropped check for the ancient gpgm tool. (bin_PROGRAMS): Renamed gpg to gpg2 and gpgv to gpgv2. This is so that it won't conflict with the current stable version of gpg. * pkglue.c (pk_check_secret_key): New. * seckey-cert.c (do_check): Reenable this test here again. * g10.c (main): Add command -K as an alias for --list-secret-keys. Command "-k" is now an alias to --list-keys. Remove special treatment of -kv and -kvv. (set_cmd): Ditto. (main): Strip a "-cvs" suffix when testing for a version specific config file. * status.h, status.c, g10.c [USE_SHM_COPROCESSING]: Removed. This is not any longer available. 2003-07-29 Werner Koch * g10.c (main): Add secmem features and set the random seed file. (g10_exit): Update the random seed file. * parse-packet.c (parse_signature,read_protected_v3_mpi) (parse_key): Fixed use of mpi_set_opaque. * keygen.c (gen_card_key): Ditto. 2003-07-28 Werner Koch * status.c (progress_cb): Adjusted for use with Libcgrypt. (set_status_fd): Register that callback. * keygen.c (smartcard_change_login_data): New. (smartcard_change_lang): New. (smartcard_change_sex): New. (check_smartcard): Add menu entries to edit the above. (gen_elg,gen_dsa,gen_rsa): Reimplemented in terms of Libgcrypt. (genhelp_protect, genhelp_factors, key_from_sexp): New. * comment.c (make_comment_node_from_buffer): New. (make_comment_node): Reimplemented in terms of above. 2003-07-27 Werner Koch Adjusted for gcry_mpi_print and gcry_mpi_scan API change. 2003-07-24 Werner Koch * g10.c: New command --card-status. * card-util.c (card_status): New. * call-agent.c (learn_status_cb): Parse more information. * keylist.c (print_pubkey_info): Add FP arg for optional printing to a stream. Changed all callers. 2003-07-23 Werner Koch * keygen.c (generate_keypair): Create an AUTHKEYTYPE entry for cards. (do_generate_keypair): Abd generate the authkey. (check_smartcard): Changed menu accordingly. 2003-07-22 Werner Koch * g10.c: New command --change-pin. * card-util.c: New. * call-agent.c (agent_scd_change_pin): New. (agent_release_card_info): New. * keygen.c (check_smartcard): Use it here. 2003-07-16 Werner Koch * export.c (parse_export_options): New option sexp-format. (export_seckeys,export_secsubkeys): Check sexp-format option. (do_export): Ignore armor for sexp format. (do_export_stream): Handle sexp-format. (write_sexp_line,write_sexp_keyparm, build_sexp_seckey): New. (build_sexp): New. 2003-07-03 Werner Koch * options.h (DBG_CIPHER): Reintroduced it. * seskey.c (encode_session_key): Debug output of the session key. * pubkey-enc.c (get_it): Handle card case. * call-agent.c (agent_scd_pkdecrypt): New. * pkglue.c (pk_encrypt): Add RSA support. * g10.c (main): Default to --use-agent. * keygen.c (show_smartcard): Print info about the public key. (check_smartcard): Check for existing key here. (gen_card_key): And not anymore here. (fpr_is_zero): New. (generate_keypair): Generate both keys for a card. (smartcard_change_url): Nw. 2003-07-02 Werner Koch * seckey-cert.c (is_secret_key_protected): Let it handle mode 1002. 2003-07-01 Werner Koch * keygen.c (gen_card_key): Obviously we should use the creation date received from SCDAEMON, so that the fingerprints will match. * sign.c (do_sign): Pass the serialno to the sign code. * keyid.c (serialno_and_fpr_from_sk): New. 2003-06-30 Werner Koch * call-agent.h (agent_card_info_s): Add field serialno. * call-agent.c (store_serialno): New. (learn_status_cb): Store the serial number. * keygen.c (gen_card_key): Store the serial number (check_smartcard): New argument to return the serial number. (generate_keypair): Get the serial number from check_smartcard and store it as a parameter. * parse-packet.c (parse_key): Use the protect.iv field to store the serial number. * build-packet.c (do_secret_key): Write the serial number. 2003-06-27 Werner Koch * seckey-cert.c (check_secret_key): Bypass the unprotection for mode 1002. * sign.c (do_sign): Handle card case (i.e. mode 1002). 2003-06-26 Werner Koch * build-packet.c (do_secret_key): Implement special protection mode 1002. * parse-packet.c (parse_key): Likewise. * keygen.c (smartcard_gen_key): New. * call-agent.c (agent_scd_setattr): New. 2003-06-24 Werner Koch * Makefile.am: Removed signal.c * g10.c (emergency_cleanup): New. (main): Use gnupg_init_signals and register malloc for assuan. 2003-06-23 Werner Koch * keyid.c (do_fingerprint_md): Made it work again. 2003-06-19 Werner Koch Fixed all "==" comparisons against error code constants to use gpg_err_code(). * import.c (import_secret_one): (import_revoke_cert): (chk_self_sigs): * misc.c (openpgp_md_map_name): Check also for the Hx format. (openpgp_cipher_map_name): Check also for the Sx format. (pubkey_get_npkey): Adjusted for changed gcrypt API. (pubkey_get_nskey): Ditto. (pubkey_get_nsig): Ditto. (pubkey_get_nenc): Ditto. 2003-06-18 Werner Koch Finished the bulk of changes for gnupg 1.9. This included switching to libgcrypt functions, using shared error codes from libgpg-error, replacing the old functions we used to have in ../util by those in ../jnlib and ../common, renaming the malloc functions and a couple of types. Note, that not all changes are listed below becuause they are too similar and done at far too many places. As of today the code builds using the current libgcrypt from CVS but it is very unlikely that it actually works. * sig-check.c (cmp_help): Removed. Was never used. * pkglue.c: New. Most stuff taken from gnupg 1.1.2. * pkglue.h: New. * misc.c (pull_in_libs): Removed. * keygen.c (count_chr): New. (ask_user_id): Removed faked RNG support. * misc.c (openpgp_md_map_name,openpgp_cipher_map_name) (openpgp_pk_map_name): New. * skclist.c (build_sk_list): Removed faked RNG support. (is_insecure): Removed. * comment.c (make_mpi_comment_node): Use gcry MPI print function. * keyid.c (v3_keyid): New. * misc.c (mpi_write,mpi_write_opaque,mpi_read,mpi_read_opaque) (mpi_print): New. Taken from gnupg 1.1.2. (checksum_mpi): Replaced by implementation from 1.1.2. * g10.c (my_strusage): Renamed from strusage and return NULL instead calling a default function. (add_to_strlist2): New. Taken from ../util/strgutil.c of gnupg 1.2. * plaintext.c (handle_plaintext): New arg CREATE_FILE to cope with the fact that gpg-error does not have this error code anymore. * mainproc.c (symkey_decrypt_sesskey): Ditto. * seskey.c (make_session_key): Adjusted for use with libgcrypt. (encode_session_key): Ditto. (do_encode_md): Ditto. (encode_md_value): Ditto. * keyring.c: Use libgpg-error instead of READ_ERROR etc. * g10.c: Adjusted all algorithm name/id mapping functions. (set_debug): Pass MPI and CRYPTO debug values to libgcrypt. * Makefile.am (INCLUDES): Define LOCALEDIR and the default error source. * g10.c (i18n_init): s/G10_LOCALEDIR/LOCALEDIR/. Renamed m_alloc et al to xmalloc et al. s/g10_errstr/gpg_strerror/ s/MPI/gcry_mpi_t/ Adjusted all md_open calls to the libgcrypt API. * build-packet.c (do_comment): Return error code from iobuf write function. (do_user_id): Ditto. (do_public_key): Ditto. * Makefile.am: Add new files, link gpg with libgpg-error. * g10.c, options.h: New option --agent-program. * call-agent.c: New. * gpg.h, call-agent.h: New. 2003-06-03 David Shaw * options.h, g10.c (main), keylist.c (list_keyblock_print): Add "show-validity" and "show-long-keyid" list-options. * gpgv.c (get_validity, trust_value_to_string): Stubs. * g10.c (main): Use SAFE_VERSION instead of VERSION in the version-specific gpg.conf file so it can be overridden on RISCOS. 2003-06-01 David Shaw * g10.c (main), keylist.c (show_policy_url, show_notation), mainproc.c (check_sig_and_print): Emulate the old policy and notation behavior (display by default). Send to status-fd whether it is displayed on the screen or not. * g10.c (main): Since we now have some options in devel that won't work in a stable branch gpg.conf file, try for a version-specific gpg.conf-VERSION file before falling back to gpg.conf. * main.h, options.h: Move various option flags to options.h. 2003-05-31 David Shaw * mainproc.c (check_sig_and_print), main.h, keylist.c (show_policy, show_notation): Collapse the old print_notation_data into show_policy() and show_notation() so there is only one function to print notations and policy URLs. * options.h, main.h, g10.c (main), keyedit.c (print_and_check_one_sig), keylist.c (list_one, list_keyblock_print), pkclist.c (do_edit_ownertrust), sign.c (mk_notation_and_policy): New "list-options" and "verify-options" commands. These replace the existing --show-photos/--no-show-photos, --show-notation/--no-show-notation, --show-policy-url/--no-show-policy-url, and --show-keyring options. The new method is more flexible since a user can specify (for example) showing photos during sig verification, but not in key listings. The old options are emulated. * main.h, misc.c (parse_options): New general option line parser. Fix the bug in the old version that did not handle report syntax errors after a valid entry. * import.c (parse_import_options), export.c (parse_export_options): Call it here instead of duplicating the code. 2003-05-30 David Shaw * keylist.c (list_one): Don't show the keyring filename when in --with-colons mode. Actually translate "Keyring" string. * mainproc.c (proc_tree): We can't currently handle multiple signatures of different classes or digests (we'd pretty much have to run a different hash context for each), but if they are all the same, make an exception. This is Debian bug #194292. * sig-check.c (check_key_signature2): Make string translatable. * packet.h, getkey.c (fixup_uidnode): Mark real primary uids differently than assumed primaries. * keyedit.c (no_primary_warning): Use the differently marked primaries here in a new function to warn when an --edit-key command might rearrange the self-sig dates enough to change which uid is primary. (menu_expire, menu_set_preferences): Use no_primary_warning() here. * Makefile.am: Use @DLLIBS@ for -ldl. 2003-05-26 David Shaw * getkey.c (premerge_public_with_secret): Made "no secret subkey for" warning a verbose item and translatable. (From wk on stable branch) * sig-check.c (check_key_signature2): Made "no subkey for subkey binding packet" a verbose item instead of a !quiet one. There are too many garbled keys out in the wild. (From wk on stable branch) * filter.h: Remove const from WHAT. (From wk on stable branch) * progress.c (handle_progress): Store a copy of NAME. (progress_filter): Release WHAT, make sure not to print a NULL WHAT. (From wk on stable branch) * openfile.c (open_sigfile): Adjust free for new progress semantics. (From wk on stable branch) * plaintext.c (ask_for_detached_datafile): Don't dealloc pfx->WHAT. (From wk on stable branch) * seckey-cert.c (do_check): Issue the RSA_OR_IDEA status when the cipher algo is IDEA to make it easier to track down the problem. (From twoaday on stable branch) 2003-05-24 David Shaw * armor.c, g10.c, kbnode.c, misc.c, pkclist.c, sign.c, build-packet.c, getkey.c, keydb.c, openfile.c, plaintext.c, status.c, gpgv.c, keygen.c, options.h, sig-check.c, tdbio.h, encode.c, mainproc.c, parse-packet.c, signal.c, textfilter.c: Edit all preprocessor instructions to remove whitespace before the '#'. This is not required by C89, but there are some compilers out there that don't like it. 2003-05-21 David Shaw * trustdb.h, trustdb.c (is_disabled), gpgv.c (is_disabled): Rename is_disabled to cache_disabled_value, which now takes a pk and not just the keyid. This is for speed since there is no need to re-fetch a key when we already have that key handy. Cache the result of the check so we don't need to hit the trustdb more than once. * getkey.c (skip_disabled): New function to get a pk and call is_disabled on it. (key_byname): Use it here. * packet.h, getkey.c (skip_disabled), keylist.c (print_capabilities): New "pk_is_disabled" macro to retrieve the cached disabled value if available, and fill it in via cache_disabled_value if not available. * trustdb.c (get_validity): Cache the disabled value since we have it handy and it might be useful later. * parse-packet.c (parse_key): Clear disabled flag when parsing a new key. Just in case someone forgets to clear the whole key. * getkey.c (merge_selfsigs_main): Add an "if all else fails" path for setting a single user ID primary when there are multiple set primaries all at the same second, or no primaries set and the most recent user IDs are at the same second, or no signed user IDs at all. This is arbitrary, but deterministic. * exec.h, photoid.h: Add copyright message. * keylist.c (list_keyblock_print): Don't dump attribs for revoked/expired/etc uids for non-colon key listings. This is for consistency with --show-photos. * main.h, keylist.c (dump_attribs), mainproc.c (check_sig_and_print): Dump attribs if --attrib-fd is set when verifying signatures. * g10.c (main): New --gnupg option to disable the various --openpgp, --pgpX, etc. options. This is the same as --no-XXXX for those options. * revoke.c (ask_revocation_reason): Clear old reason if user elects to repeat question. This is bug 153. * keyedit.c (sign_uids): Show keyid of the key making the signature. 2003-05-21 Werner Koch * progress.c (handle_progress) * sign.c (write_plaintext_packet) * encode.c (encode_simple,encode_crypt): Make sure that a filename of "-" is considered to be stdin so that iobuf_get_filelength won't get called. This fixes bug 156 reported by Gregery Barton. 2003-05-02 David Shaw * packet.h, build-packet.c (build_sig_subpkt), export.c (do_export_stream), import.c (remove_bad_stuff, import), parse-packet.c (dump_sig_subpkt, parse_one_sig_subpkt): Remove vestigal code for the old sig cache subpacket. This wasn't completely harmless as it caused subpacket 101 to disappear on import and export. * options.h, armor.c, cipher.c, g10.c, keyedit.c, pkclist.c, sign.c, encode.c, getkey.c, revoke.c: The current flags for different levels of PGP-ness are massively complex. This is step one in simplifying them. No functional change yet, just use a macro to check for compliance level. * sign.c (sign_file): Fix bug that causes spurious compression preference warning. * sign.c (clearsign_file): Fix bug that prevents proper warning message from appearing when clearsigning in --pgp2 mode with a non-v3 RSA key. * main.h, misc.c (compliance_option_string, compliance_string, compliance_failure), pkclist.c (build_pk_list), sign.c (sign_file, clearsign_file), encode.c (encode_crypt, write_pubkey_enc_from_list): New functions to put the "this message may not be usable...." warning in one place. * options.h, g10.c (main): Part two of the simplification. Use a single enum to indicate what we are compliant to (1991, 2440, PGPx, etc.) * g10.c (main): Show errors for failure in export, send-keys, recv-keys, and refresh-keys. * options.h, g10.c (main): Give algorithm warnings for algorithms chosen against the --pgpX and --openpgp rules. * keydb.h, pkclist.c (algo_available): Make TIGER192 invalid in --openpgp mode. * sign.c (sign_file), pkclist.c (algo_available): Allow passing a hint of 0. 2003-05-01 David Shaw * tdbio.c (create_version_record): Only create new trustdbs with TM_CLASSIC or TM_PGP. * trustdb.h, trustdb.c (trust_string, get_ownertrust_string, get_validity_string, ask_ownertrust, validate_keys), pkclist.c (do_edit_ownertrust): Rename trust_string to trust_value_to_string for naming consistency. * trustdb.h, trustdb.c (string_to_trust_value): New function to translate a string to a trust value. * g10.c (main): Use string_to_trust_value here for --force-ownertrust. * options.h, g10.c (main), trustdb.c (trust_model_string, init_trustdb, check_trustdb, update_trustdb, get_validity, validate_one_keyblock): An "OpenPGP" trust model is misleading since there is no official OpenPGP trust model. Use "PGP" instead. 2003-04-30 David Shaw * build-packet.c (build_sig_subpkt): Comments. * exec.c (exec_write): Cast NULL to void* to properly terminate varargs list. * keyedit.c (show_key_with_all_names): Just for safety, catch an invalid pk algorithm. * sign.c (make_keysig_packet): Crucial that the call to mksubpkt comes LAST before the calls to finalize the sig as that makes it possible for the mksubpkt function to get a reliable pointer to the subpacket area. * pkclist.c (do_we_trust_pre): If an untrusted key was chosen by a particular user ID, use that ID as the one to ask about when prompting whether to use the key anyway. (build_pk_list): Similar change here when adding keys to the recipient list. * trustdb.c (update_validity): Fix bug that prevented more than one validity record per trust record. (get_validity): When retrieving validity for a (user) supplied user ID, return the validity for that user ID only, and do not fall back to the general key validity. (validate_one_keyblock): Some commentary on whether non-self-signed user IDs belong in the web of trust (arguably, they do). 2003-04-27 David Shaw * g10.c (main): Add --no-textmode. * export.c (do_export_stream), keyedit.c (show_key_with_all_names, menu_addrevoker), mainproc.c (check_sig_and_print), photoid.c (show_photos), sign.c (mk_notation_and_policy), trustdb.c (get_validity, reset_trust_records, validate_keys): Make some strings translatable. * mainproc.c (check_sig_and_print): Show digest algorithm and sig class when verifying a sig with --verbose on, and add version, pk and hash algorithms and sig class to VALIDSIG. * parse-packet.c (enum_sig_subpkt): Make a warning message a --verbose warning message since we don't need to warn every time we see an unknown critical (we only need to invalidate the signature). * trustdb.c (init_trustdb): Check the trustdb options even with TM_AUTO since the auto may become TM_CLASSIC or TM_OPENPGP. 2003-04-26 David Shaw * sign.c (do_sign): Show the hash used when making a signature in verbose mode. * tdbio.h, tdbio.c (tdbio_read_model): New function to return the trust model used in a given trustdb. * options.h, g10.c (main), trustdb.c (init_trustdb, check_trustdb, update_trustdb): Use tdbio_read_model to implement an "auto" trust model which is set via the trustdb. 2003-04-23 David Shaw * import.c (import_revoke_cert): Remove ultimate trust when revoking an ultimately trusted key. * keyedit.c (sign_uids): Allow replacing expired signatures. Allow duplicate signatures with --expert. * pkclist.c (check_signatures_trust): Don't display a null fingerprint when checking a signature with --always-trust enabled. * filter.h (progress_filter_context_t), progress.c (handle_progress), plaintext.c (ask_for_detached_datafile, hash_datafiles): Fix compiler warnings. Make "what" constant. * build-packet.c (do_plaintext): Do not create invalid literal packets with >255-byte names. 2003-04-15 Werner Koch * Makefile.am (AM_CFLAGS): Make use of AM_CFLAGS and AM_LDFLAGS. * g10.c, options.h: New option --enable-progress-filter. * progress.c (handle_progress): Make use of it. 2003-04-15 Marcus Brinkmann * progress.c: New file. * Makefile.am (common_source): Add progress.c. * filter.h (progress_filter_context_t): New type. (progress_filter, handle_progress): New prototypes. * main.h (open_sigfile): New argument for prototype. * openfile.c (open_sigfile): New argument to install progress filter. * encode.c (encode_simple): New variable PFX. Register progress filter. Install text_filter after that. (encode_crypt): Likewise. * sign.c (sign_file): Likewise. (clearsign_file): Likewise. * decrypt.c (decrypt_message): Likewise. (decrypt_messages): Likewise. * verify.c (verify_signatures): Likewise. (verify_one_file): Likewise. * plaintext.c (hash_datafiles): Likewise. (ask_for_detached_datafile): Likewise. 2003-04-10 Werner Koch * passphrase.c (read_passphrase_from_fd): Do a dummy read if the agent is to be used. Noted by Ingo Klöcker. (agent_get_passphrase): Inhibit caching when we have no fingerprint. This is required for key generation as well as for symmetric only encryption. * passphrase .c (agent_get_passphrase): New arg CANCELED. (passphrase_to_dek): Ditto. Passed to above. Changed all callers to pass NULL. * seckey-cert.c (do_check): New arg CANCELED. (check_secret_key): Terminate loop when canceled. * keyedit.c (change_passphrase): Pass ERRTEXT untranslated to passphrase_to_dek and translate where appropriate. * seckey-cert.c (check_secret_key): Ditto. * keygen.c (ask_passphrase): Ditto. * passphrase.c (agent_get_passphrase): Translate the TRYAGAIN_TEXT. Switch the codeset to utf-8. 2003-04-09 Werner Koch * decrypt.c (decrypt_messages): Fixed error handling; the function used to re-loop with same file after an error. Reported by Joseph Walton. 2003-04-08 David Shaw * main.h, g10.c (main), import.c (parse_import_options, fix_pks_corruption): It's really PKS corruption, not HKP corruption. Keep the old repair-hkp-subkey-bug command as an alias. * g10.c (main): Rename --no-version to --no-emit-version for consistency. Keep --no-version as an alias. 2003-04-04 David Shaw * pkclist.c (algo_available): PGP 8 can use the SHA-256 hash. * sign.c (sign_file, clearsign_file, sign_symencrypt_file): Remove unused code. 2003-04-01 Werner Koch * mainproc.c (check_sig_and_print): Add primary key fpr to VALIDSIG status. 2003-03-24 David Shaw * keydb.h: Err on the side of making an unknown signature a SIG rather than a CERT. * import.c (delete_inv_parts): Discard any key signatures that aren't key types (i.e. 0x00, 0x01, etc.) * g10.c (main): Add deprecated option warning for --list-ownertrust. Add --compression-algo alias for --compress-algo. Change --version output strings to match "showpref" strings, and make translatable. * status.c (do_get_from_fd): Accept 'y' as well as 'Y' for --command-fd boolean input. * trustdb.c: Fix typo (DISABLE_REGEXP -> DISABLE_REGEX) * keyedit.c (show_key_with_all_names_colon): Show no-ks-modify flag. 2003-03-11 David Shaw * options.h, g10.c (main), keyserver.c (kopts): Add "try-dns-srv" keyserver option. Defaults to on. * passphrase.c (agent_get_passphrase): Fix memory leak with symmetric messages. Fix segfault with symmetric messages. Fix incorrect prompt with symmetric messages. 2003-03-10 Werner Koch * compress.c (init_uncompress): Use a 15 bit window size so that the output of implementations which don't run for PGP 2 compatibility won't get garbled. 2003-03-04 David Shaw * trustdb.c (validate_keys): Mask the ownertrust when building the list of fully valid keys so that disabled keys are still counted in the web of trust. (get_ownertrust_with_min): Do the same for the minimum ownertrust calculation. * parse-packet.c (dump_sig_subpkt): Show the notation names for not-human-readable notations. Fix cosmetic off-by-one length counter. * options.skel: Add explantion and commented-out "no-mangle-dos-filenames". * mainproc.c (proc_encrypted): Make string translatable. * keyserver.c (keyserver_spawn): Quote ':', '%', and any 8-bit characters in the uid strings sent to the keyserver helper. * keyring.c (keyring_rebuild_cache): Lock the keyring while rebuilding the signature caches to prevent another gpg from tampering with the temporary copy. * keygen.c (keygen_set_std_prefs): Include AES192 and AES256 in default prefs. * keyedit.c (show_prefs): Make strings translatable. * keydb.c: Double the maximum number of keyrings to 40. * gpgv.c (main): Fix bug #113 - gpgv should accept the --ignore-time-conflict option. * g10.c (main): --openpgp disables --pgpX. Double the amount of secure memory to 32k (keys are getting bigger these days). * Makefile.am: Makefile.am: Use @CAPLIBS@ to link in -lcap if we are using capabilities. 2003-02-26 David Shaw * keyserver.c (keyserver_spawn): Include various pieces of information about the key in the data sent to the keyserver helper. This allows the helper to use it in instructing a remote server which may not have any actual OpenPGP smarts in parsing keys. * main.h, export.c (export_pubkeys_stream, do_export_stream): Add ability to return only the first match in an exported keyblock for keyserver usage. This should be replaced at some point with a more flexible solution where each key can be armored seperately. 2003-02-22 David Shaw * sign.c (sign_file): Do not push textmode filter onto an unopened IOBUF (segfault). Noted by Marcus Brinkmann. Push and reinitialize textmode filter for each file in a multiple file list. * packet.h, getkey.c (fixup_uidnode), keyedit.c (show_prefs): Set and show the keyserver no-modify flag. * keygen.c (add_keyserver_modify): New. (keygen_upd_std_prefs): Call it here. (keygen_set_std_prefs): Accept "ks-modify" and "no-ks-modify" as prefs to set and unset keyserver modify flag. * g10.c (main): Accept "s1" in addition to "idea" to match the other ciphers. * main.h, misc.c (idea_cipher_warn): We don't need this if IDEA has been disabled. 2003-02-21 David Shaw * keygen.c (keygen_set_std_prefs): Don't put AES or CAST5 in default prefs if they are disabled. * g10.c (main): Use 3DES instead of CAST5 if we don't have CAST5 support. Use 3DES for the s2k cipher in --openpgp mode. (print_mds): #ifdef all of the optional digest algorithms. 2003-02-12 David Shaw * keydb.h, getkey.c (classify_user_id, classify_user_id2): Make 'exact' a per-desc item. Merge into one function since 'force_exact' is no longer needed. (key_byname): Use new classify_user_id function, and new exact flag in KEYDB_SEARCH_DESC. * keyring.h, keyring.c (keyring_search): Return an optional index to show which KEYDB_SEARCH_DESC was the matching one. * keydb.h, keydb.c (keydb_search): Rename to keydb_search2, and pass the optional index to keyring_search. Add a macro version of keydb_search that calls this new function. * export.c (do_export_stream): If the keyid! syntax is used, export only that specified key. If the key in question is a subkey, export the primary plus that subkey only. 2003-02-11 David Shaw * exec.c (set_exec_path): Add debugging line. * g10.c (print_hex, print_mds): Print long hash strings a lot neater. This assumes at least an 80-character display, as there are a few other similar assumptions here and there. Users who need unformatted hashes can still use with-colons. Check that SHA384 and 512 are available before using them as they are no longer always available. * Makefile.am: Use a local copy of libexecdir along with @PACKAGE@ as GNUPG_LIBEXECDIR so it can be easily overridden at make time. 2003-02-04 David Shaw * armor.c (parse_hash_header, armor_filter): Accept the new SHAs in the armor Hash: header. * g10.c (print_hex): Print long hash strings a little neater. (print_mds): Add the new SHAs to the hash list. 2003-02-02 David Shaw * keyedit.c (menu_revuid): Properly handle a nonselfsigned uid on a v4 key (treat as a v4 revocation). * import.c (print_import_check): Do not re-utf8 convert user IDs. 2003-01-27 David Shaw * mainproc.c (list_node): Show signature expiration date in with-colons sig records. * keylist.c (list_keyblock_colon), mainproc.c (list_node): Show trust sig information in with-colons sig records. 2003-01-16 David Shaw * g10.c (add_group): Trim whitespace after a group name so it does not matter where the user puts the = sign. * options.skel: Comment out the first three lines in case someone manually copies the skel file to their homedir. * sign.c (clearsign_file): Only use pgp2mode with v3 keys and MD5. This matches what we do when decoding such messages and prevents creating a message (v3+RIPEMD/160) that we can't verify. * sig-check.c (signature_check2): Use G10ERR_GENERAL as the error for signature digest conflict. BAD_SIGN implies that a signature was checked and we may try and print out a user ID for a key that doesn't exist. 2003-01-15 David Shaw * trustdb.c (init_trustdb, get_validity): Don't use a changed trust model to indicate a dirty trustdb, and never auto-rebuild a dirty trustdb with the "always" trust model. * g10.c (add_group): Last commit missed the \t ;) 2003-01-14 David Shaw * packet.h, parse-packet.c (setup_user_id), free-packet.c (free_user_id), keydb.h, keyid.c (namehash_from_uid): New function to rmd160-hash the contents of a user ID packet and cache it in the uid object. * keylist.c (list_keyblock_colon): Use namehash in field 8 of uids. Show dates for creation (selfsig date), and expiration in fields 6 and 7. * trustdb.c (get_validity, get_validity_counts, update_validity): Use new namehash function rather than hashing it locally. 2003-01-14 Werner Koch * g10.c (add_group): Fixed group parsing to allow more than one delimiter in a row and also allow tab as delimiter. 2003-01-12 David Shaw * tdbio.c (tdbio_set_dbname): Fix assertion failure with non-fully-qualified trustdb names. 2003-01-11 David Shaw * trustdb.c (get_validity_info, get_ownertrust_info, trust_letter): Simplify by returning a ? for error directly. * keyedit.c (show_key_with_all_names): Use get_validity_string and get_ownertrust_string to show full word versions of trust (i.e. "full" instead of 'f'). * trustdb.h, trustdb.c (get_ownertrust_string, get_validity_string): Same as get_ownertrust_info, and get_validity_info, except returns a full string. * trustdb.c (get_ownertrust_with_min): New. Same as 'get_ownertrust' but takes the min_ownertrust value into account. 2003-01-10 David Shaw * armor.c (armor_filter): Comment about PGP's end of line tab problem. * trustdb.h, trustdb.c (trust_letter): Make static. (get_ownertrust_info, get_validity_info): Don't mask the trust level twice. * trustdb.h, gpgv.c, trustdb.c (get_validity, get_validity_info), keylist.c (list_keyblock_colon), keyedit.c (show_key_with_all_names_colon, menu_revuid): Pass a user ID in rather than a namehash, so we only have to do the hashing in one place. * packet.h, pkclist.c (build_pk_list), free-packet.c (release_public_key_parts): Remove unused namehash element for public keys. 2003-01-07 David Shaw * keygen.c (keygen_set_std_prefs): Warn when setting an IDEA preference when IDEA is not available. 2003-01-06 David Shaw * trustdb.c (get_validity_info): 'd' for disabled is not a validity value any more. * packet.h, tdbio.h, tdbio.c (tdbio_read_record, tdbio_write_record), trustdb.c (update_validity): Store temporary full & marginal counts in the trustdb. (clear_validity, get_validity_counts): Return and clear temp counts. (store_validation_status): Keep track of which keyids have been stored. (validate_one_keyblock, validate_key_list): Use per-uid copies of the full & marginal counts so they can be recalled for multiple levels. (validate_keys): Only use unused keys for each new round. (reset_unconnected_keys): Rename to reset_trust_records, and only skip specifically excluded records. * keylist.c (print_capabilities): Show 'D' for disabled keys in capabilities section. * trustdb.c (is_disabled): Remove incorrect comment. 2003-01-03 David Shaw * import.c (import_one): Only do the work to create the status display for interactive import if status is enabled. * keyring.c (keyring_search): skipfnc didn't work properly with non-keyid searches. Noted by Stefan Bellon. * getkey.c (merge_selfsigs_main): Remove some unused code and make sure that the pk selfsigversion member accounts for 1F direct sigs. 2003-01-02 Werner Koch * keydb.c (keydb_add_resource): Don't assume that try_make_homedir terminates but check again for the existence of the directory and continue then. * openfile.c (copy_options_file): Print a warning if the skeleton file has active options. 2002-12-29 David Shaw * getkey.c (merge_selfsigs_main), main.h, sig-check.c (check_key_signature2): Pass the ultimately trusted pk directly to check_key_signature2 to avoid going through the key selection mechanism. This prevents a deadly embrace when two keys without selfsigs each sign the other. 2002-12-27 David Shaw * keyserver.c (keyserver_refresh): Don't print the "refreshing..." line if there are no keys to refresh or if there is no keyserver set. * getkey.c (merge_selfsigs_main): Any valid user ID should make a key valid, not just the last one. This also fixes Debian bug #174276. 2002-12-27 Stefan Bellon * import.c (print_import_check): Changed int to size_t. 2002-12-27 David Shaw * keyedit.c (keyedit_menu, menu_revuid): Add "revuid" feature to revoke a user ID. This is the same as issuing a revocation for the self-signature, but a much simpler interface to do it. 2002-12-26 David Shaw * keydb.h, getkey.c (key_byname): Flag to enable or disable including disabled keys. Keys specified via keyid (i.e. 0x...) are always included. * getkey.c (get_pubkey_byname, get_seckey_byname2, get_seckey_bynames), keyedit.c (keyedit_menu, menu_addrevoker): Include disabled keys in these functions. * pkclist.c (build_pk_list): Do not include disabled keys for -r or the key prompt. Do include disabled keys for the default key and --encrypt-to. * trustdb.h, trustdb.c (is_disabled): New skipfnc for skipping disabled keys. * gpgv.c (is_disabled): Stub. * keygen.c (keygen_add_key_expire): Properly handle updating a key expiration to a no-expiration value. * keyedit.c (enable_disable_key): Comment. * import.c (import_one): When in interactive mode and --verbose, don't repeat some key information twice. 2002-12-22 Timo Schulz * import.c (print_import_check): New. (import_one): Use it here. Use merge_keys_and_selfsig in the interactive mode to avoid wrong key information. * status.h: Add new status code. * status.c: Ditto. 2002-12-13 David Shaw * pkclist.c (do_we_trust): Tweak language to refer to the "named user" rather than "owner". Noted by Stefan Bellon. * trustdb.h, trustdb.c (trustdb_pending_check): New function to check if the trustdb needs a check. * import.c (import_keys_internal): Used here so we don't rebuild the trustdb if it is still clean. (import_one, chk_self_sigs): Only mark trustdb dirty if the key that is being imported has any sigs other than self-sigs. Suggested by Adrian von Bidder. * options.skel: Include the required '=' sign in the sample 'group' option. Noted by Stefan Bellon. * import.c (chk_self_sigs): Don't try and check a subkey as if it was a signature. 2002-12-11 David Shaw * tdbio.c (tdbio_read_record, tdbio_write_record): Compact the RECTYPE_TRUST records a bit. * g10.c (main): Comment out --list-trust-path until it can be implemented. * import.c (import_one): Warn when importing an Elgamal primary that this may take some time (to verify self-sigs). (chk_self_sigs): Try and cache all self-sigs so the keyblock is written to the keyring with a good rich cache. * keygen.c (ask_algo): Make the Elgamal sign+encrypt warning stronger, and remove the RSA sign+encrypt warning. 2002-12-06 Stefan Bellon * options.h: Fixed typo (mangle_dos_names instead of mangle_dos_filenames). 2002-12-05 Werner Koch * g10.c: New options --[no-]mangle-dos-filenames. * options.h (opt): Added mangle-dos-filenames. * openfile.c (open_outfile) [USE_ONLY_8DOT3]: Truncate the filename only when this option is set; this is the default. 2002-12-04 David Shaw * main.h, keyedit.c, keygen.c: Back out previous (2002-12-01) change. Minimal isn't always best. * sign.c (update_keysig_packet): Use the current time rather then a modification of the original signature time. Make sure that this doesn't cause a time warp. * keygen.c (keygen_add_key_expire): Properly handle a key expiration date in the past (use a duration of 0). * keyedit.c (menu_expire): Use update_keysig_packet so any sig subpackets are maintained during the update. * build-packet.c (build_sig_subpkt): Mark sig expired or unexpired when the sig expiration subpacket is added. (build_sig_subpkt_from_sig): Handle making an expiration subpacket from a sig that has already expired (use a duration of 0). * packet.h, sign.c (update_keysig_packet), keyedit.c (menu_set_primary_uid, menu_set_preferences): Add ability to issue 0x18 subkey binding sigs to update_keysig_packet and change all callers. * trustdb.c (validate_keys): Show trust parameters when building the trustdb, and make sure that the version record update was successful. (init_trustdb): If the current parameters aren't what was used for building the trustdb, the trustdb is invalid. * tbio.c (tdbio_db_matches_options): Update to work with new trustdbs. 2002-12-03 David Shaw * tdbio.h, tdbio.c (tdbio_read_record, tdbio_write_record): Store trust model in the trustdb version record. (tdbio_update_version_record): New function to update version record values during a trustdb check or update. (tdbio_dump_record): Show trust model in dump. * trustdb.c (validate_keys): Call tdbio_update_version_record on success so that the correct options are stored in the trustdb. * options.h: rearrange trust models so that CLASSIC is 0 and OPENPGP is 1. * options.h, g10.c (main), encode.c (write_pubkey_enc_from_list), pkclist.c (algo_available), revoke.c (gen_revoke): Add --pgp8 mode. This is basically identical to --pgp7 in all ways except that signing subkeys, v4 data sigs (including expiration), and SK comments are allowed. * getkey.c (finish_lookup): Comment. * main.h, keylist.c (reorder_keyblock), keyedit.c (keyedit_menu): Reorder user ID display in the --edit-key menu to match that of the --list-keys display. * g10.c (add_notation_data): Fix initialization. 2002-12-01 David Shaw * keyedit.c (menu_expire): Don't lose key flags when changing the expiration date of a subkey. This is not the most optimal solution, but it is minimal change on the stable branch. * main.h, keygen.c (do_copy_key_flags): New function to copy key flags, if any, from one sig to another. (do_add_key_expire): New function to add key expiration to a sig. (keygen_copy_flags_add_expire): New version of keygen_add_key_expire that also copies key flags. (keygen_add_key_flags_and_expire): Use do_add_key_expire. * import.c (fix_hkp_corruption): Comment. 2002-11-25 Stefan Bellon * plaintext.c (handle_plaintext) [__riscos__]: If nooutput is set, no filetype is needed obviously. 2002-11-24 David Shaw * main.h, misc.c (default_cipher_algo, default_compress_algo): New. Return the default algorithm by trying --cipher-algo/--compress-algo, then the first item in the pref list, then s2k-cipher-algo or ZIP. * sign.c (sign_file, sign_symencrypt_file), encode.c (encode_simple, encode_crypt): Call default_cipher_algo and default_compress_algo to get algorithms. * g10.c (main): Allow pref selection for compress algo with --openpgp. * mainproc.c (proc_encrypted): Use --s2k-digest-algo for passphrase mangling rather than --digest-algo. * sign.c (hash_for): If --digest-algo is not set, but --personal-digest-preferences is, then use the first hash algorithm in the personal list. If the signing algorithm is DSA, then use the first 160-bit hash algorithm in the personal list. If --pgp2 is set and it's a v3 RSA key, use MD5. * g10.c (main), keydb.c (keydb_add_resource, keydb_locate_writable): Rename --default-keyring as --primary-keyring. Stefan wins the naming contest. 2002-11-23 David Shaw * g10.c (add_notation_data): Disallow notation names that do not contain a '@', unless --expert is set. This is to help prevent people from polluting the (as yet unused) IETF namespace. * main.h: Comments about default algorithms. * photoid.c (image_type_to_string): Comments about 3-letter file extensions. * encode.c (encode_simple), passphrase.c (passphrase_to_dek), sign.c (sign_symencrypt_file): Use --s2k-digest-algo for passphrase mangling rather than --digest-algo. 2002-11-21 David Shaw * keygen.c (keygen_set_std_prefs): Properly handle an empty preference string. * misc.c (string_to_compress_algo): "none" is a bad choice since it conflicts with the "none" in setpref. 2002-11-14 David Shaw * g10.c (main): Allow compression algorithm names as the argument to --compress-algo. The old algorithm names still work for backwards compatibility. * misc.c (string_to_compress_algo): Allow "none" as an alias for "uncompressed". 2002-11-13 Stefan Bellon * getkey.c (get_pubkey_byfprint_fast): Fixed type incompatibility, was unsigned char instead of byte. 2002-11-13 David Shaw * encode.c (encode_simple): Make sure that files larger than about 4G use partial length encoding. This is required because OpenPGP allows only for 32 bit length fields. From Werner on stable branch. * getkey.c (get_pubkey_direct): Renamed to... (get_pubkey_fast): this and made extern. (get_pubkey_byfprint_fast): New. From Werner on stable branch. * keydb.h, import.c (import_one): Use get_pubkey_fast instead of get_pubkey. We don't need a merged key and actually this might lead to recursions. (revocation_present): Likewise for search by fingerprint. From Werner on stable branch. * g10.c (main): Try to create the trustdb even for non-colon-mode list-key operations. This is required because getkey needs to know whether a a key is ultimately trusted. From Werner on stable branch. * exec.c [__CYGWIN32__]: Keep cygwin separate from Mingw32; we don't need it here as it behaves more like a Posix system. From Werner on stable branch. * passphrase.c (agent_get_passphrase): Ditto. From Werner on stable branch. * tdbio.c (MY_O_BINARY): Need binary mode with Cygwin. From Werner on stable branch. * g10.c, gpgv.c (main) [__CYGWIN32__]: Don't get the homedir from the registry. From Werner on stable branch. * keyedit.c (show_key_with_all_names_colon): Make --with-colons --edit display match the validity and trust of --with-colons --list-keys. * passphrase.c (agent_send_all_options): Fix compile warning. * keylist.c (list_keyblock_colon): Validity for subkeys should match that of the primary key, and not that of the last user ID. * getkey.c (merge_selfsigs): Revoked/expired/invalid primary keys carry these facts onto all their subkeys, but only after the subkey has a chance to be marked valid. This is to fix an incorrect "invalid public key" error verifying a signature made by a revoked signing subkey, with a valid unrevoked primary key. 2002-11-09 Werner Koch * passphrase.c (agent_send_all_options): Use tty_get_ttyname to get the default ttyname. 2002-11-07 David Shaw * keyring.h, keyring.c (keyring_register_filename): Return the pointer if a given keyring is registered twice. * keydb.h, keydb.c (keydb_add_resource): Use flags to indicate a default keyring. (keydb_locate_writable): Prefer the default keyring if possible. * g10.c (main): Add --default-keyring option. 2002-11-06 David Shaw * options.h, g10.c (main), trustdb.c (ask_ownertrust): Add --force-ownertrust option for debugging purposes. This allows setting a whole keyring to a given trust during an --update-trustdb. Not for normal use - it's just easier than hitting "4" all the time to test a large trustdb. * pubkey-enc.c (get_session_key): With hidden recipients or try a given passphrase against all secret keys rather than trying all secret keys in turn. Don't if --try-all-secrets or --status-fd is enabled. * passphrase.c (passphrase_to_dek): Mode 1 means do a regular passphrase query, but don't prompt with the key info. * seckey-cert.c (do_check, check_secret_key): A negative ask count means to enable passphrase mode 1. * keydb.h, getkey.c (enum_secret_keys): Add flag to include secret-parts-missing keys (or not) in the list. 2002-11-05 David Shaw * keyserver.c (keyserver_search_prompt): When --with-colons is enabled, don't try and fit the search output to the screen size - just dump the whole list. 2002-11-04 David Shaw * keyserver.c (keyserver_search_prompt): When --with-colons is enabled, just dump the raw keyserver protocol to stdout and don't print the menu. * keyserver.c (show_prompt): Don't show a prompt when command-fd is being used. * trustdb.c (trust_model_string, check_trustdb, update_trustdb, validate_one_keyblock): It's not clear what a trustdb rebuild or check means with a trust model other than "classic" or "openpgp", so disallow this. 2002-11-03 David Shaw * options.h, g10.c (main): Add --trust-model option. Current models are "openpgp" which is classic+trustsigs, "classic" which is classic only, and "always" which is the same as the current option --always-trust (which still works). Default is "openpgp". * trustdb.c (validate_one_keyblock): Use "openpgp" trust model to enable trust sigs. * gpgv.c (main), mainproc.c (check_sig_and_print), pkclist.c (do_we_trust, do_we_trust_pre, check_signatures_trust): Use new --trust-model option in place of --always-trust. * keyedit.c (sign_mk_attrib, trustsig_prompt, sign_uids, keyedit_menu): Prompt for and create a trust signature with "tsign". This is functional, but needs better UI text. * build-packet.c (build_sig_subpkt): Able to build trust and regexp subpackets. * pkclist.c (do_edit_ownertrust): Comment. 2002-11-02 David Shaw * keygen.c (set_one_pref, keygen_set_std_prefs): Allow using the full algorithm name (CAST5, SHA1) rather than the short form (S3, H2). * main.h, keygen.c (keygen_get_std_prefs), keyedit.c (keyedit_menu): Return and use a fake uid packet rather than a string since we already have a nice parser/printer in keyedit.c:show_prefs. * main.h, misc.c (string_to_compress_algo): New. 2002-11-01 David Shaw * g10.c (main): Add --no-throw-keyid. * keydb.h, encode.c (write_pubkey_enc_from_list), g10.c (main), pkclist.c (build_pk_list): Add --hidden-recipient (-R) and --hidden-encrypt-to, which do a single-user variation on --throw-keyid. The "hide this key" flag is carried in bit 0 of the pk_list flags field. * keyserver.c (parse_keyrec): Fix shadowing warning. 2002-10-31 Stefan Bellon * compress.c (init_compress) [__riscos__]: Use riscos_load_module() to load ZLib module. * g10.c (main) [__riscos__]: Renames due to changes in riscos.c (e.g. prefixes all RISC OS specific functions with riscos_*). * photoid.c (show_photos) [__riscos__]: Likewise. * signal.c (got_fatal_signal) [__riscos__]: Likewise. * trustdb.c (check_regexp) [__riscos__]: Branch to RISC OS RegEx handling. 2002-10-31 David Shaw * build-packet.c (do_plaintext), encode.c (encode_sesskey, encode_simple, encode_crypt), sign.c (write_plaintext_packet): Use wipememory() instead of memset() to wipe sensitive memory as the memset() might be optimized away. 2002-10-30 David Shaw * trustdb.c (check_regexp): Modern regexps require REG_EXTENDED. 2002-10-29 David Shaw * packet.h, trustdb.h, trustdb.c (trust_string): New. Return a string like "fully trusted", "marginally trusted", etc. (get_min_ownertrust): New. Return minimum ownertrust. (update_min_ownertrust): New. Set minimum ownertrust. (check_regexp): New. Check a regular epression against a user ID. (ask_ownertrust): Allow specifying a minimum value. (get_ownertrust_info): Follow the minimum ownertrust when returning a letter. (clear_validity): Remove minimum ownertrust when a key becomes invalid. (release_key_items): Release regexp along with the rest of the info. (validate_one_keyblock, validate_keys): Build a trust sig chain while validating. Call check_regexp for regexps. Use the minimum ownertrust if the user does not specify a genuine ownertrust. * pkclist.c (do_edit_ownertrust): Only allow user to select a trust level greater than the minimum value. * parse-packet.c (can_handle_critical): Can handle critical trust and regexp subpackets. * trustdb.h, trustdb.c (clear_ownertrusts), delkey.c (do_delete_key), import.c (import_one): Rename clear_ownertrust to clear_ownertrusts and have it clear the min_ownertrust value as well. * keylist.c (list_keyblock_print): Indent uid to match pub and sig. * keyedit.c (print_and_check_one_sig, show_key_and_fingerprint, menu_addrevoker), keylist.c (list_keyblock_print, print_fingerprint): Show "T" or the trust depth for trust signatures, and add spaces to some strings to make room for it. * packet.h, parse-packet.c (dump_sig_subpkt, parse_one_sig_subpkt, parse_signature): Parse trust signature values. * tdbio.h, tdbio.c (tdbio_read_record, tdbio_write_record): Reserve a byte for the minimum ownertrust value (for use with trust signatures). 2002-10-29 Stefan Bellon * build-packet.c (calc_plaintext, do_plaintext): Removed RISC OS specific filetype parts (it's now done in make_basename()). * plaintext.c (handle_plaintext): Tidied up RISC OS specific filetype parts. * encode.c (encode_simple, encode_crypt): Added argument to make_basename() call. * sign.c (write_plaintext_packet): Added argument to make_basename() call. 2002-10-28 Stefan Bellon * build-packet.c (calc_plaintext, do_plaintext): Added filetype handling for RISC OS' file types. * plaintext.c (handle_plaintext) [__riscos__]: Added filetype handling for RISC OS' file types. 2002-10-23 David Shaw * main.h, import.c (sec_to_pub_keyblock, import_secret_one, parse_import_options), g10.c (main): New import-option "convert-sk-to-pk" to convert a secret key into a public key during import. It is on by default. 2002-10-23 Werner Koch * pubkey-enc.c (get_it): Fix segv, test for revoked only when PK has been assigned. 2002-10-18 Timo Schulz * keylist.c: (print_pubkey_info): New. (print_seckey_info): New. * main.h: Prototypes for the new functions. * delkey.c (do_delete_key): Use it here. * revoke.c (gen_desig_revoke): Ditto. 2002-10-17 Werner Koch * pkclist.c (do_edit_ownertrust): Show all user IDs. This should be enhanced to also show the current trust level. Suggested by Florian Weimer. 2002-10-17 David Shaw * g10.c (main): Handle --strict and --no-strict from the command line before the options file is loaded. 2002-10-15 David Shaw * g10.c (main): Disable --textmode when encrypting (symmetric or pk) in --pgp2 mode as PGP 2 can't handle the unknown length literal packet. Reported by Michael Richardson. 2002-10-14 David Shaw * keyserver-internal.h, keyserver.c (print_keyrec, parse_keyrec, show_prompt, keyserver_search_prompt, keyserver_spawn): Go to version 1 of the keyserver protocol. This is a better design, similar to --with-colons, that allows for keys with multiple user IDs rather than using multiple keys. It also matches the machine readable pksd format. Also use a prettier --search-keys listing format that can fill different size windows (currently set at 24 lines). 2002-10-12 Werner Koch * keygen.c (print_status_key_created): New. (do_generate_keypair): Use it to print the fingerprint. (generate_subkeypair): Likewise. 2002-10-11 David Shaw * keyedit.c (menu_addrevoker): Properly back out if the signature fails. Also, do not allow appointing the same revoker twice, and report ALREADY_SIGNED if the user tries it. 2002-10-07 David Shaw * import.c (import_keys_internal): Missed one s/inp/inp2/. * keylist.c (print_capabilities): Properly indicate per-key capabilities of sign&encrypt primary keys that have secret-parts-missing (i.e. no capabilities at all) * mainproc.c (symkey_decrypt_sesskey): Fix compiler warning. 2002-10-04 David Shaw * getkey.c (get_pubkey_direct): Don't cache keys retrieved via this function as they may not have all their fields filled in. * sig-check.c (signature_check2): Use new is_primary flag to check rather than comparing main_keyid with keyid as this still works in the case of a not fully filled in pk. 2002-10-04 Werner Koch * import.c (import_keys_internal): s/inp/inp2/ to avoid shadowing warning. * passphrase.c (agent_get_passphrase): Fixed signed/unsigned char problem in %-escaping. Noted by Ingo Klöcker. 2002-10-03 David Shaw * options.h, g10.c (main): Add --strict and --no-strict to switch the log_warning severity level from info to error. * keylist.c (print_capabilities): Secret-parts-missing keys should show that fact in the capabilities, and only primary signing keys can certify other keys. * packet.h, parse_packet.c (parse_key): Add is_primary flag for public keys (it already exists for secret keys). 2002-10-02 David Shaw * import.c (import_secret_one): Check for an illegal (>110) protection cipher when importing a secret key. * keylist.c (list_keyblock_print): Show a '#' for a secret-parts-missing key. * parse_packet.c (parse_key): Some comments. * revoke.c (gen_revoke): Remove some debugging code. * trustdb.c (verify_own_keys): Make trusted-key a non-deprecated option again. * seckey-cert.c (do_check): Don't give the IDEA warning unless the cipher in question is in fact IDEA. 2002-10-01 David Shaw * import.c (import_one): Make sure that a newly imported key starts with a clean ownertrust. 2002-10-01 Werner Koch * getkey.c (get_pubkey_direct): New. (merge_selfsigs_main): Use it here to look for an ultimately trusted key. Using the full get_pubkey might lead to an infinitive recursion. 2002-09-29 David Shaw * keyserver.c (parse_keyserver_uri): Force the keyserver URI scheme to lowercase to be case-insensitive. 2002-09-28 David Shaw * export.c (do_export_stream): Comment. * sig-check.c (check_key_signature2): Properly handle a non-designated revocation import. 2002-09-26 Werner Koch * g10.c (set_homedir): New. Changed all direct assignments to use this. * gpgv.c (set_homedir): Ditto. 2002-09-25 David Shaw * Makefile.am: Link gpg with EGDLIBS (i.e. NETLIBS) as EGD uses sockets. Remove the old NETLIBS variable since the keyserver stuff is no longer internal. 2002-09-24 David Shaw * import.c (import_keys_stream): Fix compiler type warning. * keyring.c (keyring_rebuild_cache), sig-check.c (check_key_signature2), import.c (import, chk_self_sigs): Minor language cleanups. 2002-09-23 Stefan Bellon * main.h: Introduced fast-import as import option. Removed fast as separate option from prototypes. * import.c (parse_import_options): Added fast-import option. (import_*): Removed fast as separate option. * g10.c (main): Added option fast-import, removed old fast as separate argument. * keyserver.c (keyserver_spawn): Removed old fast as separate argument. 2002-09-22 Stefan Bellon * import.c (import_keys, import_keys_stream, import_keys_internal): Added trustdb update/check to key import if not fast-import and interactive set/no-auto-check-trustdb unset. Avoided function clone by introducing import_keys_internal. 2002-09-19 David Shaw * keyserver.c (keyserver_spawn): Properly handle line truncation. Don't leak memory (~10-20 bytes) on searches. (keyserver_search_prompt): Cleanup. * keylist.c (list_keyblock_colon): Show 1F direct key signatures in --with-colons listing. 2002-09-16 David Shaw * keyedit.c (menu_addrevoker): The direct key signature for revocation keys must be at least v4 to carry the revocation key subpacket. Add a PGP 2.x warning for revocation keys. 2002-09-14 David Shaw * g10.c (check_permissions): Rearrange strings to make translating easier (don't incorporate string parts). * keyedit.c (sign_uids): Make strings translatable. * sig-check.c (check_key_signature2): Make string translatable. 2002-09-13 David Shaw * getkey.c (check_revocation_keys): Move.... * main.h, sig-check.c (check_revocation_keys): to here. Also return the signature_check error code rather than 0/1 and cache the sig result. * sig-check.c (check_key_signature2): Divert to check_revocation_keys if a revocation sig is made by someone other than the pk owner. * getkey.c (merge_selfsigs_main): Tidy. 2002-09-13 Werner Koch * g10.c (main) [__MINGW32__]: Activate oLoadExtension. 2002-09-12 David Shaw * Makefile.am, hkp.c, hkp.h, keyserver.c (keyserver_work): Remove internal HKP support. * keyserver.c (keyserver_spawn): Remove whitespace after keyserver commands. 2002-09-10 David Shaw * exec.c (expand_args): Remove loop left over from earlier implementation. (exec_write): Missed one tick. 2002-09-10 Werner Koch * g10.c, options.h: Removed option --emulate-checksum-bug. * misc.c (checksum_u16_nobug): Removed. (checksum_u16): Removed the bug emulation. (checksum_mpi): Ditto. (checksum_mpi_counted_nbits): Removed and replaced all calls with checksum_mpi. * parse-packet.c (read_protected_v3_mpi): New. (parse_key): Use it here to store it as an opaque MPI. * seckey-cert.c (do_check): Changed the v3 unprotection to the new why to store these keys. (protect_secret_key): Likewise. * build-packet.c (do_secret_key): And changed the writing. * tdbio.c (tdbio_set_dbname, open_db): Use new macro MY_O_BINARY to avoid silly ifdefs. (open_db): Fallback to RDONLY so that gpg may be used from a RO-medium. * encode.c (encode_simple): Make sure we don't use an ESK packet when we don't have a salt in the S2K. * misc.c (pct_expando) : Make sure that LEN is initialized. * exec.c (exec_finish): Use ticks to denote filenames in messages. (make_tempdir, exec_write): Changed format of messages. * keyserver.c (print_keyinfo): Release USERID in on error. (keyserver_work) [!DISABLE_KEYSERVER_HELPERS]: Exclude the unused code. 2002-09-09 Werner Koch * parse-packet.c (make_attribute_uidname): Add new ar MAX_NAMELEN for sanity checks. Changed both callers. Limit the size of an %s. * options.skel: Comment lock-once out, so that this file does not change anything when copied to a new home directory. * openfile.c (try_make_homedir): Don't exit after copying the option skeleton. * options.h: Don't use a comma when declaring variables over more than one line. * mainproc.c (symkey_decrypt_sesskey): Check length of the session key. * hkp.c (dehtmlize): Use ascii_tolower to protect against weird locales. Cast the argument for isspace for the sake of broken HP/UXes. (parse_hkp_index): s/ascii_memcasecmp/ascii_strncasecmp/. * g10.c: Removed option --emulate-3des-s2k-bug. * passphrase.c (hash_passphrase): Was used here. * export.c (parse_export_options) * keyserver.c (parse_keyserver_options) * import.c (parse_import_options) * g10.c (check_permissions): s/ascii_memcasecmp/ascii_strncasecmp/. 2002-09-09 David Shaw * g10.c (add_group): Use '=' to separate group name from group members. Use a better error message for when no = is found. * hkp.c (hkp_export): Use CRLF in headers. 2002-09-03 David Shaw * mainproc.c (print_pkenc_list): Don't increment the error counter when printing the list of keys a message was encrypted to. This would make gpg give a non-zero exit code even for completely valid messages if the message was encrypted to more than one key that the user owned. 2002-09-02 Werner Koch * g10.c (main): Try to set a default character set. Print the used one in verbosity level 3. * gpgv.c (main): Try to set a default character set. * status.c, status.h (STATUS_IMPORT_OK): New. * import.c (import_one,import_secret_one): Print new status. 2002-08-30 David Shaw * pkclist.c (build_pk_list): Add new status code to indicate an untrusted user. This (or a disabled key) fail with "unavailable pubkey" (G10ERR_UNU_PUBKEY). * pkclist.c (build_pk_list): Fail if any recipient keys are unusable. * options.skel: The PGP LDAP keyserver is back. Use MIT keyserver as a sample rather than cryptnet as cryptnet does not support searching yet. * keyedit.c (show_key_with_all_names): Fix error message (preferences are userid/selfsig and not key specific). 2002-08-30 Werner Koch * pkclist.c (do_we_trust_pre): Changed the wording of a warning. * encode.c (encode_simple,encode_crypt): Use new style CTB for compressssed packets when using MDC. We need to do this so that concatenated messages are properly decrypted. Old style compression assumes that it is the last packet; given that we can't determine the length in advance, the uncompressor does not know where to start. Actually we should use the new CTB always but this would break PGP 2 compatibility. * parse-packet.c (parse): Special treatment for new style CTB compressed packets. * build-packet.c (do_mdc): Removed. Was not used. (do_encrypted_mdc): Count in the version number and the MDC packet. 2002-08-28 David Shaw * sig-check.c (do_check_messages, do_check): Show keyid in error messages. * keyserver.c (print_keyinfo): More readable key listings for --search-keys responses. 2002-08-26 David Shaw * hkp.c (parse_hkp_index, dehtmlize): Move HTML functionality into new "dehtmlize" function. Remove HTML before trying to parse each line from the keyserver. If the keyserver provides key type information in the listing, use it. 2002-08-23 David Shaw * sig-check.c (do_check, do_check_messages): Emit the usual sig warnings even for cached sigs. This also serves to protect against missing a sig expiring while cached. * getkey.c (merge_selfsigs_main): Don't check UID self-sigs twice. 2002-08-22 David Shaw * import.c (clean_subkeys, chk_self_sigs): Merge clean_subkeys into chk_self_sigs. This improves efficiency as the same signatures are not checked multiple times. Clarify when a subkey is revoked (any revocation signature, even if it is dated before the binding signature). * getkey.c (merge_selfsigs_subkey): Subkey revocation comments. * keylist.c (list_one): Stats are only for public key listings. * g10.c (main), options.skel: Default should be include-revoked for keyserver operations. 2002-08-21 Werner Koch * import.c (import_print_stats): Print new non_imported counter which is currently not used because we terminate on errors. 2002-08-20 David Shaw * options.skel: Document no-include-attributes for keyserver-options. * keylist.c, keyedit.c, keyserver.c, sign.c: Some TODOs and comments. * export.c (do_export_stream): Fix noop bug in exporting sensitive revocation keys. * pkclist.c (do_edit_ownertrust): Comment out the option for showing trust paths until it can be implemented. 2002-08-19 Werner Koch * getkey.c (get_user_id_native): Renamed to .. (get_user_id_printable): this. Filter out all dangerous characters. Checked all usages. (get_user_id_string_native): Renamed to.. (get_user_id_string_printable): this. Filter out all dangerous characters. Checked all usages. * keyedit.c (show_basic_key_info): New. * keylist.c (print_fingerprint): New mode 3. * import.c (import_one): Use new function to display the user ID. 2002-08-16 Timo Schulz * g10.c (main): Enable opt.interactive. * import.c (import_one): Ask the user if the key shall be imported when the interactive mode is used. Useful to extract selected keys from a file. 2002-08-16 Werner Koch * seckey-cert.c: Workaround to allow decryption of v3 keys created with a bug in the mpi_get_secure_buffer. 2002-08-14 David Shaw * hkp.c (parse_hkp_index): Properly handle really large keys (5 digit key length) in HKP searches. 2002-08-13 David Shaw * encode.c (encode_simple): Fix problem with using compression algo 2 and symmetric compressed files. * encode.c (encode_simple, encode_crypt): If we are not using a MDC, compress even if a file is already compressed. This is to help against the chosen ciphertext attack. * pkclist.c (select_algo_from_prefs): Fix requested algorithm bug so the request succeeds even if the requested algorithm is not the first found. * cipher.c (write_header), encode.c (use_mdc, encode_simple, encode_crypt, encrypt_filter), g10.c (main): Be more eager to use a MDC. We use a MDC if the keys directly support it, if the keys list AES (any) or TWOFISH anywhere in the prefs, or if the cipher chosen does not have a 64 bit blocksize. 2002-08-08 David Shaw * options.skel: Some language tweaks, and remove the load-extension section for random gatherers. * keyring.c (create_tmp_file, rename_tmp_file): Create tmp files with user-only permissions, but restore the original permissions if the user has something special set. * openfile.c (copy_options_file): Create new options file (gpg.conf) with user-only permissions. * keydb.c (keydb_add_resource): Create new keyrings with user-only permissions. * tdbio.c (tdbio_set_dbname): Create new trustdbs with user-only permissions. 2002-08-07 David Shaw * sig-check.c (signature_check2): Sanity check that the md has a context for the hash that the sig is expecting. This can happen if a onepass sig header does not match the actual sig, and also if the clearsign "Hash:" header is missing or does not match the actual sig. * keyedit.c (menu_revsig): Properly show a uid is revoked without restarting gpg. This is Debian bug 124219, though their supplied patch will not do the right thing. * main.h, tdbio.c (tdbio_set_dbname), misc.c (removed check_permissions), keydb.c (keydb_add_resource), g10.c (main, check_permissions): Significant reworking of the permission check mechanism. The new behavior is to check everything in the homedir by checking the homedir itself. If the user wants to put (possibly shared) keyrings outside the homedir, they are not checked. The options file and any extension files are checked wherever they are, as well as their enclosing directories. This is Debian bug 147760. 2002-08-06 Stefan Bellon * g10.c (main): Use of EXTSEP_S in new gpg.conf string. * openfile.c (copy_options_file): Ditto. 2002-08-06 David Shaw * options.h, g10.c (main), mainproc.c (proc_encrypted): --ignore-mdc-error option to turn a MDC check error into a warning. * encode.c (encode_crypt), g10.c (main), sign.c (sign_file, clearsign_file): Use the same --pgpX warning string everywhere to ease translations. * encode.c (write_pubkey_enc_from_list): Warn when using --throw-keyid with --pgpX. Noted by Vedaal Nistar. * revoke.c (export_minimal_pk, gen_desig_revoke, gen_revoke): Export a minimal pk along with the revocation cert when in --pgpX mode so that PGP can import it. 2002-08-06 Werner Koch * options.skel: Changed comments. * g10.c (main): Try to use "gpg.conf" as default option file. * openfile.c (copy_options_file): Changed name of created file. 2002-08-02 Werner Koch * Makefile.am (LDFLAGS): Removed DYNLINK_LDFLAGS. 2002-07-30 David Shaw * options.h, g10.c (main), mainproc.c (proc_encrypted): Return a decryption failed error if a MDC does not verify. Warn if a MDC is not present (can disable via --no-mdc-warning). * exec.c (exec_write), g10.c (main), keyserver.c (keyserver_spawn): Use new DISABLE_KEYSERVER_PATH rather than FIXED_EXEC_PATH. 2002-07-28 David Shaw * sig-check.c (do_check): Properly validate v4 sigs with no hashed section at all. 2002-07-25 Werner Koch * delkey.c (do_delete_key): Always allow to delete a key in batch mode when specified by fingerprint. Suggested by Enzo Michelangeli. 2002-07-25 David Shaw * keyedit.c (menu_revsig): Change "revsig" to honor selected uids so the user can revoke sigs from particular uids only. * keylist.c (list_keyblock_print): Don't display expired uids in --list-keys unless -v and not --list-sigs (just like revoked uids). * exec.c, export.c, import.c, keyedit.c, keyserver.c, misc.c: "Warning" -> "WARNING" 2002-07-24 David Shaw * main.h, import.c (parse_import_options, fix_hkp_corruption, import_one, delete_inv_parts), g10.c (main): New import-option "repair-hkp-subkey-bug", which repairs as much as possible the HKP mangling multiple subkeys bug. It is on by default for keyserver receives, and off by default for regular --import. * main.h, import.c (import, import_one, delete_inv_parts), hkp.c (hkp_ask_import), keyserver.c (keyserver_spawn): Use keyserver import options when doing keyserver receives. * options.h, exec.h, exec.c (set_exec_path, exec_write), g10.c (main), keyserver.c (keyserver_spawn): If the user does not use "exec-path", completely replace $PATH with GNUPG_LIBEXECDIR before calling the keyserver helper. If the user does use "exec-path", append GNUPG_LIBEXECDIR after the specified path. 2002-07-23 David Shaw * import.c (parse_import_options), export.c (parse_export_options): Fix offset problem with reversed ("no-") meanings. * import.c (delete_inv_parts): Discard subkey signatures (0x18 and 0x28) if found in the userid section of the key. * sig-check.c (signature_check2): Signatures made by invalid subkeys (bad/missing binding sig) are also invalid. * keylist.c (print_fingerprint): Show the primary as well as the secondary key fingerprint in modes 1 & 2. 2002-07-22 David Shaw * options.h, main.h, g10.c (main), import.c (parse_import_options, delete_inv_parts), keyserver.c (parse_keyserver_options): add new --import-options option. The only current flag is "allow-local-sigs". * g10.c (main): Don't disable MDC in pgp7 mode. * options.h, g10.c (main), keyserver.c (parse_keyserver_options): Remove old keyserver-option include-attributes now that there is an export-option for the same thing. * options.h, main.h, export.c (parse_export_options, do_export_stream), g10.c (main): add new --export-options option. Current flags are "include-non-rfc", "include-local-sigs", "include-attributes", and "include-sensitive-revkeys". * options.h, hkp.c (hkp_export), keyserver.c (parse_keyserver_options, keyserver_spawn): try passing unknown keyserver options to export options, and if successful, use them when doing a keyserver --send-key. * build-packet.c (build_sig_subpkt): We do not generate SIGSUBPKT_PRIV_VERIFY_CACHE anymore. * revoke.c (gen_desig_revoke): Lots more comments about including sensitive revkeys along with the revocation sig itself. * keyserver.c (parse_keyserver_options): Simpler implementation that can skip one pass over the options. 2002-07-18 David Shaw * keyedit.c (keyedit_menu, menu_addrevoker): Allow specifying "sensitive" as an argument to an addrevoker command. This sets the 0x40 sensitive revoker flag. * revoke.c (gen_desig_revoke): When generating a designated revocation, include the direct key sig that contains the designated revoker subpacket. This allows sensitive designated revocation subpackets to be exported. Also indicate which revokers are sensitive in the first place. 2002-07-17 David Shaw * keyedit.c (show_key_with_all_names_colon): The 0x40 class bit in a designated revoker means "sensitive", not "local". It's exportable under the right circumstances. * main.h, options.h, export.c (do_export_stream), g10.c (main), hkp.c (hkp_export), keyserver.c (keyserver_spawn: Add a flag to skip attribute packets and their signatures while exporting. This is to accomodate keyservers (pksd again) that choke on attributes. Use keyserver-option "include-attributes" to control it. This defaults to ON (i.e. don't skip). 2002-07-09 David Shaw * options.h, keyserver.c (parse_keyserver_uri, keyserver_spawn, keyserver_work), hkp.c (hkp_ask_import, hkp_export, hkp_search): Use a much more strict reading of RFC-2396 for the keyserver URIs. Specifically, don't try and be smart about checking the value of ":port" so long as it is all digits, and properly handle opaque data (those scheme specific parts that do not start with "//"). 2002-07-04 David Shaw * photoid.c (get_default_photo_command, show_photos): Honor FIXED_PHOTO_VIEWER and DISABLE_PHOTO_VIEWER. * mainproc.c (check_sig_and_print): Use --show-photos to show photos when verifying a sig made by a key with a photo. * keyserver.c (parse_keyserver_uri): Properly parse a URI with no :port section and an empty file path, but with a terminating '/'. (keyserver_work): Honor DISABLE_KEYSERVER_HELPERS. * hkp.c (hkp_ask_import): Display keyserver URI as a URI, but only if verbose. * exec.c, g10.c: USE_EXEC_PATH -> FIXED_EXEC_PATH 2002-07-03 David Shaw * exec.h, exec.c (set_exec_path, exec_write), g10.c (main): If USE_EXEC_PATH is defined at compile time, use it to lock the exec-path and not allow the user to change it. 2002-07-02 David Shaw * options.h, g10.c (main), keyserver.c (keyserver_refresh): Maintain and use the original keyserver URI for cosmetics rather than trying to recreate it when needed. * mainproc.c (check_sig_and_print): Properly disregard expired uids. Make sure that the first uid listed is a real uid and not an attribute (attributes should only be listed in the "aka" section). When there are no valid textual userids, try for an invalid textual userid before using any attribute uid. 2002-07-01 David Shaw * options.skel: Fix a few typos, clarify "group", and remove sample photo viewers for Win32 since they are the defaults now. * parse-packet.c (make_attribute_uidname), keylist.c (dump_attribs): Fix two typecast warnings. * packet.h, build-packet.c (build_attribute_subpkt), exec.c (expand_args), mkdtemp.c (mkdtemp), photoid.c (parse_image_header): Fix some signedness compiler warnings. 2002-07-01 Werner Koch * photoid.c (get_default_photo_command): Also use __MINGW32__ instead of HAVE_DOSISH_SYSTEM. * encode.c (encode_symmetric): Do not use the new encryption code. 2002-06-30 Werner Koch * photoid.c: Use __MINGW32__ to include windows because HAVE_DOSISH_SYSTEM is also set for OS/2 and plain DOS. Provide constant missing in older mingw installations. 2002-06-21 Stefan Bellon * g10.c [__riscos__]: Moved RISC OS specific stuff to util/riscos.c and include/util.h. * gpgv.c [__riscos__]: Likewise. 2002-06-20 David Shaw * keydb.h, pkclist.c (select_algo_from_prefs): Allow passing a suggested algorithm which will be used if available. * encode.c (encode_crypt, encrypt_filter), sign.c (sign_file): Use new select_algo_from_prefs feature to check if forcing an algorithm would violate the recipient preferences. * photoid.c (get_default_photo_command, show_photos): Use different default viewers on different platforms. Currently we have Win 9x, Win NT (2k, xp), Mac OSX, RISC OS, and "everybody else". These are #ifdefs as much as possible to avoid clutter. * g10.c (strusage, build_list), keyedit.c (show_prefs), main.h, misc.c (compress_algo_to_string, check_compress_algo), pkclist.c (algo_available), keygen.c (keygen_set_std_prefs): New algo_to_string and check functions for compress algorithms. 2002-06-20 Werner Koch * misc.c (setsysinfo): Removed a #warning for Alpha's uniligedn trap disabling - it is quite possible that this is a debug relict. 2002-06-20 Stefan Bellon * g10.c [__riscos__]: Added image file system feature. * gpgv.c [__riscos__]: Added image file system feature. * photoid.c (show_photos) [__riscos__]: Set RISC OS filetype of photo id according to MIME type. 2002-06-19 David Shaw * hkp.c (parse_hkp_index): Don't leak memory when failing out of a bad HKP keyserver. * g10.c (add_notation_data): Relax slightly the rules as to what can go into a notation name - 2440 allows "@", for example. 2002-06-17 David Shaw * import.c (clean_subkeys, import_one): Only allow at most 1 binding sig and at most 1 revocation sig on a subkey, as per 2440:11.1. * hkp.c (parse_hkp_index, hkp_search): Error if the keyserver returns an unparseable HKP response. 2002-06-15 David Shaw * keyedit.c (show_key_with_all_names), keylist.c (list_keyblock_print): Show "[expired]" before expired uids. * keyedit.c (show_key_with_all_names_colon), mainproc.c (list_node), keylist.c (list_keyblock_colon): Show flag 'e' for expired user ids. Use "uat" for user attribute packets instead of "uid". Also use ' ' rather than the fake user id string on attributes. * keygen.c (keygen_add_revkey): Remove unused code. * misc.c (check_permissions): Check directory permissions properly - they are not special files. * pkclist.c (expand_id, expand_group, build_pk_list): When expanding groups before building a pk list, inherit flags from the original pre-expanded string. * pubkey-enc.c (is_algo_in_prefs): Don't use prefs from expired uids. 2002-06-14 David Shaw * free-packet.c (copy_signature): Properly copy a signature that carries a revocation key on it. * pkclist.c (expand_id, expand_group, build_pk_list): Groups now work properly when used in the "Enter the user ID" prompt. 2002-06-14 David Shaw * keyedit.c (show_key_with_all_names): Display warning if a user tries to show prefs on a v3 key with a v3 selfsig. * kbnode.c (dump_kbnode): Show if a uid is expired. * import.c (merge_blocks, import_revoke_cert): Show user ID receiving a revocation certificate. * free-packet.c (cmp_user_ids): Properly compare attribute ids. * pkclist.c (expand_groups): Maintain the strlist flags while expanding. Members of an expansion inherit their flags from the expansion key. * options.h, cipher.c (write_header), g10.c (main), keygen.c (keygen_set_std_prefs): remove the personal_mdc flag. It no longer serves a purpose now that the personal preference lists are split into cipher/digest/zip. 2002-06-14 Timo Schulz * skclist.c (is_insecure): Implemented. 2002-06-12 David Shaw * keyserver.c (keyserver_spawn): Properly handle PROGRAM responses when they have a CRLF ending. Noted by Keith Ray. * keyserver.c (keyserver_spawn): Handle CRLF endings from keyserver helpers. Also don't leak the last line worth of memory from the keyserver response. * main.h, misc.c (deprecated_warning): New function to warn about deprecated options and commands. * g10.c (main), keyserver-internal.h, keyserver.c (parse_keyserver_uri): Use new deprecated function to warn about honor-http-proxy, auto-key-retrieve, and x-broken-hkp. 2002-06-11 David Shaw * Makefile.am: link gpg with NETLIBS for the built-in HKP access. 2002-06-10 David Shaw * options.h, keyserver.c (keyserver_opts), g10.c (main): New keyserver option "include-subkeys". This feature already existed, but now can be turned off. It defaults to on. * options.h, keyserver.c (parse_keyserver_options, keyserver_spawn): There are now enough options to justify making a structure for the keyserver options rather than a page of if-then-else-if-then-etc. * getkey.c (merge_keys_and_selfsig, merge_selfsigs_main): Fix bug in calculating key expiration dates. 2002-06-09 David Shaw * keydb.h, getkey.c (get_user_id_native), import.c (import_one): Display user ID while importing a key. Note this applies to both --import and keyserver --recv-keys. * exec.c (exec_finish): Log unnatural exit (core dump, killed manually, etc) for fork/exec/pipe child processes. 2002-06-08 Timo Schulz * encode.c (encode_symmetric): Disable the compat flag when the expert mode is enabled. 2002-06-07 David Shaw * options.skel, options.h, main.h, keydb.h, pkclist.c (build_pk_list, expand_groups), g10.c (main, add_group): Add new "group" command to allow one name to expand into multiple keys. For simplicity, and to avoid potential loops, we only expand once - you can't make an alias that points to an alias. * main.h, g10.c (main), keygen.c (build_personal_digest_list): Simplify the default digest list - there is really no need for the other hashes since they will never be used after SHA-1 in the list. * options.skel, options.h, g10.c (main), hkp.c (hkp_ask_import, hkp_export, hkp_search), keyserver.c (parse_keyserver_options, parse_keyserver_uri, keyserver_work, keyserver_refresh): Make the "x-broken-hkp" keyserver scheme into keyserver-option "broken-http-proxy". Move honor_http_proxy into keyserver_options. Canonicalize the three variations of "hkp", "x-hkp", and "x-broken-hkp" into "hkp". 2002-06-07 Stefan Bellon * g10.c [__riscos__]: Added --attribute-file to do the same as --attribute-fd, but with a filename not a fd as argument. Added magic symbol for RISC OS to use different memory management. * gpgv.c [__riscos__]: Added magic symbol for RISC OS to use different memory management. 2002-06-06 David Shaw * main.h, g10.c (main), keygen.c (build_personal_digest_list): Put in a default digest preference list consisting of SHA-1, followed by every other installed digest except MD5. Note this is the same as having no digest preference at all except for SHA-1 being favored. * options.h, g10.c (main), keygen.c (keygen_set_std_prefs), pkclist.c (select_algo_from_prefs): Split --personal-preference-list into three: --personal-{cipher|digest|compress}-preferences. This allows a user to set one without affecting another (i.e. setting only a digest pref doesn't imply an empty cipher pref). * exec.c (exec_read): This is a safer way of guessing the return value of system(). Noted by Stefan Bellon. 2002-06-05 David Shaw * hkp.c (parse_hkp_index): Be more robust with keyservers returning very unparseable responses. * exec.c (exec_read): Catch and display an error when the remote process exits unnaturally (i.e. segfault) so the user knows what happened. Also fix exec_write stub which has a different number of arguments now. 2002-06-05 Timo Schulz * encode.c (encode_simple): Ignore the new mode for RFC1991. * mainproc.c (symkey_decrypt_sesskey): Better check for weird keysizes. 2002-06-05 Timo Schulz * encode.c (encode_sesskey): New. (encode_simple): Use it here. But by default we use the compat mode which supress to generate encrypted session keys. 2002-06-05 Timo Schulz * mainproc.c (symkey_decrypt_sesskey): New. (proc_symkey_enc): Support for encrypted session keys. 2002-06-04 David Shaw * sign.c (hash_for, sign_file): When encrypting and signing at the same time, consult the various hash prefs to pick a hash algorithm to use. Pass in a 160-bit hint if any of the signing keys are DSA. * keydb.h, pkclist.c (select_algo_from_prefs, algo_available): Pass a "hints" opaque pointer in to let the caller give hints as to what algorithms would be acceptable. The only current hint is for PREFTYPE_HASH to require a 160-bit hash for DSA. Change all callers in encode.c (encode_crypt, encrypt_filter) and sign.c (sign_file). If we settle on MD5 as the best algorithm based solely on recepient keys and SHA1 is also a possibility, use SHA1 unless the user intentionally chose MD5. This is as per 2440:13. * exec.c (make_tempdir): Fix duplicated filename problem. 2002-06-03 David Shaw * packet.h, parse-packet.c (enum_sig_subpkt): Report back from enum_sig_subpkt when a subpacket is critical and change all callers in keylist.c (show_policy_url, show_notation), mainproc.c (print_notation_data), and pkclist.c (do_show_revocation_reason). * keylist.c (show_policy_url, show_notation): Display if the policy or notation is critical. 2002-06-03 David Shaw * main.h, g10.c (main), keylist.c (dump_attribs, set_attrib_fd, list_keyblock_print, list_keyblock_colon), status.h, status.c (get_status_string): New --attribute-fd feature to dump the contents of attribute subpackets for frontends. If --status-fd is also used, then a new status tag ATTRIBUTE is provided for each subpacket. * packet.h, getkey.c (fixup_uidnode, merge_selfsigs_main, merge_selfsigs_subkey), parse-packet.c (setup_user_id): Keep track of the expiration time of a user ID, and while we're at it, use the expired flag from the selfsig rather than reparsing the SIG_EXPIRE subpacket. * photoid.c (generate_photo_id): When adding a new photo ID, showing the photo for confirmation is not safe when noninteractive since the "user" may not be able to dismiss a viewer window. Noted by Timo Schulz. 2002-06-03 David Shaw * options.skel: Sample photo viewers for Win32. * misc.c (pct_expando): Use the seckey for %k/%K if the pubkey is not available. * photoid.h, photoid.c (show_photos): Include the seckey in case a user tries to view a photo on a secret key, and change all callers in keyedit.c (menu_showphoto), keylist.c (list_keyblock_print), and photoid.c (generate_photo_id). 2002-06-02 David Shaw * photoid.c (show_photos): Work properly when not called with a public key. 2002-05-31 David Shaw * sign.c (mk_notation_and_policy): Free unneeded buffer. * hkp.c (parse_hkp_index): Properly handle the '&' character (i.e. "&") in HKP responses. * getkey.c (merge_selfsigs_main): Fix reversed expiration time check with self-sigs. * keyedit.c (sign_uids): When making a new self-sig on a v3 key, make a v3 self-sig unless it is currently a v3 self-sig being promoted to v4. 2002-05-31 Timo Schulz * pkclist.c (do_show_revocation_reason): Don't use capital letters for non-interactive output. (show_revocation_reason): Now it is global. * pubkey-enc.c (get_it): Show if the key has been revoked. 2002-05-30 David Shaw * sign.c (write_signature_packets, sign_file, clearsign_file, sign_symencrypt_file): Make a v4 signature if a policy URL or notation is set, unless v3 sigs are forced via rfc1991 or force-v3-sigs. Also remove some doubled code and clarify an error message (we don't sign in PGP2 mode - just detach-sign). * parse-packet.c (parse_one_sig_subpkt): Add KS_FLAGS to the "any size" section. 2002-05-29 David Shaw * keygen.c (keygen_set_std_prefs, add_feature_mdc): Use "mdc" and "no-mdc" in the prefs string to allow switching on and off the MDC feature. This is needed to properly export a key from GnuPG for use on PGP which does not support MDC - without this, MDC-capable implementations will still try and generate MDCs which will break PGP. * keygen.c (keygen_get_std_prefs): Show "[mdc]" in prefs string if it is enabled. * options.h, g10.c (main), cipher.c (write_header), keygen.c (keygen_set_std_prefs): For consistency, allow the user to specify mdc/no-mdc in the --personal-preference-list. If disabled, it acts just like --disable-mdc. 2002-05-29 David Shaw * options.h, exec.c: Add some debugging info, using the 1024 debug flag. * exec.c (win_system): New system()-like function for win32 that does not return until the child process terminates. Of course, this doesn't help if the process itself exits before it is finished. 2002-05-29 Werner Koch * encode.c (encode_simple): Intialize PKT when --no-literal is used. * keyedit.c (show_key_with_all_names_colon): Renamed the record for revocation keys to "rvk". 2002-05-27 Werner Koch * keyedit.c (show_key_with_all_names_colon): New. (show_key_with_all_names): Divert to new function when required. Sanitize printing of revoker name. 2002-05-27 David Shaw * build-packet.c (build_sig_subpkt): Handle setting sig flags for certain subpacket types (notation, policy url, exportable, revocable). keyedit.c (sign_mk_attrib): Flags no longer need to be set here. * packet.h, parse-packet.c (parse_one_sig_subpkt), build-packet.c (build_sig_subpkt): Call parse_one_sig_subpkt to sanity check buffer lengths before building a sig subpacket. 2002-05-26 David Shaw * sign.c (mk_notation_and_policy): Include secret key to enable %s expandos, and pass notations through pct_expando as well. * main.h, misc.c (pct_expando): Add %s and %S expandos for signer's keyid. 2002-05-25 David Shaw * g10.c (strusage, build_list): Add compress algorithms to --version list. Show algorithm numbers when --verbose --version is done. 2002-05-22 David Shaw * options.h, main.h, keygen.c (keygen_set_set_prefs, keygen_get_std_prefs, keygen_upd_std_prefs), keyedit.c (keyedit_menu), g10.c (main), pkclist.c (select_algo_from_prefs): Add --personal-preference-list which allows the user to factor in their own preferred algorithms when the preference lists are consulted. Obviously, this does not let the user violate a recepient's preferences (and the RFC) - this only influences the ranking of the agreed-on (and available) algorithms from the recepients. Suggested by David Hollenberg. * options.h, keygen.c (keygen_set_std_prefs), g10.c (main): Rename --preference-list to --default-preference-list (as that is what it really is), and make it a true default in that if the user selects "default" they get this list and not the compiled-in list. 2002-05-22 Werner Koch * g10.c (main): Add missing LF in a info printout and made it translatable. Noted by Michael Tokarev. 2002-05-21 Werner Koch * g10.c (main): Removed the undef of USE_SHM_COPROCESSING which was erroneously introduced on 2002-01-09. * signal.c (got_fatal_signal): Don't write the Nul to stderr. Reported by David Hollenberg. 2002-05-18 David Shaw * main.h, g10.c (main), revoke.c (gen_desig_revoke): Generate a designated revocation via --desig-revoke * keyedit.c (keyedit_menu, menu_addrevoker): New "addrevoker" command to add a designated revoker to a key. 2002-05-17 David Shaw * gpgv.c: Add stub for get_ownertrust(). * g10.c (main): --allow-freeform-uid should be implied by OpenPGP. Add --no-allow-freeform-uid. * keyedit.c (sign_uids): Issue a warning when signing a non-selfsigned uid. * getkey.c (merge_selfsigs_main): If a key has no selfsigs, and allow-non-selfsigned-uid is not set, still try and make the key valid by checking all uids for a signature from an ultimately trusted key. 2002-05-16 David Shaw * main.h, keygen.c (keygen_add_revkey): Add revocation key subpackets to a signature (callable by make_keysig_packet). (write_direct_sig): Write a 1F direct key signature. (parse_revocation_key): Parse a string in algo:fpr:sensitive format into a revocation key. (get_parameter_revkey, do_generate_keypair): Call above functions when prompted from a batch key generation file. * build-packet.c (build_sig_subpkt): Allow multiple revocation key subpackets in a single sig. * keydb.h, getkey.c (get_seckey_byfprint): Same as get_pubkey_byfprint, except for secret keys. We only know the fingerprint of a revocation key, so this is needed to retrieve the secret key needed to issue a revokation. * packet.h, parse-packet.c (parse_signature, parse_revkeys): Split revkey parsing off into a new function that can be used to reparse after manipulating the revkey list. * sign.c (make_keysig_packet): Ability to make 1F direct key signatures. 2002-05-15 David Shaw * options.skel: keyserver.pgp.com is gone, so list pgp.surfnet.nl as a sample LDAP server instead. * getkey.c (merge_selfsigs_main): Properly handle multiple revocation keys in a single packet. Properly handle revocation keys that are in out-of-order packets. Remove duplicates in revocation key list. 2002-05-14 Timo Schulz * exec.c (make_tempdir) [MINGW32]: Added missing '\'. 2002-05-14 Stefan Bellon * exec.c (make_tempdir): Make use of EXTSEP_S instead of hardcoded dot as extension separator. 2002-05-13 David Shaw * photoid.c (show_photos): Use the long keyid as the filename for the photo. Use the short keyid as the filename on 8.3 systems. * exec.h, exec.c (make_tempdir, exec_write, exec_finish): Allow caller to specify filename. This should make things easier on windows and macs where the file extension is required, but a whole filename is even better. * keyedit.c (show_key_with_all_names, show_prefs): Show proper prefs for a v4 key uid with no selfsig at all. * misc.c (check_permissions): Don't check permissions on non-normal files (pipes, character devices, etc.) 2002-05-11 Werner Koch * mainproc.c (proc_symkey_enc): Avoid segv in case the parser encountered an invalid packet. * keyserver.c (keyserver_export): Get confirmation before sending all keys. 2002-05-10 Stefan Bellon * g10.c, hkp.c, keyedit.c, keyserver.c: Replaced all occurrances of strcasecmp with ascii_strcasecmp and all occurrances of strncasecmp with ascii_memcasecmp. 2002-05-10 David Shaw * packet.h, getkey.c (fixup_uidnode), keyedit.c (show_prefs): Show assumed prefs for hash and compression as well as the cipher pref. Show assumed prefs if there are no prefs at all on a v4 self-signed key. * options.h, g10.c (main), sign.c (make_keysig_packet): New --cert-digest-algo function to override the default key signing hash algorithm. 2002-05-09 David Shaw * getkey.c (merge_selfsigs_main): Make sure the revocation key list starts clean as this function may be called more than once (e.g. from functions in --edit). * g10.c, encode.c (encode_crypt), sign.c (sign_file, sign_symencrypt_file): Make --compress-algo work like the documentation says. It should be like --cipher-algo and --digest-algo in that it can override the preferences calculation and impose the setting the user wants. No --compress-algo setting allows the usual preferences calculation to take place. * main.h, compress.c (compress_filter): use new DEFAULT_COMPRESS_ALGO define, and add a sanity check for compress algo value. 2002-05-08 David Shaw * pkclist.c (select_algo_from_prefs): There is an assumed compression preference for uncompressed data. 2002-05-07 David Shaw * options.h, g10.c (main), getkey.c (finish_lookup), pkclist.c (algo_available): --pgp7, identical to --pgp6 except that it permits a few algorithms that PGP 7 added: AES128, AES192, AES256, and TWOFISH. Any more of these --pgpX flags, and it'll be time to start looking at a generic --emulate-pgp X option. * export.c (do_export_stream): Warn the user when exporting a secret key if it or any of its secret subkeys are protected with SHA1 while simple_sk_checksum is set. * parse-packet.c (parse_key): Show when the SHA1 protection is used in --list-packets. * options.h, build-packet.c (do_comment), g10.c (main): Rename --no-comment as --sk-comments/--no-sk-comments (--no-comment still works) and make the default be --no-sk-comments. 2002-05-07 Werner Koch * keygen.c (get_parameter_algo): Never allow generation of the deprecated RSA-E or RSA-S flavors of PGP RSA. (ask_algo): Allow generation of RSA sign and encrypt in expert mode. Don't allow ElGamal S+E unless in expert mode. * helptext.c: Added entry keygen.algo.rsa_se. 2002-05-07 David Shaw * keyedit.c (sign_uids): If --expert is set, allow re-signing a uid to promote a v3 self-sig to a v4 one. This essentially deletes the old v3 self-sig and replaces it with a v4 one. * packet.h, parse-packet.c (parse_key), getkey.c (merge_keys_and_selfsig, merge_selfsigs_main): a v3 key with a v4 self-sig must never let the v4 self-sig express a key expiration time that extends beyond the original v3 expiration time. 2002-05-06 David Shaw * keyedit.c (sign_uids): When making a self-signature via "sign" don't ask about sig level or expiration, and include the usual preferences and such for v4 self-sigs. (menu_set_preferences): Convert uids from UTF8 to native before printing. * keyedit.c (sign_uids): Convert uids from UTF8 to native before printing. (menu_set_primary_uid): Show error if the user tries to make a uid with a v3 self-sig primary. 2002-05-05 David Shaw * import.c (import_one): When merging with a key we already have, don't let a key conflict (same keyid but different key) stop the import: just skip the bad key and continue. * exec.c (make_tempdir): Under Win32, don't try environment variables for temp directories - GetTempDir tries environment variables internally, and it's better not to second-guess it in case MS adds some sort of temp dir handling to Windows at some point. 2002-05-05 Timo Schulz * mainproc.c (proc_symkey_enc): Don't ask for a passphrase in the list only mode. 2002-05-05 David Shaw * keyserver.c (keyserver_refresh): --refresh-keys implies --merge-only so as not to import keys with keyids that match the ones being refreshed. Noted by Florian Weimer. 2002-05-04 Stefan Bellon * free-packet.c (copy_public_key): Don't call m_alloc(0), therefore added consistency check for revkey and numrefkeys. * getkey.c (check_revocation_keys): Added consistency check for revkey and numrefkeys. * keyedit.c (show_key_with_all_names): Likewise. 2002-05-03 David Shaw * photoid.c: Provide default image viewer for Win32. * misc.c (pct_expando): %t means extension, not name ("jpg", not "jpeg"). * keyserver.c (keyserver_spawn), photoid.c (show_photos), exec.h, exec.c: Allow the caller to determine the temp file extension when starting an exec_write and change all callers. * keyedit.c (sign_uids): Nonrevocable key signatures cause an automatic promotion to v4. * exec.c: Provide stubs for exec_ functions when NO_EXEC is defined. 2002-05-02 David Shaw * photoid.h, photoid.c (parse_image_header, image_type_to_string): Useful functions to return data about an image. * packet.h, parse-packet.c (make_attribute_uidname, parse_attribute_subpkts, parse_attribute), photoid.h, photoid.c (show_photos): Handle multiple images in a single attribute packet. * main.h, misc.c (pct_expando), sign.c (mk_notation_and_policy), photoid.c (show_photos): Simpler expando code that does not require using compile-time string sizes. Call image_type_to_string to get image strings (i.e. "jpg", "image/jpeg"). Change all callers. * keyedit.c (menu_showphoto), keylist.c (list_keyblock_print): Allow viewing multiple images within a single attribute packet. * gpgv.c: Various stubs for link happiness. 2002-05-02 David Shaw * build-packet.c (build_sig_subpkt), keyedit.c (sign_uids), options.h, sign.c (mk_notation_and_policy), g10.c (main, add_notation_data, add_policy_url (new), check_policy_url (removed)): Allow multiple policy URLs on a given signature. Split "--notation-data" into "--cert-notation" and "--sig-notation" so the user can set different policies for key and data signing. For backwards compatibility, "--notation-data" sets both, as before. 2002-05-02 Werner Koch * options.skel: Removed the comment on trusted-keys because this option is now deprecated. 2002-05-01 David Shaw * keyedit.c (menu_adduid): 2440bis04 says that multiple attribute packets on a given key are legal. * keyserver.c (keyserver_refresh): the fake v3 keyid hack applies to "mailto" URLs as well since they are also served by pksd. 2002-04-29 Werner Koch Added a copyright year for files changed this year. 2002-04-25 Werner Koch * g10.c, options.h: New options --display, --ttyname, --ttytype, --lc-ctype, --lc-messages to be used with future versions of the gpg-agent. * passphrase.c (agent_send_option,agent_send_all_options): New. (agent_open): Send options to the agent. * trustdb.c (update_ownertrust, clear_ownertrust): Do an explicit do_sync because revalidation_mark does it only if when the timestamp actually changes. 2002-04-23 David Shaw * main.h, keygen.c (do_generate_keypair), keylist.c (print_signature_stats, list_all, list_one, list_keyblock, list_keyblock_print, list_keyblock_colon): After generating a new key, show the key information (name, keyid, fingerprint, etc.) Also do not print uncheckable signatures (missing key..) in --check-sigs. Print statistics (N missing keys, etc.) after --check-sigs. * keyedit.c (sign_uids): When signing a key with an expiration date on it, the "Do you want your signature to expire at the same time?" question should default to YES. 2002-04-22 David Shaw * parse-packet.c (parse_plaintext), packet.h, plaintext.c (handle_plaintext): Fix bug in handling literal packets with zero-length data (no data was being confused with partial body length). * misc.c (pct_expando), options.skel: %t means extension ("jpg"). %T means MIME type ("image/jpeg"). * import.c (import_one): Only trigger trust update if the keyring is actually changed. * export.c (do_export_stream): Missing a m_free. 2002-04-22 Stefan Bellon * keyid.c (expirestr_from_sk, expirestr_from_sig): Added _() to string constant. * exec.c (make_tempdir) [__riscos__]: Better placement of temporary file. 2002-04-20 David Shaw * keygen.c (generate_subkeypair): 2440bis04 adds that creating subkeys on v3 keys is a MUST NOT. * getkey.c (finish_lookup): The --pgp6 "use the primary key" behavior should only apply while data signing and not encryption. Noted by Roger Sondermann. 2002-04-19 Werner Koch * keygen.c (keygen_set_std_prefs): Put back 3DES because the RFC says it is good form to do so. 2002-04-19 David Shaw * keyedit.c (menu_deluid): Only cause a trust update if we delete a non-revoked user id. * hkp.c (hkp_ask_import), keyserver.c (parse_keyserver_options, keyserver_spawn), options.h: Remove fast-import keyserver option (no longer meaningful). * g10.c (main), keyedit.c (sign_uids), options.h: Change --default-check-level to --default-cert-check-level as it makes clear what it operates on. * g10.c (main): --pgp6 also implies --no-ask-sig-expire. * delkey.c (do_delete_key): Comment. * keyedit.c (sign_uids, keyedit_menu, menu_deluid, menu_delsig, menu_expire, menu_revsig, menu_revkey): Only force a trustdb check if we did something that changes it. * g10.c: add "--auto-check-trustdb" to override a "--no-auto-check-trustdb" 2002-04-19 Werner Koch * tdbio.c (tdbio_write_nextcheck): Return a status whether the stamp was actually changed. * trustdb.c (revalidation_mark): Sync the changes. Removed the sync operation done by its callers. (get_validity): Add logic for maintaining a pending_check flag. (clear_ownertrust): New. * keyedit.c (sign_uids): Don't call revalidation_mark depending on primary_pk. (keyedit_menu): Call revalidation_mark after "trust". (show_key_with_all_names): Print a warning on the wrong listed key validity. * delkey.c (do_delete_key): Clear the owenertrust information when deleting a public key. 2002-04-18 Werner Koch * seskey.c (encode_md_value): Print an error message if a wrong digest algorithm is used with DSA. Changed all callers to cope with a NULL return. Problem noted by Imad R. Faiad. 2002-04-18 David Shaw * trustdb.c (mark_usable_uid_certs): Properly handle nonrevocable signatures that can expire. In short, the only thing that can override an unexpired nonrevocable signature is another unexpired nonrevocable signature. * getkey.c (finish_lookup): Always use primary signing key for signatures when --pgp6 is on since pgp6 and 7 do not understand signatures made by signing subkeys. 2002-04-18 Werner Koch * trustdb.c (validate_keys): Never schedule a nextcheck into the past. (validate_key_list): New arg curtime use it to set next_expire. (validate_one_keyblock): Take the current time from the caller. (clear_validity, reset_unconnected_keys): New. (validate_keys): Reset all unconnected keys. * getkey.c (premerge_public_with_secret): Fixed 0x12345678! syntax for use with secret keys. (lookup): Advance the searchmode after a search FIRST. * seckey-cert.c (do_check): Always calculate the old checksum for use after unprotection. * g10.c, options.skel: New option --no-escape-from. Made --escape-from and --force-v3-sigs the default and removed them from the options skeleton. 2002-04-16 Werner Koch * parse-packet.c (parse_key): Support a SHA1 checksum as per draft-rfc2440-bis04. * packet.h (PKT_secret_key): Add field sha1chk. * seckey-cert.c (do_check): Check the SHA1 checksum (protect_secret_key): And create it. * build-packet.c (do_secret_key): Mark it as sha-1 protected. * g10.c, options.h: New option --simple-sk-checksum. 2002-04-13 David Shaw * parse-packet.c (parse_signature): Minor fix - signatures should expire at their expiration time and not one second later. * keygen.c (proc_parameter_file): Allow specifying preferences string (i.e. "s5 s2 z1 z2", etc) in a batchmode key generation file. * keyedit.c (keyedit_menu): Print standard error message when signing a revoked key (no new translation). * getkey.c (merge_selfsigs): Get the default set of key prefs from the real (not attribute) primary uid. 2002-04-12 David Shaw * pkclist.c (build_pk_list): Fix bug that allowed a key to be selected twice in batch mode if one instance was the default recipient and the other was an encrypt-to. Noted by Stefan Bellon. * parse-packet.c (dump_sig_subpkt): Show data in trust and regexp sig subpackets. * keyedit.c (keyedit_menu): Use new function real_uids_left to prevent deleting the last real (i.e. non-attribute) uid. Again, according to the attribute draft. (menu_showphoto): Make another string translatable. 2002-04-11 David Shaw * build-packet.c (build_sig_subpkt): Delete subpackets from both hashed and unhashed area on update. (find_subpkt): No longer needed. * keyedit.c (sign_uids): With --pgp2 on, refuse to sign a v3 key with a v4 signature. As usual, --expert overrides. Try to tweak some strings to a closer match so they can all be translated in one place. Use different helptext keys to allow different help text for different questions. * keygen.c (keygen_upd_std_prefs): Remove preferences from both hashed and unhashed areas if they are not going to be used. 2002-04-10 David Shaw * misc.c (pct_expando), options.skel: Use %t to indicate type of a photo ID (in this version, it's always "jpeg"). Also tweak string expansion loop to minimize reallocs. * mainproc.c (do_check_sig): Variable type fix. * keyedit.c (menu_set_primary_uid): Differentiate between true user IDs and attribute user IDs when making one of them primary. That is, if we are making a user ID primary, we alter user IDs. If we are making an attribute packet primary, we alter attribute packets. This matches the language in the latest attribute packet draft. * keyedit.c (sign_uids): No need for the empty string hack. * getkey.c (fixup_uidnode): Only accept preferences from the hashed segment of the self-sig. 2002-04-10 Werner Koch * tdbio.c (migrate_from_v2): Fixed the offset to read the old ownertrust value and only add entries to the table if we really have a value. 2002-04-08 David Shaw * status.h, status.c (get_status_string): Add KEYEXPIRED, EXPSIG, and EXPKEYSIG. Add "deprecated-use-keyexpired-instead" to SIGEXPIRED. * sig-check.c (do_check): Start transition from SIGEXPIRED to KEYEXPIRED, since the actual event is signature verification by an expired key and not an expired signature. (do_signature_check, packet.h): Rename as signature_check2, make public, and change all callers. * mainproc.c (check_sig_and_print, do_check_sig): Use status EXPSIG for an expired, but good, signature. Add the expiration time (or 0) to the VALIDSIG status line. Use status KEYEXPSIG for a good signature from an expired key. * g10.c (main): remove checks for no arguments now that argparse does it. 2002-04-06 Werner Koch * keyring.c (keyring_get_keyblock): Disable the keylist mode here. * encode.c (encode_simple, encode_crypt): Only test on compressed files if a compress level was not explicity set. * keygen.c (keygen_set_std_prefs): Removed Blowfish and Twofish from the list of default preferences, swapped the preferences of RMD160 and SHA1. Don't include a preference to 3DES unless the IDEA kludge gets used. * free-packet.c (free_packet): call free_encrypted also for PKT_ENCRYPTED_MDC. * compress.c (release_context): New. (handle_compressed): Allocate the context and setup a closure to release the context. This is required because there is no guarantee that the filter gets popped from the chain at the end of the function. Problem noted by Timo and probably also the cause for a couple of other reports. (compress_filter): Use the release function if set. * tdbio.c [__CYGWIN32__]: Don't rename ftruncate. Noted by Disastry. * parse-packet.c (parse_signature): Put parens around a bit test. * exec.c (make_tempdir): Double backslash for TMP directory creation under Windows. Better strlen the DIRSEP_S constants for allocation measurements. * decrypt.c (decrypt_messages): Release the passphrase aquired by get_last_passphrase. 2002-04-02 Werner Koch * Makefile.am (EXTRA_DIST): Removed OPTIONS an pubring.asc - they are no longer of any use. 2002-04-03 David Shaw * keyserver.c (parse_keyserver_options): fix auto-key-retrieve to actually work as a keyserver-option (noted by Roger Sondermann). * keylist.c (reorder_keyblock): do not reorder the primary attribute packet - the first user ID must be a genuine one. 2002-03-31 David Shaw * keylist.c (list_keyblock_colon): Fix ownertrust display with --with-colons. * keygen.c (generate_user_id), photoid.c (generate_photo_id): Properly initialize the user ID refcount. A few more "y/n" -> "y/N" in photoid.c. * keyedit.c (ask_revoke_sig): Warn the user if they are about to revoke an expired sig (not a problem, but they should know). Also tweak a few prompts to change "y/n" to "y/N", which is how most other prompts are written. * keyserver.c (keyserver_search_prompt): Control-d escapes the keyserver search prompt. * pkclist.c (show_revocation_reason & callers): If a subkey is considered revoked solely because the parent key is revoked, print the revocation reason from the parent key. * trustdb.c (get_validity): Allow revocation/expiration to apply to a uid/key with no entry in the trustdb. 2002-03-29 David Shaw * keyserver.c (printunquoted): unquote backslashes from keyserver searches * hkp.c (write_quoted): quote backslashes from keyserver searches 2002-03-26 Werner Koch * keygen.c (ask_keysize): Removed the warning for key sizes > 1536. 2002-03-25 Werner Koch * keyedit.c (sign_uids): Use 2 strings and not a %s so that translations can be done the right way. * helptext.c: Fixed small typo. 2002-03-23 David Shaw * import.c (append_uid, merge_sigs): it is okay to import completely non-signed uids now (with --allow-non-selfsigned-uid). * getkey.c (get_primary_uid, merge_selfsigs_main): do not choose an attribute packet (i.e. photo) as primary uid. This prevents oddities like "Good signature from [image of size 2671]". This is still not perfect (one can still select an attribute packet as primary in --edit), but is closer to the way the draft is going. * g10.c (build_list): algorithms should include 110. * g10.c (main): --pgp2 implies --no-ask-sig-expire and --no-ask-cert-expire as those would cause a v4 sig/cert. * armor.c (is_armor_header): be more lenient in what constitutes a valid armor header (i.e. -----BEGIN blah blah-----) as some Windows programs seem to add spaces at the end. --openpgp makes it strict again. 2002-03-18 David Shaw * keyserver.c (keyserver_search_prompt): Properly handle a "no keys found" case from the internal HKP code (external HKP is ok). Also, make a COUNT -1 (i.e. streamed) keyserver response a little more efficient. * g10.c (main): Add --no-allow-non-selfsigned-uid 2002-03-17 David Shaw * g10.c (main): --openpgp implies --allow-non-selfsigned-uid. * getkey.c (merge_selfsigs_main): If none of the uids are primary (because none are valid) then pick the first to be primary (but still invalid). This is for cosmetics in case some display needs to print a user ID from a non-selfsigned key. Also use --allow-non-selfsigned-uid to make such a key valid and not --always-trust. The key is *not* automatically trusted via --allow-non-selfsigned-uid. * mainproc.c (check_sig_and_print): Make sure non-selfsigned uids print [uncertain] on verification even though one is primary now. * getkey.c (merge_selfsigs): If the main key is not valid, then neither are the subkeys. * import.c (import_one): Allow --allow-non-selfsigned-uid to work on completely unsigned keys. Print the uids in UTF8. Remove mark_non_selfsigned_uids_valid(). * keyedit.c (show_key_with_all_names): Show revocation key as UTF8. * sign.c (clearsign_file): Allow --not-dash-escaped to work with v3 keys. 2002-03-14 Werner Koch * main.h: Changed the default algorithms to CAST5 and SHA1. 2002-03-13 David Shaw * import.c (chk_self_sigs): Show which user ID a bad self-sig (invald sig or unsupported public key algorithm) resides on. * import.c (chk_self_sigs): any valid self-sig should mark a user ID or subkey as valid - otherwise, an attacker could DoS the user by inventing a bogus invalid self-signature. 2002-03-07 David Shaw * g10.c (main): make a few more strings translatable. * options.h, options.skel, g10.c (main), gpgv.c, mainproc.c (check_sig_and_print), keyserver.c (parse_keyserver_options): --auto-key-retrieve should really be a keyserver-option variable. * import.c (revocation_present): new function to print a warning if a key is imported that has been revoked by designated revoker, but the designated revoker is not present to verify the revocation. If keyserver-options auto-key-retrieve is set, try and fetch the designated revoker from the keyserver. * import.c (import_one): call revocation_present after importing a new key. Note that this applies to --import, --recv-keys, and --search-keys. * keyserver-internal.h, keyserver.c (keyserver_import_fprint): import via fingerprint (for revocation keys). * keyserver.c (keyserver_import_keyid): much simpler implementation now that we're using KEYDB_SEARCH_DESC internally. 2002-03-04 David Shaw * revoke.c (gen_revoke): do not prompt for revocation reason for v3 revocations (unless force-v4-certs is on) since they wouldn't be used anyway. * keyedit.c (menu_revsig): show the status of the sigs (exportable? revocable?) to the user before prompting for which sig to revoke. Also, make sure that local signatures get local revocations. * keyedit.c (ask_revoke_sig): remind the user which sigs are local. * g10.c (main): Add "exec-path" variable to override PATH for execing programs. * export.c (do_export_stream): properly check return code from classify_user_id to catch unclassifiable keys. 2002-03-03 David Shaw * parse-packet.c (parse_signature): variable type tweak for RISC OS (from Stefan) 2002-02-28 David Shaw * getkey.c (check_revocation_keys): New function to check a revocation against a list of potential revocation keys. Note the loop-breaking code here. This is to prevent blowing up if A is B's revocation key, while B is also A's. Note also that this is written so that a revoked revoker can still issue revocations: i.e. If A revokes B, but A is revoked, B is still revoked. I'm not completely convinced this is the proper behavior, but it matches how PGP does it. It does at least have the advantage of much simpler code - my first version of this had lots of loop maintaining code so you could chain revokers many levels deep and if D was revoked, C was not, which meant that B was, and so on. It was sort of scary, actually. * getkey.c (merge_selfsigs_main): Add any revocation keys onto the pk. This is particularly interesting since we normally only get data from the most recent 1F signature, but you need multiple 1F sigs to properly handle revocation keys (PGP does it this way, and a revocation key could be marked "sensitive" and hence in a different signature). Also, if a pk has a revocation key set, check for revocation sigs that were not made by us - if made by a valid revocation key, mark the pk revoked. * packet.h, getkey.c (cache_public_key): do not cache key if "dont_cache" is set. This allows the revocation key code to look up a key and return information that may be inaccurate to prevent loops without caching the fake data. * packet.h, sig-check.c (do_signature_check): Record if a signature was made by a revoked pk. * packet.h, parse-packet.c (parse_one_sig_subpkt, can_handle_critical, parse_signature): Get revocation key information out of direct sigs. * keylist.c (list_keyblock_print): don't assume that the presence of a 0x20 signature means the key is revoked. With revocation keys, this may not be true if the revocation key is not around to verify it or if verification failed. Also, 0x1F should get listed as "sig", and not "unexpected signature class". * keyedit.c (show_key_with_all_names): Add a flag for printing revoker information and change all callers. * import.c (merge_blocks): merge in any new direct key (0x1F) sigs. * import.c (import_revoke_cert): don't keep processing after a revocation is rejected. * import.c (delete_inv_parts): Allow importing a revocation signature even if it was not issued by the key. This allows a revocation key to issue it. Of course, the sig still needs to be checked before we trust it. * free-packet.c (copy_public_key): Include a new copy of the revocation keys when duping a pk. * free-packet.c (free_seckey_enc, release_public_key_parts): Free any revocation keys that are attached to a sig or pk. * export.c (do_export_stream): Do not export signatures with "sensitive" revocation keys in them. 2002-02-27 David Shaw * export.c (do_export_stream): Do not include v3 keys in a --export-secret-subkeys export. * getkey.c (merge_selfsigs_main): If a key isn't valid (say, because of no self-signature), allow --always-trust to force it valid so it can be trusted. 2002-02-25 David Shaw * hkp.c (hkp_ask_import), hkp.h, keyserver.c (all): treat key lists internally as fingerprints when possible. All this is via KEYDB_SEARCH_DESC - no point in reinventing the wheel. This allows the helper program to search the keyserver by fingerprint if desired (and the keyserver supports it). Note that automatic fingerprint promotion during refresh only applies to v4 keys as a v4 fingerprint can be easily changed into a long or short key id, and a v3 cannot. * pubkey-enc.c, getkey.c, misc.c, main.h: Take two copies of hextobyte() from pubkey-enc.c and getkey.c and make them into one copy in misc.c. 2002-02-22 David Shaw * keyserver.c (keyserver_search_prompt): Detect a "no keys found" case even if the helper program does not explicitly say how many keys were found. * hkp.c (parse_hkp_index): Bug fix - don't report non-revoked keys as revoked in HKP key searches. 2002-02-19 Werner Koch * parse-packet.c (parse_trust): Made parsing more robust. 2002-02-19 David Shaw * hkp.c (parse_hkp_index): Catch corruption in HKP index lines (can be caused by broken or malicious keyservers). * keyserver.c (keyserver_work): Add KEYSERVER_NOT_SUPPORTED for unsupported actions (say, a keyserver that has no way to search, or a readonly keyserver that has no way to add). Also add a USE_EXTERNAL_HKP define to disable the internal HKP keyserver code. 2002-02-14 Werner Koch * g10.c: New option --no-use-agent. * pkclist.c (check_signatures_trust): Always print the warning for unknown and undefined trust. Removed the did_add cruft. Reported by Janusz A. Urbanowicz. 2002-02-11 David Shaw * hkp.c (parse_hkp_index): Bug fix - properly handle user IDs with colons (":") in them while HKP searching. 2002-02-09 David Shaw * misc.c (pct_expando): More comments. * keydb.h, sign.c (mk_notation_and_policy): Clarify what is a sig and what is a cert. A sig has sigclass 0x00, 0x01, 0x02, or 0x40, and everything else is a cert. * g10.c (main), keyedit.c (keyedit_menu): Add a "nrlsign" for nonrevocable and local key signatures. * g10.c (main): Add a --no-force-mdc to undo --force-mdc. * options.h, g10.c (main), cipher.c (write_header): Add a knob to --disable-mdc/--no-disable-mdc. Off by default, of course, but is used in --pgp2 and --pgp6 modes. * pkclist.c (build_pk_list): Allow specifying multiple users in the "Enter the user ID" loop. Enter a blank line to stop. Show each key+id as it is added. * keylist.c (show_policy_url), mainproc.c (print_notation_data): It is not illegal (though possibly silly) to have multiple policy URLs in a given signature, so print all that are present. * hkp.c (hkp_search): More efficient implementation of URL-ifying code. 2002-02-04 David Shaw * main.h, misc.c (pct_expando): New function to generalize %-expando processing in any arbitrary string. * photoid.c (show_photo): Call the new pct_expando function rather than expand strings internally. * sign.c (mk_notation_and_policy): Show policy URLs and notations when making a signature if show-policy/show-notation is on. %-expand policy URLs during generation. This lets the user have policy URLs of the form "http://notary.jabberwocky.com/keysign/%K" which will generate a per-signature policy URL. * main.h, keylist.c (show_policy_url, show_notation): Add amount to indent so the same function can be used in key listings as well as during sig generation. Change all callers. 2002-02-04 David Shaw * keyserver.c, options.h (parse_keyserver_options, keyidlist): Workaround for the pksd and OKS keyserver bug that calculates v4 RSA keyids as if they were v3. The workaround/hack is to fetch both the v4 (e.g. 99242560) and v3 (e.g. 68FDDBC7) keyids. This only happens for key refresh while using the HKP scheme and the refresh-add-fake-v3-keyids keyserver option must be set. This should stay off by default. 2002-02-03 David Shaw * keyserver.c (keyserver_spawn): Bug fix - do not append keys to each other when --sending more than one. 2002-02-02 David Shaw * options.h, g10.c (main), keyedit.c (sign_uids), sign.c (mk_notation_and_policy): Split "--set-policy-url" into "--cert-policy-url" and "--sig-policy-url" so the user can set different policies for key and data signing. For backwards compatibility, "--set-policy-url" sets both, as before. 2002-01-30 Werner Koch * g10.c (main): --gen-random --armor does now output a base64 encoded string. 2002-01-28 David Shaw * g10.c (main), options.h, pkclist.c (algo_available): --pgp6 flag. This is not nearly as involved as --pgp2. In short, it turns off force_mdc, turns on no_comment, escape_from, and force_v3_sigs, and sets compression to 1. It also restricts the user to IDEA (if present), 3DES, CAST5, MD5, SHA1, and RIPEMD160. See the comments above algo_available() for lots of discussion on why you would want to do this. 2002-01-27 David Shaw * keygen.c (keygen_set_std_prefs): Comment * keyedit.c (sign_uids): Bug fix - when signing with multiple secret keys at the same time, make sure each key gets the sigclass prompt. * exec.c (exec_finish): Close the iobuf and FILE before trying to waitpid, so the remote process will get a SIGPIPE and exit. This is only a factor when using a pipe to communicate. * exec.c (exec_write): Disable cache-on-close of the fd iobuf (is this right? Why is a fd iobuf cached at all?) 2002-01-26 Werner Koch * g10.c, options.h: New option --gpg-agent-info * passphrase.c (agent_open): Let it override the environment info. * seckey-cert.c (check_secret_key): Always try 3 times when the agent is enabled. * options.skel: Describe --use-agent. 2002-01-24 David Shaw * pubkey-enc.c (is_algo_in_prefs, get_it): Only check preferences against keys with v4 self sigs - there is really little point in warning for every single non-IDEA message encrypted to an old key. * pkclist.c (select_algo_from_prefs): Only put in the fake IDEA preference if --pgp2 is on. * mainproc.c (check_sig_and_print): Print "Expired" for expired but good signatures (this still prints "BAD" for expired but bad signatures). 2002-01-23 David Shaw * keygen.c (ask_keysize): Cosmetic: don't present a RSA signing key as a "keypair" which can be 768 bits long (as RSA minimum is 1024). * pubkey-enc.c (is_algo_in_prefs): Allow IDEA as a fake preference for v3 keys with v3 selfsigs. 2002-01-22 David Shaw * packet.h, getkey.c (merge_selfsigs_main), pkclist.c (select_algo_from_prefs): Implement the fake IDEA preference as per RFC2440:12.1. This doesn't mean that IDEA will be used (the plugin may not be present), but it does mean that a v3 key with a v3 selfsig has an implicit IDEA preference instead of 3DES. v3 keys with v4 selfsigs use preferences as normal. * encode.c (encode_crypt): if select_algo_from_prefs fails, this means that we could not find a cipher that both keys like. Since all v4 keys have an implicit 3DES preference, this means there is a v3 key with a v3 selfsig in the list. Use 3DES in this case as it is the safest option (we know the v4 key can handle it, and we'll just hope the v3 key is being used in an implementation that can handle it). If --pgp2 is on, warn the user what we're doing since it'll probably break PGP2 compatibility. * g10.c (main): Do not force using IDEA for encrypted files in --pgp2 mode - let the fake IDEA preference choose this for us for better compatibility when encrypting to multiple keys, only some of which are v3. * keygen.c (keygen_set_std_prefs): Put 3DES on the end of the default cipher pref list (RFC2440: "...it is good form to place it there explicitly."). If the user has the IDEA plugin installed, put a preference for IDEA *after* 3DES to effectively disable its use for everything except encrypting along with v3 keys. * encode.c, g10.c, sign.c: Change the PGP2 warning line from "... will not be usable ..." to "... may not be usable ..." as the user could be using one of the enhanced PGP2 variations. * helptext.c: Revise the sign_uid.class help text as suggested by Stefan. 2002-01-20 Werner Koch * passphrase.c (passphrase_to_dek): Add tryagain_text arg to be used with the agent. Changed all callers. (agent_get_passphrase): Likewise and send it to the agent * seckey-cert.c (do_check): New arg tryagain_text. (check_secret_key): Pass the string to do_check. * keygen.c (ask_passphrase): Set the error text is required. * keyedit.c (change_passphrase): Ditto. * passphrase.c (agent_open): Disable opt.use_agent in case of a problem with the agent. (agent_get_passphrase): Ditto. (passphrase_clear_cache): Ditto. 2002-01-19 Werner Koch * passphrase.c (agent_open): Add support for the new Assuan based gpg-agent. New arg to return the used protocol version. (agent_get_passphrase): Implemented new protocol here. (passphrase_clear_cache): Ditto. (readline): New. 2002-01-15 Timo Schulz * encode.c (encode_crypt_files): Fail if --output is used. * g10.c: New command --decrypt-files. * decrypt.c (decrypt_messages): New. 2002-01-09 David Shaw * g10.c, misc.c, gpgv.c: move idea_cipher_warn to misc.c so gpgv.c doesn't need a stub for it any longer. * g10.c (get_temp_dir), main.h: no longer used (it's in exec.c now) * g10.c (main), delkey.c (delete_keys), main.h : Allow --delete-key (now --delete-keys, though --delete-key still works, of course) to delete multiple keys in one go. This applies to --delete-secret-key(s) and --delete-secret-and-public-key(s) as well. 2002-01-09 Timo Schulz * encode.c (encode_crypt_files): Now it behaves like verify_files. * g10.c (main): We don't need to check argc for encode_crypt_files any longer. 2002-01-09 Timo Schulz * exec.c: Include windows.h for dosish systems. 2002-01-08 Timo Schulz * g10.c (main): New description for --encrypt-files. 2002-01-08 Werner Koch * g10.c (main): Must register the secring for encryption because it is needed to figure out the default recipient. Reported by Roger Sondermann. 2002-01-05 David Shaw * keyedit.c (menu_adduid): Require --expert before adding a photo ID to a v3 key, and before adding a second photo ID to any key. * keyedit.c (keyedit_menu): Don't allow adding photo IDs in rfc1991 or pgp2 mode. * getkey.c (merge_selfsigs_subkey): Permit v3 subkeys. Believe it or not, this is allowed by rfc 2440, and both PGP 6 and PGP 7 work fine with them. * g10.c, options.h, keyedit.c, sign.c: Move the "ask for expiration" switch off of --expert, which was getting quite overloaded, and onto ask-sig-expire and ask-cert-expire. Both default to off. * g10.c (main): Change the default compression algo to 1, to be more OpenPGP compliant (PGP also uses this, so it'll help with interoperability problems as well). * encode.c (encode_crypt): Handle compression algo 2, since the default is now 1. * build-packet.c (build_attribute_subpkt): Fix off-by-one error. 2002-01-05 Werner Koch * g10.c (main): Do not register the secret keyrings for certain commands. * keydb.c (keydb_add_resource): Use access to test for keyring existence. This avoids cached opened files which are bad under RISC OS. 2002-01-04 David Shaw * sign.c (sign_file, sign_symencrypt_file): always use one-pass packets unless rfc1991 is enabled. This allows a signature made with a v3 key to work in PGP 6 and 7. Signatures made with v4 keys are unchanged. * g10.c (main): Disallow non-detached signatures in PGP2 mode. Move the "you must use files and not pipes" PGP2 warning up so all the PGP2 stuff is together. * encode.c (encode_simple): Use the actual filesize instead of partial length packets in the internal literal packet from a symmetric message. This breaks PGP5(?), but fixes PGP2, 6, and 7. It's a decent tradeoff. Note there was only an issue with old-style RFC1991 symmetric messages. 2440-style messages in 6 and 7 work with or without partial length packets. 2002-01-03 David Shaw * g10.c (main): Removed --no-default-check-level option, as it is not consistent with other "default" options. Plus, it is the same as saying --default-check-level 0. * exec.c (exec_read): Disallow caching tempfile from child process, as this keeps the file handle open and can cause unlink problems on some platforms. * keyserver.c (keyserver_search_prompt): Minor tweak - don't bother to transform keyids into textual form if they're just going to be transformed back to numbers. 2002-01-03 Timo Schulz * g10.c: New command --encrypt-files. * verify.c (print_file_status): Removed the static because encode_crypt_files also uses this function. * main.h (print_files_status): New. (encode_crypt_files): New. * encode.c (encode_crypt_files): New. 2002-01-02 Stefan Bellon * keyserver.c: Moved util.h include down in order to avoid redefinition problems on RISC OS. * keyring.c (keyring_lock): Only lock keyrings that are writable. * keyring.c (keyring_update_keyblock): Close unused iobuf. * hkp.c (parse_hkp_index, hkp_search) [__riscos__]: Changed unsigned char* to char* because of compiler issues. * exec.c (exec_finish) [__riscos__]: Invalidate close cache so that file can be unlinked. 2001-12-28 David Shaw * g10.c (main): Use a different strlist to check extensions since they need to be handled seperately now. * misc.c,main.h (check_permissions): Properly handle permission and ownership checks on files in the lib directory (e.g. /usr/local/lib/gnupg), which are owned by root and are world-readable, and change all callers to specify extension or per-user file. * photoid.c (show_photo), keyserver.c (keyserver_spawn): Bug fix - don't call exec_finish if exec_write fails. * keyserver.c (keyserver_spawn): Look for OPTIONS from the keyserver helper - specifically, a "OUTOFBAND" option for the email keyserver. * mainproc.c (list_node), keylist.c (list_keyblock_colon), import.c (delete_inv_parts), export.c (do_export_stream): Use signature flags for exportability check rather than re-parsing the subpacket. * keyid.c, keydb.h (get_lsign_letter): No longer needed. 2001-12-27 David Shaw * exec.c (exec_finish): Show errors when temp files cannot be deleted for whatever reason. * exec.c (exec_read): Don't rely on WEXITSTATUS being present. * exec.c (make_tempdir): Add temp file creator for win32. Don't create an incoming temp file if the exec is write-only. * keyserver.c (keyserver_spawn): Clean up error handling, for when the spawn fails. * photoid.c (show_photo): Clean up error handling. * misc.c (check_permissions): Neaten. 2001-12-25 David Shaw * mkdtemp.c (mkdtemp): Add copyleft info and tweak the 'X' counter to be a bit simpler. * keyserver.c, photoid.c: Remove unused headers left over from when the exec functions lived there. 2001-12-23 Timo Schulz * misc.c (check_permissions): Do not use it for W32 systems. * tdbio.c (migrate_from_v2): Define ftruncate as chsize() for W32. * mkdtemp.c: W32 support. * photoid.c: Ditto. * exec.c: Ditto. 2001-12-22 David Shaw * exec.c (make_tempdir): avoid compiler warning with const * mkdtemp.c (mkdtemp): catch the empty ("") string case in case someone repurposes mkdtemp at some point. * photoid.c (generate_photo_id, show_photo): some type changes from Stefan Bellon. * exec.c (make_tempdir): handle Win32 systems, suggested by Timo Schulz. 2001-12-22 Werner Koch * encode.c (encode_simple, encode_crypt): i18n 2 strings. 2001-12-22 Timo Schulz * encode.c (encode_simple, encode_crypt): Use is_file_compressed to avoid to compress compressed files. 2001-12-22 Werner Koch * keyserver.c (keyserver_spawn): Removed some variables declaration due to shadowing warnings. * build-packet.c (build_attribute_subpkt): s/index/idx/ to avoid compiler warnig due to index(3). * getkey.c (get_ctx_handle): Use KEYDB_HANDLE as return value. * keylist.c (list_one): Made resname const. * keyedit.c (keyedit_menu): Allow "addphoto" only when --openpgp is not used. * options.skel: Changed one example photo viewer to qiv. 2001-12-21 David Shaw * Makefile.am: add exec.c, exec.h, photoid.c, and photoid.h * build-packet.c (build_attribute_subpkt): new function to build the raw attribute subpacket. Note that attribute subpackets have the same format as signature subpackets. * exec.c: new file with generic exec-a-program functionality. Used by both photo IDs and keyserver helpers. This is pretty much the same code that used to be keyserver specific, with some changes to be usable generically. * free-packet.c (free_attributes (new)): function to free an attribute packet. * gpgv.c: added stub show_photo * keyedit.c (keyedit_menu, menu_adduid, menu_showphoto): can add a photo (calls generate_photo_id), or display a photo (calls show_photo) from the --edit menu. New commands are "addphoto", and "delphoto" (same as "deluid"). * keylist.c (list_keyblock_print): show photos during key list if --show-photos enabled. * keyserver.c (keyserver_spawn): use the generic exec_xxx functions to call keyserver helper. * g10.c, options.h: three new options - --{no-}show-photos, and --photo-viewer to give the command line to display a picture. * options.skel: instructions for the photo viewer * parse-packet.c (parse_user_id, setup_user_id (new)): common code for both user IDs and attribute IDs moved to setup_user_id. * parse-packet.c (make_attribute_uidname (new)): constructs a fake "name" for attribute packets (e.g. "[image of size ...]") * parse-packet.c (parse_attribute (replaces parse_photo_id), parse_attribute_subpkts): Builds an array of individual attributes. Currently only handles attribute image / type jpeg subpackets. * sign.c (hash_uid): Fix bug in signing attribute (formerly photo_id) packets. * packet.h, and callers: globally change "photo_id" to "attribute" and add structures for attributes. The packet format is generic attributes, even though the only attribute type thus far defined is jpeg. 2001-12-21 David Shaw * parse-packet.c (can_handle_critical): Can handle critical revocation subpackets now. * trustdb.c (mark_usable_uid_certs): Disregard revocations for nonrevocable sigs. Note that this allows a newer revocable signature to override an older nonrevocable signature. * sign.c (make_keysig_packet): add a duration field and change all callers. This makes make_keysig_packet closer to write_signature_packets and removes some duplicated expiration code. * keyedit.c (keyedit_menu, menu_revsig, sign_uids, sign_mk_attrib): Add nrsign command, don't allow revoking a nonrevocable signature, * g10.c (main): Add --nrsign option to nonrevocably sign a key from the command line. * build-packet.c (build_sig_subpkt_from_sig): Comment to explain the use of CRITICAL. 2001-12-21 Werner Koch * g10.c. options.h : New option --show-keyring * getkey.c (get_ctx_handle): New. * keylist.c (list_one): Implement option here. By David Champion. 2001-12-20 David Shaw * keyserver.c (keyserver_spawn): Use mkdtemp() to make temp directory. * mkdtemp.c: replacement function for those platforms that don't have mkdtemp (make a temp directory securely). 2001-12-19 David Shaw * misc.c (check_permissions): New function to stat() and ensure the permissions of GNUPGHOME and the files have safe permissions. * keydb.c (keydb_add_resource): Check keyring permissions. * tdbio.c (tdbio_set_dbname): Check permissions of trustdb.gpg * keyserver.c (keyserver_spawn): Disable keyserver schemes that involve running external programs if the options file has unsafe permissions or ownership. * g10.c, options.h: New option --no-permission-warning to disable the permission warning message(s). This also permits use of the keyserver if it had been disabled (see above). Also check the permissions/ownership of random_seed. * keyserver.c (keyserver_spawn): The new glibc prints a warning when using mktemp() (the code was already secure, but the warning was bound to cause confusion). Use a different implementation based on get_random_bits() instead. Also try a few times to get the temp dir before giving up. 2001-12-19 Werner Koch * g10.c, passphrase.c [CYGWIN32]: Allow this as an alias for MINGW32. 2001-12-18 David Shaw * g10.c (idea_cipher_warn): Add a flag to show the warning always or once per session and change all callers (show always except for the secret key protection and unknown cipher from an encrypted message errors). Also make the strings translatable. * pubkey-enc.c (get_it): Add the IDEA cipher warning if the user tries to decrypt an IDEA encrypted message without the IDEA plugin. * keyserver.c (parse_keyserver_uri): More strict checking of the keyserver URI. Specifically, fail if the ":port" section is anything except a number between 1 and 65535. 2001-12-17 David Shaw * keyserver.c (print_keyinfo): No need to check for control/illegal characters, as utf8_to_native does this for us. * mainproc.c (proc_encrypted): Use generic IDEA warning. * gpgv.c: add stub for idea_cipher_warn * g10.c, hkp.c, keyserver.c: Fix capitalization and plural issues. * encode.c (encode_crypt), sign.c (sign_file, clearsign_file): disable pgp2 mode after the message is no longer pgp2 compatible. * g10.c (main): Tweak the PGP2.x IDEA warning to use the generic warning, and not merely fail if the IDEA plugin isn't there. * g10.c (main, idea_cipher_warn), keygen.c (set_one_pref), seckey-cert.c (do_check): Add a generic IDEA warning for when the IDEA plugin is not present. This pops up when the user uses "--cipher-algo idea", when setpref is used to set a "S1" preference, and when a secret key protected with IDEA is used. 2001-12-15 Werner Koch * keyserver.c (keyserver_spawn): Assert that we have dropped privs. 2001-12-13 Werner Koch * pubkey-enc.c (get_session_key): Check that the public key algorithm is indeed usable for en/decryption. This avoid a strange error message from pubkey_decrypt if for some reasons a bad algorithm indentifier is passed. 2001-12-12 David Shaw * Fixed some types for portability. Noted by Stefan Bellon. 2001-12-11 Werner Koch * hkp.c (hkp_export): Do not print possible control characters from a keyserver response. (parse_hkp_index): Made uid an unsigned char* because it is passed to isspace(). (hkp_search): Ditto for the char* vars. * g10.c (main): Print the IDEA warning also for -c and -se. * g10.c (get_temp_dir): Assert that we have dropped privs * encode.c (encode_crypt): Include the first key into the --pgp2 check. 2001-12-07 David Shaw * g10.c, options.h: New option --pgp2. This is identical to "--rfc1991 --cipher-algo idea --compress-algo 1 --digest-algo md5 --force_v3_sigs" with the addition of an warning to advise the user not to use a pipe (which would break pgp2 compatibility). * encode.c (encode_crypt): warn if the user tries to encrypt to any key that is not RSA and <= 2048 bits when the --pgp2 option is used. * sign.c (sign_file, clearsign_file): When using --pgp2, make a v3 sig, and warn if the signature is made with a non-v3 key. 2001-12-05 David Shaw * sign.c (sign_file, clearsign_file, sign_symencrypt_file): Prompt for sig expiration if --expert is set and --force-v3-sigs is not set (v3 sigs cannot expire). * mainproc.c (check_sig_and_print): After checking a sig, print expiration status. This causes a error return if the sig is expired. * build-packet.c (build_sig_subpkt_from_sig): Include a critical sig expiration subpacket if the sig is to expire. * keyedit.c (sign_uids): Do not sign an expired key unless --expert is set, in which case prompt. Also, offer to expire a signature when the key the user is signing expires. * keygen.c (ask_expire_interval): Add a value to determine whether to prompt for a key or sig expiration and change all callers. * keyid.c: New functions: expirestr_from_sig and colon_expirestr_from_sig. * keylist.c (list_keyblock_colon): Show sig expiration date in the --with-colons listing. * sign.c (make_keysig_packet, write_signature_packets): Pass in an optional timestamp for the signature packet, and change all callers. * keyedit.c (sign_mk_attrib): Include a critical expiration subpacket in the signature if an expiration date is given. 2001-12-04 David Shaw * keyedit.c (sign_uids): If the user tries to sign a locally-signed key, allow the cert to be promoted to a full exportable signature. This essentially deletes the old non-exportable sig, and replaces it with a new exportable one. 2001-12-04 David Shaw * keyedit.c (keyedit_menu): Do not allow signing a revoked key unless --expert is set, and ask even then. * keyedit.c (sign_uids): Do not allow signing a revoked UID unless --expert is set, and ask even then. * g10.c, options.h : New option --expert 2001-11-16 David Shaw * Allow the user to select no compression via "--compress-algo 0" on the command line. * keyedit.c (show_prefs): Show compression preferences in the long-form "showpref" style. * keygen.c (set_one_pref): Permit setting a no-compression ("Z0") preference. * getkey.c (fixup_uidnode): Fix compression preference corruption bug. 2001-12-02 David Shaw * g10.c: Add advisory --for-your-eyes-only option as per section 5.9 of 2440. 2001-12-05 David Shaw * Force a V4 sig if the user has a notation or policy URL set. 2001-12-04 David Shaw * g10.c: Add options --keyserver-options, --temp-directory, and auto-key-retrieve (the opposite of no-auto-key-retrieve). * hkp.c (hkp_search): New function to handle searching a HKP keyserver for a key * hkp.c (hkp_ask_import, hkp_export): Pretty large changes to make them communicate via the generic functions in keyserver.c * keyserver.c: new file with generic keyserver routines for getting keys from a keyserver, sending keys to a keyserver, and searching for keys on a keyserver. Calls the internal HKP stuff in hkp.c for HKP keyserver functions. Other calls are handled by an external program which is spawned and written to and read from via pipes. Platforms that don't have pipes use temp files. 2001-11-20 David Shaw * options.h, g10.c: New options show-notation, no-show-notation, default-check-level, no-default-check-level, show-policy-url, no-show-policy-url. * packet.h, sign.c (make_keysig_packet), parse-packet.c (parse_signature), free-packet.c (free_seckey_enc): Fill in structures for notation, policy, sig class, exportability, etc. * keyedit.c, keylist.c (print_and_check_one_sig, list_keyblock_print): Show flags in signature display for cert details (class, local, notation, policy, revocable). If selected, show the notation and policy url. * keyedit.c (sign_uids): Prompt for and use different key sig classes. * helptext.c (helptexts): Add help text to explain different key signature classes 2001-11-26 David Shaw * trustdb.c (mark_usable_uid_certs): Fix segfault from bad initialization and fix reversed key signature expiration check. 2001-11-09 Werner Koch * export.c (do_export_stream): Put all given names into a search description and change the loop so that all matching names are returned. 2001-11-08 Werner Koch * pubkey-enc.c (get_it): To reduce the number of questions on the MLs print the the name of cipher algorithm 1 with the error message. * mainproc.c: Changed the way old rfc1991 encryption cipher is selected. Based on a patch by W Lewis. * pkclist.c (do_edit_ownertrust): Allow to skip over keys, the non working "show info" is now assigned to "i" * trustdb.c (ask_ownertrust, validate_keys): Implement a real quit here. Both are by David Shaw. * trustdb.c (validate_keys): Make sure next_exipire is initialized. * sign.c (make_keysig_packet): Use SHA-1 with v4 RSA keys. * g10.c, options.h : New option --[no-]froce-v4-certs. * sign.c (make_keysig_packet): Create v4 sigs on v4 keys even with a v3 key. Use that new option. By David Shaw * revoke.c (ask_revocation_reason): Allow to select "no reason". By David Shaw. * keyid.c (fingerprint_from_sk): Calculation of an v3 fpr was plain wrong - nearly the same code in fingerprint_from_pk is correct. * build-packet.c (do_secret_key): Added a few comments to the code. 2001-11-07 Werner Koch * g10.c (main): Print a warning when -r is used w/o encryption. Suggested by Pascal Scheffers. 2001-10-23 Werner Koch * keyedit.c (keyedit_menu): Changed helptext for showpref command. Suggested by Reinhard Wobst. * keyring.c (keyring_search): When marking the offtbl ready, take into account that we may have more than one keyring. 2001-10-22 Werner Koch * Makefile.am: Do not use OMIT_DEPENDENCIES * build-packet.c (build_sig_subpkt): Default is now to put all types of subpackets into the hashed area and only list those which should go into the unhashed area. 2001-10-18 Werner Koch * keydb.c (keydb_add_resource): Rearranged the way we keep track of the resource. There will now be an entry for each keyring here and not in keyring.c itself. Store a token to allow creation of a keyring handle. Changed all functions to utilize this new design. (keydb_locate_writable): Make a real implementation. * keyring.c (next_kr): Removed and changed all callers to set the resource directly from the one given with the handle. (keyring_is_writable): New. (keyring_rebuild_cache): Add an arg to pass the token from keydb. 2001-10-17 Werner Koch * keyring.c (keyring_search): Enabled word search mode but print a warning that it is buggy. 2001-10-11 Werner Koch * hkp.c (hkp_ask_import): No more need to set the port number for the x-hkp scheme. (hkp_export): Ditto. 2001-10-06 Stefan Bellon * passphrase.c [__riscos__]: Disabled agent specific stuff. * g10.c: New option --no-force-v3-sigs. 2001-10-04 Werner Koch * export.c (do_export_stream): Do not push the compress filter here because the context would run out of scope due to the iobuf_close done by the caller. (do_export): Do it here instead. 2001-09-28 Werner Koch * keyedit.c (sign_uids): Always use the primary key to sign keys. * getkey.c (finish_lookup): Hack to return only the primary key if a certification key has been requested. * trustdb.c (cmp_kid_for_make_key_array): Renamed to (validate_one_keyblock): this and changed arg for direct calling. (make_key_array): Renamed to (validate_one_keyblock): this and changed args for direct calling. (mark_usable_uid_certs, validate_one_keyblock) (validate_key_list): Add next_expire arg to keep track of expiration times. (validate_keys): Ditto for UTKs and write the stamp. * tdbio.c (migrate_from_v2): Check return code of tbdio_sync. * tdbdump.c (import_ownertrust): Do a tdbio_sync(). * keyring.c: Made the offtbl an global object. 2001-09-27 Werner Koch * pkclist.c (do_edit_ownertrust): Allow settin of ultimate trust. * trustdb.c (mark_keyblock_seen): New. (make_key_array): Use it to mark the subkeys too. (validate_keys): Store validity for ultimatly trusted keys. 2001-09-26 Werner Koch * pkclist.c (check_signatures_trust, do_we_trust): Removed the invocation of add_ownertrust. Minor changes to the wording. (add_ownertrust, add_ownertrust_cb): Removed. * trustdb.c (get_validity): Allow to lookup the validity using a subkey. * trustdb.c (new_key_hash_table): Increased the table size to 1024 and changed the masks accordingly. (validate): Changed stats printing. (mark_usable_uid_certs): New. (cmp_kid_for_make_key_array): Does now check the signatures and figures out a usable one. 2001-09-25 Werner Koch * keyring.c (new_offset_item,release_offset_items) (new_offset_hash_table, lookup_offset_hash_table) (update_offset_hash_table, update_offset_hash_table_from_kb): New. (keyring_search): Use a offset table to optimize search for unknown keys. (keyring_update_keyblock, keyring_insert_keyblock): Insert new offsets. * getkey.c (MAX_UNK_CACHE_ENTRIES): Removed the unknown keys caching code. * g10.c, options.h, import.c: Removed the entire allow-secret-key-import stuff because the validity is now controlled by other means. * g10.c: New command --rebuild-keydb-caches. * keydb.c (keydb_rebuild_caches): New. * keyring.c (do_copy): Moved some code to (create_tmp_file, rename_tmp_file, write_keyblock): new functions. (keyring_rebuild_cache): New. * packet.h (PKT_ring_trust): Add sigcache field. * parse-packet.c (parse_trust): Parse sigcache. * keyring.c (do_copy): Always insert a sigcache packet. (keyring_get_keyblock): Copy the sigcache packet to the signature. * sig-check.c (cache_sig_result): Renamed from cache_selfsig_result. Changed implementation to use the flag bits and changed all callers. (mdc_kludge_check): Removed this unused code. (do_check): Do not set the sig flags here. * import.c (read_block): Make sure that ring_trust packets are never imported. * export.c (do_export_stream): and never export them. * trustdb.c (make_key_array): Skip revoked and expired keys. 2001-09-24 Werner Koch * g10.c, options.h: New option --no-auto-check-trustdb. * keygen.c (do_generate_keypair): Set newly created keys to ultimately trusted. * tdbio.h, tdbio.c: Removed all support for records DIR, KEY, UID, PREF, SIG, SDIR and CACH. Changed migration function to work direct on the file. (tdbio_read_nextcheck): New. (tdbio_write_nextcheck): New. 2001-09-21 Werner Koch Revamped the entire key validation system. * trustdb.c: Complete rewrite. No more validation on demand, removed some functions, adjusted to all callers to use the new and much simpler interface. Does not use the LID anymore. * tdbio.c, tdbio.h: Add new record types trust and valid. Wrote a migration function to convert to the new trustdb layout. * getkey.c (classify_user_id2): Do not allow the use of the "#" prefix. * keydb.h: Removed the TDBIDX mode add a skipfnc to the descriptor. * keyring.c (keyring_search): Implemented skipfnc. * passphrase.c (agent_open): Add missing bracket. Include windows.h. 2001-09-19 Werner Koch * keylist.c (print_fingerprint): Renamed from fingerprint, made global available. Added new arg to control the print style. * mainproc.c (print_fingerprint): Removed. * pkclist.c (print_fpr, fpr_info): Removed and changed callers to use print_fingerprint. * keyedit.c (show_fingerprint): Ditto. * passphrase.c (writen, readn) (agent_open, agent_close) (agent_get_passphrase) (passphrase_clear_cache): Support for W32. Contributed by Timo. * import.c (import_one): Release keydb handles at 2 more places. * keyring.c (keyring_release): Close the iobuf. (keyring_get_keyblock): Init ret_kb to NULL and store error contidion. * import.c (import_new_stats_handle): New. (import_release_stats_handle): New. (import_print_stats): Renamed from static fnc print_stats. (import_keys, import_keys_stream): Add an optional status handle arg and changed all callers. * hkp.c (hkp_ask_import): Add an stats_handle arg and changed all callers. * mainproc.c (print_pkenc_list): Use print_utf8_string2(). 2001-09-18 Werner Koch * g10.c: New command --refresh-keys. * hkp.c (hkp_refresh_keys): New. Contributed by Timo Schulz. * parse-packet.c (parse): Stop on impossible packet lengths. 2001-09-17 Werner Koch * mainproc.c (print_notation_data): Wrap notation data status lines after 50 chars. * mainproc.c (proc_pubkey_enc): Make option try-all-secrets work. By disastry@saiknes.lv. 2001-09-14 Werner Koch * parse-packet.c (dump_sig_subpkt): List key server preferences and show the revocable flag correctly. Contributed by David Shaw. 2001-09-09 Werner Koch * keyedit.c (keyedit_menu): No need to define another p. * keylist.c (print_capabilities): s/used/use/ so that it does not shadow a global. * sign.c (sign_file): Renamed arg encrypt to encryptflag * keygen.c: Replaced all "usage" by "use". * misc.c (openpgp_pk_algo_usage): Ditto. * pubkey-enc.c (get_it): Renamed arg k to enc so that the later defined k does not shadow it. * parse-packet.c (parse_gpg_control): No need to define another i. * getkey.c (get_pubkey_byfprint): Must use the enum values and not the fprint_len. * keyring.c (keyring_search): Removed a non-sense break. Both bugs pointed out by Stefan. 2001-09-07 Werner Koch * status.c, status.h: Added NO_RECP and ALREADY_SIGNED. * pkclist.c (build_pk_list): Issue NO_RECP. * keyedit.c (sign_uids): Added experimental ALREADY_SIGNED * hkp.c (hkp_import): Use log_error. Bug reported by Neal H Walfield. * getkey.c (classify_user_id2): Change args to take the desc union direct. It was a stupid idea to pass the individual fields of an union to this function. Changed all callers. (classify_user_id): Ditto and allow to pass NULL as the description. 2001-09-06 Werner Koch * getkey.c (fixup_uidnode): Features flag is now a bit vector. * keygen.c (add_feature_mdc): Ditto. Revamped the entire key I/O code to be prepared for other ways of key storages and to get rid of the existing shit. GDBM support has gone. * keydb.c: New * keyring.c, keyring.h: New. * ringedit.c: Removed. Moved some stuff to keyring.c * getkey.c: Changed everything related to the key retrieving functions which are now using the keydb_ functions. (prepare_search, word_match_chars, word_match) (prepare_word_match, compare_name): Moved to keyring.c (get_pubkey_byname): Removed ctx arg and add ret_kdbhd arg. Changed all callers. (key_byname): Use get_pubkey_end to release the context and take new ret_kbdhd arg. Changed all callers. (classify_user_id2): Fill the 16 byte fingerprint up with 4 null bytes not with zero bytes of value 4, tsss. * import.c (import_one): Updated to use the new keydb interface. (import_secret_one): Ditto. (import_revoke_cert): Ditto. * delkey.c (do_delete_key): Ditto. * keyedit.c (keyedit_menu): Ditto. (get_keyblock_byname): Removed. * revoke.c (gen_revoke): Ditto. * export.c (do_export_stream): Ditto. * trustdb.c (update_trustdb): Ditto. * g10.c, gpgv.c (main): Renamed add_keyblock_resource to keydb_add_resource. * Makefile.am: Added and removed files. * keydb.h: Moved KBNODE typedef and MAX_FINGERPRINT_LEN to * global.h: this new header. 2001-09-03 Werner Koch * passphrase.c (agent_get_passphrase): Changed nread to size_t. (passphrase_clear_cache): Ditto. * keyid.c (mk_datestr): Avoid trigraphs. (fingerprint_from_pk): Cache the keyid in the pk. * options.h: Add opt.with_fingerprint so that we know whether the corresponding options was used. * g10.c (main): Set it here. * pkclist.c (check_signatures_trust): Always print fingerprint when this option is used. Mixed a minor memory leak. * status.c, status.h: New status INV_RECP. * pkclist.c (build_pk_list): Issue this status. 2001-08-31 Werner Koch * parse-packet.c (parse_key,parse_pubkeyenc) (parse_signature): Return error on reading bad MPIs. * mainproc.c (check_sig_and_print): Always print the user ID even if it is not bound by a signature. Use the primary UID in the status messages and encode them in UTF-8 * status.c (write_status_text_and_buffer): New. 2001-08-30 Werner Koch * packet.h (sigsubpkttype_t): Add SIGSUBPKT_FEATURES. (PKT_public_key, PKT_user_id): Add a flag for it. * parse-packet.c, build-packet.c: Add support for them. * getkey.c (fixup_uidnode, merge_selfsigs): Set the MDC flags. * keygen.c (add_feature_mdc): New. (keygen_upd_std_prefs): Always set the MDC feature. * keyedit.c (show_prefs): List the MDC flag * pkclist.c (select_mdc_from_pklist): New. * encode.c (encode_crypt, encrypt_filter): Test whether MDC should be used. * cipher.c (write_header): Set MDC use depending on the above test. Print more status info. * delkey.c (do_delete_key): Kludge to delete a secret key with no public key available. * ringedit.c (find_secret_keyblock_direct): New. * getkey.c (seckey_available): Simplified. * ringedit.c (cmp_seckey): Now compares the secret key against the public key while ignoring all secret parts. (keyring_search): Use a public key packet as arg. Allow to search for subnkeys (search): Likewise. Changed all callers. (find_secret_keyblock_bypk): New. (find_secret_keyblock_byname): First locate the pubkey and then find the correponding secret key. * parse-packet.c (parse): Renamed pkttype arg to onlykeypkts and changed code accordingly. Changed all callers. (search_packet): Removed pkttype arg. * keyedit.c (keyedit_menu): First locate the public key and then try to locate a secret key. * ringedit.c (locate_keyblock_by_fpr): Removed. (locate_keyblock_by_keyid): Removed. (find_keyblock_bysk): Removed. * sig-check.c (check_key_signature2): Print the keyid along with the wrong sig class errors. 2001-08-24 Werner Koch * sign.c (sign_file): Stripped the disabled comment packet code. (sign_file, sign_symencrypt_file): Moved common code to .. (write_onepass_sig_packets): .. this new function. (sign_file, clearsign_file, sign_symencrypt_file): Moved common code to (write_signature_packets): this new function. (write_signature_packets, make_keysig_packet) (update_keysig_packet): Moved common code to (hash_uid, hash_sigclass_to_magic): these new functions (sign_file, sign_symencrypt_file): Moved common code to (write_plaintext_packet): this new function. 2001-08-21 Stefan Bellon * trustdb.c (query_trust_info): Changed trustlevel to signed int. * g10.c [__riscos__]: Fixed handling of --use-agent --lock-multiple. 2001-08-20 Werner Koch * encr-data.c (decrypt_data): Keep track on whether we already printed information about the used algorithm. * mainproc.c (proc_encrypted): Removed the non-working IDEA hack and print a message about the assumed algorithm. * passphrase.c (passphrase_to_dek): Use the same algorithm as above. (proc_symkey_enc): Print the algorithm, so that the user knows it before entering the passphrase. (proc_pubkey_enc, proc_pubkey_enc): Zero the DEK out. * encode.c (encode_crypt, encrypt_filter): Ditto. * g10.c: Allow for --sign --symmetric. * sign.c (sign_and_symencrypt): New. Applied patches from Stefan Bellon to support RISC OS. Nearly all of these patches are identified by the __riscos__ macro. * compress.c: Added a couple of casts. * g10.c [__riscos__]: Some patches and new options foo-file similar to all foo-fd options. * gpgv.c, openfile.c, ringedit.c, tdbio.c: Minor fixes. Mainly replaced hardcoded path separators with EXTSEP_S like macros. * passprase.c [__riscos__]: Disabled agent stuff * trustdb.c (check_trust): Changed r_trustlevel to signed int to avoid mismatch problems in pkclist.c * pkclist.c (add_ownertrust): Ditto. * plaintext.c (handle_plaintext) [__riscos__]: Print a note when file can't be created. * options.h [__riscos__]: Use an extern unless included from the main module. * signal.c (got_fatal_signal) [__riscos__]: Close all files. 2001-08-14 Werner Koch * keygen.c (ask_algo): New arg r_usage. Allow for RSA keys. (gen_rsa): Enabled the code. (do_create): Enabled RSA branch. (parse_parameter_usage): New. (proc_parameter_file): Handle usage parameter. (read_parameter_file): Ditto. (generate_keypair): Ditto. (generate_subkeypair): Ditto. (do_generate_keypair): Ditto. (do_add_key_flags): New. (keygen_add_std_prefs): Use the new function. (keygen_add_key_flags_and_expire): New. (write_selfsig, write_keybinding): Handle new usage arg. * build-packet.c (build_sig_subpkt): Make sure that key flags go into the hashed area. * keygen.c (write_uid): Initialize the reference cunter. * keyedit.c (keyedit_menu): No more need to update the trustdb for preferences. Added calls to merge keblock. * kbnode.c (dump_kbnode): Print some more flags. 2001-08-10 Werner Koch Revamped the preference handling. * packet.h (prefitem_t, preftype_t): New. (PKT_public_key): Added a uid field. (PKT_user_id): Added field to store preferences and a reference counter. * parse-packet.c (parse_user_id,parse_photo_id): Initialize them * free-packet.c (free_user_id): Free them. (copy_user_id): Removed. (scopy_user_id): New. (cmp_user_ids): Optimized for identical pointers. (release_public_key_parts): Release the uid. (copy_public_key_with_new_namehash): Removed. (copy_prefs): New. * keyedit.c (menu_adduid): Use the new shallow copy user id. (show_prefs): Adjusted implementation. (keyedit_menu): No more need to update the trustdb after changing preferences. * getkey.c (fixup_uidnode): Store preferences. (find_by_name): Return a user id packet and remove namehash stuff. (lookup): Removed the unused namehash stuff. (finish_lookup): Added foundu arg. (pk_from_block): Removed the namehash arg and changed all callers. (merge_selfsigs): Copy prefs to all keys. * trustdb.c (get_pref_data): Removed. (is_algo_in_prefs): Removed. (make_pref_record): Deleted and removed all class. * pkclist.c (select_algo_from_prefs): Adjusted for the new preference implementation. * pubkey-enc.c (is_algo_in_prefs): New. (get_it): Use that new function. 2001-08-09 Werner Koch * build-packet.c (build_sig_subpkt): Fixed calculation of newarea->size. * g10.c (main): New option "--preference-list" * keyedit.c (keyedit_menu): New commands "setpref" and "updpref". (menu_set_preferences): New. * keygen.c (keygen_set_std_prefs): New. (set_one_pref): New. (check_zip_algo): New. (keygen_get_std_prefs): New. (keygen_upd_std_prefs): New (keygen_add_std_prefs): Move the pref setting code into the above fnc. * build-packet.c (build_sig_subpkt): Updated the list of allowed to update subpackets. 2001-08-08 Werner Koch * packet.h (subpktarea_t): New. (PKT_signature): Use that type for hashed_data and unhashed_data and removed the _data prefix from those fields. Changed all users. * parse-packet.c (parse_signature): Changed allocation for that. (parse_sig_subpkt): Changed declaration (enum_sig_subpkt): Ditto and changed implementation accordingly. * free-packet.c (cp_subpktarea): Renamed from cp_data_block and adjusted implementation. Changed caller. * sig-check.c (mdc_kludge_check): Adjusted the hashing. (do_check): Ditto. * sign.c (sign_file, clearsign_file, make_keysig_packet, update_keysig_packet): Ditto. * build-packet.c (build_sig_subpkt): Partial rewrite. (find_subpkt): Adjusted and made static. (delete_sig_subpkt): Adjusted. (do_signature): Ditto. * keygen.c (ask_keysize): Do not print the notes about suggested key sizes if just a DSA key is generated. * trustdb.c (add_ultimate_key): s/log_error/log_info/ for duplicated inserted trusted keys. 2001-08-07 Werner Koch * sign.c (sleep): Redefine for W32. * g10.c, options.h: Set new flag opt.no_homedir_creation when --no-options is given. * openfile.c (try_make_homedir): Don't create the homedir in that case. 2001-08-03 Werner Koch * armor.c (armor_filter): Removed the default comment string because it could get us in trouble due to translations using non ascii characters. 2001-08-01 Werner Koch * keylist.c (list_keyblock_print): Do not list revoked UIDs unless in verbose mode and we do no signature listing. * getkey.c (finish_lookup): Skip subkeys which are not yet valid. * g10.c, options.h: New option --ignore-valid-from. * sign.c (make_keysig_packet): Added new sigversion argument to allow the caller to force generation of required signature version. Changed all callers. Suggested by Thomas Roessler. * keyedit.c (sign_uids): Force v4 signature generation for local sigs. Removed the check for local signature and pre-v4 keys. 2001-07-27 Werner Koch * keyedit.c (sign_uids): Check that we are not trying to to a lsign with a pre-v4 key. Bug noticed by Thomas Roessler. 2001-07-26 Werner Koch * parse-packet.c (parse_photo_id): Reset all variables. * getkey.c (merge_selfsigs_main): Removed checks on PHOTO_ID because this is handled identically to a user ID. 2001-07-06 Werner Koch * cipher.c (write_header): Don't use MDC with --rfc1991. Suggested by disastry@saiknes.lv. 2001-07-05 Werner Koch * g10.c, options.h: New option --preserve-permissions. * ringedit.c (add_keyblock_resource): Use it here (keyring_copy): and here. * trustdb.c (verify_own_keys): Be more silent on --quiet. Suggested by Thomas Roessler. * sig-check.c (check_key_signature2): Ditto. * mainproc.c (proc_encrypted, proc_tree): Ditto * getkey.c (lookup): Ditto. 2001-07-04 Werner Koch * ringedit.c (add_keyblock_resource): Restore filename in case of error. 2001-06-25 Werner Koch * kbnode.c (dump_kbnode): Print the signature timestamp. * keyedit.c (keyedit_menu): New menu point "primary". (change_primary_uid_cb): New. (menu_set_primary_uid): New. * sign.c (update_keysig_packet): New. * build-packet.c (build_sig_subpkt): Put the primary UID flag into the hashed area. Allow update of some more packets. 2001-06-15 Werner Koch * getkey.c (merge_selfsigs): Exit gracefully when a secret key is encountered. May happen if a secret key is in public keyring. Reported by Francesco Potorti. 2001-06-12 Werner Koch * getkey.c (compare_name): Use ascii_memistr(), ascii_memcasecmp() * keyedit.c (keyedit_menu): Use ascii_strcasecmp(). * armor.c (radix64_read): Use ascii_toupper(). * ringedit.c (do_bm_search): Ditto. * keygen.c (read_parameter_file): Ditto. * openfile.c (CMP_FILENAME): Ditto. * g10.c (i18n_init): We can now use just LC_ALL. 2001-05-29 Werner Koch * keygen.c (generate_subkeypair): Print a warning if a subkey is created on a v3 key. Suggested by Brian M. Carlson. 2001-05-27 Werner Koch * keyid.c (get_lsign_letter): New. * keylist.c (list_keyblock_colon): Use it here. * mainproc.c (list_node): and here. * getkey.c, packet.h, free-packet.c: Removed that useless key created field; I dunno why I introducded this at all - the creation time is always bound to the key packet and subject to fingerprint calculation etc. * getkey.c (fixup_uidnode): Add keycreated arg and use this instead of the signature timestamp to calculate the help_key_expire. Bug reported by David R. Bergstein. (merge_selfsigs_main): Correct key expiration time calculation. (merge_selfsigs_subkey): Ditto. 2001-05-25 Werner Koch * revoke.c (gen_revoke): Add a cast to a tty_printf arg. * delkey.c (do_delete_key): Ditto. * keyedit.c (print_and_check_one_sig): Ditto. (ask_revoke_sig): Ditto. (menu_revsig): Ditto. (check_all_keysigs): Removed unused arg. 2001-05-23 Werner Koch * g10.c (opts): Typo fix by Robert C. Ames. 2001-05-06 Werner Koch * revoke.c: Small typo fix 2001-05-04 Werner Koch * passphrase.c (passphrase_clear_cache): Shortcut if agent usage is not enabled. 2001-05-01 Werner Koch * passphrase.c (writen): Replaced ssize_t by int. Thanks to to Robert Joop for reporting that SunOS 4.1.4 does not have it. 2001-04-28 Werner Koch * getkey.c (merge_public_with_secret): pkttype was not set to subkey. 2001-04-27 Werner Koch * skclist.c (build_sk_list): Changed one log_debug to log_info. 2001-04-25 Werner Koch * keyedit.c (show_prefs): Add a verbose mode. (show_key_with_all_names): Pass verbose flag for special value of with_pref. (keyedit_menu): New command "showpref" (show_key_with_all_names): Mark revoked uids and the primary key. 2001-04-24 Werner Koch * getkey.c (get_primary_uid): Return a different string in case of error and made it translatable. * build-packet.c (do_secret_key): Ugly, we wrote a zero instead of the computed ndays. Thanks to M Taylor for complaining about a secret key import problem. 2001-04-23 Werner Koch * hkp.c (hkp_ask_import): Allow to specify a port number for the keyserver. Add a kudge to set the no_shutdown flag. (hkp_export): Ditto. * options.skel: Document the changes 2001-04-20 Werner Koch * options.skel: Add some more comments. 2001-04-19 Werner Koch * keyid.c (mk_datestr): New. Handles negative times. We must do this because Windoze segvs on negative times passed to gmtime(). Changed all datestr_from function to use this one. * keyid.c, keyid.h (colon_strtime): New. To implement the fixed-list-mode. (colon_datestr_from_pk): New. (colon_datestr_from_sk): New. (colon_datestr_from_sig): New. * keylist.c (list_keyblock_colon): Use these functions here. * mainproc.c (list_node): Ditto. 2001-04-18 Werner Koch * openfile.c (open_sigfile): Fixed the handling of ".sign". * mainproc.c (proc_tree): Use iobuf_get_real_fname. Both are by Vincent Broman. 2001-04-14 Werner Koch * getkey.c (fixup_uidnode): Removed check for !sig which is pointless here. Thanks to Jan Niehusmann. 2001-04-10 Werner Koch * sig-check.c (check_key_signature2): Use log_info instead of log_error so that messed up keys do not let gpg return an error. Suggested by Christian Kurz. * getkey.c (merge_selfsigs_main): Do a fixup_uidnode only if we have both, uid and sig. Thanks to M Taylor. 2001-04-05 Werner Koch * armor.c (unarmor_pump_new,unarmor_pump_release): New. (unarmor_pump): New. * pipemode.c (pipemode_filter): Use the unarmor_pump to handle armored or non-armored detached signatures. We can't use the regular armor_filter because this does only check for armored signatures the very first time. In pipemode we may have a mix of armored and binary detached signatures. * mainproc.c (proc_tree): Do not print the "old style" notice when this is a pipemode processes detached signature. (proc_plaintext): Special handling of pipemode detached sigs. * packet.h (CTRLPKT_PLAINTEXT_MARK): New. * parse-packet.c (create_gpg_control): New. * kbnode.c (dump_kbnode): Support it here. * mainproc.c (check_sig_and_print): Fixed the check for bad sequences of multiple signatures. (proc_plaintext): Add the marker packet. (proc_tree): We can now check multiple detached signatures. 2001-04-02 Werner Koch The length of encrypted packets for blocksizes != 8 was not correct encoded. I think this is a minor problem, because we usually use partial length packets. Kudos to Kahil D. Jallad for pointing this out. * packet.h: Add extralen to PKT_encrypted. * cipher.c (write_header): Set extralen. * build-packet.c (do_encrypted): Use extralen instead of const 10. (do_encrypted_mdc): Ditto. * parse-packet.c (parse_encrypted): Set extralen to 0 because we don't know it here. 2001-03-30 Werner Koch * getkey.c (premerge_public_with_secret): Changed wording an add the keyID to the info message. 2001-03-29 Werner Koch * getkey.c (premerge_public_with_secret): Use log_info instead of log_error when no secret key was found for a public one. Fix the usage if the secret parts of a key are not available. * openfile.c (ask_outfile_name): Trim spaces. (open_outfile): Allow to enter an alternate filename. Thanks to Stefan Bellon. * plaintext.c (handle_plaintext): Ditto. 2001-03-28 Werner Koch * mainproc.c (do_check_sig): Allow direct key and subkey revocation signature. * sig-check.c (check_key_signature2): Check direct key signatures. Print the signature class along with an error. 2001-03-27 Werner Koch * packet.h: Add a missing typedef to an enum. Thanks to Stefan Bellon. * g10.c: New option --no-sig-create-check. * sign.c (do_sign): Implement it here. * g10.c: New option --no-sig-cache. * sig-check.c (check_key_signature2): Implement it here. (cache_selfsig_result): and here. * keylist.c (list_keyblock): Removed debugging stuff. * getkey.c (cache_public_key): Made global. * keygen.c (write_selfsig, write_keybinding): Cache the new key. * getkey.c (key_byname): Add new arg secmode and changed all callers to request explicitly the mode. Deriving this information from the other supplied parameters does not work if neither pk nor sk are supplied. 2001-03-25 Werner Koch * packet.h (ctrlpkttype_t): New. * mainproc.c (add_gpg_control,proc_plaintext,proc_tree): Use the new enum values. * pipemode.c (make_control): Ditto. * armor.c (armor_filter): Ditto. 2001-03-24 Werner Koch * sign.c (do_sign): Verify the signature right after creation. 2001-03-23 Werner Koch * status.c, status.h (STATUS_UNEXPECTED): New. * mainproc.c (do_proc_packets): And emit it here. 2001-03-21 Werner Koch * status.c: Add sys/types.h so that it runs on Ultrix. Reported by Georg Schwarz.x * build-packet.c (build_sig_subpkt): Fixed generaton of packet length header in case where 2 bytes headers are needed. Thanks to Piotr Krukowiecki. 2001-03-19 Werner Koch * g10.c (main): the default keyring is no always used unless --no-default-keyring is given. * ringedit.c (add_keyblock_resource): invalidate cache after file creation. 2001-03-15 Werner Koch * keygen.c (ask_algo): Changed the warning of the ElGamal S+E Algo. * keylist.c (print_capabilities): New. (list_keyblock_colon): and use it here. 2001-03-13 Werner Koch * main.c, options.h: New option --fixed_list_mode. * keylist.c (list_keyblock_colon): use it here. * getkey.c (merge_keys_and_selfsig): Divert merging of public keys to the function used in key selection.. * keylist.c (is_uid_valid): Removed. (list_keyblock): Splitted into .. (list_keyblock_print, list_keyblock_colon): .. these. functions. Changed them to use the flags set in the key lookup code. (reorder_keyblock): New, so that primary user IDs are listed first. * ringedit.c (keyring_copy): flush the new iobuf chaces before rename or remove operations. This is mainly needed for W32. * hkp.c [HAVE_DOSISH_SYSTEM]: Removed the disabled code because we have now W32 socket support in ../util/http.c * skclist.c (key_present_in_sk_list): New. (is_duplicated_entry): New. (build_sk_list): Check for duplicates and do that before unlocking. 2001-03-12 Werner Koch * armor.c (parse_header_line): Removed double empty line check. (parse_header_line): Replaced trim_trailing_ws with a counting function so that we can adjust for the next read. * options.skel: Fixed 3 typos. By Thomas Klausner. Replaced the keyserver example by a better working server. * parse-packet.c (parse_symkeyenc): Return Invalid_Packet on error. (parse_pubkeyenc): Ditto. (parse_onepass_sig): Ditto. (parse_plaintext): Ditto. (parse_encrypted): Ditto. (parse_signature): Return error at other places too. (parse_key): Ditto. * g10.c (main): Set opt.list_packets to another value when invoked with the --list-packets command. * mainproc.c (do_proc_packets): Don's stop processing when running under --list-packets command. * signal.c (do_sigaction): Removed. (init_one_signal): New to replace the above. Needed to support systems without sigactions. Suggested by Dave Dykstra. (got_fatal_signal,init_signals): Use the above here. (do_block): Use sigset() if sigprocmask() is not available. * armor.c (parse_hash_header): Test on TIGER192, which is the correct value as per rfc2440. By Edwin Woudt. 2001-03-08 Werner Koch * misc.c: Include time.h. By James Troup. * getkey.c: Re-enabled the unknown user Id and PK caches and increased their sizes. * getkey.c (merge_selfsigs_main): Set expire date and continue processing even if we found a revoked key. (merge_selfsigs_subkeys): Ditto. * packet.h: Add an is_revoked flag to the user_id packet. * getkey.c (fixup_uidnode): Set that flag here. (merge_selfsigs_main): Fix so that the latest signature is used to find the self-signature for an UID. * parse-packet.c (parse_user_id): Zero out all fields. * mainproc.c (check_sig_and_print): Print the primary user ID according the the node flag and then all other non-revoked user IDs. (is_uid_revoked): Removed; it is now handled by the key selection code. Changed the year list of all copyright notices. 2001-03-07 Werner Koch * getkey.c (finish_lookup): Print an info message only in verbose mode. 2001-03-05 Werner Koch * packet.h: Replaced sigsubpkt_t value 101 by PRIV_VERIFY_CACHE. We have never used the old value, so we can do this without any harm. * parse-packet.c (dump_sig_subpkt): Ditto. (parse_one_sig_subpkt): Parse that new sub packet. * build-packet.c (build_sig_subpkt): Removed the old one from the hashed area. (delete_sig_subpkt): New. (build_sig_subpkt): Allow an update of that new subpkt. * sig-check.c (check_key_signature2): Add verification caching (cache_selfsig_result): New. * export.c (do_export_stream): Delete that sig subpkt before exporting. * import.c (remove_bad_stuff): New. (import): Apply that function to all imported data 2001-03-03 Werner Koch * getkey.c: Introduced a new lookup context flag "exact" and used it in all place where we once used primary. (classify_user_id2): Replaced the old function and add an extra argument to return whether an exact keyID has been requested. (key_byname): Removed the unused ctx.primary flag (get_seckey_byname2): Ditto. (finish_lookup): Changed debugging output. 2001-03-02 Werner Koch * keylist.c (list_one): Remove the merge key calls. 2001-03-01 Werner Koch * getkey.c (finish_lookup): Don't use it if we no specific usage has been requested. (merge_selfsigs_main): fix UID only if we have an signature. (lookup): Return UNU_PUBKEY etc. instead of NO_PUBKEY if we found a key but the requested usage does not allow this key. * import.c (import_one): Take UNU_PUBKEY into account. * mainproc.c (list_node): Ditto. * keylist.c (list_keyblock): Ditto. * keyedit.c (print_and_check_one_sig): Ditto. 2001-02-09 Werner Koch * delkey.c (delete_key): Removed that silly assert which rendered the whole new stuff meaningless. 2001-02-08 Werner Koch * getkey.c (key_byname): It can happen that we have both, sk and pk NULL, fix for that. * parse-packet.c (parse_one_sig_subpkt): Add support for primary_uid and key_flags. (can_handle_critical): Ditto * parse-packet.c (parse_encrypted): Fixed listing of pktlen for MDC packets. * getkey.c: Backported the version of this file from gpg 1.1. this involved some changes in other files too. * parse-packet.c (parse_key): Clear req_usage. * skclist.c (build_sk_list): Use req_usage to pass the usage information to the lookup function. * pkclist.c (build_pk_list): Ditto. * free-packet.c (copy_public_parts_to_secret_key): New. * keydb.h: Add IS_* macros to check the sig_class. * misc.c (openpgp_cipher_test_algo): New. (openpgp_pk_test_algo): New. (openpgp_pk_algo_usage): New. (openpgp_md_test_algo): New. * packet.h: Add a few fields to PKT_{public,secret}_key and PKT_user_id. * seckey-cert.c (do_check): Use the new main_keyid field. 2001-02-04 Werner Koch * encr-data.c (decrypt_data): Catch error when we had problems to parse the encrypted packet. By Timo. 2001-01-29 Werner Koch * g10.c (main): --batch does now set nogreeting. * delkey.c (do_delete_key): Fixed delete-both functionality. 2001-01-22 Werner Koch * g10.c: New command --delete-secret-and-public-key. * delkey.c (delete_key): Add new arg allow_both. (do_delete_key): Move most stuff from above to this new function. 2001-01-12 Werner Koch * passphrase.c (passphrase_to_dek): Use MD5 when IDEA is installed and we have no S2K. * mainproc.c (proc_encrypted): Likewise 2001-01-11 Werner Koch * sig-check.c (do_check): Print the signature key expire message only in verbose mode and added the keyID. 2001-01-09 Werner Koch * status.c, status.h: New status USERID_HINT. (write_status_text): Replace LF and CR int text by C-escape sequence. * passphrase.c (passphrase_to_dek): Fixed the NEED_PASSPHRASE output. It does now always print 2 keyIDs. Emit the new USERID_HINT. 2001-01-08 Werner Koch * g10.c, options.h: New option --no-expensive-trust-checks. * keylist.c (list_keyblock): Act on this option. 2001-01-04 Werner Koch * g10.c (main): Set homedir only in the pre-parsing phase and replace backslashes in the W32 version. 2001-01-03 Werner Koch * status.c, status.h : New status KEY_CREATED * keygen.c (do_generate_keypair,generate_subkeypair): Emit it. 2000-12-28 Werner Koch * signal.c (got_fatal_signal): Remove lockfiles here because the atexit stuff does not work due to the use of raise. Suggested by Peter Fales. * gpgv.c (remove_lockfiles): New stub. 2000-12-19 Werner Koch * status.c, status.h (cpr_get_no_help): New. * keyedit.c (keyedit_menu): Use it here because we have our own help list here. 2000-12-18 Werner Koch * mainproc.c (print_failed_pkenc): Don't print the sometimes confusing message about unavailabe secret key. Renamed ... (print_pkenc_list): ... to this and introduced failed arg. (proc_encrypted): Print the failed encryption keys and then the one to be used. (proc_pubkey_enc): Store also the key we are going to use. * mainproc.c (check_sig_and_print): Don't list revoked user IDs. (is_uid_revoked): New. 2000-12-08 Werner Koch * pipemode.c: Made the command work. Currently only for non-armored detached signatures. * mainproc.c (release_list): Reset the new pipemode vars. (add_gpg_control): Handle the control packets for pipemode * status.c, status.h: New stati {BEGIN,END}_STREAM. 2000-12-07 Werner Koch * g10.c: New option --allow-secret-key-import. * import.c (import_keys,import_keys_stream): Honor this option. (import): New arg allow_secret and pass that arg down to ... (import_secret_one): to this and print a warning if secret key importing is not allowed. 2000-12-05 Werner Koch * cipher.c (cipher_filter): Moved the end_encryption status ... * encode.c (encode_simple,encode_crypt): to here * sign.c (sign_file): and here. * status.c (mywrite): Removed. (get_status_string): Removed the LFs from the strings. (set_status_fd,is_status_enabed,write_status_text, write_status_buffer): Replaced all mywrite by stdio calls and use fdopen to create a strem. This is needed to make things smoother in the W32 version. 2000-12-04 Werner Koch * import.c (merge_blocks): Increment n_sigs for revocations. 2000-11-30 Werner Koch * g10.c (main): Use iobuf_translate_file_handle for all options with filehandles as arguments. This is function does some magic for the W32 API. * verify.c (verify_signatures): Add a comment rant about the detached signature problem. * mainproc.c (proc_tree): Issue an error if a detached signature is assumed but a standard one was found. * plaintext.c (hash_datafiles): Don't fall back to read signature from stdin. * openfile.c (open_sigfile): Print verbose message only if the file could be accessed. 2000-11-24 Werner Koch * passphrase.c [HAVE_DOSISH_SYSTEM]: Disabled all the agent stuff. 2000-11-16 Werner Koch * g10.c: New option --use-agent * passphrase.c (agent_open,agent_close): New. (agent_get_passphrase,agent_clear_passphrase): New. (passphrase_clear_cache): New. (passphrase_to_dek): Use the agent here. * seckey-cert.c (do_check): Clear cached passphrases. 2000-11-15 Werner Koch * status.c (write_status_text): Moved the big switch to ... (get_status_string): ... new function. (write_status_buffer): New. * status.c (mywrite): New and replaced all write() by this. * status.c, status.h: Add 3 status lcodes for notaions and policy. * mainproc.c (print_notation_data): Do status output of notations. 2000-11-13 Werner Koch * sign.c (clearsign_file): Use LF macro to print linefeed. 2000-11-11 Paul Eggert Clean up the places in the code that incorrectly use "long" or "unsigned long" for file offsets. The correct type to use is "off_t". The difference is important on large-file hosts, where "off_t" is longer than "long". * keydb.h (struct keyblock_pos_struct.offset): Use off_t, not ulong, for file offsets. * packet.h (dbg_search_packet, dbg_copy_some_packets, search_packet, copy_some_packets): Likewise. * parse-packet.c (parse, dbg_search_packet, search_packet, dbg_copy_some_packets, copy_some_packets): Likewise. * ringedit.c (keyring_search): Likewise. * parse-packet.c (parse): Do not use %lu to report file offsets in error diagnostics; it's not portable. * ringedit.c (keyring_search): Likewise. 2000-11-09 Werner Koch * g10.c (main): New option --enable-special-filenames. 2000-11-07 Werner Koch * g10.c (main): New command --pipemode. * pipemode.c: New. 2000-10-23 Werner Koch * armor.c (armor_filter): Changed output of hdrlines, so that a CR is emitted for DOS systems. * keygen.c (read_parameter_file): Add a cast for isspace(). * status.c (myread): Use SIGINT instead of SIGHUP for DOS. 2000-10-19 Werner Koch * g10.c: New option --ignore-crc-error * armor.c (invalid_crc): New. (radix64_read): Act on new option. * openfile.c (try_make_homedir): Klaus Singvogel fixed a stupid error introduced on Sep 6th. 2000-10-18 Werner Koch * misc.c (print_cipher_algo_note): Don't print the note for AES. Changed wording. 2000-10-16 Werner Koch * mainproc.c (do_proc_packets): Hack to fix the problem that signatures are not detected when there is a MDC packet but no compression packet. * g10.c (print_hashline): New. (print_mds): Use above func with --with-colons. * mainproc.c (check_sig_and_print): Detect multiple signatures and don't verify them. 2000-10-14 Werner Koch * mainproc.c (add_onepass_sig): There is an easier solution to the error fixed yesterday; just check that we only have onepass packets. However, the other solution provides an cleaner interface and opens the path to get access to other information from the armore headers. (release_list): Reset some more variables. 2000-10-13 Werner Koch * mainproc.c (add_gpg_control): New. (do_proc_packets): use it. (proc_plaintext): Changed logic to detect clearsigns. (proc_tree): Check the cleartext sig with some new code. * packet.h: New packet PKT_GPG_CONTROL. * parse-packet.c (parse_gpg_control): New. * misc.c (get_session_marker): New. * armor.c (armor_filter): Replaced the faked 1-pass packet by the new control packet. * keyedit.c (keyedit_menu): Allow batchmode with a command_fd. * status.c (my_read): New. (do_get_from_fd): use it. 2000-10-12 Werner Koch * keygen.c (keygen_add_std_prefs): Add Rijndael to the prefs. 2000-10-07 Werner Koch * gpgv.c: Add more stubs for ununsed code to make the binary smaller. Wed Oct 4 15:50:18 CEST 2000 Werner Koch * sign.c (hash_for): New arg to take packet version in account, changed call callers. * gpgv.c: New. * Makefile.am: Rearranged source files so that gpgv can be build with at least files as possible. Mon Sep 18 12:13:52 CEST 2000 Werner Koch * hkp.c (not_implemented): Print a notice for W32 Fri Sep 15 18:40:36 CEST 2000 Werner Koch * keygen.c (keygen_add_std_prefs): Changed order of preferences to twofish, cast5, blowfish. * pkclist.c (algo_available): Removed hack to disable Twofish. Thu Sep 14 17:45:11 CEST 2000 Werner Koch * parse-packet.c (dump_sig_subpkt): Dump key flags. Print special warning in case of faked ARRs. * getkey.c (finsih_lookup): Hack so that for v4 RSA keys the subkey is used for encryption. Thu Sep 14 14:20:38 CEST 2000 Werner Koch * g10.c (main): Default S2K algorithms are now SHA1 and CAST5 - this should solve a lot of compatibility problems with other OpenPGP apps because those algorithms are SHOULD and not optional. The old way to force it was by using the --openpgp option whith the drawback that this would disable a couple of workarounds for PGP. * g10.c (main): Don't set --quite along with --no-tty. By Frank Tobin. * misc.c (disable_core_dump): Don't display a warning here but a return a status value and ... * g10.c (main): ...print warnining here. Suggested by Sam Roberts. Wed Sep 13 18:12:34 CEST 2000 Werner Koch * keyedit.c (keyedit_menu): Allow to use "debug" on the secret key. * ringedit.c (cmp_seckey): Fix for v4 RSA keys. * seckey-cert.c (do_check): Workaround for PGP 7 bug. Wed Sep 6 17:55:47 CEST 2000 Werner Koch * misc.c (print_pubkey_algo_note): Do not print the RSA notice. * sig-check.c (do_signature_check): Do not emit the RSA status message. * pubkey-enc.c (get_session_key): Ditto. * encode.c (encode_simple, encode_crypt): Fix for large files. * sign.c (sign_file): Ditto. Wed Sep 6 14:59:09 CEST 2000 Werner Koch * passphrase.c (hash_passphrase): Removed funny assert. Reported by David Mathog. * openfile.c (try_make_homedir): Changes for non-Posix systems. * g10.c (main): Take the default homedir from macro. * g10.c: The --trusted-key option is back. * trustdb.c (verify_own_key): Handle this option. (add_ultimate_key): Moved stuff from verify_own_key to this new func. (register_trusted_key): New. Fri Aug 25 16:05:38 CEST 2000 Werner Koch * parse-packet.c (dump_sig_subpkt): Print info about the ARR. * openfile.c (overwrite_filep): Always return okay if the file is called /dev/null. (make_outfile_name): Add ".sign" to the list of know extensions. (open_sigfile): Ditto. Wed Aug 23 19:52:51 CEST 2000 Werner Koch * g10.c: New option --allow-freeform-uid. By Jeroen C. van Gelderen. * keygen.c (ask_user_id): Implemented here. Fri Aug 4 14:23:05 CEST 2000 Werner Koch * status.c (do_get_from_fd): Ooops, we used fd instead of opt.command_fd. Thanks to Michael Tokarev. Tue Aug 1 20:06:23 CEST 2000 Werner Koch * g10.c: New opttion --try-all-secrets on suggestion from Matthias Urlichs. * pubkey-enc.c (get_session_key): Quite easy to implement here. Thu Jul 27 17:33:04 CEST 2000 Werner Koch * g10.c: New option --merge-only. Suggested by Brendan O'Dea. * import.c (import_one): Implemented it here (import_secret_one): Ditto. (print_stats): and give some stats. Thu Jul 27 12:01:00 CEST 2000 Werner Koch * g10.c: New options --show-session-key and --override-session-key * pubkey-enc.c (hextobyte): New. (get_override_session_key): New. * mainproc.c (proc_pubkey_enc): Add session-key stuff. * status.h, status.c (STATUS_SESSION_KEY): New. Thu Jul 27 10:02:38 CEST 2000 Werner Koch * g10.c (main): Use setmode(O_BINARY) for MSDOS while generating random bytes (print_mds): Likewise for stdin. * plaintext.c (handle_plaintext): Likewise for stdout. Mon Jul 24 10:30:17 CEST 2000 Werner Koch * keyedit.c (menu_expire): expire date for primary key can be set again. Wed Jul 19 11:26:43 CEST 2000 Werner Koch * keylist.c (is_uid_valid): New. (list_keyblock): Print validity information for all user IDs. Note, this has to be done at other places too; for now we have only minimal support. Wed Jul 12 13:32:06 CEST 2000 Werner Koch * helptext.c, pkclist.c: s/superseeded/superseded/ Mon Jul 10 16:08:57 CEST 2000 Werner Koch * parse-packet.c (enum_sig_subpkt): Fixed testing on crtitical bit in case of a NULL buffer. Reported by Peter Marschall. Wed Jul 5 13:28:45 CEST 2000 Werner Koch * keyedit.c, keyid.c: Add some _() * argparse.c: Changed the flag to suppress --version handling to also suppress --help. Wed Jun 28 11:54:44 CEST 2000 Werner Koch * armor.c (armor_filter): Set sigclass to 0 in case of non-dash-escaped clearsig. This makes this mode work again. * mainproc.c (proc_tree): Fixed handling of one-pass-sig packets in textmode. Disabled the ugly workaround for PGP 5 - let's see whether thi breaks less cases. Found by Ted Cabeen. * options.h (DBG_HASHING): New. All commented md_start_debug are now controlled by this debug option. * sign.c (print_status_sig_created): New and called from 2 places. * keygen.c (gen_rsa): New, but commented. (ask_algo): Commented support for RSA. * seckey-cert.c (protect_secret_key): Started to fix the code for v4 RSA keys - it is not solved yet. However, we have time until, Sep 20th ;) Wed Jun 14 12:27:09 CEST 2000 Werner Koch * status.c (init_shm_coprocessing): Changed the sequence of the get,attach to cope with the changes in newer Linux kernels. This bug has been found by who also proposed this solution. Hopefully this does not break gpg on to many systems. * cipher.c (write_header): Protect the IV with the MDC too. * encr-data.c (decrypt_data): Likewise. Fri Jun 9 10:09:52 CEST 2000 Werner Koch * g10.c: New options --no-auto-key-retrieve * options.h (auto_key_retrieve): New. * mainproc.c (check_sig_and_print): Implemented that. Wed Jun 7 19:19:09 CEST 2000 Werner Koch * sig-check.c (do_check): Use EMULATE_MDENCODE also on v4 packets. Wed Jun 7 17:25:38 CEST 2000 Werner Koch * cipher.c (write_header): Use plain CFB mode for MDC encrypted packets. * encr-data.c (decrypt_data): Ditto. Mon Jun 5 23:41:54 CEST 2000 Werner Koch * seskey.c (do_encode_md, encode_md_value): Add new arg v3compathack to work around a bug in old versions. * sig-check.c (do_check): use the aboved workaround when enabled. * g10.c: New option --emulate-md-decode-bug Mon Jun 5 12:37:43 CEST 2000 Werner Koch * build-packet.c (do_mdc): New. (do_encrypted_mdc): Changed for the new proposal. * parse-packet.c (parse_mdc): New. (parse_encrypted): Fixed for the new proposal. * packet.h (PKT_MDC): New. * cipher.c (cipher_filter): Build the MDC packet here. * g10.c (main): Enable --force-mdc. * encr-data.c (mdc_decode_filter): Fixed for new MDC method * options.h(rfc2440): New. * g10.c (main): Changed the selected values for --openpgp to not include optional algorithms. Thu May 18 11:38:54 CEST 2000 Werner Koch * keyedit.c (keyedit_menu): Add a keyword arg to the prompt. * status.c, status.h: Added 3 new status tokens. * status.c (do_get_from_fd): New. (cpr_enabled,cpr_get,cpr_get_hidden,cpr_kill_prompt, cpr_get_answer_is_yes,cpr_get_answer_yes_no_quit): Modified to work with the new function. * g10.c: Add new option --command-fd. * status.c (progress_cb): New. (set_status_fd): Register progress functions Fri May 12 14:01:20 CEST 2000 Werner Koch * delkey.c (delete_key): Add 2 new status messages * status.c, status.h (STATUS_DELETE_PROBLEM): New. Fixed years of copyright in all source files. Mon May 1 17:08:14 CEST 2000 Werner Koch * trustdb.c (propagate_validity): Fixed the bug that only one uid gets fully trusted even when all are signed by an ultimate key. Mon May 1 15:38:04 CEST 2000 Werner Koch * getkey.c (key_byname): Always returned a defined context. Fixed a segv for invalid user id specifications. Reported by Walter Koch. * getkey.c (get_user_id): I18ned "no user id" string. By Walter. * pkclist.c (do_show_revocation_reason): Typo fixes. * helptext.c: Ditto. * armor.c (armor_filter): Fixed some CRLF issues. By Mike McEwan. Fri Apr 14 19:37:08 CEST 2000 Werner Koch * pkclist.c (do_show_revocation_reason): New. (show_revocation_reason): New and called at various places. * g10.c (main): Fixed small typo. * pkclist.c (do_we_trust): Act on always_trust but not for revoked keys. Suggested by Chip Salzenberg. * g10.c: New option --lock-never. * ringedit.c (get_writable_keyblock_file): New. * keygen.c (do_generate_keypair): Use this instead of the hardwired one. * keygen.c (ask_user_id): Check that the email address is in the correct field. Suggested by Christian Kurz. Mon Apr 10 13:34:19 CEST 2000 Werner Koch * keyedit.c (show_key_with_all_names): s/sbb/ssb/ Tue Mar 28 14:26:58 CEST 2000 Werner Koch * trustdb.c (verify_own_keys): Do not print warning about unprotected key when in quiet mode. Wed Mar 22 13:50:24 CET 2000 Werner Koch * mainproc.c (print_userid): Do UTF8 conversion before printing. * import.c (import_one): Ditto. (import_secret_one): Ditto. (delete_inv_parts): Ditto. Thu Mar 16 16:20:23 CET 2000 Werner Koch * keylist.c (print_key_data): Handle a NULL pk gracefully. * getkey.c (merge_one_pk_and_selfsig): Fixed silly code for getting the primary keys keyID but kept using the one from the subkey. * pubkey-enc.c (get_it): Print a note for expired subkeys. * getkey.c (has_expired): New. (subkeys_expiretime): New. (finish_lookup): Check for expired subkeys needed for encryption. (merge_keys_and_selfsig): Fixed expiration date merging for subkeys. * keylist.c (list_keyblock): Print expiration time for "sub". (list_one): Add missing merging for public keys. * mainproc.c (list_node): Ditto. 2000-03-14 13:49:38 Werner Koch (wk@habibti.openit.de) * keygen.c (keyedit_menu): Do not allow to use certain commands while the secret key is selected. 2000-03-09 12:53:09 Werner Koch (wk@habibti.openit.de) * keygen.c (ask_expire_interval): Movede parsig to ... (parse_expire_string): ... this new function. And some new control commands. (proc_parameter_file): Add expire date parsing. (do_generate_keypair): Allow the use of specified output files. 2000-03-08 10:38:38 Werner Koch (wk@habibti.openit.de) * keygen.c (ask_algo): Removed is_v4 return value and the commented code to create Elg keys in a v3 packet. Removed the rounding of key sizes here. (do_create): Likewise removed arg v4_packet. (gen_elg): Likewise removed arg version. Now rounding keysizes here. (gen_dsa): Rounding keysize now here. (release_parameter_list): New (get_parameter*): New. (proc_parameter_file): New. (read_parameter_file): New. (generate_keypair): Splitted. Now uses read_parameter_file when in batch mode. Additional argument to specify a parameter file. (do_generate_keypair): Main bulk of above fucntion and uses the parameter list. (do_create): Don't print long notice in batch mode. * g10.c (main): Allow batched key generation. Thu Mar 2 15:37:46 CET 2000 Werner Koch * pubkey-enc.c (get_it): Print a note about unknown cipher algos. * g10.c (opts): Add a note to the help listing about the man page and removed some options from the help listing. * keyedit.c (print_and_check_one_sig): Use a new function to truncate the output of the user ID. Suggested by Jan-Benedict Glaw. Wed Feb 23 10:07:57 CET 2000 Werner Koch * helptext.c: typo fix. Thu Feb 17 13:39:32 CET 2000 Werner Koch * revoke.c: Removed a bunch of commented code. * packet.h (SIGSUBPKT_REVOC_REASON): New. * build-packet.c (build_sig_subpkt): Support new sub packet. * parse-packet.c (parse_one_sig_subpkt): Ditto. (dump_sig_subpkt): Ditto. * revoke.c (ask_revocation_reason): New. (release_revocation_reason_info): New. (revocation_reason_build_cb): New. (gen_revoke): Ask for reason. * main.h (struct revocation_reason_info): Add declaration. * keyedit.c (menu_revsig): Add support for revocation reason. (menu_revkey): Ditto. (sign_uid_mk_attrib): Renamed to ... (sign_mk_attrib): ... this, made static and add support for reasons. Tue Feb 15 08:48:13 CET 2000 Werner Koch * build-packet.c (build_packet): Fixed fixing of old comment packets. * import.c (import_keys): Fixed importing from stdin when called with nnames set to zero as it normally happens. Mon Feb 14 14:30:20 CET 2000 Werner Koch * sig-check.c (check_key_signature2): Add new arg r_expired. (do_signature_check): New arg to pass it down to ... (do_check): New arg r-expire which is set when the signature has expired. * trustdb.c (check_sig_record): Set SIGF_EXPIRED flag and set the expiretime to zero so that thi signature will not be checked anymore. Fri Feb 11 17:44:40 CET 2000 Werner Koch * g10.c (g10_exit): Update the random seed_file. (main): Set the random seed file. New option --no-random-seed-file. Thu Feb 10 17:39:44 CET 2000 Werner Koch * keyedit.c (menu_expire): Fixed segv due to unitialized sub_pk. By Rémi. Thu Feb 10 11:39:41 CET 2000 Werner Koch * keylist.c (list_keyblock): Don't print warnings in the middle of regulat output lines. By Rémi. * sig-check.c: Include options.h Wed Feb 9 15:33:44 CET 2000 Werner Koch * gpg.c: New option --ignore-time-conflict * sig-check.c (do_check): Implemented this option. * trustdb.c (check_trust): Ditto. * sign.c (do_sign): Ditto. * keygen.c (generate_subkeypair): Ditto. * encode.c (encode_simple): use iobuf_cancel after open failure. Reported by Huy Le. Fri Jan 14 18:32:01 CET 2000 Werner Koch * packet.h (STRING2KEY): Changed mode from byte to int. * parse-packet.c (parse_key): Add the special GNU protection stuff * build-packet.c (so_secret_key): Ditto. * seckey-cert.c (do_check): Ditto. * keyedit.c (change_passphrase): Ditto. * export.c (export_secsubkeys): New. (do_export_stream): Hack to export the primary key using mode 1001. * g10.c: New command --export-secret-subkeys Thu Jan 13 19:31:58 CET 2000 Werner Koch * armor.c (is_armored): Check for 1-pass-sig packets. Reported by David Hallinan . (armor_filter): Replaced one LF by the LF macro. Reported by Wolfgang Redtenbacher. Wed Jan 5 11:51:17 CET 2000 Werner Koch * g10.c (main): Reset new global flag opt.pgp2_workarounds when --openpgp is used. * mainproc.c (proc_plaintext): Do the PGP2,5 workarounds only when the global flag is set. (proc_tree): Ditto. * textfilter.c (copy_clearsig_text): Ditto. * armor.c (armor_filter): Ditto. * g10.c: New option --list-only * mainproc.c (proc_tree): Don't do it if opt.list_only is active. (proc_pubkey_enc): Implement option. * status.h, status.c ({BEGIN,END}_{EN,DE}CRYPTION): New. * cipher.c (cipher_filter): New status outputs. * mainproc.c (proc_encrypted): New status outputs. Fri Dec 31 14:08:15 CET 1999 Werner Koch * armor.c (armor_filter): Made the "Comment:" header translatable. * hkp.c (hkp_import): Make sure that the program does not return success when there is a connection problem. Reported by Phillip Jones. Sun Dec 19 15:22:26 CET 1999 Werner Koch * armor.c (LF): Use this new macro at all places where a line LF is needed. This way DOSish textfiles should be created when the input data is also in dos mode. * sign.c (LF): Ditto. * textfilter.c (LF): Ditto. (copy_clearsig_text): Disabled the forcing of CR,LF sequences for DOS systems. * plaintext.c (handle_plaintext): Fixes for line endings on DOS. and react on a LF in cleartext. * armor.c (fake_packet): Restore the original line ending after removing trailing spaces. * signal.c (got_fatal_signal): DOS fix. Thu Dec 16 10:07:58 CET 1999 Werner Koch * mainproc.c (print_failed_pkenc): Fix for unknown algorithm. Found by fygrave@epr0.org. Thu Dec 9 10:31:05 CET 1999 Werner Koch * hkp.c: i18n the strings. Sat Dec 4 15:32:20 CET 1999 Werner Koch * trustdb.c (verify_key): Shortcut for ultimately trusted keys. Sat Dec 4 12:30:28 CET 1999 Werner Koch * pkclist.c (build_pk_list): Validate the trust using the namehash if this one has been set by the key lookup. * g10.c: Add --delete-secret-key to the help page. * openfile.c (copy_options_file): Made static. (try_make_homedir): New. * ringedit.c (add_keyblock_resource): Use the try_make_hoemdir logic. * tdbio.c (tdbio_set_dbname): Likewise. * keygen.c (generate_user_id): Use m_alloc_clear() here. We should better use an allocation function specific to the user_id packet. * keygen.c (keygen_add_std_prefs): Changed symmetric preferences to include Blowfish again. This is due to it's better speed compared to CAST5. * g10.c (strusage): Print the home directory. * armor.c (armor_filter): Take action on the cancel control msg. * filter.h (armor_filter_context_t): Add cancel flag. Mon Nov 29 21:52:11 CET 1999 Werner Koch * g10.c: New option --fast-list-mode .. * keylist.c (list_keyblock): .. and implemented. * mainproc.c (list_node): Ditto. * import.c (mark_non_selfsigned_uids_valid): Fixed the case that there is a uid without any packet following. Mon Nov 22 11:14:53 CET 1999 Werner Koch * mainproc.c (proc_plaintext): Never enable the hash processing when skip_verify is active. * armor.c (parse_header_line): Stop parsing on a WS line too. Suggested by Aric Cyr. * tdbdump.c (HEXTOBIN): Changed the name of the argument, so that traditional cpp don't mess up the macros. Suggested by Jos Backus. * mainproc.c (list_node): Print the PK algo in the --with-colon mode. * keylist.c (list_keyblock): Ditto. * signal.c (got_fatal_signal): Found the reason why exit(8) did not work - it is better to set the disposition back to default before raising the signal. Print the notice on stderr always. Fri Nov 12 20:33:19 CET 1999 Werner Koch * g10.c (make_username): Swapped the logic. * keylist.c (public_key_list): Now takes a STRLIST as arg and moved the creation ot this list to the caller, so that he can copy with UTF-conversion of user IDs. Changed all callers. (secret_key_list): Likewise. * getkey.c (get_user_id_string_native): New and ... * encode.c (write_pubkey_enc_from_list): ... use it here. * pubring.asc: Updated. * packet.h (PKT_PHOTO_ID): New. * parse-packet.c (parse_photo_id): New. * build-packet.c (do_user_id: Handle photo IDs. (build_packet): Change CTB for photo IDs * free-packet.c (free_user_id): Release memory used for photo IDs * sig-check.c (hash_uid_node): Handle photo IDs too. * trustdb.c (print_uid_from_keyblock): Hash photo ID. (make_uid_records): Ditto. * getkey.c (find_by_name): Ditto. * keyedit.c (show_prefs): Ditto. * keylist.c (list_keyblock): Ditto. Thu Oct 28 16:08:20 CEST 1999 Werner Koch * keygen.c (ask_expire_interval): Print a warning for systems with a signed 32 time_t if the exiration time is beyoind 2038. Fri Oct 8 20:40:50 CEST 1999 Werner Koch * ringedit.c (enum_keyblocks): The last fix way really stupid; reverted and set rt to Unknown. Fri Oct 8 20:32:01 CEST 1999 Werner Koch * ringedit.c (enum_keyblocks): Zero the entire kbpos out on open. * g10.c (oEntropyDLL): Removed option. (main): Made the warning on development versions more verbose. * g10.c (oHonorHttpProxy): New option. * hkp.c (hkp_ask_import,hkp_export): Implement this option. * options.skel: Enable this option for new installations Mon Oct 4 21:23:04 CEST 1999 Werner Koch * import.c (import_keys): Changed calling interface, adjusted caller. (import): Moved printing of stats out ... (print_stats): New. ... to here. (import_keys_stream): Call stats print here. (import_keys): Print stats as totals for all files. * tdbio.h (DIRF_NEWKEYS): New * tdbio.c (tdbio_dump_record): Print the new flag. * trustdb.c (check_trust_record): New arg sigs_only. Adapted all callers. (do_update_trust_record): Removed recheck arg and add a new sigs_only do we can later improve on the performance. Changed all callers too. (check_trustdb): Evalutate the new flag and add a status output. Do a check when the dir record has not been checked. (build_cert_tree): Evaluate the new flag. (check_trust): Ditto. Do a trust_record check, when the dir record is not marked as checked. (mark_fresh_keys): New. (clear_lid_table): New. (sync_trustdb): New. * import.c (import_keys): Call sync_trustdb() after processing. (import_keys_stream): Ditto. * tdbdump.c (import_ownertrust): Ditto. * import.c (import_revoke_cert): Notify the trust DB. (do_update_trust_record): Use |= to set the REVOKED bit and not &=; shame on me for this bad copy+paste introduced bug. (do_we_trust): Add trustmask to allow revoked key override to work. Chnaged are to allow return of a mofified trustlevel. Adapted the one caller. * g10.c: New options --emulate-3des-s2k-bug * passphrase.c (hash_passphrase): Implemented above. * mainproc.c (proc_tree): Check for standalone signatures. (do_check_sig): Print a notice for a standalone revocation (check_sig_and_print): Do not print an error for unchecked standalone revocations. Tue Sep 28 20:54:37 CEST 1999 Werner Koch * encode.c (encode_simple): Use new CTB when we don't have the length of the file. This is somewhat strange as the comment above indicates that this part is actually fixed for PGP 5 - maybe I simply lost the source line, tsss. * armor.c (armor_filter): Set a flag if no OpenPGP data has been found. * verify.c (verify_signatures): Add an error helptext. Thu Sep 23 19:24:30 CEST 1999 Werner Koch * openfile.c (open_outfile): Fixed the 8dot3 handling. * passphrase.c (passphrase_to_dek): Print uid using utf8 func. * delkey.c (delete_key): Ditto. * pkclist.c (show_paths,do_edit_ownertrust,do_we_trust): Ditto (do_we_trust_pre): Ditto. * trustdb.c (print_user_id,check_uidsigs): Ditto. * revoke.c (gen_revoke,ask_revoke_sig): Ditto. Thu Sep 23 09:52:58 CEST 1999 Werner Koch * verify.c (print_file_status): New. (verify_one_file): Moved status print to th new fnc. Add error status. * status.c, status.h (STATUS_FILE_ERROR): New Wed Sep 22 10:14:17 CEST 1999 Werner Koch * openfile.c (make_outfile_name): Use case-insenstive compare for DOS systems. Add ".pgp" to the list of know extensions. (open_outfile): For DOS systems try to replace the suffiy instead of appending it. * status.c, status.h: Add STATUS_FILE_{START,DONE}. * verify.c (verify_one_file): Emit these new stati. * sign.c (clearsign_file): Avoid duplicated Entries in the "Hash:" line. Those headers are now only _not_ printed when there are only old-style keys _and_ all hashs are MD5. Mon Sep 20 12:24:41 CEST 1999 Werner Koch * verify.c (verify_files, ferify_one_file): New. * g10.c: New command --verify-files Fri Sep 17 12:56:42 CEST 1999 Werner Koch * g10.c: Add UK spelling as alias for armor options ;-) * import.c (append_uid): Fixed a SEGV when there is no selfsig and no subkey. (merge_sigs): Ditto. Removed the assertion. Wed Sep 15 16:22:17 CEST 1999 Werner Koch * g10.c: New option --entropy-dll-name Mon Sep 13 10:51:29 CEST 1999 Werner Koch * signal.c (got_fatal_signal): Print message using write(2) and only for development versions. Mon Sep 6 19:59:08 CEST 1999 Werner Koch * tdbio.c (tdbio_set_dbname): Use mkdir macro * ringedit.c (add_keyblock_resource): Ditto. Fri Sep 3 10:04:45 CEST 1999 Werner Koch * pkclist.c (build_pk_list): Skip keys set with --encrypt-to also when asking for a key. * plaintext.c (handle_plaintext): Make sure that we don't read a second EOF in the read loop for partial length packets. * mainproc.c (check_sig_and_print): print user ID as utf-8. Thu Sep 2 16:40:55 CEST 1999 Werner Koch * import.c (merge_blocks): First add new subkeys, then merge subkey certificates. (merge_sigs): Don't merge subkey signatures here. Wed Sep 1 15:30:44 CEST 1999 Werner Koch * keygen.c (ask_expire_interval): Fixed bug related to cpr_xx (tnx Francis J. Lacoste). Tue Aug 31 17:20:44 CEST 1999 Werner Koch * plaintext.c (do_hash): Hash CR,LF for a single CR. (ask_for_detached_datafile): Changed arguments to be closer to those of hash_datafiles and cleanup the code a bit. * mainproc.c (proc_tree): Workaround for pgp5 textmode detached signatures. Changed behavior of asking for data file to be the same as with provided data files. * keylist.c (list_keyblock): Use UTF8 print functions. Mon Aug 30 20:38:33 CEST 1999 Werner Koch * import.c (chk_self_sigs): some s/log_error/log_info/ so that gpg does not return an error if a key has some invalid packets. * helptext.c: Fixed some typos and changed the way the translation works. The english text is now the keyword for gettext and not anymore the keyword supplied to the function. Done after some discussion with Walter who thinks this is much easier for the translators. * misc.c (disable_core_dumps): Don't do it for DOSish systems. * signal.c (signal_name): Bounds check on signum. Wed Aug 4 10:34:18 CEST 1999 Werner Koch * pubring.asc: Updated. * pkclist.c (do_we_trust_pre,check_signatures_trust): Do not print the warning about --always_trust when --quiet is used. * pkclist.c (fpr_info): New and called at several places. * parse-packet.c (dump_sig_subpkt): List revocation key contents. Mon Jul 26 09:34:46 CEST 1999 Werner Koch * pkclist.c (build_pk_list): Fixed typo in format string. * trustdb.c (create_shadow_dir): Don't translate the error string. * g10.c (main): Fixed spelling of user-id. * getkey.c (find_by_name_pk,find_by_name_sk, find_by_keyid,find_by_keyid_sk): Ditto and translate it. * import.c (mark_non_selfsigned_uids_valid,delete_inv_parts): Ditto. Mon Jul 26 01:01:39 CEST 1999 Michael Roth * g10.c, options.h: New options --no-literal and --set-filesize * encode.c (encode_simple, encode_crypt): Support for the options --no-literal and --set-filesize. * sign.c (sign_file): ditto. Fri Jul 23 13:53:03 CEST 1999 Werner Koch * ringedit.c (enum_keyblocks): Removed annoying error message in cases when we have no keyring at all to enum. * getkey.c (classify_user_id): Rewrote to relax the recognition of keyIDs and fingerprints (Michael). * mainproc.c (check_sig_and_print): Print status NO_PUBKEY. (print_failed_pkenc): Print status NO_SECKEY. * import.c (mark_non_selfsigned_uids_valid): New. * g10.c: New option --allow-non-selfsigned-uid. * pkclist.c (print_fpr): New. (do_we_trust_pre): Print the fpr before asking whether to use the key anyway. (do_edit_ownertrust): Likewise. Thu Jul 22 20:03:03 CEST 1999 Werner Koch * ringedit.c (enum_keyblocks): Removed annoying error message in cases when we have no keyring at all to enum. * getkey.c (classify_user_id): Rewrote to relax the recognition of keyIDs and fingerprints (Michael). * mainproc.c (check_sig_and_print): Print status NO_PUBKEY. (print_failed_pkenc): Print status NO_SECKEY. * import.c (mark_non_selfsigned_uids_valid): New. * g10.c: New option --allow-non-selfsigned-uid. Thu Jul 15 10:15:35 CEST 1999 Werner Koch * g10.c: New options --disable-{cipher,pubkey}-algo. Wed Jul 14 19:42:08 CEST 1999 Werner Koch * status.h (STATUS_IMPORTED): New. * import.c (import): Print some status information (Holger Schurig). * g10.c (main): Make --no-greeting work again. Add a warning when --force-mds is used. Tue Jul 13 17:39:25 CEST 1999 Werner Koch * pkclist.c (do_edit_ownertrust): Changed the way help works. (build_pk_list): Implemented default recipient stuff. * g10.c: New options --default-recipient[-self] (main): Suppress greeting in most cases, entering a passphrase or a missing value is not considered to be interactive use. Merged --print-md and --print-mds; the latter is now obsolete. Changed the way --gen-random works and documented it. Changed the way --gen-prime works and add a man entry. * g10.c (MAINTAINER_OPTIONS): Removed. Mon Jul 12 18:45:57 CEST 1999 Werner Koch * keyedit.c (keyedit_menu): Add arg sign_mode and changed callers * g10.c (main): New command --lsign-key. Mon Jul 12 14:55:34 CEST 1999 Werner Koch * mainproc.c (kidlist_item): New. (release_list): Release failed pk-enc-list. (print_failed_pkenc): New (proc_encrypted): Print info about failed PK enc. * openfile.c (make_outfile_name): s/error/info/ * passphrase.c (passphrase_to_dek): Return an empty passphrase when in batch mode and don't make the warning message fatal * seckey-cert.c (check_secret_key): Try only once when in batch mode. * g10.c (make_username): New. Thu Jul 8 16:21:27 CEST 1999 Werner Koch * packet.h (PKT_ring_trust): New * parse-packet.c (parse_trust): Store trust value * build-packet (build_packet): Ignore ring trust packets. * mainproc.c (add_ring_trust): New. (list_node): Print "rtv" records. * g10.c: New option --with-fingerprint. * trustdb.c (verify_own_keys): Don't insert if we are dry running (check_trust): Ditto. Wed Jul 7 13:08:40 CEST 1999 Werner Koch * Makefile.am: Support for libtool. * keygen.c (ask_expire_interval): Hack to allow for an expire date. * trustdb.c (do_update_trust_record,update_trust_record): Splitted. (check_trust_record): New. (check_trust,build_cert_tree): Check the dir record as needed. (upd_pref_record): Removed. (make_pref_record): New. (propagate_validity): Stop as soon as we have enough validity. * tbdio.c (MAX_CACHE_ENTRIES_HARD): Increased the limit. Fri Jul 2 11:45:54 CEST 1999 Werner Koch * g10.c (g10_exit): Dump random stats. * sig-check.c (check_key_signature,check_key_signature2): Enhanced version and wrapper for old function. (do_signature_check,signature_check): Ditto. Thu Jul 1 12:47:31 CEST 1999 Werner Koch * keyedit.c (show_key_with_all_names): Print a notice for disabled keys. (enable_disable_keys): Add functionality * pkclist.c (edit_ownertrust): preserve disabled state. (build_pk_list): Skip disabled keys. * trustdb.c (upd_one_ownertrust): Ditto. (build_cert_tree): Mask the ownertrust. (trust_letter): Mask the value. (do_check): Take disabled flag into account. * passphrase.c (passphrase_to_dek): Add a pubkey_algo arg and changed all callers. * g10.c (utf8_strings): 2 new options. * trustdb.c (insert_trust_record_by_pk): New, replaces the next one. (insert_trust_record): Now takes a keyblock as arg. Changed all callers to use the appropritae function. * openfile.c (ask_outfile_name): New. * plaintext.c (handle_plaintext): Ask for filename if there is no valid syntax. Don't use fname varbatim but filter it. Tue Jun 29 21:44:25 CEST 1999 Werner Koch * trustdb.h (TRUST_FLAG_DISABLED): New. * status.c (USE_CAPABILITIES): Capabilities support (Remi). * tdbio.c : Added new fields to the DIR record. (tdbio_write_record): Fixed the update of the hash tables. (tdbio_delete_record): Drop the record from the hash tables. (drop_from_hashtbl): New. * status.c (cpr_get): Special online help mode. * helptext.c ("keyedit.cmd"): Removed. * keyedit.c (keyedit_menu): Use only help system. (enable_disable_key): New bit doies not yet work. Sat Jun 26 12:15:59 CEST 1999 Werner Koch * dearmor.c (enarmor_file): Fixed comment string. * tdbdump.c (export_ownertrust): Text fix. * tbio.c (tdbio_invalid): Ditto. * parse-packet.c (parse_key): Made temp buffer larger. * Makefile.am (install-data-local): Add missing backslashes Tue Jun 15 12:21:08 CEST 1999 Werner Koch * g10.c (main): Made iterated+salted the default S2K method. * Makefile.am (install-data-local): Use DESTDIR. * passphrase.c (passphrase_to_dek): Emit missing-passphrase while in batchmode. * parse-packet.c (parse_pubkeyenc): Fixed a SEGV. Mon Jun 14 21:18:54 CEST 1999 Michael Roth * g10.c: New options --openpgp, --no-tty, --emit-version, --default-comment and --lock-multiple Thu Jun 10 14:18:23 CEST 1999 Werner Koch * free-packet.c (free_encrypted): Fixed EOF case (Remi). (free_plaintext): Ditto. * helptext.c (keyedit.delsig.unknown): New (Remi). * keyedit.c (print_and_check_one_sig): Add arg print_without_key and changed all callers to make use of it (Remi): Tue Jun 8 13:36:25 CEST 1999 Werner Koch * keylist.c (print_key_data): New and called elsewhere. * g10.c: New option --with-key-data Wed Jun 2 14:17:19 CEST 1999 Werner Koch * mainproc.c (proc_tree): Yet another bad hack to cope with broken pgp2 created detached messages in textmode. Tue Jun 1 16:01:46 CEST 1999 Werner Koch * openfile.c (make_outfile_name): New. * plaintext.c (handle_plaintext): Outputfile is now the inputfile without the suffix. * g10.c: New option --use-embedded-filename Mon May 31 19:41:10 CEST 1999 Werner Koch * g10.c (main): Fix for SHM init (Michael). * compress.c, encr-data.c, mdfilter.c, plaintext.c, free-packet.c: Speed patches (Rémi). Thu May 27 09:40:55 CEST 1999 Werner Koch * status.c (cpr_get_answer_yes_no_quit): New. * keyedit.c (menu_delsig): New. (check_all_keysigs): Splitted. (print_and_check_one_sig): New. Wed May 26 14:36:29 CEST 1999 Werner Koch * build-packet.c (build_sig_subpkt): Support large packets. * parse-packet.c (enum_sig_subpkt): Replaces parse_sig_subpkt. * mainproc.c (print_notation_data): Print all notation packets. * g10.c (add_notation_data): Add a way to specify the critical flag. (main): Add option --set-policy-url. (check_policy_url): Basic checks. * sign.c (mk_notation_and_policy): Replaces mk_notation. * parse-packet.c (can_handle_critical): Moved decision whether we can handle critical subpacket to an extra function. Tue May 25 19:50:32 CEST 1999 Werner Koch * sign.c (sign_file): Always use compression algo 1 for signed onyl file becuase we can´ be sure the the verifier supports other algorithms. * build-packet.c (build_sig_subpkt): Support for notation data. * sign.c (sign_file,clearsign_file,make_keysig_packet): Ditto. (mk_notation): New. * g10.c (add_notation_data): New and add option -N * mainproc.c (print_notation_data): New. (check_sig_and_print): Print any notation data of the signed text. Sun May 23 14:20:22 CEST 1999 Werner Koch * pkclist.c (check_signatures_trust): Print a warning and return immediateley if opt.always_trust is true. * g10.c (main): Corrected handling of no-default-keyring * pkclist.c (algo_available): Disable Twofish until we have settled how to do the MDC. * hkp.c: Disable everything for mingw32 Sat May 22 22:47:26 CEST 1999 Werner Koch * mainproc.c (check_sig_and_print): Add sig creation time to the VALIDSIG status output. Add more info to the ERRSIG output. * sig-check.c (signature_check): Add sig time after epoch to SIG_ID. * import.c (import_one): Merge duplicate user IDs. (collapse_uids): New. * kbnode.c (move_kbnode): New. (remove_kbnode): New. * keyedit.c (keyedit_menu): Call collapse_uids. * g10.c: new option --logger-fd. * import.c: s/log_*_f/log_*/ Thu May 20 14:04:08 CEST 1999 Werner Koch * misc.c (pull_in_libs): do the volatile only for gcc * sig-check (signature_check): Emit SIG_iD only for classes 0 and 1. * armor.c (armor_filter): Add detection of PGP2 created clearsigs. (fake_packet): A tab is not a WS for pgp2 - handle this. * textfilter.c (len_without_trailing_chars): New. (copy_clearsig_text): Add pgp2mode arg. * sign.c (clearsign_file): pass old_style to the above fnc. Wed May 19 16:04:30 CEST 1999 Werner Koch * g10.c: New option --interactive. * mainproc.c (proc_plaintext): Add workaround for pgp2 bug (do_check_sig): Ditto. (proc_tree): Ditto. * plaintext.c (do_hash): Ditto. (hash_datafiles): Ditto, add an arg, changed all callers. * mdfilter.c (md_filter): Add support for the alternate hash context. Mon May 17 21:54:43 CEST 1999 Werner Koch * parse-packet.c (parse_encrypted): Support for PKT_ENCRYPTED_MDC. * build-packet.c (do_encrypted_mdc): Ditto. * cipher.c (write_header): Add mdc hashing. (cipher_filter): write out the hash. * mainproc.c (do_proc_packets): Add PKT_ENCRYPTED_MDC. * encr-data.c (decrypt_data): Add mdc hashing. (mdc_decode_filter): New. * parse-packet.c (parse_sig_subpkt): Fixed stupid bug for subpkt length calculation (parse_signature): Fixed even more stupid bug. Sat May 8 19:28:08 CEST 1999 Werner Koch * build-packet.c (do_signature): Removed MDC hack. * encode.c (encode_crypt_mdc): Removed. * mainproc.c (do_check_sig): Removed MDC hack. (check_sig_and_print): Ditto. * parse-packet.c (parse_signature): Ditto. * sig-check.c (mdc_kludge_check): Ditto. * free-packte.c (copy_signature, free_seckey_enc): Ditto. * parse-packet.c (parse_signature,parse_key): Store data of unknown algorithms with mpi_set_opaque inseatd of the old faked data stuff. (read_rest): Removed. (read_rest2): Renamed to read_rest * build-packet.c (write_fake_data): Use mpi_get_opaque. * free-packet.c (cp_fake_data): Removed and cahnged all callers to use mpi_copy. (free_pubkey_enc,free_seckey_enc,release_public_key_parts, release_secret_key_parts): Use mpi_free for opaque data. Thu May 6 14:18:17 CEST 1999 Werner Koch * trustdb.c (check_trust): Check for revoked subkeys. * pkclist.c (do_we_trust): Handled revoked subkeys. (do_we_trust_pre): Ditto. (check_signatures_trust): Ditto. * build-packet.c (hash_public_key): Fix for ancient g10 keys. * mainproc.c (do_proc_packets): Return EOF if no data has been read. * g10.c (main): Catch errors for default operation. Thu Apr 29 12:29:22 CEST 1999 Werner Koch * sign.c (sign_file): Fixed hashing in case of no subpackets. (clearsign_file): Ditto. (make_keysig_packet): Ditto. Wed Apr 28 13:03:03 CEST 1999 Werner Koch * keyedit.c (keyedit_menu): Add new command revkey. * (menu_revkey): New. Mon Apr 26 17:48:15 CEST 1999 Werner Koch * parse-packet.c (parse_signature): Add the MDC hack. * build-packet.c (do_signature): Ditto. * free-packet.c (free_seckey_enc,copy_signature,cmp_signatures): Ditto. * mainproc.c (do_check_sig): Ditto. * sig-check.c (mdc_kludge_check): New. * encode.c (encrypt_mdc_file): New. * keyedit.c (check_all_keysigs): List revocations. * (menu_revsig): New. * sign (make_keysig_packet): Support for class 0x30. Sun Apr 18 20:48:15 CEST 1999 Werner Koch * pkclist.c (select_algo_from_prefs): Fixed the case that one key has no preferences (Remi Guyomarch). keylist.c (list_keyblock): ulti_hack to propagate trust to all uids. Sun Apr 18 10:11:28 CEST 1999 Werner Koch * seckey-cert.c (do_check): Use real IV instead of a 0 one, so that it works even if the length of the IV doesn't match the blocksize. Removed the save_iv stuff. (protect_secret_key): Likewise. Create the IV here. * packet.h (PKT_secret_key): Increased size of IV field and add a ivlen field. * parse-packet.c (parse_key): Use the len protect.ivlen. * build-packet.c (do_secret_key). Ditto. * getkey.c (key_byname): Close keyblocks. * Makefile.am (gpgm): Removed this * g10.c: Merged gpg and gpgm * import.c (import): Utilize option quiet. * tdbio.c (tdbio_set_dbname): Ditto. * ringedit.c (add_keyblock_resource,keyring_copy): Ditto. * keyedit.c (sign_uids): Add some batch support. * g10.c (main): add call to tty_batchmode. Fri Apr 9 12:26:25 CEST 1999 Werner Koch * status.c (write_status_text): Some more status codes. * passphrase_to_dek (passphrase_to_dek): add a status code. * seckey_cert.c (check_secret_key): Likewise. * encr-data.c (decrypt_data): Reverse the last changes * cipher.c (write_header): Ditto. * parse-packet.c (parse_key): Dropped kludge for ancient blowfish mode. Thu Apr 8 09:35:53 CEST 1999 Werner Koch * mainproc.c (proc_encrypted): Add a new status output * passphrase.c (passphrase_to_dek): Ditto. * status.h status.c: Add new status tokens. Wed Apr 7 20:51:39 CEST 1999 Werner Koch * encr-data.c (decrypt_data): Fixes for 128 bit blocksize * cipher.c (write_header): Ditto. * seckey-cert.c (do_check): Ditto. (protect_secret_key). Ditto. * misc.c (print_cipher_algo_note): Twofish is now a standard algo. * keygen.c (do_create): Fixed spelling (Gaël Quéri) (ask_keysize): Only allow keysizes up to 4096 * ringedit.c (add_keyblock_resource): chmod newly created secrings. * import.c (delete_inv_parts): Fixed accidently deleted subkeys. Tue Apr 6 19:58:12 CEST 1999 Werner Koch * armor.c: Removed duped include (John Bley) * mainproc.c: Ditto. * build-packet.c (hash_public_key): Fixed hashing of the header. * import.c (delete_inv_parts): Allow import of own non-exportable sigs. Sat Mar 20 13:59:47 CET 1999 Werner Koch * armor.c (fake_packet): Fix for not not-dash-escaped Sat Mar 20 11:44:21 CET 1999 Werner Koch * g10.c (main): Added command --recv-keys * hkp.c (hkp_import): New. Wed Mar 17 13:09:03 CET 1999 Werner Koch * trustdb.c (check_trust): add new arg add_fnc and changed all callers. (do_check): Ditto. (verify_key): Ditto. (propagate_validity): Use the new add_fnc arg. (print_user_id): Add the FILE arg. (propagate_ownertrust): New. * pkclist.c (add_ownertrust_cb): New and changed the add_ownertrust logic. * getkey.c (get_keyblock_bylid): New. * trustdb.c (print_uid_from_keyblock): New. (dump_tn_tree_with_colons): New. (list_trust_path): Add colon print mode. * trustdb.c (insert_trust_record): Always use the primary key. * encode.c (encode_simple): Added text_mode filter (Rémi Guyomarch) (encode_crypt): Ditto. * mainproc.c (proc_pubkey_enc): Added status ENC_TO. * armor.c (armor_filter): Added status NODATA. * passphrase.c (passphrase_to_dek): Always print NEED_PASSPHRASE * seckey_cert.c (check_secret_key): Added BAD_PASS status. * g10.c (main): Set g10_opt_homedir. Sun Mar 14 19:34:36 CET 1999 Werner Koch * keygen.c (do_create): Changed wording of the note (Hugh Daniel) Thu Mar 11 16:39:46 CET 1999 Werner Koch * tdbdump.c: New * trustdb.c (walk_sigrecs,do_list_sigs,list_sigs, list_records,list_trustdb,export_ownertrust,import_ownertrust): Moved to tdbdump.c (init_trustdb): renamed to setup_trustdb. Changed all callers. (do_init_trustdb): renamed to init_trustdb(). * trustdb.c (die_invalid_db): replaced by tdbio_invalid. * tdbio.c (tdbio_invalid): New. * import.c (delete_inv_parts): Skip non exportable signatures. * keyedit.c (sign_uid_mk_attrib): New. (sign_uids): Add the local argument. (keyedit_menu): New "lsign" command. * trustdb.c (register_trusted_key): Removed this and all related stuff. * g10.c (oTrustedKey): Removed option. * tdbio.h (dir.valcheck): New trustdb field. * tdbio.c: Add support for this field (tdbio_read_modify_stamp): New. (tdbio_write_modify_stamp): New. * trustdb.c (do_check): Check against this field. Removed cache update. (verify_key): Add cache update. (upd_uid_record): Some functional changes. (upd_cert_record): Ditto Wed Mar 10 11:26:18 CET 1999 Werner Koch * keylist.c (list_keyblock): Fixed segv in uid. Print 'u' as validity of sks. Mon Mar 8 20:47:17 CET 1999 Werner Koch * getkey.c (classify_user_id): Add new mode 12 (#). * seckey-cert.c (check_secret_key): replaced error by info. * trustdb.c (query_trust_info): Add another arg, changed all callers. (check_trust): Ditto. (do_check): Ditto. (verify_key): Handle namehash. * keylist.c (list_keyblock): print trust info for user ids. * sig-check.c (signature_check): Add sig-created to status output. Tue Mar 2 16:44:57 CET 1999 Werner Koch * textfilter.c (copy_clearsig_text): New. (clearsign): Removed. * sign.c (clearsign_file): does not use textfiler anymore. * keygen.c (ask_user_id): print a note about the used charset. Tue Mar 2 10:38:42 CET 1999 Werner Koch * sig-check.c (signature_check): sig-id now works for all algos. * armor.c (armor_filter): Fixed armor bypassing. Sun Feb 28 19:11:00 CET 1999 Werner Koch * keygen.c (ask_user_id): Don't change the case of email addresses. (has_invalid_email_chars): Adjusted. * keylist.c (list_one): Really list serect keys (Remi Guyomarch) * keyedit.c (menu_select_uid): Add some braces to make egcs happy. (menu_select_key): Ditto. * mainproc.c (do_proc_packets): List sym-enc packets (Remi Guyomarch) Fri Feb 26 17:55:41 CET 1999 Werner Koch * pkclist.c (build_pk_list): Return error if there are no recipients. * sig-check.c (signature_check): New signature id feature. * armor.c (make_radic64_string): New. * mainproc.c (proc_pubkey_enc): early check for seckey availability. * pkclist.c (do_we_trust_pre): print user id before asking. * ringedit.c (add_keyblock_resource,get_keyblock_handle): Cleaner handling of default resource. Thu Feb 25 18:47:39 CET 1999 Werner Koch * pkclist.c (algo_available): New. (select_algo_from_prefs): Check whether algo is available. * ringedit.c (keyring_copy): Take care of opt.dry_run. (do_gdbm_store): Ditto. * openfile.c (open_outfile). Ditto. (copy_options_file): Ditto. * trustdb.c (update_trustdb): Ditto. (clear_trust_checked_flag): Ditto. (update_trust_record): Ditto. (insert_trust_record): Ditto. Wed Feb 24 11:07:27 CET 1999 Werner Koch * keylist.c (secret_key_list): Now really list the secret key. * trustdb.c (do_init_trustdb): New. Init is now deferred. Mon Feb 22 20:04:00 CET 1999 Werner Koch * getkey.c (lookup_sk): Return G10ERR_NO_SECKEY and not x_PUBKEY. Fri Feb 19 15:49:15 CET 1999 Werner Koch * pkclist.c (select_algo_from_prefs): retrieve LID if not there. * armor.c (fake_packet): Replaced ugly lineending handling. * g10.c (oNoEncryptTo): New. * pkclist.c (build_pk_list): Implemented this option. * g10.c (main): Greeting is now printed to stderr and not to tty. Use add_to_strlist() instead of direct coding. * import.c (import): Use iobuf_push_filter2. * mainproc.c (check_sig_and_print): Print all user ids for good signatures. * getkey.c (get_pubkeyblock): New. * import.c (chk_self_sigs): Fixed SEGV for unbounded class 0x18 keys. (delete_inv_parts): Delete special marked packets. Tue Feb 16 14:10:02 CET 1999 Werner Koch * g10.c (main): New option --encrypt-to * pkclist.c (build_pk_list): Implemented encrypt-to. * parse-packet.c (parse_user_id): Removed the hack to work with utf-8 strings. * g10.c (main): Install lockfile cleanup handler. * tdbio.c (cleanup): Removed: this is now handled by dotlock. Sat Feb 13 14:13:04 CET 1999 Werner Koch * tdbio.c (tdbio_set_dbname): Init lockhandle for a new trustdb Wed Feb 10 17:15:39 CET 1999 Werner Koch * g10.c (main): check for development version now in configure * tdbio.c (tdbio_write_record): Add uid.validity (tdbio_read_record) : Ditto. (tdbio_dump_record) : Ditto. * keygen.c (keygen_add_std_prefs): Replaced Blowfish by Twofish, removed MD5 and Tiger. * pubkey-enc.c (get_it): Suppress warning about missing Blowfish in preferences in certain cases. * ringedit.c (lock_rentry,unlock_rentry): New. * getkey.c (key_byname): Pass ret_kb down to lookup_xx. * armor.c (armor_filter): No output of of empty comment lines. Add option --no-version to suppress the output of the version string. * getkey.c: Release the getkey context for auto context variables. Sun Jan 24 18:16:26 CET 1999 Werner Koch * getkey.c: Changed the internal design to allow simultaneous lookup of multible user ids (get_pubkey_bynames): New. (get_seckey_bynames): New. (get_seckey_next): New. (get_seckey_end): New. * keylist.c (list_one): Use the new functions. * keylist.c (list_keyblock): add a newline for normal listings. * g10.c (--recipient): New option name to replace --remote-user Wed Jan 20 18:59:49 CET 1999 Werner Koch * textfilter.c: Mostly rewritten * plaintext.c (handle_plaintext): Use now text_filter semantics. Tue Jan 19 19:34:58 CET 1999 Werner Koch * export.c (export_pubkeys_stream): New. (do_export_stream): New. * g10.c (aSendKeys): New command. * hkp.c (hkp_export): New. * compress.c (do_uncompress): Hack for algo 1 and 1.1.3 Sun Jan 17 11:04:33 CET 1999 Werner Koch * textfilter.c (text_filter): Now uses iobuf_read_line(). (read_line): Removed. * armor.c (trim_trailing_spaces): Removed and replaced by trim_trailing_ws from libutil Sat Jan 16 12:03:27 CET 1999 Werner Koch * hkp.c (hkp_ask_import): Use only the short keyid Sat Jan 16 09:27:30 CET 1999 Werner Koch * import.c (import_key_stream): New (import): New, moved most of import_keys here. * g10.c: New option --keyserver * mainproc.c (check_sig_and_print): Hook to import a pubkey. * pref.c pref.h : Removed * hkp.c hkp.h: New Wed Jan 13 14:10:15 CET 1999 Werner Koch * armor.c (radix64_read): Print an error if a bad armor was detected. Wed Jan 13 12:49:36 CET 1999 Werner Koch * armor.c (radix64_read): Now handles malformed armors produced by some buggy MUAs. Tue Jan 12 11:17:18 CET 1999 Werner Koch * ringedit.c (find_keyblock_bysk): New. * skc_list.c (is_insecure): New. (build_sk_list): usage check for insecure keys. * import.c (chk_self_sigs): Add handling for subkeys. (delete_inv_parts): Skip unsigned subkeys * sig-check.c (do_check): Print info if the signature is older than the key. * keygen.c (generate_subkeypair): Fail on time warp. * sign.c (do_sign): Ditto. Sun Jan 10 15:10:02 CET 1999 Werner Koch * armor.c (fake_packet): Fixed not-dash-escaped bug. Sat Jan 9 16:02:23 CET 1999 Werner Koch * sig-check.c (do_check): Output time diff on error * status.c (STATUS_VALIDSIG): New. (is_status_enabled): New. * mainproc.c (check_sig_and_print): Issue that status message. * plaintext.c (special_md_putc): Removed * armor.c (armor_filter): print error for truncated lines. * free-packet.c (free_encrypted): Revomed call to set_block_mode. (free_plaintext): Ditto. Thu Jan 7 18:00:58 CET 1999 Werner Koch * pkclist.c (add_ownertrust): Fixed return value. * encr-data.c (decrypt_data): Disabled iobuf_set_limit and iobuf_pop_filter stuff. * compress.c (handle_compressed): Disabled iobuf_pop_filter. * packet.h (PKT_secret_key): Add is_primary flag. * parse-packet.c (parse_key): Set this flag. * passphrase.c (passphrase_to_dek): Kludge to print the primary keyid - changed the API: keyid must now hold 2 keyids. * getkey.c (get_primary_seckey): New. * seckey-cert.c (do_check): pass primary keyid to passphrase query * tbdio.c (open_db): removed the atexit (tdbio_set_dbname): and moved it to here. * armor.c: Rewrote large parts. Tue Dec 29 19:55:38 CET 1998 Werner Koch * revoke.c (gen_revoke): Removed compression. * pkclist.c (do_we_trust_pre): special check for revoked keys * trustdb.c (update_trust_record): Fixed revoke flag. Tue Dec 29 14:41:47 CET 1998 Werner Koch * misc.c (disable_core_dumps): Check for EINVAL (Atari) * getkey (merge_one_pk_and_selfsig): Fixed search of expiredate. (merge_keys_and_selfsig): Ditto. * free-packet.c (cmp_public_keys): cmp expire only for v3 packets (cmp_secret_keys): Ditto. (cmp_public_secret_key): Ditto. Wed Dec 23 17:12:24 CET 1998 Werner Koch * armor.c (find_header): Reset not_dashed at every header Wed Dec 23 13:18:14 CET 1998 Werner Koch * pkclist.c (add_ownertrust): Refresh validity values. * trustdb.c (enum_cert_paths_print): New arg refresh. * ringedit.c: Fixed problems fix keyrings * parse-packet.c (dbg_parse_packet): New debug functions. * getkey.c (getkey_disable_caches): New. * import.c (import_keys): Disable caches. Thu Dec 17 18:31:15 CET 1998 Werner Koch * misc.c (trap_unaligned): Only for glibc 1 * sign.c (write_dash_escaped): Now escapes "From " lines * g10.c: New option --escape-from-lines * trustdb.c (sort_tsl_list): New (list_trust_path): Now prints sorted list. (enum_cert_paths): Likewise. (enum_cert_paths_print): New. (print_paths): New printing format. * pkclist.c (add_ownertrust): New arg quit. (edit_ownertrust): New quit selection and does not query the recipients ownertrust anymore. (add_ownertrust): Print the ceritficate path. Mon Dec 14 21:18:49 CET 1998 Werner Koch * parse-packet.c (parse_signature): Now checks for critical bit (parse_sig_subpkt): Splitted. (parse_one_sig_subpkt): New. * sig-check.c (do_check): handle critical bit. Sun Dec 13 14:10:56 CET 1998 Werner Koch * pcklist.c (select_algo_from_prefs): Preferences should now work (lost the != ? ) Thu Dec 10 20:15:36 CET 1998 Werner Koch * ringedit.c (gdbm_store): Fix for inserts * g10.c (main): New option --export-all * export.c (export_pubkeys): New arg. (do_export): Now may skip old keys. * status.c: Minor patches for Sun's cc * keygen.c (ask_algo): Disabled v3 ElGamal choice, rearranged the numbers. Add a warning question when a sign+encrypt key is selected. * g10.c (do_not_use_RSA): Removed. * misc.c (print_pubkey_algo_note): New as replacement for the do_not_use_RSA() and chnaged all callers. (print_cipher_algo_note): New. (print_hash_algo_note): New. * cipher.c (write_header): Add a call to print_cipher_algo_note. * seckey-cert.c (protect_secret_key): Ditto * sign.c (do_sign): Add a call to print_digest_algo_note. * getkey.c (get_long_user_id_string): New. * mainproc.c (check_sig_and_print): Changed the format of the status output. * encrypt.c (write_pubkey_enc_from_list): print used symmetric cipher. * pkclist.c (do_we_trust): Changed a message. Wed Dec 9 13:41:06 CET 1998 Werner Koch * misc.c (trap_unaligned) [ALPHA]: Only if UAC_SIGBUS is defined. * sign.c (write_dash_escaped): Add the forgotten patch by Brian Moore. * compress.c (do_uncompress): Fixed the inflating bug. Tue Dec 8 13:15:16 CET 1998 Werner Koch * trustdb.c (upd_uid_record): Now uses the newest self-signature (insert_trust_record): Now calls update with recheck set to true. (register_trusted_key): New. (verify_own_keys): Enhanced by list of trusted keys. * g10.c (main): Print a warning when a devel version is used. (main): New option --trusted-key * import.c (merge_blocks): Fixed merging of new user ids and added merging of subkeys. (append_uid): Ditto. (merge_keysig): New. (append_key): New. * getkey.c (merge_one_pk_and_selfsig): Get the expiration time from the newest self-signature. (merge_keys_and_selfsig): Ditto. * free-packet.c (cmp_secret_key): New. Fri Nov 27 21:37:41 CET 1998 Werner Koch * g10.c: New option --lock-once * tdbio.c (open_db): Add an atexit (cleanup): New. (tdbio_sync): Add locking. (tdbio_end_transaction): Ditto. (put_record_into_cache): Ditto. * ringedit.c (keyring_copy): Ditto. (cleanup): New. (add_keyblock_resource): Add an atexit. Fri Nov 27 15:30:24 CET 1998 Werner Koch * armor.c (find_header): Another fix for clearsigs. Fri Nov 27 12:39:29 CET 1998 Werner Koch * status.c (display_help): Removed. * helptext.c: New and removed the N_() from all cpr_gets. Fri Nov 20 16:54:52 1998 Werner Koch (wk@isil.d.shuttle.de) * g10.c (main): New option --not-dash-escaped * sign.c (write_dashed_escaped): Ditto. * armor.c (find_header): Support for NotDashEscaped header. * getkey.c: print "disabled cache.." only if verbose is used. Thu Nov 19 07:17:31 1998 Werner Koch * parse-packet.c (dump_sig_subpkt): Fixed expire listing * getkey.c (merge_keys_and_selfsig): Fixed expire calculation. (merge_one_pk_and_selfsig): Ditto. * keyedit.c (menu_expire). Ditto. * keygen.c (keygen_add_key_expire): Ditto. (ask_expire_interval): New and changed all local function to use this instead. (keygen_add_key_expire): Opaque should now be a public key; changed all callers. * parse.packet.c (parse): use skip_rest to skip packets. * keyedit.c (keyedit_menu): New arg for cmdline cmds. Wed Nov 18 20:33:50 1998 Werner Koch (wk@isil.d.shuttle.de) * trustdb.c (check_trustdb): Now rechecks all gived userids. (collect_paths): Some fixes. (upd_pref_records): Skips empty items, evaluate all items. * parse-packet.c (dump_sig_subpkt): Better listing of prefs. (skip_packet): Now knows about marker packet * g10.c: removed cmd "--edit-sig". * pubring.asc: Updated. Sat Nov 14 14:01:29 1998 Werner Koch (wk@isil.d.shuttle.de) * g10.c (main): Changed syntax of --list-trust-path * trustdb.c (list_trust_path): Replaced max_depth by opt.max_cert_depth Fri Nov 13 07:39:58 1998 Werner Koch * trustdb.c (collect_paths): Removed a warning message. (enum_trust_web): Removed. (enum_cert_paths): New. * pkclist.c (add_ownertrust): Changed to use enum_cert_paths. (edit_ownertrust): Now list ceritficates on request. (show_paths): New. Wed Nov 11 18:05:44 1998 Werner Koch * g10.c (main): New option --max-cert-depth * tdbio.h: add new fields to ver and dir record. * tdbio.c: read/write/dump of these fields. (tdbio_db_matches_options): New. * trustdb.c: replaced MAC_CERT_DEPTH by opt.max_cert_depth. (do_check): cache validity and changed other functions to reset the cached value. * keylist.c (list_one): Now lists the ownertrust. * mainproc.c (list_node): Ditto. Tue Nov 10 10:08:59 1998 Werner Koch (wk@isil.d.shuttle.de) * g10.c (g10_exit): Now looks at the new g10_errors_seen. * mainproc.c (check_sig_and_print): Sets g10_errors_seen. * *.c : i18n many more strings. * ringedit.c (locate_keyblock_by_keyid): Add HAVE_LIBGDBM (locate_keyblock_by_fpr): Ditto. * g10.c (main): removed unsused "int errors". (main): Add new option --charset. * g10.c (main): special message for the unix newbie. Mon Nov 9 07:17:42 1998 Werner Koch * getkey.c (finish_lookup): Kludge to prefere algo 16. * trustdb.c (new_lid_table): Clear cached item. * status.c (cpr_get_utf8): New. * pkclist.c (build_pk_list): Uses this. Sun Nov 8 17:20:39 1998 Werner Koch (wk@isil.d.shuttle.de) * mainproc.c (check_sig_and_print): Why did I use strlen()-1 in the printf? - This truncated the TZ. Sat Nov 7 15:57:28 1998 me,,, (wk@tobold) * getkey.c (lookup): Changes to support a read_next. (get_pubkey): Fixed a memory leak. * keylist.c (list_one): Now lists all matching user IDs. Tue Nov 3 16:19:21 1998 Werner Koch (wk@isil.d.shuttle.de) * keygen.c (ask_user_id): Now converted to UTF-8 * g10.c (main): Kludge for pgp clearsigs and textmode. Fri Oct 30 16:40:39 1998 me,,, (wk@tobold) * signal.c (block_all_signals): New. (unblock_all_signals): New * tdbio.c (tdbio_end_transaction): Now blocks all signals. * trustdb.c (new_lid_table): Changed the representation of the former local_lid_info stuff. * trustdb.c (update_trust_record): Reorganized the whole thing. * sig-check.c (check_key_signature): Now handles class 0x28 Wed Oct 28 18:56:33 1998 me,,, (wk@tobold) * export.c (do_export): Takes care of the exportable sig flag. Tue Oct 27 14:53:04 1998 Werner Koch (wk@isil.d.shuttle.de) * trustdb.c (update_trust_record): New "fast" parameter. Sun Oct 25 19:32:05 1998 Werner Koch (wk@isil.d.shuttle.de) * openfile.c (copy_options_File): New. * ringedit.c (add_keyblock_resource): Creates options file * tdbio.c (tdbio_set_dbname): Ditto. Sat Oct 24 14:10:53 1998 brian moore * mainproc.c (proc_pubkey_enc): Don't release the DEK (do_proc_packets): Ditto. Fri Oct 23 06:49:38 1998 me,,, (wk@tobold) * keyedit.c (keyedit_menu): Comments are now allowed * trustdb.c: Rewrote large parts. Thu Oct 22 15:56:45 1998 Michael Roth (mroth@nessie.de) * encode.c: (encode_simple): Only the plain filename without a given directory is stored in generated packets. (encode_crypt): Ditto. * sign.c: (sign_file) Ditto. Thu Oct 22 10:53:41 1998 Werner Koch (wk@isil.d.shuttle.de) * trustdb.c (update_trust_record): Add new optional arg. * import.c (import_keys): Add statistics output * trustdb.c (update_trustdb): Ditto. (insert_trustdb): Ditto. * tdbio.c (tdbio_begin_transaction): New. (tdbio_end_transaction): New. (tdbio_cancel_transaction): New. * g10.c (main): New option --quit. * trustdb.c (check_hint_sig): No tests for user-id w/o sig. This caused an assert while checking the sigs. * trustdb.c (upd_sig_record): Splitted into several functions. * import.c (import_keys): New arg "fast". * g10.c (main): New command --fast-import. Wed Oct 21 18:19:36 1998 Michael Roth * ringedit.c (add_keyblock_resource): Directory is now created. * tdbio.c (tdbio_set_dbname): New info message. Wed Oct 21 11:52:04 1998 Werner Koch (wk@isil.d.shuttle.de) * trustdb.c (update_trustdb): released keyblock in loop. * keylist.c (list_block): New. (list_all): Changed to use list_block. * trustdb.c: Completed support for GDBM * sign.c (only_old_style): Changed the way force_v3 is handled (sign_file): Ditto. (clearsign_file): Ditto. * keygen.c (has_invalid_email_chars): Splitted into mailbox and host part. * keylist.c (list_one): Add a merge_keys_and_selfsig. * mainproc.c (proc_tree): Ditto. Sun Oct 18 11:49:03 1998 Werner Koch (wk@isil.d.shuttle.de) * sign.c (only_old_style): Add option force_v3_sigs (sign_file): Fixed a bug in sig->version (clearsign_file): Ditto. * parse-packet.c (dump_sig_subpkt): New * keyedit.c (menu_expire): New. * free-packet.c (cmp_signatures): New Sat Oct 17 10:22:39 1998 Werner Koch (wk@isil.d.shuttle.de) * armor.c: changed output line length from 72 to 64. * keyedit.c (fix_keyblock): New. Fri Oct 16 10:24:47 1998 Werner Koch (wk@isil.d.shuttle.de) * trustdb.c: Rewrote most. * tdbio.c: Add cache and generalized hash tables. * options.h (ENABLE_COMMENT_PACKETS): New but undef'ed. * encode.c, sign.c, keygen.c: Disabled comment packets. * export.c (do_export): Comment packets are never exported, except for those in the secret keyring. * g10.c (main): Removed option do-no-export-rsa; should be be replaced by a secpial tool. * export.c (do_export): Removed the code for the above option. * armor.c (find_header): Support for new only_keyblocks. * import.c (import_keys): Only looks for keyblock armors. * packet.h: replaced valid_days by expiredate and changed all users. * build-packet.c (do_public_key): calculates valid-days (do_secret_key): Ditto. * parse-packet.c (parse_key): expiredate is calucated from the valid_period in v3 packets. * keyid.c (do_fingerprint_md): calculates valid_dates. * keygen.c (add_key_expire): fixed key expiration time for v4 packets. * armor.c (find_header): A LF in the first 28 bytes was skipped for non-armored data. Thu Oct 8 11:35:51 1998 Werner Koch (wk@isil.d.shuttle.de) * armor.c (is_armored): Add test on old comment packets. * tdbio.c (tdbio_search_dir_bypk): fixed memory leak. * getkey.c: Changed the caching algorithms. Wed Oct 7 19:33:28 1998 Werner Koch (wk@isil.d.shuttle.de) * kbnodes.c (unused_nodes): New. Wed Oct 7 11:15:36 1998 Werner Koch (wk@isil.d.shuttle.de) * keyedit.c (sign_uids): Fixed a problem with SK which could caused a save of an unprotected key. (menu_adduid): Ditto. * keyedit.c (keyedit_menu): Prefs are now correctly listed for new user ids. * trustdb.c (update_trust_record): New. (insert_trust_record): Now makes use of update_trust_record. Tue Oct 6 16:18:03 1998 Werner Koch (wk@isil.d.shuttle.de) * trustdb.c (read_record): replaces most of the tdbio_read_records. (write_record): Ditto. Sat Oct 3 11:01:21 1998 Werner Koch (wk@isil.d.shuttle.de) * keygen.c (ask_alogo): enable ElGamal enc-only only for addmode. Wed Sep 30 10:15:33 1998 Werner Koch (wk@isil.d.shuttle.de) * import.c (import_one): Fixed update of wrong keyblock. Tue Sep 29 08:32:08 1998 me,,, (wk@tobold) * mainproc.c (proc_plaintext): Display note for special filename. * plaintext.c (handle_plaintext): Suppress output of special file. Mon Sep 28 12:57:12 1998 Werner Koch (wk@isil.d.shuttle.de) * g10.c (verify_own_keys): Add warning if a key is not protected. * passphrase (hash_passphrase): Fixed iterated+salted mode and setup for keysizes > hashsize. * g10.c (main): New options: --s2k-{cipher,digest,mode}. Fri Sep 25 09:34:23 1998 Werner Koch (wk@isil.d.shuttle.de) * g10.c: Chnaged some help texts. Tue Sep 22 19:34:39 1998 Werner Koch (wk@isil.d.shuttle.de) * passphrase.c (read_passphrase_from_fd): fixed bug for long passphrases. Mon Sep 21 11:28:05 1998 Werner Koch (wk@(none)) * getkey.c (lookup): Add code to use the sub key if the primary one does not match the usage. * armor.c (armor_filter): New error message: no valid data found. (radix64_read): Changes to support multiple messages. (i18n.h): New. * mainproc.c (add_onepass_sig): bug fix. Mon Sep 21 08:03:16 1998 Werner Koch (wk@isil.d.shuttle.de) * pkclist.c (do_we_trust): Add keyid to most messages. * passphrase.c (read_passphrase_from_fd): New. (have_static_passphrase): New (get_passphrase_fd): Removed. (set_passphrase_fd): Removed. * g10.c (main): passphrase is now read here. * keyedit.c (keyedit_menu): "help" texts should now translate fine. Mon Sep 21 06:40:02 1998 Werner Koch (wk@isil.d.shuttle.de) * encode.c (encode_simple): Now disables compression when --rfc1991 is used. (encode_crypt): Ditto. Fri Sep 18 16:50:32 1998 Werner Koch (wk@isil.d.shuttle.de) * getkey.c (merge_key_and_selfsig): New. Fri Sep 18 10:20:11 1998 Werner Koch (wk@isil.d.shuttle.de) * pkclist.c (select_algo_from_prefs): Removed 3DES kludge. * seskey.c (make_session_key): Fixed SERIOUS bug introduced by adding the weak key detection code. * sign.c (sign_file): Changed aremor header in certain cases. Tue Sep 15 17:52:55 1998 Werner Koch (wk@isil.d.shuttle.de) * mainproc.c (check_sig_and_print): Replaced ascime by asctimestamp. Mon Sep 14 11:40:52 1998 Werner Koch (wk@isil.d.shuttle.de) * seskey.c (make_session_key): Now detects weak keys. * trustdb (clear_trust_checked_flag): New. * plaintext.c (handle_plaintext): Does no anymore suppress CR from cleartext signed messages. Sun Sep 13 12:54:29 1998 Werner Koch (wk@isil.d.shuttle.de) * trustdb.c (insert_trust_record): Fixed a stupid bug in the free liunked list loops. Sat Sep 12 15:49:16 1998 Werner Koch (wk@isil.d.shuttle.de) * status.c (remove_shmid): New. (init_shm_comprocess): Now sets permission to the real uid. Wed Sep 9 11:15:03 1998 Werner Koch (wk@isil.d.shuttle.de) * packet.h (PKT_pubkey_enc): New flah throw_keyid, and add logic to implement it. * g10.c (main): New Option --throw-keyid * getkey.c (enum_secret_keys): Add new ar and changed all callers. Tue Sep 8 20:04:09 1998 Werner Koch (wk@isil.d.shuttle.de) * delkey.c (delete_key): Moved from keyedit.c. Mon Sep 7 16:37:52 1998 Werner Koch (wk@isil.d.shuttle.de) * build-packet.c (calc_length_header): New arg new_ctb to correctly calculate the length of new style packets. * armor.c (is_armored): Checks for symkey_enc packets. * pkclist.c (select_algo_from_prefs): 3DEs substitute is now CAST5. Tue Aug 11 17:54:50 1998 Werner Koch (wk@isil.d.shuttle.de) * build-packet.c (do_secret_key): Fixed handling of old keys. * getkey.c (compare_name): Fixed exact and email matching * openfile.c (open_outfile): Changed arguments and all callers. Tue Aug 11 09:14:35 1998 Werner Koch (wk@isil.d.shuttle.de) * encode.c (encode_simple): Applied option set-filename and comment. (encode_crypt): Ditto. * sign.c (sign_file): Ditto. * armor.c (armor_filter): Applied option comment. * encode.c (encode_crypt): Moved init_packet to the begin. (encode_simple): add an init_packet(). * comment (write_comment): Now enforces a hash sign as the 1st byte. * import.c (import_one): Add explanation for "no user ids". * compress.c (do_uncompress): Applied Brian Warner's patch to support zlib 1.1.3 etc. * trustdb.c (check_trust): Fixed a problem after inserting new keys. * getkey (lookup): do not return the primary key if usage is given (lookup_sk): Ditto and take usage into account. * status.c (cpr_get_answer_is_yes): add display_help. Mon Aug 10 10:11:28 1998 Werner Koch (wk@isil.d.shuttle.de) * getkey.c (lookup_sk): Now always returns the primary if arg primary is true. (lookup): Likewise. (get_pubkey_byname): Now returns the primary key (get_seckey_byname): Ditto. Mon Aug 10 08:34:03 1998 Werner Koch (wk@isil.d.shuttle.de) * keyid.c (pubkey_letter): ELG_E is now a small g. Sat Aug 8 17:26:12 1998 Werner Koch (wk@isil.d.shuttle.de) * openfile (overwrite_filep): Changed semantics and all callers. Sat Aug 8 12:17:07 1998 Werner Koch (wk@isil.d.shuttle.de) * status.c (display_help): New. Thu Aug 6 16:30:41 1998 Werner Koch,mobil,,, (wk@tobold) * seskey.c (encode_session_key): Now uses get_random_bits(). Thu Aug 6 07:34:56 1998 Werner Koch,mobil,,, (wk@tobold) * ringedit.c (keyring_copy): No more backupfiles for secret keyrings and add additional warning in case of a failed secret keyring operation. Wed Aug 5 11:54:37 1998 Werner Koch (wk@isil.d.shuttle.de) * g10.c (check_opts): Moved to main. Changed def_cipher_algo semantics and chnaged all users. * pubkey-enc.c (get_sssion_key): New informational output about preferences. * parse-packet.c (parse_symkeyenc): Fixed salted+iterated S2K (parse_key): Ditto. * build-packet.c (do_secret_key): Ditto. (do_symkey_enc): Ditto. Tue Aug 4 08:59:10 1998 Werner Koch (wk@isil.d.shuttle.de) * getkey.c (enum_secret_keys): Now returns only primary keys. * getkey (lookup): Now sets the new namehash field. * parse-packet.c (parse_sig_subpkt2): New. * sign.c (sign_file): one-pass sigs are now emiited reverse. Preference data is considered when selecting the compress algo. Wed Jul 29 12:53:03 1998 Werner Koch (wk@isil.d.shuttle.de) * free-packet.c (copy_signature): New. * keygen.c (generate_subkeypair): rewritten * g10.c (aKeyadd): Removed option --add-key Mon Jul 27 10:37:28 1998 Werner Koch (wk@isil.d.shuttle.de) * seckey-cert.c (do_check): Additional check on cipher blocksize. (protect_secret_key): Ditto. * encr-data.c: Support for other blocksizes. * cipher.c (write_header): Ditto. Fri Jul 24 16:47:59 1998 Werner Koch (wk@isil.d.shuttle.de) * kbnode.c (insert_kbnode): Changed semantics and all callers. * keyedit.c : More or less a complete rewrite Wed Jul 22 17:10:04 1998 Werner Koch (wk@isil.d.shuttle.de) * build-packet.c (write_sign_packet_header): New. Tue Jul 21 14:37:09 1998 Werner Koch (wk@isil.d.shuttle.de) * import.c (import_one): Now creates a trustdb record. * g10.c (main): New command --check-trustdb Mon Jul 20 11:15:07 1998 Werner Koch (wk@isil.d.shuttle.de) * genkey.c (generate_keypair): Default key is now DSA with encryption only ElGamal subkey. Thu Jul 16 10:58:33 1998 Werner Koch (wk@isil.d.shuttle.de) * keyid.c (keyid_from_fingerprint): New. * getkey.c (get_pubkey_byfprint): New. Tue Jul 14 18:09:51 1998 Werner Koch (wk@isil.d.shuttle.de) * keyid.c (fingerprint_from_pk): Add argument and changed all callers. (fingerprint_from_sk): Ditto. Tue Jul 14 10:10:03 1998 Werner Koch (wk@isil.d.shuttle.de) * plaintext.c (handle_plaintext): Now returns create error if the file could not be created or the user responded not to overwrite the file. * mainproc.c (proc_plaintext): Tries again if the file could not be created to check the signature without output. * misc.c (disable_core_dumps): New. * g10.c (main): disable coredumps for gpg * g10.c (MAINTAINER_OPTIONS): New to disable some options Mon Jul 13 16:47:54 1998 Werner Koch (wk@isil.d.shuttle.de) * plaintext.c (hash_datafiles): New arg for better support of detached sigs. Changed all callers. * mainproc.c (proc_signature_packets): Ditto. * g10.c (main): New option "compress-sigs" * sig.c (sign_file): detached signatures are not anymore compressed unless the option --compress-sigs is used. Thu Jul 9 19:54:54 1998 Werner Koch (wk@isil.d.shuttle.de) * armor.c: Fixes to allow zero length cleartext signatures Thu Jul 9 14:52:47 1998 Werner Koch (wk@isil.d.shuttle.de) * g10.c (build_list): Now drops setuid. (main): Changed the way keyrings and algorithms are registered . Wed Jul 8 14:17:30 1998 Werner Koch (wk@isil.d.shuttle.de) * packet.h (PKT_public_key): Add field keyid. * parse-packet.c (parse_key): Reset the above field. * keyid.c (keyid_from_pk): Use above field as cache. * tdbio.c, tdbio.h: New * trustdb.c: Moved some functions to tdbio.c. (print_keyid): New. * pkclist.c (check_signatures_trust): New. Wed Jul 8 10:45:28 1998 Werner Koch (wk@isil.d.shuttle.de) * plaintext.c (special_md_putc): New. (handle_plaintext): add clearsig argument * mainproc.c (proc_plaintext): detection of clearsig * sign.c (write_dased_escaped): Changed clearsig format Tue Jul 7 18:56:19 1998 Werner Koch (wk@isil.d.shuttle.de) * armor.c (find_header): Now makes sure that there is only one empty line for clearsigs, as this is what OP now says. Mon Jul 6 13:09:07 1998 Werner Koch (wk@isil.d.shuttle.de) * g10.c (main): New option default-secret-key * getkey.c (get_seckey_byname): support for this option. Mon Jul 6 09:03:49 1998 Werner Koch (wk@isil.d.shuttle.de) * getkey.c (add_keyring): Keyrings are now added to end of the list of keyrings. The first added keyringwill be created. (add_secret_keyring): Likewise. * ringedit.c (add_keyblock_resource): Files are created here. * g10.c (aNOP): Removed * getkey.c (lookup): Add checking of usage for name lookups * packet.h (pubkey_usage): Add a field which may be used to store usage capabilities. * pkclist.c (build_pk_list): getkey now called with usage arg. * skclist.c (build_sk_list): Ditto. * sign.c (clearsign_file): Fixed "Hash:" headers Sat Jul 4 13:33:31 1998 Werner Koch (wk@isil.d.shuttle.de) * trustdb.c (list_ownertrust): New. * g10.c (aListOwnerTrust): New. * g10.c (def_pubkey_algo): Removed. * trustdb.c (verify_private_data): Removed and also the call to it. (sign_private_data): Removed. Fri Jul 3 13:26:10 1998 Werner Koch (wk@isil.d.shuttle.de) * g10.c (aEditKey): was aEditSig. Changed usage msg. * keyedit.c: Done some i18n stuff. * g10.c (do_not_use_RSA): New. * sign.c (do_sign): Add call to above function. * encode.c (write_pubkey_enc_from_list): Ditto. Thu Jul 2 21:01:25 1998 Werner Koch (wk@isil.d.shuttle.de) * parse-packet.c: Now is able sto store data of unknown algorithms. * free-packet.c: Support for this. * build-packet.c: Can write data of packet with unknown algos. Thu Jul 2 11:46:36 1998 Werner Koch (wk@isil.d.shuttle.de) * parse-packet.c (parse): fixed 4 byte length header Wed Jul 1 12:36:55 1998 Werner Koch (wk@isil.d.shuttle.de) * packet.h (new_ctb): New field for some packets * build-packet.c (build_packet): Support for new_ctb * parse-packet.c (parse): Ditto. Mon Jun 29 12:54:45 1998 Werner Koch (wk@isil.d.shuttle.de) * packet.h: changed all "_cert" to "_key", "subcert" to "subkey". * free-packet.c (free_packet): Removed memory leak for subkeys. Sun Jun 28 18:32:27 1998 Werner Koch (wk@isil.d.shuttle.de) * import.c (import_keys): Renamed from import_pubkeys. (import_secret_one): New. * g10.c (aExportSecret): New. * export.c (export_seckeys): New. * parse-packet.c (parse_certificate): Cleaned up. (parse_packet): Trust packets are now considered as unknown. (parse_pubkey_warning): New. Fri Jun 26 10:37:35 1998 Werner Koch (wk@isil.d.shuttle.de) * keygen.c (has_invalid_email_chars): New. Wed Jun 24 16:40:22 1998 Werner Koch (wk@isil.d.shuttle.de) * armor.c (armor_filter): Now creates valid onepass_sig packets with all detected hash algorithms. * mainproc.c (proc_plaintext): Now uses the hash algos as specified in the onepass_sig packets (if there are any) Mon Jun 22 11:54:08 1998 Werner Koch (wk@isil.d.shuttle.de) * plaintext.c (handle_plaintext): add arg to disable outout * mainproc.c (proc_plaintext): disable output when in sigs_only mode. Thu Jun 18 13:17:27 1998 Werner Koch (wk@isil.d.shuttle.de) * keygen.c: Removed all rsa packet stuff, chnaged defaults for key generation. Sun Jun 14 21:28:31 1998 Werner Koch (wk@isil.d.shuttle.de) * misc.c (checksum_u16): Fixed a stupid bug which caused a wrong checksum calculation for the secret key protection and add a backward compatibility option. * g10.c (main): Add option --emulate-checksum-bug. Thu Jun 11 13:26:44 1998 Werner Koch (wk@isil.d.shuttle.de) * packet.h: Major changes to the structure of public key material which is now stored in an array and not anaymore in a union of algorithm specific structures. These is needed to make the system more extendable and makes a lot of stuff much simpler. Changed all over the system. * dsa.c, rsa.c, elg.c: Removed. Wed Jun 10 07:22:02 1998 Werner Koch,mobil,,, (wk@tobold) * g10.c ("load-extension"): New option. Mon Jun 8 22:23:37 1998 Werner Koch (wk@isil.d.shuttle.de) * seckey-cert.c (do_check): Removed cipher constants (protect_secret_key): Ditto. Fri May 29 10:00:28 1998 Werner Koch (wk@isil.d.shuttle.de) * trustdb.c (query_trust_info): New. * keylist.c (list_one): Add output of trust info * mainproc (list_node): ditto. * g10.c (main): full trustdb init if -with-colons and any of the key list modes. Thu May 28 10:34:42 1998 Werner Koch (wk@isil.d.shuttle.de) * status.c (STATUS_RSA_OR_IDEA): New. * sig-check.c (check_signature): Output special status message. * pubkey-enc.c (get_session_key): Ditto. * mainproc.c (check_sig_and_print): Changed format of output. * passpharse.c (passphrase_to_dek): Likewise. Wed May 27 13:46:48 1998 Werner Koch (wk@isil.d.shuttle.de) * g10.c (aListSecretKeys): New option --list-secret-keys * keylist.c (std_key_list): Renamed to public_key_list. (secret_key_list): New (list_one, list_all): Add support for secret keys. * getkey.c (get_secret_keyring): New. * mainproc.c (list_node): Add option --with-colons for secret keys * sig-check.c (check_key_signature): detection of selfsigs * mainproc.c (list_node): fixed listing. * g10.c (aListSecretKeys): New option --always-trust * pkclist.c (do_we_trust): Override per option added * status.c (write_status_text): Add a prefix to every output line. Wed May 27 07:49:21 1998 Werner Koch (wk@isil.d.shuttle.de) * g10 (--compress-keys): New. * options.h (compress_keys): New. * export.c (export_pubkeys): Only compresses with the new option. Tue May 26 11:24:33 1998 Werner Koch (wk@isil.d.shuttle.de) * passphrase.c (get_last_passphrase): New (set_next_passphrase): New. (passphrase_to_dek): add support for the above functions. * keyedit.c (make_keysig_packet): Add sigclass 0x18, changed all callers due to a new argument. * keygen.c (write_keybinding): New (generate_subkeypair): Add functionality (ask_algo, ask_keysize, ask_valid_days): Broke out of generate_keypair (ask_user_id, ask_passphrase): Ditto. Thu May 21 11:26:13 1998 Werner Koch (wk@isil.d.shuttle.de) * g10.c,gpgd.c (main): Does now return an int, so that egcs does not complain. * armor.c (fake_packet): Removed erro message and add a noticed that this part should be fixed. * sign.c (sign_file): Compression now comes in front of encryption. * encode.c (encode_simple): Ditto. (encode_crypt): Ditto. Tue May 19 16:18:19 1998 Werner Koch (wk@isil.d.shuttle.de) * armor.c (fake_packet): Changed assertion to log_error Sat May 16 16:02:06 1998 Werner Koch (wk@isil.d.shuttle.de) * build-packet.c (build_packet): Add SUBKEY packets. Fri May 15 17:57:23 1998 Werner Koch (wk@isil.d.shuttle.de) * sign.c (hash_for): New and used in all places here. * main.h (DEFAULT_): new macros. * g10.c (opt.def_digest_algo): Now set to 0 * compress.c (init_compress): Add support for algo 1 * options.h (def_compress_algo): New * g10.c (main): New option --compress-algo Fri May 15 13:23:59 1998 Werner Koch (wk@isil.d.shuttle.de) * g10.c (print_mds): New feature to print only one hash, chnaged formatting. Thu May 14 15:36:24 1998 Werner Koch (wk@isil.d.shuttle.de) * misc.c (trap_unaligned) [__alpha__]: New * g10.c (trap_unaligned): Add call to this to track down SIGBUS on Alphas (to avoid the slow emulation code). Wed May 13 11:48:27 1998 Werner Koch (wk@isil.d.shuttle.de) * build-packet.c (do_signature): Support for v4 pakets. * keyedit.c (make_keysig_packet): Ditto. * build-packet.c (build_sig_subpkt_from_sig): New. (build_sig_subpkt): New. * elg.c (g10_elg_sign): removed keyid_from_skc. * dsa.c (g10_dsa_sign): Ditto. * rsa.c (g10_rsa_sign): Ditto. * keyedit.c (make_keysig_packet): Add call to keyid_from_skc * sign.c (clearsign_file): Support for v4 signatures. (sign_file): Ditto. Wed May 6 09:31:24 1998 Werner Koch (wk@isil.d.shuttle.de) * parse-packet.c (do_parse): add support for 5 byte length leader. (parse_subpkt): Ditto. * build-packet.c (write_new_header): Ditto. * packet.h (SIGSUBPKT_): New constants. * parse-packet.c (parse_sig_subpkt): Changed name, made global, and arg to return packet length, chnaged all callers Tue May 5 22:11:59 1998 Werner Koch (wk@isil.d.shuttle.de) * keygen.c (gen_dsa): New. * build_packet.c (do_secret_cert): Support for DSA Mon May 4 19:01:25 1998 Werner Koch (wk@isil.d.shuttle.de) * compress.c: doubled buffer sizes * parse-packet.c (do_plaintext): now uses iobuf_read/write. Mon May 4 09:35:53 1998 Werner Koch (wk@isil.d.shuttle.de) * seskey.c (encode_md_value): Add optional argument hash_algo, changed all callers. * passphrase.c (make_dek_from_passphrase): Removed * (get_passhrase_hash): Changed name to passphrase_to_dek, add arg, changed all callers. * all: Introduced the new ELG identifier and added support for the encryption only one (which is okay to use by GNUPG for signatures). Sun May 3 17:50:26 1998 Werner Koch (wk@isil.d.shuttle.de) * packet.h (PKT_OLD_COMMENT): New name for type 16. * parse-packet.c (parse_comment): Now uses type 61 Fri May 1 12:44:39 1998 Werner Koch,mobil,,, (wk@tobold) * packet.h (count): Chnaged s2k count from byte to u32. * seckey-cert.c (do_check): Changed s2k algo 3 to 4, changed reading of count. * build-packet.c (do_secret_cert): ditto. * parse-packet.c (parse_certificate): ditto. * parse-packet.c (parse_symkeyenc): New. * build-packet.c (do_symkey_enc): New. Thu Apr 30 16:33:34 1998 Werner Koch (wk@isil.d.shuttle.de) * sign.c (clearsign_file): Fixed "Hash: " armor line. Tue Apr 28 14:27:42 1998 Werner Koch (wk@isil.d.shuttle.de) * parse-packet.c (parse_subpkt): Some new types. Mon Apr 27 12:53:59 1998 Werner Koch (wk@isil.d.shuttle.de) * g10.c (main): Add option --skip-verify. * mainproc.c (check_sig_and_print): Ditto. * g10.c (print_mds): Add output for Tiger. * sign.c (sign_file): Now uses partial length headers if used in canonical textmode (kludge to fix a bug). * parse-packet.c (parse_certificate): Changed BLOWFISH id. * pubkey-enc.c (get_session_key): Ditto. * seskey.c (make_session_key): Ditto. * seckey-cert.c (protect_secret_key,do_check): Add BLOWFISH160. Fri Apr 24 17:38:48 1998 Werner Koch,mobil,,, (wk@tobold) * sig-check.c (check_key_signature): Add sig-class 0x14..0x17 * keyedit.c (sign-key): Some changes to start with support of the above new sig-classes. Wed Apr 22 09:01:57 1998 Werner Koch,mobil,,, (wk@tobold) * getkey.c (compare_name): add email matching Tue Apr 21 16:17:12 1998 Werner Koch,mobil,,, (wk@tobold) * armor.c (armor_filter): fixed missing last LF before CSUM. Thu Apr 9 11:35:22 1998 Werner Koch (wk@isil.d.shuttle.de) * seckey-cert.c (do_check): New; combines all the check functions into one. * sign.c: removed all key management functions * keyedit.c: New. Thu Apr 9 09:49:36 1998 Werner Koch (wk@isil.d.shuttle.de) * import.c (chk_self_sigs): Changed an error message. Wed Apr 8 16:19:39 1998 Werner Koch (wk@isil.d.shuttle.de) * packet.h: packet structs now uses structs from the pubkey, removed all copy operations from packet to pubkey structs. Wed Apr 8 13:40:33 1998 Werner Koch (wk@isil.d.shuttle.de) * trustdb.c (verify_own_certs): Fixed "public key not found". * getkey.c (key_byname): New, combines public and secret key search. * pkclist.c (build_pkc_list): Add new arg usage, changed all callers. * skclist.c (build_skc_list): Likewise. * ringedit.c (find_keyblock, keyring_search2): Removed. Wed Apr 8 09:47:21 1998 Werner Koch (wk@isil.d.shuttle.de) * sig-check.c (do_check): Applied small fix from Ulf Möller. Tue Apr 7 19:28:07 1998 Werner Koch (wk@isil.d.shuttle.de) * cipher.c, encr-data.c, seckey-cert.c: Now uses cipher_xxxx functions instead of blowfish_xxx or cast_xxx Tue Apr 7 11:04:02 1998 Werner Koch (wk@isil.d.shuttle.de) * Makefile.am (g10maint.o): Changed the way it is created. Mon Apr 6 11:17:08 1998 Werner Koch (wk@isil.d.shuttle.de) * misc.c: New. * keygen.c (checksum,checksum_u16,checksum_mpi): Moved to misc.c * seckey-cert.c: Kludge for wrong ELG checksum implementation. Sat Apr 4 20:07:01 1998 Werner Koch (wk@isil.d.shuttle.de) * cipher.c (cipher_filter): Support for CAST5 * encr-data.c (decode_filter): Ditto. (decrypt_data): Ditto. * seskey.c (make_session_key): Ditto. * seckey-cert.c (check_elg, check_dsa): Ditto, (protect_secret_key): Ditto. * pubkey-enc.c (get_session_key): Ditto. * passphrase.c (hash_passphrase): Ditto. Thu Apr 2 20:22:35 1998 Werner Koch (wk@isil.d.shuttle.de) * gpgd.c: New Thu Apr 2 10:38:16 1998 Werner Koch (wk@isil.d.shuttle.de) * keygen.c (generate_keypair): Add valid_days stuff. * trustdb.c (check_trust): Add check for valid_days. Wed Apr 1 16:15:58 1998 Werner Koch (wk@isil.d.shuttle.de) * keygen.c (generate_keypair): Addional question whether the selected large keysize is really needed. Wed Apr 1 15:56:33 1998 Werner Koch (wk@isil.d.shuttle.de) * seckey-cert.c (protect_secret_key): merged protect_xxx to here. Wed Apr 1 10:34:46 1998 Werner Koch (wk@isil.d.shuttle.de) * Makefile.am (g10maint.c): Changed creation rule, so that it works on FreeBSD (missing CFLAGS). * parse-packet.c (parse_subkey): Removed. Thu Mar 19 15:22:36 1998 Werner Koch (wk@isil.d.shuttle.de) * ringedit.c (keyring_enum): Fixed problem with reading too many packets. Add support to read secret keyrings. * getkey.c (scan_keyring): Removed (lookup): New to replace scan_keyring. (scan_secret_keyring): Removed. (lookup_skc): New. Wed Mar 18 11:47:34 1998 Werner Koch (wk@isil.d.shuttle.de) * ringedit.c (enum_keyblocks): New read mode 11. * keyid.c (elg_fingerprint_md): New and changed all other functions to call this if the packet version is 4 or above. Tue Mar 17 20:46:16 1998 Werner Koch (wk@isil.d.shuttle.de) * parse-packet.c (parse_certificate): Add listing support for subkeys. Tue Mar 17 20:32:22 1998 Werner Koch (wk@isil.d.shuttle.de) * armor.c (is_armored): Allow marker packet. Thu Mar 12 13:36:49 1998 Werner Koch (wk@isil.d.shuttle.de) * trustdb.c (check_trust): Checks timestamp of pubkey. * sig-check. (do_check): Compares timestamps. Tue Mar 10 17:01:56 1998 Werner Koch (wk@isil.d.shuttle.de) * g10.c (main): Add call to init_signals. * signal.c: New. Mon Mar 9 12:43:42 1998 Werner Koch (wk@isil.d.shuttle.de) * dsa.c: New * packet.h, free-packet.c, parse-packet.c : Add support for DSA * sig-check.c, getkey.c, keyid.c, ringedit.c: Ditto. * seckey-cert.c: Ditto. * packet.h : Moved .digest_algo of signature packets to outer structure. Changed all references Sun Mar 8 13:06:42 1998 Werner Koch (wk@isil.d.shuttle.de) * openfile.c : Support for stdout filename "-". * mainproc.c (check_sig_and_print): Enhanced status output: * status.c (write_status_text): New. Fri Mar 6 16:10:54 1998 Werner Koch (wk@isil.d.shuttle.de) * kbnode.c (clone_kbnode): Fixed private_flag. * mainproc.c (list_node): Output of string "Revoked" as user-id. Fri Mar 6 14:26:39 1998 Werner Koch (wk@isil.d.shuttle.de) * g10.c (main): Add userids to "-kv" and cleaned up this stuff. Fri Mar 6 12:45:58 1998 Werner Koch (wk@isil.d.shuttle.de) * g10.c (main): Changed semantics of the list-... commands and added a new one. Removed option "-d" * decrypt.c: New. * trustdb.c (init_trustdb): Autocreate directory only if it ends in "/.gnupg". Thu Mar 5 12:12:11 1998 Werner Koch (wk@isil.d.shuttle.de) * mainproc.c (do_proc_packets): New. Common part of proc_packet. (proc_signature_packets): special version to handle signature data. * verify.c: New. * g10.c (aVerify): New. * plaintext.c (hash_datafiles): New. * compress.c (handle_compressed): Add callback arg, changed caller. Thu Mar 5 10:20:06 1998 Werner Koch (wk@isil.d.shuttle.de) * g10.c: Is nom the common source for gpg and gpgm * g10maint.c: Removed * Makefile.am: Add rule to build g10maint.c Thu Mar 5 08:43:59 1998 Werner Koch (wk@isil.d.shuttle.de) * g10.c (main): Changed the way clear text sigs are faked. Wed Mar 4 19:47:37 1998 Werner Koch (wk@isil.d.shuttle.de) * g10maint.c (aMuttKeyList): New * keylist.c: New. Wed Mar 4 17:20:33 1998 Werner Koch (wk@isil.d.shuttle.de) * getkey.c (get_pubkey_byname): Kludge to allow 0x prefix. Tue Mar 3 13:46:55 1998 Werner Koch (wk@isil.d.shuttle.de) * g10maint.c (main): New option --gen-random. Tue Mar 3 09:50:08 1998 Werner Koch (wk@isil.d.shuttle.de) * g10.c (aDeleteSecretKey): New. (aEditSig): Add option "--edit-key" as synonym for "--edit-sig". (aDeleteSecretKey): New. * getkey.c (seckey_available): New. * sign.c (delete_key): Enhanced to delete secret keys, changed all callers. Mon Mar 2 21:23:48 1998 Werner Koch (wk@isil.d.shuttle.de) * pkc_list.c (build_pkc_list): Add interactive input of user ID. Mon Mar 2 20:54:05 1998 Werner Koch (wk@isil.d.shuttle.de) * pkclist.c (do_we_trust_pre): New. (add_ownertrust): Add message. * trustdb.c (enum_trust_web): Quick fix. Mon Mar 2 13:50:53 1998 Werner Koch (wk@isil.d.shuttle.de) * g10.c (main): New action aDeleteKey * sign.c (delete_key): New. Sun Mar 1 16:38:58 1998 Werner Koch (wk@isil.d.shuttle.de) * trustdb.c (do_check): No returns TRUST_UNDEFINED instead of eof error. Fri Feb 27 18:14:03 1998 Werner Koch (wk@isil.d.shuttle.de) * armor.c (find_header): Removed trailing CR on headers. Fri Feb 27 18:02:48 1998 Werner Koch (wk@isil.d.shuttle.de) * ringedit.c (keyring_search) [MINGW32]: Open and close file here because rename does not work on open files. Chnaged callers. Fri Feb 27 16:43:11 1998 Werner Koch (wk@isil.d.shuttle.de) * sig-check.c (do_check): Add an md_enable. * mainproc.c (do_check_sig): Use md_open in case of detached sig (proc_tree): Take detached sigs into account. Fri Feb 27 15:22:46 1998 Werner Koch (wk@isil.d.shuttle.de) * g10.c (main): Make use of GNUPGHOME envvar. * g10main.c (main): Ditto. Wed Feb 25 11:40:04 1998 Werner Koch (wk@isil.d.shuttle.de) * plaintext.c (ask_for_detached_datafile): add opt.verbose to info output. * openfile.c (open_sigfile): Try also name ending in ".asc" Wed Feb 25 08:41:00 1998 Werner Koch (wk@isil.d.shuttle.de) * keygen.c (generate_keypair): Fixed memory overflow. Tue Feb 24 15:51:55 1998 Werner Koch (wk@isil.d.shuttle.de) * parse-packet.c (parse_certificate): Support for S2K. * build-packet.c (do_secret_cert): Ditto. * keygen.c (gen_elg): Ditto. * seckey-cert.c (check_elg): Ditto (protect_elg): Ditto. * sign.c (chnage_passphrase): Ditto. * passphrase.c (get_passphrase_hash): Support for a salt and changed all callers. (make_dek_from_passphrase): Ditto. Tue Feb 24 12:30:56 1998 Werner Koch (wk@isil.d.shuttle.de) * build-packet.c (hash_public_cert): Disabled debug output. Fri Feb 20 17:22:28 1998 Werner Koch (wk@isil.d.shuttle.de) * trustdb.c (init_trustdb) [MINGW32]: Removed 2nd mkdir arg. (keyring_copy) [MINGW32]: Add a remove prior to the renames. Wed Feb 18 18:39:02 1998 Werner Koch (wk@isil.d.shuttle.de) * Makefile.am (OMIT_DEPENDENCIES): New. * rsa.c: Replaced log_bug by BUG. Wed Feb 18 13:35:58 1998 Werner Koch (wk@isil.d.shuttle.de) * mainproc.c (do_check_sig): Now uses hash_public_cert. * parse-packet.c (parse_certificate): Removed hashing. * packet.h (public_cert): Removed hash variable. * free-packet.c (copy_public_cert, free_public_cert): Likewise. * sig-check.c (check_key_signatures): Changed semantics. Wed Feb 18 12:11:28 1998 Werner Koch (wk@isil.d.shuttle.de) * trustdb.c (do_check): Add handling for revocation certificates. (build_sigrecs): Ditto. (check_sigs): Ditto. Wed Feb 18 09:31:04 1998 Werner Koch (wk@isil.d.shuttle.de) * armor.c (armor_filter): Add afx->hdrlines. * revoke.c (gen_revoke): Add comment line. * dearmor.c (enarmor_file): Ditto. * sig-check.c (check_key_signature): Add handling for class 0x20. * mainproc.c : Ditto. Tue Feb 17 21:24:17 1998 Werner Koch (wk@isil.d.shuttle.de) * armor.c : Add header lines "...ARMORED FILE .." * dearmor.c (enarmor_file): New. * g10maint.c (main): New option "--enarmor" Tue Feb 17 19:03:33 1998 Werner Koch (wk@isil.d.shuttle.de) * mainproc.c : Changed a lot, because the packets are now stored a simple linlked list and not anymore in a complicatd tree structure. Tue Feb 17 10:14:48 1998 Werner Koch (wk@isil.d.shuttle.de) * free_packet.c (cmp_public_certs): New. (cmp_user_ids): New. * kbnode.c (clone_kbnode): New. (release_kbnode): Add clone support. * ringedit.c (find_keyblock_bypkc): New. * sign.c (remove_keysigs): Self signatures are now skipped, changed arguments and all callers. * import.c : Add functionality. Tue Feb 17 09:31:40 1998 Werner Koch (wk@isil.d.shuttle.de) * options.h (homedir): New option. * g10.c, g10maint.c, getkey.c, keygen.c, trustdb.c (opt.homedir): New. * trustdb.c (init_trustdb): mkdir for hoem directory (sign_private_data): Renamed "sig" to "g10.sig" Mon Feb 16 20:02:03 1998 Werner Koch (wk@isil.d.shuttle.de) * kbnode.c (commit_kbnode): New. (delete_kbnode): removed unused first arg. Changed all Callers. * ringedit.c (keyblock_resource_name): New. (get_keyblock_handle): NULL for filename returns default resource. Mon Feb 16 19:38:48 1998 Werner Koch (wk@isil.d.shuttle.de) * sig-check.s (check_key_signature): Now uses the supplied public key to check the signature and not any more the one from the getkey.c (do_check): New. (check_signature): Most work moved to do_check. Mon Feb 16 14:48:57 1998 Werner Koch (wk@isil.d.shuttle.de) * armor.c (find_header): Fixed another bug. Mon Feb 16 12:18:34 1998 Werner Koch (wk@isil.d.shuttle.de) * getkey.c (scan_keyring): Add handling of compressed keyrings. Mon Feb 16 10:44:51 1998 Werner Koch (wk@isil.d.shuttle.de) * g10.c, g10maint.c (strusage): Rewrote. (build_list): New Mon Feb 16 08:58:41 1998 Werner Koch (wk@isil.d.shuttle.de) * armor.c (use_armor): New. Sat Feb 14 14:30:57 1998 Werner Koch (wk@isil.d.shuttle.de) * mainproc.c (proc_tree): Sigclass fix. Sat Feb 14 14:16:33 1998 Werner Koch (wk@isil.d.shuttle.de) * armor.c (armor_filter): Changed version and comment string. * encode.c, sign.c, keygen.c: Changed all comment packet strings. Sat Feb 14 12:39:24 1998 Werner Koch (wk@isil.d.shuttle.de) * g10.c (aGenRevoke): New command. * revoke.c: New. * sign.c (make_keysig_packet): Add support for sigclass 0x20. Fri Feb 13 20:18:14 1998 Werner Koch (wk@isil.d.shuttle.de) * ringedit.c (enum_keyblocks, keyring_enum): New. Fri Feb 13 19:33:40 1998 Werner Koch (wk@isil.d.shuttle.de) * export.c: Add functionality. * keygen.c (generate_keypair): Moved the leading comment behind the key packet. * kbnode.c (walk_kbnode): Fixed. * g10.c (main): listing armored keys now work. Fri Feb 13 16:17:43 1998 Werner Koch (wk@isil.d.shuttle.de) * parse-packet.c (parse_publickey, parse_signature): Fixed calls to mpi_read used for ELG b. Fri Feb 13 15:13:23 1998 Werner Koch (wk@isil.d.shuttle.de) * g10.c (main): changed formatting of help output. Thu Feb 12 22:24:42 1998 Werner Koch (wk@frodo) * pubkey-enc.c (get_session_key): rewritten Copyright 1998,1999,2000,2001,2002,2003,2004,2005, 2006,2007 Free Software Foundation, Inc. This file is free software; as a special exception the author gives unlimited permission to copy and/or distribute it, with or without modifications, as long as this notice is preserved. This file is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY, to the extent permitted by law; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. diff --git a/g10/trustdb.c b/g10/trustdb.c index 62eafba0d..ff218ad80 100644 --- a/g10/trustdb.c +++ b/g10/trustdb.c @@ -1,2362 +1,2439 @@ /* trustdb.c - * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, - * 2005 Free Software Foundation, Inc. + * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + * 2007 Free Software Foundation, Inc. * * This file is part of GnuPG. * * GnuPG is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * GnuPG is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ #include #include #include #include #include #ifndef DISABLE_REGEX #include #include #endif /* !DISABLE_REGEX */ #include "gpg.h" #include "status.h" #include "iobuf.h" #include "keydb.h" #include "util.h" #include "options.h" #include "packet.h" #include "main.h" #include "i18n.h" #include "tdbio.h" #include "trustdb.h" /* * A structure to store key identification as well as some stuff needed * for validation */ struct key_item { struct key_item *next; unsigned int ownertrust,min_ownertrust; byte trust_depth; byte trust_value; char *trust_regexp; u32 kid[2]; }; typedef struct key_item **KeyHashTable; /* see new_key_hash_table() */ /* * Structure to keep track of keys, this is used as an array wherre * the item right after the last one has a keyblock set to NULL. * Maybe we can drop this thing and replace it by key_item */ struct key_array { KBNODE keyblock; }; /* control information for the trust DB */ static struct { int init; int level; char *dbname; } trustdb_args; /* some globals */ static struct key_item *user_utk_list; /* temp. used to store --trusted-keys */ static struct key_item *utk_list; /* all ultimately trusted keys */ static int pending_check_trustdb; static int validate_keys (int interactive); /********************************************** ************* some helpers ******************* **********************************************/ static struct key_item * new_key_item (void) { struct key_item *k; k = xmalloc_clear (sizeof *k); return k; } static void release_key_items (struct key_item *k) { struct key_item *k2; for (; k; k = k2) { k2 = k->next; xfree (k->trust_regexp); xfree (k); } } /* * For fast keylook up we need a hash table. Each byte of a KeyIDs * should be distributed equally over the 256 possible values (except * for v3 keyIDs but we consider them as not important here). So we * can just use 10 bits to index a table of 1024 key items. * Possible optimization: Don not use key_items but other hash_table when the * duplicates lists gets too large. */ static KeyHashTable new_key_hash_table (void) { struct key_item **tbl; tbl = xmalloc_clear (1024 * sizeof *tbl); return tbl; } static void release_key_hash_table (KeyHashTable tbl) { int i; if (!tbl) return; for (i=0; i < 1024; i++) release_key_items (tbl[i]); xfree (tbl); } /* * Returns: True if the keyID is in the given hash table */ static int test_key_hash_table (KeyHashTable tbl, u32 *kid) { struct key_item *k; for (k = tbl[(kid[1] & 0x03ff)]; k; k = k->next) if (k->kid[0] == kid[0] && k->kid[1] == kid[1]) return 1; return 0; } /* * Add a new key to the hash table. The key is identified by its key ID. */ static void add_key_hash_table (KeyHashTable tbl, u32 *kid) { struct key_item *k, *kk; for (k = tbl[(kid[1] & 0x03ff)]; k; k = k->next) if (k->kid[0] == kid[0] && k->kid[1] == kid[1]) return; /* already in table */ kk = new_key_item (); kk->kid[0] = kid[0]; kk->kid[1] = kid[1]; kk->next = tbl[(kid[1] & 0x03ff)]; tbl[(kid[1] & 0x03ff)] = kk; } /* * Release a key_array */ static void release_key_array ( struct key_array *keys ) { struct key_array *k; if (keys) { for (k=keys; k->keyblock; k++) release_kbnode (k->keyblock); xfree (keys); } } /********************************************* ********** Initialization ***************** *********************************************/ /* * Used to register extra ultimately trusted keys - this has to be done * before initializing the validation module. * FIXME: Should be replaced by a function to add those keys to the trustdb. */ void register_trusted_keyid(u32 *keyid) { struct key_item *k; k = new_key_item (); k->kid[0] = keyid[0]; k->kid[1] = keyid[1]; k->next = user_utk_list; user_utk_list = k; } void register_trusted_key( const char *string ) { KEYDB_SEARCH_DESC desc; if (classify_user_id (string, &desc) != KEYDB_SEARCH_MODE_LONG_KID ) { log_error(_("`%s' is not a valid long keyID\n"), string ); return; } register_trusted_keyid(desc.u.kid); } /* * Helper to add a key to the global list of ultimately trusted keys. * Retruns: true = inserted, false = already in in list. */ static int add_utk (u32 *kid) { struct key_item *k; for (k = utk_list; k; k = k->next) { if (k->kid[0] == kid[0] && k->kid[1] == kid[1]) { return 0; } } k = new_key_item (); k->kid[0] = kid[0]; k->kid[1] = kid[1]; k->ownertrust = TRUST_ULTIMATE; k->next = utk_list; utk_list = k; if( opt.verbose > 1 ) log_info(_("key %s: accepted as trusted key\n"), keystr(kid)); return 1; } /**************** * Verify that all our secret keys are usable and put them into the utk_list. */ static void verify_own_keys(void) { TRUSTREC rec; ulong recnum; int rc; struct key_item *k; if (utk_list) return; /* scan the trustdb to find all ultimately trusted keys */ for (recnum=1; !tdbio_read_record (recnum, &rec, 0); recnum++ ) { if ( rec.rectype == RECTYPE_TRUST && (rec.r.trust.ownertrust & TRUST_MASK) == TRUST_ULTIMATE) { byte *fpr = rec.r.trust.fingerprint; int fprlen; u32 kid[2]; /* Problem: We do only use fingerprints in the trustdb but * we need the keyID here to indetify the key; we can only * use that ugly hack to distinguish between 16 and 20 * butes fpr - it does not work always so we better change * the whole validation code to only work with * fingerprints */ fprlen = (!fpr[16] && !fpr[17] && !fpr[18] && !fpr[19])? 16:20; keyid_from_fingerprint (fpr, fprlen, kid); if (!add_utk (kid)) log_info(_("key %s occurs more than once in the trustdb\n"), keystr(kid)); } } /* Put any --trusted-key keys into the trustdb */ for (k = user_utk_list; k; k = k->next) { if ( add_utk (k->kid) ) { /* not yet in trustDB as ultimately trusted */ PKT_public_key pk; memset (&pk, 0, sizeof pk); rc = get_pubkey (&pk, k->kid); if (rc) log_info(_("key %s: no public key for trusted key - skipped\n"), keystr(k->kid)); else { update_ownertrust (&pk, ((get_ownertrust (&pk) & ~TRUST_MASK) | TRUST_ULTIMATE )); release_public_key_parts (&pk); } log_info (_("key %s marked as ultimately trusted\n"),keystr(k->kid)); } } /* release the helper table table */ release_key_items (user_utk_list); user_utk_list = NULL; return; } /********************************************* *********** TrustDB stuff ******************* *********************************************/ /* * Read a record but die if it does not exist */ static void read_record (ulong recno, TRUSTREC *rec, int rectype ) { int rc = tdbio_read_record (recno, rec, rectype); if (rc) { log_error(_("trust record %lu, req type %d: read failed: %s\n"), recno, rec->rectype, g10_errstr(rc) ); tdbio_invalid(); } if (rectype != rec->rectype) { log_error(_("trust record %lu is not of requested type %d\n"), rec->recnum, rectype); tdbio_invalid(); } } /* * Write a record and die on error */ static void write_record (TRUSTREC *rec) { int rc = tdbio_write_record (rec); if (rc) { log_error(_("trust record %lu, type %d: write failed: %s\n"), rec->recnum, rec->rectype, g10_errstr(rc) ); tdbio_invalid(); } } /* * sync the TrustDb and die on error */ static void do_sync(void) { int rc = tdbio_sync (); if(rc) { log_error (_("trustdb: sync failed: %s\n"), g10_errstr(rc) ); g10_exit(2); } } static const char * trust_model_string(void) { switch(opt.trust_model) { case TM_CLASSIC: return "classic"; case TM_PGP: return "PGP"; case TM_EXTERNAL: return "external"; case TM_ALWAYS: return "always"; case TM_DIRECT: return "direct"; default: return "unknown"; } } /**************** * Perform some checks over the trustdb * level 0: only open the db * 1: used for initial program startup */ int setup_trustdb( int level, const char *dbname ) { /* just store the args */ if( trustdb_args.init ) return 0; trustdb_args.level = level; trustdb_args.dbname = dbname? xstrdup(dbname): NULL; return 0; } void init_trustdb() { int level = trustdb_args.level; const char* dbname = trustdb_args.dbname; if( trustdb_args.init ) return; trustdb_args.init = 1; if(level==0 || level==1) { int rc = tdbio_set_dbname( dbname, !!level ); if( rc ) log_fatal("can't init trustdb: %s\n", g10_errstr(rc) ); } else BUG(); if(opt.trust_model==TM_AUTO) { /* Try and set the trust model off of whatever the trustdb says it is. */ opt.trust_model=tdbio_read_model(); /* Sanity check this ;) */ if(opt.trust_model!=TM_CLASSIC && opt.trust_model!=TM_PGP && opt.trust_model!=TM_EXTERNAL) { log_info(_("unable to use unknown trust model (%d) - " "assuming %s trust model\n"),opt.trust_model,"PGP"); opt.trust_model=TM_PGP; } if(opt.verbose) log_info(_("using %s trust model\n"),trust_model_string()); } if(opt.trust_model==TM_PGP || opt.trust_model==TM_CLASSIC) { /* Verify the list of ultimately trusted keys and move the --trusted-keys list there as well. */ if(level==1) verify_own_keys(); if(!tdbio_db_matches_options()) pending_check_trustdb=1; } } /*********************************************** ************* Print helpers **************** ***********************************************/ /**************** * This function returns a letter for a trustvalue Trust flags * are ignore. */ static int trust_letter (unsigned int value) { switch( (value & TRUST_MASK) ) { case TRUST_UNKNOWN: return '-'; case TRUST_EXPIRED: return 'e'; case TRUST_UNDEFINED: return 'q'; case TRUST_NEVER: return 'n'; case TRUST_MARGINAL: return 'm'; case TRUST_FULLY: return 'f'; case TRUST_ULTIMATE: return 'u'; default: return '?'; } } /* NOTE TO TRANSLATOR: these strings are similar to those in trust_value_to_string(), but are a fixed length. This is needed to make attractive information listings where columns line up properly. The value "10" should be the length of the strings you choose to translate to. This is the length in printable columns. It gets passed to atoi() so everything after the number is essentially a comment and need not be translated. Either key and uid are both NULL, or neither are NULL. */ const char * uid_trust_string_fixed(PKT_public_key *key,PKT_user_id *uid) { if(!key && !uid) return _("10 translator see trustdb.c:uid_trust_string_fixed"); else if(uid->is_revoked || (key && key->is_revoked)) return _("[ revoked]"); else if(uid->is_expired) return _("[ expired]"); else if(key) switch(get_validity(key,uid)&TRUST_MASK) { case TRUST_UNKNOWN: return _("[ unknown]"); case TRUST_EXPIRED: return _("[ expired]"); case TRUST_UNDEFINED: return _("[ undef ]"); case TRUST_MARGINAL: return _("[marginal]"); case TRUST_FULLY: return _("[ full ]"); case TRUST_ULTIMATE: return _("[ultimate]"); } return "err"; } /* The strings here are similar to those in pkclist.c:do_edit_ownertrust() */ const char * trust_value_to_string (unsigned int value) { switch( (value & TRUST_MASK) ) { case TRUST_UNKNOWN: return _("unknown"); case TRUST_EXPIRED: return _("expired"); case TRUST_UNDEFINED: return _("undefined"); case TRUST_NEVER: return _("never"); case TRUST_MARGINAL: return _("marginal"); case TRUST_FULLY: return _("full"); case TRUST_ULTIMATE: return _("ultimate"); default: return "err"; } } int string_to_trust_value (const char *str) { if(ascii_strcasecmp(str,"undefined")==0) return TRUST_UNDEFINED; else if(ascii_strcasecmp(str,"never")==0) return TRUST_NEVER; else if(ascii_strcasecmp(str,"marginal")==0) return TRUST_MARGINAL; else if(ascii_strcasecmp(str,"full")==0) return TRUST_FULLY; else if(ascii_strcasecmp(str,"ultimate")==0) return TRUST_ULTIMATE; else return -1; } /**************** * Recreate the WoT but do not ask for new ownertrusts. Special * feature: In batch mode and without a forced yes, this is only done * when a check is due. This can be used to run the check from a crontab */ void check_trustdb () { init_trustdb(); if(opt.trust_model==TM_PGP || opt.trust_model==TM_CLASSIC) { if (opt.batch && !opt.answer_yes) { ulong scheduled; scheduled = tdbio_read_nextcheck (); if (!scheduled) { log_info (_("no need for a trustdb check\n")); return; } if (scheduled > make_timestamp ()) { log_info (_("next trustdb check due at %s\n"), strtimestamp (scheduled)); return; } } validate_keys (0); } else log_info (_("no need for a trustdb check with `%s' trust model\n"), trust_model_string()); } /* * Recreate the WoT. */ void update_trustdb() { init_trustdb(); if(opt.trust_model==TM_PGP || opt.trust_model==TM_CLASSIC) validate_keys (1); else log_info (_("no need for a trustdb update with `%s' trust model\n"), trust_model_string()); } void revalidation_mark (void) { init_trustdb(); /* we simply set the time for the next check to 1 (far back in 1970) * so that a --update-trustdb will be scheduled */ if (tdbio_write_nextcheck (1)) do_sync (); pending_check_trustdb = 1; } int trustdb_pending_check(void) { return pending_check_trustdb; } /* If the trustdb is dirty, and we're interactive, update it. Otherwise, check it unless no-auto-check-trustdb is set. */ void trustdb_check_or_update(void) { if(trustdb_pending_check()) { if(opt.interactive) update_trustdb(); else if(!opt.no_auto_check_trustdb) check_trustdb(); } } void read_trust_options(byte *trust_model,ulong *created,ulong *nextcheck, byte *marginals,byte *completes,byte *cert_depth) { TRUSTREC opts; init_trustdb(); read_record(0,&opts,RECTYPE_VER); if(trust_model) *trust_model=opts.r.ver.trust_model; if(created) *created=opts.r.ver.created; if(nextcheck) *nextcheck=opts.r.ver.nextcheck; if(marginals) *marginals=opts.r.ver.marginals; if(completes) *completes=opts.r.ver.completes; if(cert_depth) *cert_depth=opts.r.ver.cert_depth; } /*********************************************** *********** Ownertrust et al. **************** ***********************************************/ static int read_trust_record (PKT_public_key *pk, TRUSTREC *rec) { int rc; init_trustdb(); rc = tdbio_search_trust_bypk (pk, rec); if (rc == -1) return -1; /* no record yet */ if (rc) { log_error ("trustdb: searching trust record failed: %s\n", g10_errstr (rc)); return rc; } if (rec->rectype != RECTYPE_TRUST) { log_error ("trustdb: record %lu is not a trust record\n", rec->recnum); return G10ERR_TRUSTDB; } return 0; } /**************** * Return the assigned ownertrust value for the given public key. * The key should be the primary key. */ unsigned int get_ownertrust ( PKT_public_key *pk) { TRUSTREC rec; int rc; rc = read_trust_record (pk, &rec); if (rc == -1) return TRUST_UNKNOWN; /* no record yet */ if (rc) { tdbio_invalid (); return rc; /* actually never reached */ } return rec.r.trust.ownertrust; } unsigned int get_min_ownertrust (PKT_public_key *pk) { TRUSTREC rec; int rc; rc = read_trust_record (pk, &rec); if (rc == -1) return TRUST_UNKNOWN; /* no record yet */ if (rc) { tdbio_invalid (); return rc; /* actually never reached */ } return rec.r.trust.min_ownertrust; } /* * Same as get_ownertrust but this takes the minimum ownertrust value * into into account, and will bump up the value as needed. */ static int get_ownertrust_with_min (PKT_public_key *pk) { unsigned int otrust,otrust_min; otrust = (get_ownertrust (pk) & TRUST_MASK); otrust_min = get_min_ownertrust (pk); if(otrustnamehash, 20) ) break; recno = vrec.r.valid.next; } if (!recno) /* insert a new validity record */ { memset (&vrec, 0, sizeof vrec); vrec.recnum = tdbio_new_recnum (); vrec.rectype = RECTYPE_VALID; memcpy (vrec.r.valid.namehash, uid->namehash, 20); vrec.r.valid.next = trec.r.trust.validlist; trec.r.trust.validlist = vrec.recnum; } vrec.r.valid.validity = validity; vrec.r.valid.full_count = uid->help_full_count; vrec.r.valid.marginal_count = uid->help_marginal_count; write_record (&vrec); trec.r.trust.depth = depth; write_record (&trec); } /*********************************************** ********* Query trustdb values ************** ***********************************************/ /* Return true if key is disabled */ int cache_disabled_value(PKT_public_key *pk) { int rc; TRUSTREC trec; int disabled=0; if(pk->is_disabled) return (pk->is_disabled==2); init_trustdb(); rc = read_trust_record (pk, &trec); if (rc && rc != -1) { tdbio_invalid (); goto leave; } if (rc == -1) /* no record found, so assume not disabled */ goto leave; if(trec.r.trust.ownertrust & TRUST_FLAG_DISABLED) disabled=1; /* Cache it for later so we don't need to look at the trustdb every time */ if(disabled) pk->is_disabled=2; else pk->is_disabled=1; leave: return disabled; } void check_trustdb_stale(void) { static int did_nextcheck=0; init_trustdb (); if (!did_nextcheck && (opt.trust_model==TM_PGP || opt.trust_model==TM_CLASSIC)) { ulong scheduled; did_nextcheck = 1; scheduled = tdbio_read_nextcheck (); if (scheduled && scheduled <= make_timestamp ()) { if (opt.no_auto_check_trustdb) { pending_check_trustdb = 1; log_info (_("please do a --check-trustdb\n")); } else { log_info (_("checking the trustdb\n")); validate_keys (0); } } } } /* * Return the validity information for PK. If the namehash is not * NULL, the validity of the corresponsing user ID is returned, * otherwise, a reasonable value for the entire key is returned. */ unsigned int get_validity (PKT_public_key *pk, PKT_user_id *uid) { TRUSTREC trec, vrec; int rc; ulong recno; unsigned int validity; u32 kid[2]; PKT_public_key *main_pk; if(uid) namehash_from_uid(uid); init_trustdb (); check_trustdb_stale(); keyid_from_pk (pk, kid); if (pk->main_keyid[0] != kid[0] || pk->main_keyid[1] != kid[1]) { /* this is a subkey - get the mainkey */ main_pk = xmalloc_clear (sizeof *main_pk); rc = get_pubkey (main_pk, pk->main_keyid); if (rc) { char *tempkeystr=xstrdup(keystr(pk->main_keyid)); log_error ("error getting main key %s of subkey %s: %s\n", tempkeystr, keystr(kid), g10_errstr(rc)); xfree(tempkeystr); validity = TRUST_UNKNOWN; goto leave; } } else main_pk = pk; if(opt.trust_model==TM_DIRECT) { /* Note that this happens BEFORE any user ID stuff is checked. The direct trust model applies to keys as a whole. */ validity=get_ownertrust(main_pk); goto leave; } rc = read_trust_record (main_pk, &trec); if (rc && rc != -1) { tdbio_invalid (); return 0; } if (rc == -1) /* no record found */ { validity = TRUST_UNKNOWN; goto leave; } /* loop over all user IDs */ recno = trec.r.trust.validlist; validity = 0; while (recno) { read_record (recno, &vrec, RECTYPE_VALID); if(uid) { /* If a user ID is given we return the validity for that user ID ONLY. If the namehash is not found, then there is no validity at all (i.e. the user ID wasn't signed). */ if(memcmp(vrec.r.valid.namehash,uid->namehash,20)==0) { validity=(vrec.r.valid.validity & TRUST_MASK); break; } } else { /* If no namehash is given, we take the maximum validity over all user IDs */ if ( validity < (vrec.r.valid.validity & TRUST_MASK) ) validity = (vrec.r.valid.validity & TRUST_MASK); } recno = vrec.r.valid.next; } if ( (trec.r.trust.ownertrust & TRUST_FLAG_DISABLED) ) { validity |= TRUST_FLAG_DISABLED; pk->is_disabled=2; } else pk->is_disabled=1; leave: /* set some flags direct from the key */ if (main_pk->is_revoked) validity |= TRUST_FLAG_REVOKED; if (main_pk != pk && pk->is_revoked) validity |= TRUST_FLAG_SUB_REVOKED; /* Note: expiration is a trust value and not a flag - don't know why * I initially designed it that way */ if (main_pk->has_expired || pk->has_expired) validity = (validity & ~TRUST_MASK) | TRUST_EXPIRED; if (pending_check_trustdb) validity |= TRUST_FLAG_PENDING_CHECK; if (main_pk != pk) free_public_key (main_pk); return validity; } int get_validity_info (PKT_public_key *pk, PKT_user_id *uid) { int trustlevel; trustlevel = get_validity (pk, uid); if( trustlevel & TRUST_FLAG_REVOKED ) return 'r'; return trust_letter ( trustlevel ); } const char * get_validity_string (PKT_public_key *pk, PKT_user_id *uid) { int trustlevel; trustlevel = get_validity (pk, uid); if( trustlevel & TRUST_FLAG_REVOKED ) return _("revoked"); return trust_value_to_string(trustlevel); } static void get_validity_counts (PKT_public_key *pk, PKT_user_id *uid) { TRUSTREC trec, vrec; ulong recno; if(pk==NULL || uid==NULL) BUG(); namehash_from_uid(uid); uid->help_marginal_count=uid->help_full_count=0; init_trustdb (); if(read_trust_record (pk, &trec)!=0) return; /* loop over all user IDs */ recno = trec.r.trust.validlist; while (recno) { read_record (recno, &vrec, RECTYPE_VALID); if(memcmp(vrec.r.valid.namehash,uid->namehash,20)==0) { uid->help_marginal_count=vrec.r.valid.marginal_count; uid->help_full_count=vrec.r.valid.full_count; /* printf("Fetched marginal %d, full %d\n",uid->help_marginal_count,uid->help_full_count); */ break; } recno = vrec.r.valid.next; } } void list_trust_path( const char *username ) { } /**************** * Enumerate all keys, which are needed to build all trust paths for * the given key. This function does not return the key itself or * the ultimate key (the last point in cerificate chain). Only * certificate chains which ends up at an ultimately trusted key * are listed. If ownertrust or validity is not NULL, the corresponding * value for the returned LID is also returned in these variable(s). * * 1) create a void pointer and initialize it to NULL * 2) pass this void pointer by reference to this function. * Set lid to the key you want to enumerate and pass it by reference. * 3) call this function as long as it does not return -1 * to indicate EOF. LID does contain the next key used to build the web * 4) Always call this function a last time with LID set to NULL, * so that it can free its context. * * Returns: -1 on EOF or the level of the returned LID */ int enum_cert_paths( void **context, ulong *lid, unsigned *ownertrust, unsigned *validity ) { return -1; } /**************** * Print the current path */ void enum_cert_paths_print( void **context, FILE *fp, int refresh, ulong selected_lid ) { return; } /**************************************** *********** NEW NEW NEW **************** ****************************************/ static int ask_ownertrust (u32 *kid,int minimum) { PKT_public_key *pk; int rc; int ot; pk = xmalloc_clear (sizeof *pk); rc = get_pubkey (pk, kid); if (rc) { log_error (_("public key %s not found: %s\n"), keystr(kid), g10_errstr(rc) ); return TRUST_UNKNOWN; } if(opt.force_ownertrust) { log_info("force trust for key %s to %s\n", keystr(kid),trust_value_to_string(opt.force_ownertrust)); update_ownertrust(pk,opt.force_ownertrust); ot=opt.force_ownertrust; } else { ot=edit_ownertrust(pk,0); if(ot>0) ot = get_ownertrust (pk); else if(ot==0) ot = minimum?minimum:TRUST_UNDEFINED; else ot = -1; /* quit */ } free_public_key( pk ); return ot; } static void mark_keyblock_seen (KeyHashTable tbl, KBNODE node) { for ( ;node; node = node->next ) if (node->pkt->pkttype == PKT_PUBLIC_KEY || node->pkt->pkttype == PKT_PUBLIC_SUBKEY) { u32 aki[2]; keyid_from_pk (node->pkt->pkt.public_key, aki); add_key_hash_table (tbl, aki); } } static void dump_key_array (int depth, struct key_array *keys) { struct key_array *kar; for (kar=keys; kar->keyblock; kar++) { KBNODE node = kar->keyblock; u32 kid[2]; keyid_from_pk(node->pkt->pkt.public_key, kid); printf ("%d:%08lX%08lX:K::%c::::\n", depth, (ulong)kid[0], (ulong)kid[1], '?'); for (; node; node = node->next) { if (node->pkt->pkttype == PKT_USER_ID) { int len = node->pkt->pkt.user_id->len; if (len > 30) len = 30; printf ("%d:%08lX%08lX:U:::%c:::", depth, (ulong)kid[0], (ulong)kid[1], (node->flag & 4)? 'f': (node->flag & 2)? 'm': (node->flag & 1)? 'q':'-'); print_string (stdout, node->pkt->pkt.user_id->name, len, ':'); putchar (':'); putchar ('\n'); } } } } static void store_validation_status (int depth, KBNODE keyblock, KeyHashTable stored) { KBNODE node; int status; int any = 0; for (node=keyblock; node; node = node->next) { if (node->pkt->pkttype == PKT_USER_ID) { PKT_user_id *uid = node->pkt->pkt.user_id; if (node->flag & 4) status = TRUST_FULLY; else if (node->flag & 2) status = TRUST_MARGINAL; else if (node->flag & 1) status = TRUST_UNDEFINED; else status = 0; if (status) { update_validity (keyblock->pkt->pkt.public_key, uid, depth, status); mark_keyblock_seen(stored,keyblock); any = 1; } } } if (any) do_sync (); } /* * check whether the signature sig is in the klist k */ static struct key_item * is_in_klist (struct key_item *k, PKT_signature *sig) { for (; k; k = k->next) { if (k->kid[0] == sig->keyid[0] && k->kid[1] == sig->keyid[1]) return k; } return NULL; } /* * Mark the signature of the given UID which are used to certify it. * To do this, we first revmove all signatures which are not valid and * from the remain ones we look for the latest one. If this is not a * certification revocation signature we mark the signature by setting * node flag bit 8. Revocations are marked with flag 11, and sigs * from unavailable keys are marked with flag 12. Note that flag bits * 9 and 10 are used for internal purposes. */ static void mark_usable_uid_certs (KBNODE keyblock, KBNODE uidnode, u32 *main_kid, struct key_item *klist, u32 curtime, u32 *next_expire) { KBNODE node; PKT_signature *sig; /* first check all signatures */ for (node=uidnode->next; node; node = node->next) { int rc; node->flag &= ~(1<<8 | 1<<9 | 1<<10 | 1<<11 | 1<<12); if (node->pkt->pkttype == PKT_USER_ID || node->pkt->pkttype == PKT_PUBLIC_SUBKEY) break; /* ready */ if (node->pkt->pkttype != PKT_SIGNATURE) continue; sig = node->pkt->pkt.signature; if (main_kid && sig->keyid[0] == main_kid[0] && sig->keyid[1] == main_kid[1]) continue; /* ignore self-signatures if we pass in a main_kid */ if (!IS_UID_SIG(sig) && !IS_UID_REV(sig)) continue; /* we only look at these signature classes */ if(sig->sig_class>=0x11 && sig->sig_class<=0x13 && sig->sig_class-0x10flag |= 1<<12; continue; } node->flag |= 1<<9; } /* reset the remaining flags */ for (; node; node = node->next) node->flag &= ~(1<<8 | 1<<9 | 1<<10 | 1<<11 | 1<<12); /* kbnode flag usage: bit 9 is here set for signatures to consider, * bit 10 will be set by the loop to keep track of keyIDs already * processed, bit 8 will be set for the usable signatures, and bit * 11 will be set for usable revocations. */ /* for each cert figure out the latest valid one */ for (node=uidnode->next; node; node = node->next) { KBNODE n, signode; u32 kid[2]; u32 sigdate; if (node->pkt->pkttype == PKT_PUBLIC_SUBKEY) break; if ( !(node->flag & (1<<9)) ) continue; /* not a node to look at */ if ( (node->flag & (1<<10)) ) continue; /* signature with a keyID already processed */ node->flag |= (1<<10); /* mark this node as processed */ sig = node->pkt->pkt.signature; signode = node; sigdate = sig->timestamp; kid[0] = sig->keyid[0]; kid[1] = sig->keyid[1]; /* Now find the latest and greatest signature */ for (n=uidnode->next; n; n = n->next) { if (n->pkt->pkttype == PKT_PUBLIC_SUBKEY) break; if ( !(n->flag & (1<<9)) ) continue; if ( (n->flag & (1<<10)) ) continue; /* shortcut already processed signatures */ sig = n->pkt->pkt.signature; if (kid[0] != sig->keyid[0] || kid[1] != sig->keyid[1]) continue; n->flag |= (1<<10); /* mark this node as processed */ /* If signode is nonrevocable and unexpired and n isn't, then take signode (skip). It doesn't matter which is older: if signode was older then we don't want to take n as signode is nonrevocable. If n was older then we're automatically fine. */ if(((IS_UID_SIG(signode->pkt->pkt.signature) && !signode->pkt->pkt.signature->flags.revocable && (signode->pkt->pkt.signature->expiredate==0 || signode->pkt->pkt.signature->expiredate>curtime))) && (!(IS_UID_SIG(n->pkt->pkt.signature) && !n->pkt->pkt.signature->flags.revocable && (n->pkt->pkt.signature->expiredate==0 || n->pkt->pkt.signature->expiredate>curtime)))) continue; /* If n is nonrevocable and unexpired and signode isn't, then take n. Again, it doesn't matter which is older: if n was older then we don't want to take signode as n is nonrevocable. If signode was older then we're automatically fine. */ if((!(IS_UID_SIG(signode->pkt->pkt.signature) && !signode->pkt->pkt.signature->flags.revocable && (signode->pkt->pkt.signature->expiredate==0 || signode->pkt->pkt.signature->expiredate>curtime))) && ((IS_UID_SIG(n->pkt->pkt.signature) && !n->pkt->pkt.signature->flags.revocable && (n->pkt->pkt.signature->expiredate==0 || n->pkt->pkt.signature->expiredate>curtime)))) { signode = n; sigdate = sig->timestamp; continue; } /* At this point, if it's newer, it goes in as the only remaining possibilities are signode and n are both either revocable or expired or both nonrevocable and unexpired. If the timestamps are equal take the later ordered packet, presuming that the key packets are hopefully in their original order. */ if (sig->timestamp >= sigdate) { signode = n; sigdate = sig->timestamp; } } sig = signode->pkt->pkt.signature; if (IS_UID_SIG (sig)) { /* this seems to be a usable one which is not revoked. * Just need to check whether there is an expiration time, * We do the expired certification after finding a suitable * certification, the assumption is that a signator does not * want that after the expiration of his certificate the * system falls back to an older certification which has a * different expiration time */ const byte *p; u32 expire; p = parse_sig_subpkt (sig->hashed, SIGSUBPKT_SIG_EXPIRE, NULL ); expire = p? sig->timestamp + buffer_to_u32(p) : 0; if (expire==0 || expire > curtime ) { signode->flag |= (1<<8); /* yeah, found a good cert */ if (next_expire && expire && expire < *next_expire) *next_expire = expire; } } else signode->flag |= (1<<11); } } static int clean_sigs_from_uid(KBNODE keyblock,KBNODE uidnode,int noisy,int self_only) { int deleted=0; KBNODE node; u32 keyid[2]; assert(keyblock->pkt->pkttype==PKT_PUBLIC_KEY); keyid_from_pk(keyblock->pkt->pkt.public_key,keyid); /* Passing in a 0 for current time here means that we'll never weed out an expired sig. This is correct behavior since we want to keep the most recent expired sig in a series. */ mark_usable_uid_certs(keyblock,uidnode,NULL,NULL,0,NULL); /* What we want to do here is remove signatures that are not considered as part of the trust calculations. Thus, all invalid signatures are out, as are any signatures that aren't the last of a series of uid sigs or revocations It breaks down like this: coming out of mark_usable_uid_certs, if a sig is unflagged, it is not even a candidate. If a sig has flag 9 or 10, that means it was selected as a candidate and vetted. If a sig has flag 8 it is a usable signature. If a sig has flag 11 it is a usable revocation. If a sig has flag 12 it was issued by an unavailable key. "Usable" here means the most recent valid signature/revocation in a series from a particular signer. Delete everything that isn't a usable uid sig (which might be expired), a usable revocation, or a sig from an unavailable key. */ for(node=uidnode->next; node && node->pkt->pkttype==PKT_SIGNATURE; node=node->next) { int keep=self_only?(node->pkt->pkt.signature->keyid[0]==keyid[0] && node->pkt->pkt.signature->keyid[1]==keyid[1]):1; /* Keep usable uid sigs ... */ if((node->flag & (1<<8)) && keep) continue; /* ... and usable revocations... */ if((node->flag & (1<<11)) && keep) continue; /* ... and sigs from unavailable keys. */ /* disabled for now since more people seem to want sigs from unavailable keys removed altogether. */ /* if(node->flag & (1<<12)) continue; */ /* Everything else we delete */ /* At this point, if 12 is set, the signing key was unavailable. If 9 or 10 is set, it's superceded. Otherwise, it's invalid. */ if(noisy) log_info("removing signature from key %s on user ID \"%s\": %s\n", keystr(node->pkt->pkt.signature->keyid), uidnode->pkt->pkt.user_id->name, node->flag&(1<<12)?"key unavailable": node->flag&(1<<9)?"signature superceded":"invalid signature"); delete_kbnode(node); deleted++; } return deleted; } /* This is substantially easier than clean_sigs_from_uid since we just have to establish if the uid has a valid self-sig, is not revoked, and is not expired. Note that this does not take into account whether the uid has a trust path to it - just whether the keyholder themselves has certified the uid. Returns true if the uid was compacted. To "compact" a user ID, we simply remove ALL signatures except the self-sig that caused the user ID to be remove-worthy. We don't actually remove the user ID packet itself since it might be ressurected in a later merge. Note that this function requires that the caller has already done a merge_keys_and_selfsig(). TODO: change the import code to allow importing a uid with only a revocation if the uid already exists on the keyring. */ static int clean_uid_from_key(KBNODE keyblock,KBNODE uidnode,int noisy) { KBNODE node; PKT_user_id *uid=uidnode->pkt->pkt.user_id; int deleted=0; assert(keyblock->pkt->pkttype==PKT_PUBLIC_KEY); assert(uidnode->pkt->pkttype==PKT_USER_ID); /* Skip valid user IDs, compacted user IDs, and non-self-signed user IDs if --allow-non-selfsigned-uid is set. */ if(uid->created || uid->flags.compacted || (!uid->is_expired && !uid->is_revoked && opt.allow_non_selfsigned_uid)) return 0; for(node=uidnode->next; node && node->pkt->pkttype==PKT_SIGNATURE; node=node->next) if(!node->pkt->pkt.signature->flags.chosen_selfsig) { delete_kbnode(node); deleted=1; uidnode->pkt->pkt.user_id->flags.compacted=1; } if(noisy) { const char *reason; char *user=utf8_to_native(uid->name,uid->len,0); if(uid->is_revoked) reason=_("revoked"); else if(uid->is_expired) reason=_("expired"); else reason=_("invalid"); log_info("compacting user ID \"%s\" on key %s: %s\n", user,keystr_from_pk(keyblock->pkt->pkt.public_key), reason); xfree(user); } return deleted; } /* Needs to be called after a merge_keys_and_selfsig() */ void clean_one_uid(KBNODE keyblock,KBNODE uidnode,int noisy,int self_only, int *uids_cleaned,int *sigs_cleaned) { int dummy; assert(keyblock->pkt->pkttype==PKT_PUBLIC_KEY); assert(uidnode->pkt->pkttype==PKT_USER_ID); if(!uids_cleaned) uids_cleaned=&dummy; if(!sigs_cleaned) sigs_cleaned=&dummy; /* Do clean_uid_from_key first since if it fires off, we don't have to bother with the other */ *uids_cleaned+=clean_uid_from_key(keyblock,uidnode,noisy); if(!uidnode->pkt->pkt.user_id->flags.compacted) *sigs_cleaned+=clean_sigs_from_uid(keyblock,uidnode,noisy,self_only); } void clean_key(KBNODE keyblock,int noisy,int self_only, int *uids_cleaned,int *sigs_cleaned) { KBNODE uidnode; merge_keys_and_selfsig(keyblock); for(uidnode=keyblock->next; uidnode && uidnode->pkt->pkttype!=PKT_PUBLIC_SUBKEY; uidnode=uidnode->next) if(uidnode->pkt->pkttype==PKT_USER_ID) clean_one_uid(keyblock,uidnode,noisy,self_only, uids_cleaned,sigs_cleaned); } +/* Returns a sanitized copy of the regexp (which might be "", but not + NULL). */ +#ifndef DISABLE_REGEX +static char * +sanitize_regexp(const char *old) +{ + size_t start=0,len=strlen(old),idx=0; + int escaped=0,standard_bracket=0; + char *new=xmalloc((len*2)+1); /* enough to \-escape everything if we + have to */ + + /* There are basically two commonly-used regexps here. GPG and most + versions of PGP use "<[^>]+[@.]example\.com>$" and PGP (9) + command line uses "example.com" (i.e. whatever the user specfies, + and we can't expect users know to use "\." instead of "."). So + here are the rules: we're allowed to start with "<[^>]+[@.]" and + end with ">$" or start and end with nothing. In between, the + only legal regex character is ".", and everything else gets + escaped. Part of the gotcha here is that some regex packages + allow more than RFC-4880 requires. For example, 4880 has no "{}" + operator, but GNU regex does. Commenting removes these operators + from consideration. A possible future enhancement is to use + commenting to effectively back off a given regex to the Henry + Spencer syntax in 4880. -dshaw */ + + /* Are we bracketed between "<[^>]+[@.]" and ">$" ? */ + if(len>=12 && strncmp(old,"<[^>]+[@.]",10)==0 + && old[len-2]=='>' && old[len-1]=='$') + { + strcpy(new,"<[^>]+[@.]"); + idx=strlen(new); + standard_bracket=1; + start+=10; + len-=2; + } + + /* Walk the remaining characters and ensure that everything that is + left is not an operational regex character. */ + for(;start$", then it was escaping the ">" and is fine. If the regexp + actually ended with the bare "\", then it's an illegal regexp and + regcomp should kick it out. */ + + if(standard_bracket) + strcat(new,">$"); + + return new; +} +#endif /*!DISABLE_REGEX*/ + /* Used by validate_one_keyblock to confirm a regexp within a trust signature. Returns 1 for match, and 0 for no match or regex error. */ static int check_regexp(const char *expr,const char *string) { #ifdef DISABLE_REGEX /* When DISABLE_REGEX is defined, assume all regexps do not match. */ return 0; -#elif defined(__riscos__) - return riscos_check_regexp(expr, string, DBG_TRUST); #else int ret; - regex_t pat; + char *regexp; - if(regcomp(&pat,expr,REG_ICASE|REG_NOSUB|REG_EXTENDED)!=0) - return 0; + regexp=sanitize_regexp(expr); - ret=regexec(&pat,string,0,NULL,0); +#ifdef __riscos__ + ret=riscos_check_regexp(expr, string, DBG_TRUST); +#else + { + regex_t pat; - regfree(&pat); + ret=regcomp(&pat,regexp,REG_ICASE|REG_NOSUB|REG_EXTENDED); + if(ret==0) + { + ret=regexec(&pat,string,0,NULL,0); + regfree(&pat); + ret=(ret==0); + } + } +#endif if(DBG_TRUST) - log_debug("regexp `%s' on `%s': %s\n",expr,string,ret==0?"YES":"NO"); + log_debug("regexp `%s' (`%s') on `%s': %s\n", + regexp,expr,string,ret==0?"YES":"NO"); + + xfree(regexp); - return (ret==0); + return ret; #endif } /* * Return true if the key is signed by one of the keys in the given * key ID list. User IDs with a valid signature are marked by node * flags as follows: * flag bit 0: There is at least one signature * 1: There is marginal confidence that this is a legitimate uid * 2: There is full confidence that this is a legitimate uid. * 8: Used for internal purposes. * 9: Ditto (in mark_usable_uid_certs()) * 10: Ditto (ditto) * This function assumes that all kbnode flags are cleared on entry. */ static int validate_one_keyblock (KBNODE kb, struct key_item *klist, u32 curtime, u32 *next_expire) { struct key_item *kr; KBNODE node, uidnode=NULL; PKT_user_id *uid=NULL; PKT_public_key *pk = kb->pkt->pkt.public_key; u32 main_kid[2]; int issigned=0, any_signed = 0; keyid_from_pk(pk, main_kid); for (node=kb; node; node = node->next) { /* A bit of discussion here: is it better for the web of trust to be built among only self-signed uids? On the one hand, a self-signed uid is a statement that the key owner definitely intended that uid to be there, but on the other hand, a signed (but not self-signed) uid does carry trust, of a sort, even if it is a statement being made by people other than the key owner "through" the uids on the key owner's key. I'm going with the latter. However, if the user ID was explicitly revoked, or passively allowed to expire, that should stop validity through the user ID until it is resigned. -dshaw */ if (node->pkt->pkttype == PKT_USER_ID && !node->pkt->pkt.user_id->is_revoked && !node->pkt->pkt.user_id->is_expired) { if (uidnode && issigned) { if (uid->help_full_count >= opt.completes_needed || uid->help_marginal_count >= opt.marginals_needed ) uidnode->flag |= 4; else if (uid->help_full_count || uid->help_marginal_count) uidnode->flag |= 2; uidnode->flag |= 1; any_signed = 1; } uidnode = node; uid=uidnode->pkt->pkt.user_id; /* If the selfsig is going to expire... */ if(uid->expiredate && uid->expiredate<*next_expire) *next_expire = uid->expiredate; issigned = 0; get_validity_counts(pk,uid); mark_usable_uid_certs (kb, uidnode, main_kid, klist, curtime, next_expire); } else if (node->pkt->pkttype == PKT_SIGNATURE && (node->flag & (1<<8)) && uid) { /* Note that we are only seeing unrevoked sigs here */ PKT_signature *sig = node->pkt->pkt.signature; kr = is_in_klist (klist, sig); /* If the trust_regexp does not match, it's as if the sig did not exist. This is safe for non-trust sigs as well since we don't accept a regexp on the sig unless it's a trust sig. */ if (kr && (kr->trust_regexp==NULL || opt.trust_model!=TM_PGP || (uidnode && check_regexp(kr->trust_regexp, uidnode->pkt->pkt.user_id->name)))) { if(DBG_TRUST && opt.trust_model==TM_PGP && sig->trust_depth) log_debug("trust sig on %s, sig depth is %d, kr depth is %d\n", uidnode->pkt->pkt.user_id->name,sig->trust_depth, kr->trust_depth); /* Are we part of a trust sig chain? We always favor the latest trust sig, rather than the greater or lesser trust sig or value. I could make a decent argument for any of these cases, but this seems to be what PGP does, and I'd like to be compatible. -dms */ if(opt.trust_model==TM_PGP && sig->trust_depth && pk->trust_timestamp<=sig->timestamp && (sig->trust_depth<=kr->trust_depth || kr->ownertrust==TRUST_ULTIMATE)) { /* If we got here, we know that: this is a trust sig. it's a newer trust sig than any previous trust sig on this key (not uid). it is legal in that it was either generated by an ultimate key, or a key that was part of a trust chain, and the depth does not violate the original trust sig. if there is a regexp attached, it matched successfully. */ if(DBG_TRUST) log_debug("replacing trust value %d with %d and " "depth %d with %d\n", pk->trust_value,sig->trust_value, pk->trust_depth,sig->trust_depth); pk->trust_value=sig->trust_value; pk->trust_depth=sig->trust_depth-1; /* If the trust sig contains a regexp, record it on the pk for the next round. */ if(sig->trust_regexp) pk->trust_regexp=sig->trust_regexp; } if (kr->ownertrust == TRUST_ULTIMATE) uid->help_full_count = opt.completes_needed; else if (kr->ownertrust == TRUST_FULLY) uid->help_full_count++; else if (kr->ownertrust == TRUST_MARGINAL) uid->help_marginal_count++; issigned = 1; } } } if (uidnode && issigned) { if (uid->help_full_count >= opt.completes_needed || uid->help_marginal_count >= opt.marginals_needed ) uidnode->flag |= 4; else if (uid->help_full_count || uid->help_marginal_count) uidnode->flag |= 2; uidnode->flag |= 1; any_signed = 1; } return any_signed; } static int search_skipfnc (void *opaque, u32 *kid, PKT_user_id *dummy) { return test_key_hash_table ((KeyHashTable)opaque, kid); } /* * Scan all keys and return a key_array of all suitable keys from * kllist. The caller has to pass keydb handle so that we don't use * to create our own. Returns either a key_array or NULL in case of * an error. No results found are indicated by an empty array. * Caller hast to release the returned array. */ static struct key_array * validate_key_list (KEYDB_HANDLE hd, KeyHashTable full_trust, struct key_item *klist, u32 curtime, u32 *next_expire) { KBNODE keyblock = NULL; struct key_array *keys = NULL; size_t nkeys, maxkeys; int rc; KEYDB_SEARCH_DESC desc; maxkeys = 1000; keys = xmalloc ((maxkeys+1) * sizeof *keys); nkeys = 0; rc = keydb_search_reset (hd); if (rc) { log_error ("keydb_search_reset failed: %s\n", g10_errstr(rc)); xfree (keys); return NULL; } memset (&desc, 0, sizeof desc); desc.mode = KEYDB_SEARCH_MODE_FIRST; desc.skipfnc = search_skipfnc; desc.skipfncvalue = full_trust; rc = keydb_search (hd, &desc, 1); if (rc == -1) { keys[nkeys].keyblock = NULL; return keys; } if (rc) { log_error ("keydb_search_first failed: %s\n", g10_errstr(rc)); xfree (keys); return NULL; } desc.mode = KEYDB_SEARCH_MODE_NEXT; /* change mode */ do { PKT_public_key *pk; rc = keydb_get_keyblock (hd, &keyblock); if (rc) { log_error ("keydb_get_keyblock failed: %s\n", g10_errstr(rc)); xfree (keys); return NULL; } if ( keyblock->pkt->pkttype != PKT_PUBLIC_KEY) { log_debug ("ooops: invalid pkttype %d encountered\n", keyblock->pkt->pkttype); dump_kbnode (keyblock); release_kbnode(keyblock); continue; } /* prepare the keyblock for further processing */ merge_keys_and_selfsig (keyblock); clear_kbnode_flags (keyblock); pk = keyblock->pkt->pkt.public_key; if (pk->has_expired || pk->is_revoked) { /* it does not make sense to look further at those keys */ mark_keyblock_seen (full_trust, keyblock); } else if (validate_one_keyblock (keyblock, klist, curtime, next_expire)) { KBNODE node; if (pk->expiredate && pk->expiredate >= curtime && pk->expiredate < *next_expire) *next_expire = pk->expiredate; if (nkeys == maxkeys) { maxkeys += 1000; keys = xrealloc (keys, (maxkeys+1) * sizeof *keys); } keys[nkeys++].keyblock = keyblock; /* Optimization - if all uids are fully trusted, then we never need to consider this key as a candidate again. */ for (node=keyblock; node; node = node->next) if (node->pkt->pkttype == PKT_USER_ID && !(node->flag & 4)) break; if(node==NULL) mark_keyblock_seen (full_trust, keyblock); keyblock = NULL; } release_kbnode (keyblock); keyblock = NULL; } while ( !(rc = keydb_search (hd, &desc, 1)) ); if (rc && rc != -1) { log_error ("keydb_search_next failed: %s\n", g10_errstr(rc)); xfree (keys); return NULL; } keys[nkeys].keyblock = NULL; return keys; } /* Caller must sync */ static void reset_trust_records(void) { TRUSTREC rec; ulong recnum; int count = 0, nreset = 0; for (recnum=1; !tdbio_read_record (recnum, &rec, 0); recnum++ ) { if(rec.rectype==RECTYPE_TRUST) { count++; if(rec.r.trust.min_ownertrust) { rec.r.trust.min_ownertrust=0; write_record(&rec); } } else if(rec.rectype==RECTYPE_VALID && ((rec.r.valid.validity&TRUST_MASK) || rec.r.valid.marginal_count || rec.r.valid.full_count)) { rec.r.valid.validity &= ~TRUST_MASK; rec.r.valid.marginal_count=rec.r.valid.full_count=0; nreset++; write_record(&rec); } } if (opt.verbose) log_info (_("%d keys processed (%d validity counts cleared)\n"), count, nreset); } /* * Run the key validation procedure. * * This works this way: * Step 1: Find all ultimately trusted keys (UTK). * mark them all as seen and put them into klist. * Step 2: loop max_cert_times * Step 3: if OWNERTRUST of any key in klist is undefined * ask user to assign ownertrust * Step 4: Loop over all keys in the keyDB which are not marked seen * Step 5: if key is revoked or expired * mark key as seen * continue loop at Step 4 * Step 6: For each user ID of that key signed by a key in klist * Calculate validity by counting trusted signatures. * Set validity of user ID * Step 7: If any signed user ID was found * mark key as seen * End Loop * Step 8: Build a new klist from all fully trusted keys from step 6 * End Loop * Ready * */ static int validate_keys (int interactive) { int rc = 0; int quit=0; struct key_item *klist = NULL; struct key_item *k; struct key_array *keys = NULL; struct key_array *kar; KEYDB_HANDLE kdb = NULL; KBNODE node; int depth; int ot_unknown, ot_undefined, ot_never, ot_marginal, ot_full, ot_ultimate; KeyHashTable stored,used,full_trust; u32 start_time, next_expire; /* Make sure we have all sigs cached. TODO: This is going to require some architectual re-thinking, as it is agonizingly slow. Perhaps combine this with reset_trust_records(), or only check the caches on keys that are actually involved in the web of trust. */ keydb_rebuild_caches(0); start_time = make_timestamp (); next_expire = 0xffffffff; /* set next expire to the year 2106 */ stored = new_key_hash_table (); used = new_key_hash_table (); full_trust = new_key_hash_table (); kdb = keydb_new (0); reset_trust_records(); /* Fixme: Instead of always building a UTK list, we could just build it * here when needed */ if (!utk_list) { if (!opt.quiet) log_info (_("no ultimately trusted keys found\n")); goto leave; } /* mark all UTKs as used and fully_trusted and set validity to ultimate */ for (k=utk_list; k; k = k->next) { KBNODE keyblock; PKT_public_key *pk; keyblock = get_pubkeyblock (k->kid); if (!keyblock) { log_error (_("public key of ultimately" " trusted key %s not found\n"), keystr(k->kid)); continue; } mark_keyblock_seen (used, keyblock); mark_keyblock_seen (stored, keyblock); mark_keyblock_seen (full_trust, keyblock); pk = keyblock->pkt->pkt.public_key; for (node=keyblock; node; node = node->next) { if (node->pkt->pkttype == PKT_USER_ID) update_validity (pk, node->pkt->pkt.user_id, 0, TRUST_ULTIMATE); } if ( pk->expiredate && pk->expiredate >= start_time && pk->expiredate < next_expire) next_expire = pk->expiredate; release_kbnode (keyblock); do_sync (); } klist = utk_list; log_info(_("%d marginal(s) needed, %d complete(s) needed, %s trust model\n"), opt.marginals_needed,opt.completes_needed,trust_model_string()); for (depth=0; depth < opt.max_cert_depth; depth++) { int valids=0,key_count; /* See whether we should assign ownertrust values to the keys in klist. */ ot_unknown = ot_undefined = ot_never = 0; ot_marginal = ot_full = ot_ultimate = 0; for (k=klist; k; k = k->next) { int min=0; /* 120 and 60 are as per RFC2440 */ if(k->trust_value>=120) min=TRUST_FULLY; else if(k->trust_value>=60) min=TRUST_MARGINAL; if(min!=k->min_ownertrust) update_min_ownertrust(k->kid,min); if (interactive && k->ownertrust == TRUST_UNKNOWN) { k->ownertrust = ask_ownertrust (k->kid,min); if (k->ownertrust == -1) { quit=1; goto leave; } } /* This can happen during transition from an old trustdb before trust sigs. It can also happen if a user uses two different versions of GnuPG or changes the --trust-model setting. */ if(k->ownertrustkid[0],(ulong)k->kid[1], trust_value_to_string(k->ownertrust), trust_value_to_string(min)); k->ownertrust=min; } if (k->ownertrust == TRUST_UNKNOWN) ot_unknown++; else if (k->ownertrust == TRUST_UNDEFINED) ot_undefined++; else if (k->ownertrust == TRUST_NEVER) ot_never++; else if (k->ownertrust == TRUST_MARGINAL) ot_marginal++; else if (k->ownertrust == TRUST_FULLY) ot_full++; else if (k->ownertrust == TRUST_ULTIMATE) ot_ultimate++; valids++; } /* Find all keys which are signed by a key in kdlist */ keys = validate_key_list (kdb, full_trust, klist, start_time, &next_expire); if (!keys) { log_error ("validate_key_list failed\n"); rc = G10ERR_GENERAL; goto leave; } for (key_count=0, kar=keys; kar->keyblock; kar++, key_count++) ; /* Store the calculated valididation status somewhere */ if (opt.verbose > 1) dump_key_array (depth, keys); for (kar=keys; kar->keyblock; kar++) store_validation_status (depth, kar->keyblock, stored); log_info (_("depth: %d valid: %3d signed: %3d" " trust: %d-, %dq, %dn, %dm, %df, %du\n"), depth, valids, key_count, ot_unknown, ot_undefined, ot_never, ot_marginal, ot_full, ot_ultimate ); /* Build a new kdlist from all fully valid keys in KEYS */ if (klist != utk_list) release_key_items (klist); klist = NULL; for (kar=keys; kar->keyblock; kar++) { for (node=kar->keyblock; node; node = node->next) { if (node->pkt->pkttype == PKT_USER_ID && (node->flag & 4)) { u32 kid[2]; /* have we used this key already? */ keyid_from_pk (kar->keyblock->pkt->pkt.public_key, kid); if(test_key_hash_table(used,kid)==0) { /* Normally we add both the primary and subkey ids to the hash via mark_keyblock_seen, but since we aren't using this hash as a skipfnc, that doesn't matter here. */ add_key_hash_table (used,kid); k = new_key_item (); k->kid[0]=kid[0]; k->kid[1]=kid[1]; k->ownertrust = (get_ownertrust (kar->keyblock->pkt->pkt.public_key) & TRUST_MASK); k->min_ownertrust = get_min_ownertrust(kar->keyblock->pkt->pkt.public_key); k->trust_depth= kar->keyblock->pkt->pkt.public_key->trust_depth; k->trust_value= kar->keyblock->pkt->pkt.public_key->trust_value; if(kar->keyblock->pkt->pkt.public_key->trust_regexp) k->trust_regexp= xstrdup(kar->keyblock->pkt-> pkt.public_key->trust_regexp); k->next = klist; klist = k; break; } } } } release_key_array (keys); keys = NULL; if (!klist) break; /* no need to dive in deeper */ } leave: keydb_release (kdb); release_key_array (keys); release_key_items (klist); release_key_hash_table (full_trust); release_key_hash_table (used); release_key_hash_table (stored); if (!rc && !quit) /* mark trustDB as checked */ { if (next_expire == 0xffffffff || next_expire < start_time ) tdbio_write_nextcheck (0); else { tdbio_write_nextcheck (next_expire); log_info (_("next trustdb check due at %s\n"), strtimestamp (next_expire)); } if(tdbio_update_version_record()!=0) { log_error(_("unable to update trustdb version record: " "write failed: %s\n"), g10_errstr(rc)); tdbio_invalid(); } do_sync (); pending_check_trustdb = 0; } return rc; } diff --git a/po/ChangeLog b/po/ChangeLog index aeb458aa6..e3f450244 100644 --- a/po/ChangeLog +++ b/po/ChangeLog @@ -1,170 +1,174 @@ +2007-12-12 Werner Koch + + * POTFILES.in: Add a couple of missing files. + 2007-12-03 Jakub Bogusz (wk) * pl.po: Updated. Received through entry bug#856. 2007-11-15 Werner Koch * de.po: Type fix. 2007-11-12 Daniel Nylander (wk) * sv.po: Updated. 2007-09-14 Werner Koch * de.po: Changed translation of --honor-http-proxy. 2007-08-29 Werner Koch * de.po: Translated the argparse.c strings. 2007-08-28 Werner Koch * de.po: Updated. 2007-08-16 Werner Koch * pt_BR.po, es.po: Remove the "GNU" from the project ID. That stupid msginit uses a script project-id to retrieve a new project id. Instead of using what it founds out, it tries to put "GNU" before the id if _any_ file in the current directory has a string "GNU ". As en@bold.po is build automagically this package name mangling breaks make distcheck as it tries to rebuild the po file with the "correct" name. The upshot is never to use GNU in you po directory. * de.po: Fix a few fuzzy entries and translate new strings. 2007-07-04 Werner Koch * de.po: Update a few strings. 2007-05-09 Werner Koch * de.po: Update a few strings. 2007-05-07 gettextize * Makefile.in.in: Upgrade to gettext-0.16.1. 2007-02-26 Werner Koch * sv.po: Update from Daniel. 2007-01-31 Werner Koch * de.po: Fixed a few fuzzy entries. 2007-01-25 Werner Koch * de.po: Add Plural-Forms. 2006-12-22 Werner Koch * sv.po: Installed revised and updated translation by Daniel Nylander. 2006-11-13 Werner Koch * ru.po: Update from Maxim. 2006-11-10 Werner Koch * de.po: Received complete update from Walter. 2006-11-06 Werner Koch * tr.po: Updated. 2006-09-25 Werner Koch * LINGUAS: Copied from gnupg 1.4.5. * de.po: Merged with the version from 1.4.5. * be.po, ca.po, cs.po, da.po, de.po, eo.po, el.po, es.po, et.po * fi.po, fr.po, gl.po, hu.po, id.po, it.po, ja.po, nb.po, pl.po * pt_BR.po, pt.po, ro.po, ru.po, sk.po, sv.po, tr.po, zh_TW.po * zh_CN.po: Copied from gnupg 1.4.5. 2005-11-23 Werner Koch * de.po: Updated. 2005-08-01 Werner Koch * de.po: Converted to utf-8; fixed a few umlaut problems. 2005-04-21 Werner Koch * de.po: Fixed all fuzzies and untranslated strings. 2005-01-04 Werner Koch * de.po: Updated. 2004-10-22 Werner Koch * POTFILES.in: Removed sc-investigate.c 2004-10-04 Werner Koch * de.po: Typo fixes. 2004-09-30 gettextize * Makefile.in.in: Upgrade to gettext-0.14.1. * Rules-quot: Upgrade to gettext-0.14.1. 2004-09-30 Werner Koch * de.po: Updated. * POTFILES.in: Add more files. 2004-07-22 Werner Koch * de.po: Updated. 2004-04-06 Werner Koch * Makevars (DOMAIN): Init from PACKAGE_GT 2003-12-09 Werner Koch * Makevars (MSGID_BUGS_ADDRESS): New. 2003-04-29 Werner Koch * LINUGAS: NEW. 2003-04-29 gettextize * Rules-quot: New file, from gettext-0.11.5. * boldquot.sed: New file, from gettext-0.11.5. * en@boldquot.header: New file, from gettext-0.11.5. * en@quot.header: New file, from gettext-0.11.5. * insert-header.sin: New file, from gettext-0.11.5. * quot.sed: New file, from gettext-0.11.5. * remove-potcdate.sin: New file, from gettext-0.11.5. 2002-08-21 Werner Koch * de.po: Updated the translation. 2002-08-10 Werner Koch * Makefile.in.in: Installed from gettext-0.10.40. * POTFILES.in: New. * de.po: New. Copyright 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is free software; as a special exception the author gives unlimited permission to copy and/or distribute it, with or without modifications, as long as this notice is preserved. This file is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY, to the extent permitted by law; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. diff --git a/po/POTFILES.in b/po/POTFILES.in index a991fb49d..033fbeb08 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,99 +1,106 @@ # List of files with translatable strings agent/call-pinentry.c agent/command-ssh.c agent/divert-scd.c agent/genkey.c agent/gpg-agent.c agent/preset-passphrase.c agent/protect-tool.c agent/trustlist.c agent/findkey.c common/exechelp.c common/http.c common/simple-pwquery.c common/sysutils.c common/yesno.c common/miscellaneous.c +common/asshelp.c +common/audit.c +common/helpfile.c g10/armor.c g10/build-packet.c g10/call-agent.c g10/card-util.c g10/dearmor.c g10/decrypt.c g10/delkey.c g10/encode.c g10/encr-data.c g10/exec.c g10/export.c g10/getkey.c g10/gpg.c g10/gpgv.c g10/helptext.c g10/import.c g10/keydb.c g10/keyedit.c g10/keygen.c g10/keyid.c g10/keylist.c g10/keyring.c g10/keyserver.c g10/mainproc.c g10/misc.c g10/openfile.c g10/parse-packet.c g10/passphrase.c g10/photoid.c g10/pkclist.c g10/plaintext.c g10/pubkey-enc.c g10/revoke.c g10/seckey-cert.c g10/seskey.c g10/sig-check.c g10/sign.c g10/skclist.c g10/tdbdump.c g10/tdbio.c g10/textfilter.c g10/trustdb.c g10/verify.c jnlib/argparse.c jnlib/logging.c jnlib/utf8conv.c kbx/kbxutil.c scd/app-nks.c scd/app-openpgp.c +scd/app-dinsig.c scd/scdaemon.c sm/base64.c sm/call-agent.c sm/call-dirmngr.c sm/certchain.c sm/certcheck.c sm/certdump.c sm/certlist.c sm/certreqgen.c +sm/certreqgen-ui.c sm/decrypt.c sm/delete.c sm/encrypt.c sm/export.c sm/gpgsm.c sm/import.c sm/keydb.c sm/keylist.c sm/misc.c sm/qualified.c sm/sign.c sm/verify.c tools/gpg-connect-agent.c tools/gpgconf-comp.c tools/gpgconf.c tools/no-libgcrypt.c tools/symcryptrun.c +tools/gpg-check-pattern.c + diff --git a/tools/gpg-connect-agent.c b/tools/gpg-connect-agent.c index e0abaa9c9..57eed64f0 100644 --- a/tools/gpg-connect-agent.c +++ b/tools/gpg-connect-agent.c @@ -1,2000 +1,2000 @@ /* gpg-connect-agent.c - Tool to connect to the agent. * Copyright (C) 2005, 2007 Free Software Foundation, Inc. * * This file is part of GnuPG. * * GnuPG is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * GnuPG is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ #include #include #include #include #include #include #include #include #include #include "i18n.h" #include "../common/util.h" #include "../common/asshelp.h" #include "../common/sysutils.h" #include "../common/membuf.h" #include "../common/ttyio.h" #define CONTROL_D ('D' - 'A' + 1) #define octdigitp(p) (*(p) >= '0' && *(p) <= '7') /* Constants to identify the commands and options. */ enum cmd_and_opt_values { aNull = 0, oQuiet = 'q', oVerbose = 'v', oRawSocket = 'S', oExec = 'E', oRun = 'r', oSubst = 's', oNoVerbose = 500, oHomedir, oHex, oDecode, oNoExtConnect }; /* The list of commands and options. */ static ARGPARSE_OPTS opts[] = { { 301, NULL, 0, N_("@\nOptions:\n ") }, { oVerbose, "verbose", 0, N_("verbose") }, { oQuiet, "quiet", 0, N_("quiet") }, { oHex, "hex", 0, N_("print data out hex encoded") }, { oDecode,"decode", 0, N_("decode received data lines") }, { oRawSocket, "raw-socket", 2, N_("|NAME|connect to Assuan socket NAME")}, { oExec, "exec", 0, N_("run the Assuan server given on the command line")}, { oNoExtConnect, "no-ext-connect", 0, N_("do not use extended connect mode")}, { oRun, "run", 2, N_("|FILE|run commands from FILE on startup")}, { oSubst, "subst", 0, N_("run /subst on startup")}, /* hidden options */ { oNoVerbose, "no-verbose", 0, "@"}, { oHomedir, "homedir", 2, "@" }, {0} }; /* We keep all global options in the structure OPT. */ struct { int verbose; /* Verbosity level. */ int quiet; /* Be extra quiet. */ const char *homedir; /* Configuration directory name */ int hex; /* Print data lines in hex format. */ int decode; /* Decode received data lines. */ const char *raw_socket; /* Name of socket to connect in raw mode. */ int exec; /* Run the pgm given on the command line. */ unsigned int connect_flags; /* Flags used for connecting. */ int enable_varsubst; /* Set if variable substitution is enabled. */ int trim_leading_spaces; } opt; /* Definitions for /definq commands and a global linked list with all the definitions. */ struct definq_s { struct definq_s *next; char *name; /* Name of inquiry or NULL for any name. */ int is_var; /* True if FILE is a variable name. */ int is_prog; /* True if FILE is a program to run. */ char file[1]; /* Name of file or program. */ }; typedef struct definq_s *definq_t; static definq_t definq_list; static definq_t *definq_list_tail = &definq_list; /* Variable definitions and glovbal table. */ struct variable_s { struct variable_s *next; char *value; /* Malloced value - always a string. */ char name[1]; /* Name of the variable. */ }; typedef struct variable_s *variable_t; static variable_t variable_table; /* To implement loops we store entire lines in a linked list. */ struct loopline_s { struct loopline_s *next; char line[1]; }; typedef struct loopline_s *loopline_t; /* This is used to store the pid of the server. */ static pid_t server_pid = (pid_t)(-1); /* A list of open file descriptors. */ static struct { int inuse; #ifdef HAVE_W32_SYSTEM HANDLE handle; #endif } open_fd_table[256]; /*-- local prototypes --*/ static char *substitute_line_copy (const char *buffer); static int read_and_print_response (assuan_context_t ctx, int *r_goterr); static assuan_context_t start_agent (void); /* Print usage information and and provide strings for help. */ static const char * my_strusage( int level ) { const char *p; switch (level) { case 11: p = "gpg-connect-agent (GnuPG)"; break; case 13: p = VERSION; break; case 17: p = PRINTABLE_OS_NAME; break; case 19: p = _("Please report bugs to <" PACKAGE_BUGREPORT ">.\n"); break; case 1: case 40: p = _("Usage: gpg-connect-agent [options] (-h for help)"); break; case 41: p = _("Syntax: gpg-connect-agent [options]\n" "Connect to a running agent and send commands\n"); break; case 31: p = "\nHome: "; break; case 32: p = opt.homedir; break; case 33: p = "\n"; break; default: p = NULL; break; } return p; } static char * gnu_getcwd (void) { char *buffer; size_t size = 100; for (;;) { buffer = xmalloc (size+1); if (getcwd (buffer, size) == buffer) return buffer; xfree (buffer); if (errno != ERANGE) return NULL; size *= 2; } } /* Unescale STRING and returned the malloced result. The surrounding quotes must already be removed from STRING. */ static char * unescape_string (const char *string) { const unsigned char *s; int esc; size_t n; char *buffer; unsigned char *d; n = 0; for (s = (const unsigned char*)string, esc=0; *s; s++) { if (esc) { switch (*s) { case 'b': case 't': case 'v': case 'n': case 'f': case 'r': case '"': case '\'': case '\\': n++; break; case 'x': if (s[1] && s[2] && hexdigitp (s+1) && hexdigitp (s+2)) n++; break; default: if (s[1] && s[2] && octdigitp (s) && octdigitp (s+1) && octdigitp (s+2)) n++; break; } esc = 0; } else if (*s == '\\') esc = 1; else n++; } buffer = xmalloc (n+1); d = (unsigned char*)buffer; for (s = (const unsigned char*)string, esc=0; *s; s++) { if (esc) { switch (*s) { case 'b': *d++ = '\b'; break; case 't': *d++ = '\t'; break; case 'v': *d++ = '\v'; break; case 'n': *d++ = '\n'; break; case 'f': *d++ = '\f'; break; case 'r': *d++ = '\r'; break; case '"': *d++ = '\"'; break; case '\'': *d++ = '\''; break; case '\\': *d++ = '\\'; break; case 'x': if (s[1] && s[2] && hexdigitp (s+1) && hexdigitp (s+2)) { s++; *d++ = xtoi_2 (s); s++; } break; default: if (s[1] && s[2] && octdigitp (s) && octdigitp (s+1) && octdigitp (s+2)) { *d++ = (atoi_1 (s)*64) + (atoi_1 (s+1)*8) + atoi_1 (s+2); s += 2; } break; } esc = 0; } else if (*s == '\\') esc = 1; else *d++ = *s; } *d = 0; return buffer; } /* Do the percent unescaping and return a newly malloced string. If WITH_PLUS is set '+' characters will be changed to space. */ static char * unpercent_string (const char *string, int with_plus) { const unsigned char *s; unsigned char *buffer, *p; size_t n; n = 0; for (s=(const unsigned char *)string; *s; s++) { if (*s == '%' && s[1] && s[2]) { s++; n++; s++; } else if (with_plus && *s == '+') n++; else n++; } buffer = xmalloc (n+1); p = buffer; for (s=(const unsigned char *)string; *s; s++) { if (*s == '%' && s[1] && s[2]) { s++; *p++ = xtoi_2 (s); s++; } else if (with_plus && *s == '+') *p++ = ' '; else *p++ = *s; } *p = 0; return (char*)buffer; } static const char * set_var (const char *name, const char *value) { variable_t var; for (var = variable_table; var; var = var->next) if (!strcmp (var->name, name)) break; if (!var) { var = xmalloc (sizeof *var + strlen (name)); var->value = NULL; strcpy (var->name, name); var->next = variable_table; variable_table = var; } xfree (var->value); var->value = value? xstrdup (value) : NULL; return var->value; } static void set_int_var (const char *name, int value) { char numbuf[35]; snprintf (numbuf, sizeof numbuf, "%d", value); set_var (name, numbuf); } /* Return the value of a variable. That value is valid until a variable of the name is changed. Return NULL if not found. Note that envvars are copied to our variable list at the first access and not at oprogram start. */ static const char * get_var (const char *name) { variable_t var; const char *s; if (!*name) return ""; for (var = variable_table; var; var = var->next) if (!strcmp (var->name, name)) break; if (!var && (s = getenv (name))) return set_var (name, s); if (!var || !var->value) return NULL; return var->value; } /* Perform some simple arithmentic operations. Caller must release the return value. On error the return value is NULL. */ static char * arithmetic_op (int operator, const char *operands) { long result, value; char numbuf[35]; while ( spacep (operands) ) operands++; if (!*operands) return NULL; result = strtol (operands, NULL, 0); while (*operands && !spacep (operands) ) operands++; while (*operands) { while ( spacep (operands) ) operands++; if (!*operands) break; value = strtol (operands, NULL, 0); while (*operands && !spacep (operands) ) operands++; switch (operator) { case '+': result += value; break; case '-': result -= value; break; case '*': result *= value; break; case '/': if (!value) return NULL; result /= value; break; case '%': if (!value) return NULL; result %= value; break; default: log_error ("unknown arithmetic operator `%c'\n", operator); return NULL; } } snprintf (numbuf, sizeof numbuf, "%ld", result); return xstrdup (numbuf); } /* Extended version of get_var. This returns a malloced string and understand the fucntion syntax: "func args". Defined functions are get - Return a value described by the next argument: cwd - The current working directory. homedir - The gnupg homedir. sysconfdir - GnuPG's system configuration directory. bindir - GnuPG's binary directory. libdir - GnuPG's library directory. libexecdir - GnuPG's library directory for executable files. datadir - GnuPG's data directory. serverpid - The PID of the current server. unescape ARGS Remove C-style escapes from string. Note that "\0" and "\x00" terminate the string implictly. Use "\x7d" to represent the closing brace. The args start right after the first space after the function name. unpercent ARGS unpercent+ ARGS Remove percent style ecaping from string. Note that "%00 terminates the string implicitly. Use "%7d" to represetn the closing brace. The args start right after the first space after the function name. "unpercent+" also maps '+' to space. percent ARGS percent+ ARGS Escape the args using the percent style. Tabs, formfeeds, linefeeds and carriage returns are also escaped. "percent+" also maps spaces to plus characters. Example: get_var_ext ("get sysconfdir") -> "/etc/gnupg" */ static char * get_var_ext (const char *name) { static int recursion_count; const char *s; char *result; char *p; char *free_me = NULL; if (recursion_count > 50) { log_error ("variables nested too deeply\n"); return NULL; } recursion_count++; free_me = opt.enable_varsubst? substitute_line_copy (name) : NULL; if (free_me) name = free_me; for (s=name; *s && !spacep (s); s++) ; if (!*s) { s = get_var (name); result = s? xstrdup (s): NULL; } else if ( (s - name) == 3 && !strncmp (name, "get", 3)) { while ( spacep (s) ) s++; if (!strcmp (s, "cwd")) { result = gnu_getcwd (); if (!result) log_error ("getcwd failed: %s\n", strerror (errno)); } else if (!strcmp (s, "homedir")) result = make_filename (opt.homedir, NULL); else if (!strcmp (s, "sysconfdir")) result = xstrdup (gnupg_sysconfdir ()); else if (!strcmp (s, "bindir")) result = xstrdup (gnupg_bindir ()); else if (!strcmp (s, "libdir")) result = xstrdup (gnupg_libdir ()); else if (!strcmp (s, "libexecdir")) result = xstrdup (gnupg_libexecdir ()); else if (!strcmp (s, "datadir")) result = xstrdup (gnupg_datadir ()); else if (!strcmp (s, "serverpid")) { char numbuf[30]; snprintf (numbuf, sizeof numbuf, "%d", (int)server_pid); result = xstrdup (numbuf); } else { log_error ("invalid argument `%s' for variable function `get'\n", s); log_info ("valid are: cwd, " "{home,bin,lib,libexec,data}dir, serverpid\n"); result = NULL; } } else if ( (s - name) == 8 && !strncmp (name, "unescape", 8)) { s++; result = unescape_string (s); } else if ( (s - name) == 9 && !strncmp (name, "unpercent", 9)) { s++; result = unpercent_string (s, 0); } else if ( (s - name) == 10 && !strncmp (name, "unpercent+", 10)) { s++; result = unpercent_string (s, 1); } else if ( (s - name) == 7 && !strncmp (name, "percent", 7)) { s++; result = percent_escape (s, "\t\r\n\f\v"); } else if ( (s - name) == 8 && !strncmp (name, "percent+", 8)) { s++; result = percent_escape (s, "\t\r\n\f\v"); for (p=result; *p; p++) if (*p == ' ') *p = '+'; } else if ( (s - name) == 1 && strchr ("+-*/%", *name)) { result = arithmetic_op (*name, s+1); } else { log_error ("unknown variable function `%.*s'\n", (int)(s-name), name); result = NULL; } xfree (free_me); recursion_count--; return result; } /* Substitute variables in LINE and return a new allocated buffer if required. The function might modify LINE if the expanded version fits into it. */ static char * substitute_line (char *buffer) { char *line = buffer; char *p, *pend; const char *value; size_t valuelen, n; char *result = NULL; char *freeme = NULL; while (*line) { p = strchr (line, '$'); if (!p) return result; /* No more variables. */ if (p[1] == '$') /* Escaped dollar sign. */ { memmove (p, p+1, strlen (p+1)+1); line = p + 1; continue; } if (p[1] == '{') { int count = 0; for (pend=p+2; *pend; pend++) { if (*pend == '{') count++; else if (*pend == '}') { if (--count < 0) break; } } if (!*pend) return result; /* Unclosed - don't substitute. */ } else { for (pend=p+1; *pend && !spacep (pend) && *pend != '$' ; pend++) ; } if (p[1] == '{' && *pend == '}') { int save = *pend; *pend = 0; freeme = get_var_ext (p+2); value = freeme; *pend++ = save; } else if (*pend) { int save = *pend; *pend = 0; value = get_var (p+1); *pend = save; } else value = get_var (p+1); if (!value) value = ""; valuelen = strlen (value); if (valuelen <= pend - p) { memcpy (p, value, valuelen); p += valuelen; n = pend - p; if (n) memmove (p, p+n, strlen (p+n)+1); line = p; } else { char *src = result? result : buffer; char *dst; dst = xmalloc (strlen (src) + valuelen + 1); n = p - src; memcpy (dst, src, n); memcpy (dst + n, value, valuelen); n += valuelen; strcpy (dst + n, pend); line = dst + n; xfree (result); result = dst; } xfree (freeme); freeme = NULL; } return result; } /* Same as substitute_line but do not modify BUFFER. */ static char * substitute_line_copy (const char *buffer) { char *result, *p; p = xstrdup (buffer?buffer:""); result = substitute_line (p); if (!result) result = p; else xfree (p); return result; } static void assign_variable (char *line, int syslet) { char *name, *p, *tmp, *free_me, *buffer; /* Get the name. */ name = line; for (p=name; *p && !spacep (p); p++) ; if (*p) *p++ = 0; while (spacep (p)) p++; if (!*p) set_var (name, NULL); /* Remove variable. */ else if (syslet) { free_me = opt.enable_varsubst? substitute_line_copy (p) : NULL; if (free_me) p = free_me; buffer = xmalloc (4 + strlen (p) + 1); strcpy (stpcpy (buffer, "get "), p); tmp = get_var_ext (buffer); xfree (buffer); set_var (name, tmp); xfree (tmp); xfree (free_me); } else { tmp = opt.enable_varsubst? substitute_line_copy (p) : NULL; if (tmp) { set_var (name, tmp); xfree (tmp); } else set_var (name, p); } } static void show_variables (void) { variable_t var; for (var = variable_table; var; var = var->next) if (var->value) printf ("%-20s %s\n", var->name, var->value); } /* Store an inquire response pattern. Note, that this function may change the content of LINE. We assume that leading white spaces are already removed. */ static void add_definq (char *line, int is_var, int is_prog) { definq_t d; char *name, *p; /* Get name. */ name = line; for (p=name; *p && !spacep (p); p++) ; if (*p) *p++ = 0; while (spacep (p)) p++; d = xmalloc (sizeof *d + strlen (p) ); strcpy (d->file, p); d->is_var = is_var; d->is_prog = is_prog; if ( !strcmp (name, "*")) d->name = NULL; else d->name = xstrdup (name); d->next = NULL; *definq_list_tail = d; definq_list_tail = &d->next; } /* Show all inquiry defintions. */ static void show_definq (void) { definq_t d; for (d=definq_list; d; d = d->next) if (d->name) printf ("%-20s %c %s\n", d->name, d->is_var? 'v' : d->is_prog? 'p':'f', d->file); for (d=definq_list; d; d = d->next) if (!d->name) printf ("%-20s %c %s\n", "*", d->is_var? 'v': d->is_prog? 'p':'f', d->file); } /* Clear all inquiry definitions. */ static void clear_definq (void) { while (definq_list) { definq_t tmp = definq_list->next; xfree (definq_list->name); xfree (definq_list); definq_list = tmp; } definq_list_tail = &definq_list; } static void do_sendfd (assuan_context_t ctx, char *line) { FILE *fp; char *name, *mode, *p; int rc, fd; /* Get file name. */ name = line; for (p=name; *p && !spacep (p); p++) ; if (*p) *p++ = 0; while (spacep (p)) p++; /* Get mode. */ mode = p; if (!*mode) mode = "r"; else { for (p=mode; *p && !spacep (p); p++) ; if (*p) *p++ = 0; } /* Open and send. */ fp = fopen (name, mode); if (!fp) { log_error ("can't open `%s' in \"%s\" mode: %s\n", name, mode, strerror (errno)); return; } fd = fileno (fp); if (opt.verbose) log_error ("file `%s' opened in \"%s\" mode, fd=%d\n", name, mode, fd); rc = assuan_sendfd (ctx, INT2FD (fd) ); if (rc) log_error ("sending descriptor %d failed: %s\n", fd, gpg_strerror (rc)); fclose (fp); } static void do_recvfd (assuan_context_t ctx, char *line) { log_info ("This command has not yet been implemented\n"); } static void do_open (char *line) { FILE *fp; char *varname, *name, *mode, *p; int fd; #ifdef HAVE_W32_SYSTEM if (server_pid == (pid_t)(-1)) { log_error ("the pid of the server is unknown\n"); log_info ("use command \"/serverpid\" first\n"); return; } #endif /* Get variable name. */ varname = line; for (p=varname; *p && !spacep (p); p++) ; if (*p) *p++ = 0; while (spacep (p)) p++; /* Get file name. */ name = p; for (p=name; *p && !spacep (p); p++) ; if (*p) *p++ = 0; while (spacep (p)) p++; /* Get mode. */ mode = p; if (!*mode) mode = "r"; else { for (p=mode; *p && !spacep (p); p++) ; if (*p) *p++ = 0; } /* Open and send. */ fp = fopen (name, mode); if (!fp) { log_error ("can't open `%s' in \"%s\" mode: %s\n", name, mode, strerror (errno)); return; } fd = fileno (fp); if (fd >= 0 && fd < DIM (open_fd_table)) { open_fd_table[fd].inuse = 1; #ifdef HAVE_W32_SYSTEM { HANDLE prochandle, handle, newhandle; handle = (void*)_get_osfhandle (fd); prochandle = OpenProcess (PROCESS_DUP_HANDLE, FALSE, server_pid); if (!prochandle) { log_error ("failed to open the server process\n"); close (fd); return; } if (!DuplicateHandle (GetCurrentProcess(), handle, prochandle, &newhandle, 0, TRUE, DUPLICATE_SAME_ACCESS )) { log_error ("failed to duplicate the handle\n"); close (fd); CloseHandle (prochandle); return; } CloseHandle (prochandle); open_fd_table[fd].handle = newhandle; } if (opt.verbose) log_info ("file `%s' opened in \"%s\" mode, fd=%d (libc=%d)\n", name, mode, (int)open_fd_table[fd].handle, fd); set_int_var (varname, (int)open_fd_table[fd].handle); #else if (opt.verbose) log_info ("file `%s' opened in \"%s\" mode, fd=%d\n", name, mode, fd); set_int_var (varname, fd); #endif } else { log_error ("can't put fd %d into table\n", fd); close (fd); } } static void do_close (char *line) { int fd = atoi (line); #ifdef HAVE_W32_SYSTEM int i; for (i=0; i < DIM (open_fd_table); i++) if ( open_fd_table[i].inuse && open_fd_table[i].handle == (void*)fd) break; if (i < DIM (open_fd_table)) fd = i; else { log_error ("given fd (system handle) has not been opened\n"); return; } #endif if (fd < 0 || fd >= DIM (open_fd_table)) { log_error ("invalid fd\n"); return; } if (!open_fd_table[fd].inuse) { log_error ("given fd has not been opened\n"); return; } #ifdef HAVE_W32_SYSTEM CloseHandle (open_fd_table[fd].handle); /* Close duped handle. */ #endif close (fd); open_fd_table[fd].inuse = 0; } static void do_showopen (void) { int i; for (i=0; i < DIM (open_fd_table); i++) if (open_fd_table[i].inuse) { #ifdef HAVE_W32_SYSTEM printf ("%-15d (libc=%d)\n", (int)open_fd_table[i].handle, i); #else printf ("%-15d\n", i); #endif } } static int getinfo_pid_cb (void *opaque, const void *buffer, size_t length) { membuf_t *mb = opaque; put_membuf (mb, buffer, length); return 0; } /* Get the pid of the server and store it locally. */ static void do_serverpid (assuan_context_t ctx) { int rc; membuf_t mb; char *buffer; init_membuf (&mb, 100); rc = assuan_transact (ctx, "GETINFO pid", getinfo_pid_cb, &mb, NULL, NULL, NULL, NULL); put_membuf (&mb, "", 1); buffer = get_membuf (&mb, NULL); if (rc || !buffer) log_error ("command \"%s\" failed: %s\n", "GETINFO pid", gpg_strerror (rc)); else { server_pid = (pid_t)strtoul (buffer, NULL, 10); if (opt.verbose) log_info ("server's PID is %lu\n", (unsigned long)server_pid); } xfree (buffer); } /* gpg-connect-agent's entry point. */ int main (int argc, char **argv) { ARGPARSE_ARGS pargs; int no_more_options = 0; assuan_context_t ctx; char *line, *p; char *tmpline; size_t linesize; int rc; int cmderr; const char *opt_run = NULL; FILE *script_fp = NULL; int use_tty, keep_line; struct { int collecting; loopline_t head; loopline_t *tail; loopline_t current; unsigned int nestlevel; char *condition; } loopstack[20]; int loopidx; gnupg_rl_initialize (); set_strusage (my_strusage); log_set_prefix ("gpg-connect-agent", 1); /* Make sure that our subsystems are ready. */ init_common_subsystems (); assuan_set_assuan_err_source (0); i18n_init(); opt.homedir = default_homedir (); opt.connect_flags = 1; /* Use extended connect mode. */ /* Parse the command line. */ pargs.argc = &argc; pargs.argv = &argv; pargs.flags = 1; /* Do not remove the args. */ while (!no_more_options && optfile_parse (NULL, NULL, NULL, &pargs, opts)) { switch (pargs.r_opt) { case oQuiet: opt.quiet = 1; break; case oVerbose: opt.verbose++; break; case oNoVerbose: opt.verbose = 0; break; case oHomedir: opt.homedir = pargs.r.ret_str; break; case oHex: opt.hex = 1; break; case oDecode: opt.decode = 1; break; case oRawSocket: opt.raw_socket = pargs.r.ret_str; break; case oExec: opt.exec = 1; break; case oNoExtConnect: opt.connect_flags &= ~(1); break; case oRun: opt_run = pargs.r.ret_str; break; case oSubst: opt.enable_varsubst = 1; opt.trim_leading_spaces = 1; break; default: pargs.err = 2; break; } } if (log_get_errorcount (0)) exit (2); use_tty = (isatty ( fileno (stdin)) && isatty (fileno (stdout))); if (opt.exec) { if (!argc) { log_error (_("option \"%s\" requires a program " "and optional arguments\n"), "--exec" ); exit (1); } } else if (argc) usage (1); if (opt.exec && opt.raw_socket) log_info (_("option \"%s\" ignored due to \"%s\"\n"), "--raw-socket", "--exec"); if (opt_run && !(script_fp = fopen (opt_run, "r"))) { log_error ("cannot open run file `%s': %s\n", opt_run, strerror (errno)); exit (1); } if (opt.exec) { int no_close[3]; no_close[0] = fileno (stderr); no_close[1] = log_get_fd (); no_close[2] = -1; rc = assuan_pipe_connect_ext (&ctx, *argv, (const char **)argv, no_close, NULL, NULL, opt.connect_flags); if (rc) { log_error ("assuan_pipe_connect_ext failed: %s\n", gpg_strerror (rc)); exit (1); } if (opt.verbose) log_info ("server `%s' started\n", *argv); } else if (opt.raw_socket) { rc = assuan_socket_connect_ext (&ctx, opt.raw_socket, 0, opt.connect_flags); if (rc) { log_error ("can't connect to socket `%s': %s\n", opt.raw_socket, gpg_strerror (rc)); exit (1); } if (opt.verbose) log_info ("connection to socket `%s' established\n", opt.raw_socket); } else ctx = start_agent (); /* See whether there is a line pending from the server (in case assuan did not run the initial handshaking). */ if (assuan_pending_line (ctx)) { rc = read_and_print_response (ctx, &cmderr); if (rc) log_info (_("receiving line failed: %s\n"), gpg_strerror (rc) ); } for (loopidx=0; loopidx < DIM (loopstack); loopidx++) loopstack[loopidx].collecting = 0; loopidx = -1; line = NULL; linesize = 0; keep_line = 1; for (;;) { int n; size_t maxlength = 2048; assert (loopidx < (int)DIM (loopstack)); if (loopidx >= 0 && loopstack[loopidx].current) { keep_line = 0; xfree (line); line = xstrdup (loopstack[loopidx].current->line); n = strlen (line); /* Never go beyond of the final /end. */ if (loopstack[loopidx].current->next) loopstack[loopidx].current = loopstack[loopidx].current->next; else if (!strncmp (line, "/end", 4) && (!line[4]||spacep(line+4))) ; else log_fatal ("/end command vanished\n"); } else if (use_tty && !script_fp) { keep_line = 0; xfree (line); line = tty_get ("> "); n = strlen (line); if (n==1 && *line == CONTROL_D) n = 0; if (n >= maxlength) maxlength = 0; } else { if (!keep_line) { xfree (line); line = NULL; linesize = 0; keep_line = 1; } n = read_line (script_fp? script_fp:stdin, &line, &linesize, &maxlength); } if (n < 0) { log_error (_("error reading input: %s\n"), strerror (errno)); if (script_fp) { fclose (script_fp); script_fp = NULL; log_error ("stopping script execution\n"); continue; } exit (1); } if (!n) { /* EOF */ if (script_fp) { fclose (script_fp); script_fp = NULL; if (opt.verbose) log_info ("end of script\n"); continue; } break; } if (!maxlength) { log_error (_("line too long - skipped\n")); continue; } if (memchr (line, 0, n)) log_info (_("line shortened due to embedded Nul character\n")); if (line[n-1] == '\n') line[n-1] = 0; if (opt.trim_leading_spaces) { const char *s = line; while (spacep (s)) s++; if (s != line) { for (p=line; *s;) *p++ = *s++; *p = 0; n = p - line; } } if (loopidx+1 >= 0 && loopstack[loopidx+1].collecting) { loopline_t ll; ll = xmalloc (sizeof *ll + strlen (line)); ll->next = NULL; strcpy (ll->line, line); *loopstack[loopidx+1].tail = ll; loopstack[loopidx+1].tail = &ll->next; if (!strncmp (line, "/end", 4) && (!line[4]||spacep(line+4))) loopstack[loopidx+1].nestlevel--; else if (!strncmp (line, "/while", 6) && (!line[6]||spacep(line+6))) loopstack[loopidx+1].nestlevel++; if (loopstack[loopidx+1].nestlevel) continue; /* We reached the corresponding /end. */ loopstack[loopidx+1].collecting = 0; loopidx++; } if (*line == '/') { /* Handle control commands. */ char *cmd = line+1; for (p=cmd; *p && !spacep (p); p++) ; if (*p) *p++ = 0; while (spacep (p)) p++; if (!strcmp (cmd, "let")) { assign_variable (p, 0); } else if (!strcmp (cmd, "slet")) { /* Deprecated - never used in a released version. */ assign_variable (p, 1); } else if (!strcmp (cmd, "showvar")) { show_variables (); } else if (!strcmp (cmd, "definq")) { tmpline = opt.enable_varsubst? substitute_line (p) : NULL; if (tmpline) { add_definq (tmpline, 1, 0); xfree (tmpline); } else add_definq (p, 1, 0); } else if (!strcmp (cmd, "definqfile")) { tmpline = opt.enable_varsubst? substitute_line (p) : NULL; if (tmpline) { add_definq (tmpline, 0, 0); xfree (tmpline); } else add_definq (p, 0, 0); } else if (!strcmp (cmd, "definqprog")) { tmpline = opt.enable_varsubst? substitute_line (p) : NULL; if (tmpline) { add_definq (tmpline, 0, 1); xfree (tmpline); } else add_definq (p, 0, 1); } else if (!strcmp (cmd, "showdef")) { show_definq (); } else if (!strcmp (cmd, "cleardef")) { clear_definq (); } else if (!strcmp (cmd, "echo")) { tmpline = opt.enable_varsubst? substitute_line (p) : NULL; if (tmpline) { puts (tmpline); xfree (tmpline); } else puts (p); } else if (!strcmp (cmd, "sendfd")) { tmpline = opt.enable_varsubst? substitute_line (p) : NULL; if (tmpline) { do_sendfd (ctx, tmpline); xfree (tmpline); } else do_sendfd (ctx, p); continue; } else if (!strcmp (cmd, "recvfd")) { tmpline = opt.enable_varsubst? substitute_line (p) : NULL; if (tmpline) { do_recvfd (ctx, tmpline); xfree (tmpline); } else do_recvfd (ctx, p); continue; } else if (!strcmp (cmd, "open")) { tmpline = opt.enable_varsubst? substitute_line (p) : NULL; if (tmpline) { do_open (tmpline); xfree (tmpline); } else do_open (p); } else if (!strcmp (cmd, "close")) { tmpline = opt.enable_varsubst? substitute_line (p) : NULL; if (tmpline) { do_close (tmpline); xfree (tmpline); } else do_close (p); } else if (!strcmp (cmd, "showopen")) { do_showopen (); } else if (!strcmp (cmd, "serverpid")) { do_serverpid (ctx); } else if (!strcmp (cmd, "hex")) opt.hex = 1; else if (!strcmp (cmd, "nohex")) opt.hex = 0; else if (!strcmp (cmd, "decode")) opt.decode = 1; else if (!strcmp (cmd, "nodecode")) opt.decode = 0; else if (!strcmp (cmd, "subst")) { opt.enable_varsubst = 1; opt.trim_leading_spaces = 1; } else if (!strcmp (cmd, "nosubst")) opt.enable_varsubst = 0; else if (!strcmp (cmd, "run")) { char *p2; for (p2=p; *p2 && !spacep (p2); p2++) ; if (*p2) *p2++ = 0; while (spacep (p2)) p++; if (*p2) { log_error ("syntax error in run command\n"); if (script_fp) { fclose (script_fp); script_fp = NULL; } } else if (script_fp) { log_error ("cannot nest run commands - stop\n"); fclose (script_fp); script_fp = NULL; } else if (!(script_fp = fopen (p, "r"))) { log_error ("cannot open run file `%s': %s\n", p, strerror (errno)); } else if (opt.verbose) log_info ("running commands from `%s'\n", p); } else if (!strcmp (cmd, "while")) { if (loopidx+2 >= (int)DIM(loopstack)) { log_error ("loops are nested too deep\n"); /* We should better die or break all loop in this case as recovering from this error won't be easy. */ } else { loopstack[loopidx+1].head = NULL; loopstack[loopidx+1].tail = &loopstack[loopidx+1].head; loopstack[loopidx+1].current = NULL; loopstack[loopidx+1].nestlevel = 1; loopstack[loopidx+1].condition = xstrdup (p); loopstack[loopidx+1].collecting = 1; } } else if (!strcmp (cmd, "end")) { if (loopidx < 0) log_error ("stray /end command encountered - ignored\n"); else { char *tmpcond; const char *value; long condition; /* Evaluate the condition. */ tmpcond = xstrdup (loopstack[loopidx].condition); tmpline = substitute_line (tmpcond); value = tmpline? tmpline : tmpcond; condition = strtol (value, NULL, 0); xfree (tmpline); xfree (tmpcond); if (condition) { /* Run loop. */ loopstack[loopidx].current = loopstack[loopidx].head; } else { /* Cleanup. */ while (loopstack[loopidx].head) { loopline_t tmp = loopstack[loopidx].head->next; xfree (loopstack[loopidx].head); loopstack[loopidx].head = tmp; } loopstack[loopidx].tail = NULL; loopstack[loopidx].current = NULL; loopstack[loopidx].nestlevel = 0; loopstack[loopidx].collecting = 0; xfree (loopstack[loopidx].condition); loopstack[loopidx].condition = NULL; loopidx--; } } } else if (!strcmp (cmd, "bye")) { break; } else if (!strcmp (cmd, "sleep")) { gnupg_sleep (1); } else if (!strcmp (cmd, "help")) { puts ( "Available commands:\n" "/echo ARGS Echo ARGS.\n" "/let NAME VALUE Set variable NAME to VALUE.\n" "/showvar Show all variables.\n" "/definq NAME VAR Use content of VAR for inquiries with NAME.\n" "/definqfile NAME FILE Use content of FILE for inquiries with NAME.\n" "/definqprog NAME PGM Run PGM for inquiries with NAME.\n" "/showdef Print all definitions.\n" "/cleardef Delete all definitions.\n" "/sendfd FILE MODE Open FILE and pass descriptor to server.\n" "/recvfd Receive FD from server and print.\n" "/open VAR FILE MODE Open FILE and assign the file descriptor to VAR.\n" "/close FD Close file with descriptor FD.\n" "/showopen Show descriptors of all open files.\n" "/serverpid Retrieve the pid of the server.\n" "/[no]hex Enable hex dumping of received data lines.\n" "/[no]decode Enable decoding of received data lines.\n" "/[no]subst Enable varibale substitution.\n" "/run FILE Run commands from FILE.\n" "/while VAR Begin loop controlled by VAR.\n" "/end End loop.\n" "/bye Terminate gpg-connect-agent.\n" "/help Print this help."); } else log_error (_("unknown command `%s'\n"), cmd ); continue; } if (opt.verbose && script_fp) puts (line); tmpline = opt.enable_varsubst? substitute_line (line) : NULL; if (tmpline) { rc = assuan_write_line (ctx, tmpline); xfree (tmpline); } else rc = assuan_write_line (ctx, line); if (rc) { log_info (_("sending line failed: %s\n"), gpg_strerror (rc) ); break; } if (*line == '#' || !*line) continue; /* Don't expect a response for a comment line. */ rc = read_and_print_response (ctx, &cmderr); if (rc) log_info (_("receiving line failed: %s\n"), gpg_strerror (rc) ); if ((rc || cmderr) && script_fp) { log_error ("stopping script execution\n"); fclose (script_fp); script_fp = NULL; } /* FIXME: If the last command was BYE or the server died for some other reason, we won't notice until we get the next input command. Probing the connection with a non-blocking read could help to notice termination or other problems early. */ } if (opt.verbose) log_info ("closing connection to agent\n"); return 0; } /* Handle an Inquire from the server. Return False if it could not be handled; in this case the caller shll complete the operation. LINE is the complete line as received from the server. This function may change the content of LINE. */ static int handle_inquire (assuan_context_t ctx, char *line) { const char *name; definq_t d; FILE *fp = NULL; char buffer[1024]; int rc, n; /* Skip the command and trailing spaces. */ for (; *line && !spacep (line); line++) ; while (spacep (line)) line++; /* Get the name. */ name = line; for (; *line && !spacep (line); line++) ; if (*line) *line++ = 0; - /* Now match it against our list. he second loop is todetect the - match all entry. **/ + /* Now match it against our list. The second loop is there to + detect the match-all entry. */ for (d=definq_list; d; d = d->next) if (d->name && !strcmp (d->name, name)) break; if (!d) for (d=definq_list; d; d = d->next) if (!d->name) break; if (!d) { if (opt.verbose) log_info ("no handler for inquiry `%s' found\n", name); return 0; } if (d->is_var) { char *tmpvalue = get_var_ext (d->file); rc = assuan_send_data (ctx, tmpvalue, strlen (tmpvalue)); xfree (tmpvalue); if (rc) log_error ("sending data back failed: %s\n", gpg_strerror (rc) ); } else { if (d->is_prog) { fp = popen (d->file, "r"); if (!fp) log_error ("error executing `%s': %s\n", d->file, strerror (errno)); else if (opt.verbose) log_error ("handling inquiry `%s' by running `%s'\n", name, d->file); } else { fp = fopen (d->file, "rb"); if (!fp) log_error ("error opening `%s': %s\n", d->file, strerror (errno)); else if (opt.verbose) log_error ("handling inquiry `%s' by returning content of `%s'\n", name, d->file); } if (!fp) return 0; while ( (n = fread (buffer, 1, sizeof buffer, fp)) ) { rc = assuan_send_data (ctx, buffer, n); if (rc) { log_error ("sending data back failed: %s\n", gpg_strerror (rc) ); break; } } if (ferror (fp)) log_error ("error reading from `%s': %s\n", d->file, strerror (errno)); } rc = assuan_send_data (ctx, NULL, 0); if (rc) log_error ("sending data back failed: %s\n", gpg_strerror (rc) ); if (d->is_var) ; else if (d->is_prog) { if (pclose (fp)) log_error ("error running `%s': %s\n", d->file, strerror (errno)); } else fclose (fp); return 1; } /* Read all response lines from server and print them. Returns 0 on success or an assuan error code. Set R_GOTERR to true if the command did not returned OK. */ static int read_and_print_response (assuan_context_t ctx, int *r_goterr) { char *line; size_t linelen; assuan_error_t rc; int i, j; int need_lf = 0; *r_goterr = 0; for (;;) { do { rc = assuan_read_line (ctx, &line, &linelen); if (rc) return rc; if (opt.verbose > 1 && *line == '#') { fwrite (line, linelen, 1, stdout); putchar ('\n'); } } while (*line == '#' || !linelen); if (linelen >= 1 && line[0] == 'D' && line[1] == ' ') { if (opt.hex) { for (i=2; i < linelen; ) { int save_i = i; printf ("D[%04X] ", i-2); for (j=0; j < 16 ; j++, i++) { if (j == 8) putchar (' '); if (i < linelen) printf (" %02X", ((unsigned char*)line)[i]); else fputs (" ", stdout); } fputs (" ", stdout); i= save_i; for (j=0; j < 16; j++, i++) { unsigned int c = ((unsigned char*)line)[i]; if ( i >= linelen ) putchar (' '); else if (isascii (c) && isprint (c) && !iscntrl (c)) putchar (c); else putchar ('.'); } putchar ('\n'); } } else if (opt.decode) { const unsigned char *s; int need_d = 1; int c = 0; for (j=2, s=(unsigned char*)line+2; j < linelen; j++, s++ ) { if (need_d) { fputs ("D ", stdout); need_d = 0; } if (*s == '%' && j+2 < linelen) { s++; j++; c = xtoi_2 ( s ); s++; j++; } else c = *s; if (c == '\n') need_d = 1; putchar (c); } need_lf = (c != '\n'); } else { fwrite (line, linelen, 1, stdout); putchar ('\n'); } } else { if (need_lf) { putchar ('\n'); need_lf = 0; } if (linelen >= 1 && line[0] == 'S' && (line[1] == '\0' || line[1] == ' ')) { fwrite (line, linelen, 1, stdout); putchar ('\n'); } else if (linelen >= 2 && line[0] == 'O' && line[1] == 'K' && (line[2] == '\0' || line[2] == ' ')) { fwrite (line, linelen, 1, stdout); putchar ('\n'); return 0; } else if (linelen >= 3 && line[0] == 'E' && line[1] == 'R' && line[2] == 'R' && (line[3] == '\0' || line[3] == ' ')) { fwrite (line, linelen, 1, stdout); putchar ('\n'); *r_goterr = 1; return 0; } else if (linelen >= 7 && line[0] == 'I' && line[1] == 'N' && line[2] == 'Q' && line[3] == 'U' && line[4] == 'I' && line[5] == 'R' && line[6] == 'E' && (line[7] == '\0' || line[7] == ' ')) { fwrite (line, linelen, 1, stdout); putchar ('\n'); if (!handle_inquire (ctx, line)) assuan_write_line (ctx, "CANCEL"); } else if (linelen >= 3 && line[0] == 'E' && line[1] == 'N' && line[2] == 'D' && (line[3] == '\0' || line[3] == ' ')) { fwrite (line, linelen, 1, stdout); putchar ('\n'); /* Received from server, thus more responses are expected. */ } else return gpg_error (GPG_ERR_ASS_INV_RESPONSE); } } } /* Connect to the agent and send the standard options. */ static assuan_context_t start_agent (void) { int rc = 0; char *infostr, *p; assuan_context_t ctx; infostr = getenv ("GPG_AGENT_INFO"); if (!infostr || !*infostr) { char *sockname; /* Check whether we can connect at the standard socket. */ sockname = make_filename (opt.homedir, "S.gpg-agent", NULL); rc = assuan_socket_connect (&ctx, sockname, 0); xfree (sockname); } else { int prot; int pid; infostr = xstrdup (infostr); if ( !(p = strchr (infostr, PATHSEP_C)) || p == infostr) { log_error (_("malformed GPG_AGENT_INFO environment variable\n")); xfree (infostr); exit (1); } *p++ = 0; pid = atoi (p); while (*p && *p != PATHSEP_C) p++; prot = *p? atoi (p+1) : 0; if (prot != 1) { log_error (_("gpg-agent protocol version %d is not supported\n"), prot); xfree (infostr); exit (1); } rc = assuan_socket_connect (&ctx, infostr, pid); xfree (infostr); } if (rc) { log_error ("can't connect to the agent: %s\n", gpg_strerror (rc)); exit (1); } if (opt.verbose) log_info ("connection to agent established\n"); rc = assuan_transact (ctx, "RESET", NULL, NULL, NULL, NULL, NULL, NULL); if (rc) { log_error (_("error sending %s command: %s\n"), "RESET", gpg_strerror (rc)); exit (1); } rc = send_pinentry_environment (ctx, GPG_ERR_SOURCE_DEFAULT, NULL, NULL, NULL, NULL, NULL, NULL, NULL); if (rc) { log_error (_("error sending standard options: %s\n"), gpg_strerror (rc)); exit (1); } return ctx; }