summaryrefslogtreecommitdiffstats
path: root/g10 (follow)
Commit message (Collapse)AuthorAgeFilesLines
* gpg: Check and fix keys on import.Justus Winter2017-06-143-2/+11
| | | | | | | | | | | * doc/gpg.texi: Document the new import option. * g10/gpg.c (main): Make the new option default to yes. * g10/import.c (parse_import_options): Parse the new option. (import_one): Act on the new option. * g10/options.h (IMPORT_REPAIR_KEYS): New macro. GnuPG-bug-id: 2236 Signed-off-by: Justus Winter <justus@g10code.com>
* gpg: Refactor key checking and fixing.Justus Winter2017-06-145-614/+693
| | | | | | | | | | | | | | * g10/Makefile.am (gpg_sources): Add new files. * g10/gpgcompose.c (keyedit_print_one_sig): New stub. * g10/keyedit.c (sig_comparison): Move to new module. (check_all_keysigs): Likewise. (fix_keyblock): Adapt callsite. (keyedit_menu): Likewise. * g10/key-check.c: New file. * g10/key-check.h: Likewise. GnuPG-bug-id: 2236 Signed-off-by: Justus Winter <justus@g10code.com>
* gpg: Refactor keyedit module.Justus Winter2017-06-134-39/+70
| | | | | | | | | | | | | * g10/Makefile.am (gpg_SOURCES): Add new file. * g10/keyedit.c (NODFLG_*): Move flags to the new header file. (print_one_sig): Export symbol and rename accordingly. (print_and_check_one_sig): Adapt accordingly. (check_all_keysigs): Likewise. * g10/keyedit.h: New file. * g10/main.h: Drop declarations, include new header. GnuPG-bug-id: 2236 Signed-off-by: Justus Winter <justus@g10code.com>
* gpg: Disable keydb handle caching only for W32Werner Koch2017-06-131-10/+17
| | | | | | | | | | | * g10/getkey.c (getkey_end) [!W32]: Re-enable caching. -- This change limits of the effects of commit d3d640b9cc98dd0d06b49a2e4d46eb67af96fe29 to W32 system. GnuPG-bug-id: 3097 Signed-off-by: Werner Koch <wk@gnupg.org>
* po: Make a string translatable.Werner Koch2017-06-131-3/+6
| | | | --
* gpg: Send gpgcompose --help output to stdout, not stderr.Neal H. Walfield2017-06-111-7/+7
| | | | | | | * g10/gpgcompose.c (show_help): Send gpgcompose --help output to stdout, not stderr. Reported-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
* gpg: Improve some output of gpgcompose.Neal H. Walfield2017-06-111-2/+5
|
* gpg: Support 'gpgcompose --encrypted-pop --help'Neal H. Walfield2017-06-111-3/+21
| | | | | | | * g10/gpgcompose.c (encrypted_pop_options): New variable. (encrypted_pop): Support the --help option. Reported-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
* gpg: Remove dead code.Neal H. Walfield2017-06-111-7/+1
| | | | | | * g10/gpgcompose.c (filter_pop): F->PKTTYPE will never be PKT_ENCRYPTED_MDC. (encrypted_pop): Likewise and there is no option --encrypted-mdc-pop.
* common,gpg,sm: Restrict the use of algorithms according to CO_DE_VS.Justus Winter2017-06-086-1/+147
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * common/compliance.c (gnupg_pk_is_allowed): New function. (gnupg_cipher_is_allowed): Likewise. (gnupg_digest_is_allowed): Likewise. * common/compliance.h (enum pk_use_case): New definition. (gnupg_pk_is_allowed): New prototype. (gnupg_cipher_is_allowed): Likewise. (gnupg_digest_is_allowed): Likewise. * g10/decrypt-data.c (decrypt_data): Restrict use of algorithms using the new predicates. * g10/encrypt.c (encrypt_crypt): Likewise. * g10/gpg.c (main): Likewise. * g10/pubkey-enc.c (get_session_key): Likewise. * g10/sig-check.c (check_signature2): Likewise. * g10/sign.c (do_sign): Likewise. * sm/decrypt.c (gpgsm_decrypt): Likewise. * sm/encrypt.c (gpgsm_encrypt): Likewise. * sm/gpgsm.c (main): Likewise. * sm/sign.c (gpgsm_sign): Likewise. * sm/verify.c (gpgsm_verify): Likewise. -- With this change, policies can effectively restrict what algorithms are used for different purposes. The algorithm policy for CO_DE_VS is implemented. GnuPG-bug-id: 3191 Signed-off-by: Justus Winter <justus@g10code.com>
* gpg: Fix computation of compliance with CO_DE_VS.Justus Winter2017-06-081-3/+4
| | | | | | | | * g10/mainproc.c (proc_encrypted): Symmetric encryption is also in compliance with CO_DE_VS. GnuPG-bug-id: 3059 Signed-off-by: Justus Winter <justus@g10code.com>
* gpg: Avoid failure exit when scdaemon is disabled but not needed.Werner Koch2017-06-081-2/+4
| | | | | | | | | | | | * g10/call-agent.c (warn_version_mismatch): Use log_info if error is "not supported". -- This fix may make the fix for GnuPG-bug-id: 3192 even more robust. Signed-off-by: Werner Koch <wk@gnupg.org>
* common: Add cipher mode to compliance predicate.Justus Winter2017-06-071-1/+1
| | | | | | | | | | * common/compliance.c (gnupg_cipher_is_compliant): Add mode parameter. * common/compliance.h (gnupg_cipher_is_compliant): Likewise. * g10/mainproc.c (proc_encrypted): Adapt callsite. * sm/decrypt.c (gpgsm_decrypt): Likewise. GnuPG-bug-id: 3059 Signed-off-by: Justus Winter <justus@g10code.com>
* common,gpg,sm: Initialize compliance module.Justus Winter2017-06-071-0/+3
| | | | | | | | | | * common/compliance.c (gnupg_initialize_compliance): New function. * common/compliance.h (gnupg_initialize_compliance): New prototype. * g10/gpg.c (main): Use the new function. * sm/gpgsm.c (main): Likewise. GnuPG-bug-id: 3191 Signed-off-by: Justus Winter <justus@g10code.com>
* common,gpg: Move the compliance option printer.Justus Winter2017-06-076-28/+11
| | | | | | | | | | | | | | * common/compliance.c (gnupg_compliance_option_string): New function. * common/compliance.h (gnupg_compliance_option_string): New prototype. * g10/encrypt.c (write_pubkey_enc_from_list): Update callsite. * g10/gpg.c (main): Likewise. * g10/keyedit.c (keyedit_menu): Likewise. * g10/pkclist.c (build_pk_list): Likewise. * g10/main.h (compliance_option_string): Remove prototype. * g10/misc.c (compliance_option_string): Remove function. GnuPG-bug-id: 3191 Signed-off-by: Justus Winter <justus@g10code.com>
* common,gpg,sm: Move the compliance option parser.Justus Winter2017-06-071-26/+11
| | | | | | | | | | | | | | * common/compliance.c (gnupg_parse_compliance_option): New function. * common/compliance.h (struct gnupg_compliance_option): New type. (gnupg_parse_compliance_option): New prototype. * g10/gpg.c (parse_compliance_option): Remove function. (compliance_options): New variable. (main): Adapt callsite. * sm/gpgsm.c (main): Use the new common function. * sm/gpgsm.h (opt): New field 'compliance'. GnuPG-bug-id: 3191 Signed-off-by: Justus Winter <justus@g10code.com>
* gpg: Improve compliance with CO_DE_VS.Justus Winter2017-06-071-0/+1
| | | | | | | | * g10/gpg.c (set_compliance_option): The specification, section 4.1.1, forbids the use of encryption without integrity protection. GnuPG-bug-id: 3191 Signed-off-by: Justus Winter <justus@g10code.com>
* common,g10: Fix typos.Justus Winter2017-06-061-1/+1
| | | | | -- Signed-off-by: Justus Winter <justus@g10code.com>
* gpg: Report compliance with CO_DE_VS.Justus Winter2017-06-011-0/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | * common/compliance.c (gnupg_pk_is_compliant): Add DSA with certain parameters. (gnupg_cipher_is_compliant): New function. (gnupg_digest_is_compliant): Likewise. * common/compliance.h (gnupg_cipher_is_compliant): New prototype. (gnupg_digest_is_compliant): Likewise. * common/status.h (STATUS_DECRYPTION_COMPLIANCE_MODE): New status. (STATUS_VERIFICATION_COMPLIANCE_MODE): Likewise. * doc/DETAILS: Document the new status lines. * g10/mainproc.c (proc_encrypted): Compute compliance with CO_DE_VS and report that using the new status line. (check_sig_and_print): Likewise. * sm/decrypt.c (gpgsm_decrypt): Likewise. * sm/verify.c (gpgsm_verify): Likewise. -- When decrypting data and verifying signatures, report whether the operations are in compliance with the criteria for data classified as VS-NfD. This information will be picked up by the frontend and presented to the user. GnuPG-bug-id: 3059 Signed-off-by: Justus Winter <justus@g10code.com>
* gpg,common: Move the compliance framework.Justus Winter2017-06-014-99/+11
| | | | | | | | | | | | | | * common/Makefile.am (common_sources): Add new files. * common/compliance.c: New file. Move 'gnupg_pk_is_compliant' here, and tweak it to not rely on types private to gpg. * common/compliance.h: New file. Move the compliance enum here. * g10/keylist.c (print_compliance_flags): Adapt callsite. * g10/main.h (gnupg_pk_is_compliant): Remove prototype. * g10/misc.c (gnupg_pk_is_compliant): Remove function. * g10/options.h (opt): Use the new compliance enum. * sm/keylist.c (print_compliance_flags): Use the common functions. Signed-off-by: Justus Winter <justus@g10code.com>
* gpg: Fix compliance computation.Justus Winter2017-05-311-1/+1
| | | | | | | | * g10/misc.c (gnupg_pk_is_compliant): Compare against CO_RFC2440, not RFC2440 which is actually a predicate. Fixes-commit: fe0b37e123ded51cc5f4cb5e3547fdfbce37a43e Signed-off-by: Justus Winter <justus@g10code.com>
* gpg: Fix typos.Justus Winter2017-05-302-3/+3
| | | | | -- Signed-off-by: Justus Winter <justus@g10code.com>
* gpg: Disable keydb handle cachingAndre Heinecke2017-05-301-1/+11
| | | | | | | | | | | | | | | | | | * g10/getkey.c (getkey_end): Disable caching of the open keydb handle. -- This created a big regression for Windows because the keyring is only released after the global ctrl is released. So if an operation does a getkey and then tries to modify the keyring it will fail on Windows with a sharing violation. We need to modify all keyring write operations to also take the ctrl and close the cached_getkey_kdb handle to make writing work. See: https://dev.gnupg.org/T3097 GnuPG-Bug-Id: T3097 Signed-off-by: Andre Heinecke <aheinecke@intevation.de>
* g10: Fix default-key selection for signing, possibly by card.NIIBE Yutaka2017-05-224-16/+62
| | | | | | | | | | | | | | | * g10/call-agent.c (warn_version_mismatch): Revert. (start_agent): Suppress version mismatch if relevant. * g10/getkey.c (get_seckey_default_or_card): New. * g10/skclist.c (build_sk_list): Use get_seckey_default_or_card. -- The change of 97a2394, which prefers available card than default key specified is too strong. Fixes-commit: 97a2394ecafaa6f58e4a1f70ecfd04408dc15606 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* g10: Fix gpgcompose.c.NIIBE Yutaka2017-05-171-1/+1
| | | | | | | | | * g10/gpgcompose.c (show_help): Check return value. -- Fixes-commit: 00b7767bc6fe309aa20375c859ebf708cfc7b9ea Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* g10: Suppress error for card availability check.NIIBE Yutaka2017-05-171-6/+9
| | | | | | | | | | | | | | * g10/call-agent.c (start_agent): Add semantics for card; Suppress error for card check. (warn_version_mismatch): Ignore an error for scdaemon. (agent_scd_serialno): Call start_agent with FLAG_FOR_CARD_SUPPRESS_ERRORS. -- GnuPG-bug-id: 3165 Fixes-commit: 97a2394ecafaa6f58e4a1f70ecfd04408dc15606 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* gpg: Do not mark ", " translatable.Werner Koch2017-05-151-2/+2
| | | | | | | | | | * g10/tofu.c (ask_about_binding): Remove useless translation markers. -- Translation and in particular punctuation marks can only be translated with context. Thus making a sole comma translatable is useless. Signed-off-by: Werner Koch <wk@gnupg.org>
* common: Let format_text return an error.Werner Koch2017-05-152-2/+14
| | | | | | | | | | | | | | | * common/stringhelp.c (format_text): Return NULL on error. * common/t-stringhelp.c (test_format_text): Adjust for change. * g10/gpgcompose.c (show_help): Abort on out of core. * g10/tofu.c (ask_about_binding): Abort on format_text error. (show_statistics): Ditto. (show_warning): Ditto. -- For better re-usability function in common/ shot better not use xmalloc functions. Signed-off-by: Werner Koch <wk@gnupg.org>
* tests: Make it possible to run all tests using our infrastructure.Justus Winter2017-05-112-1/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Makefile.am (TESTS_ENVIRONMENT): New variable. (check-all): New phony target to run all tests. * tests/gpgme/gpgme-defs.scm (have-gpgme?): New function that tests whether the GPGME test suite is available instead of exiting the process. * tests/gpgscm/init.scm (export): New macro. * tests/gpgscm/tests.scm (run-tests): New function. (load-tests): Likewise. * tests/gpgme/run-tests.scm: Simplify and move the parsing of the list of tests to 'all-tests.scm'. * tests/gpgsm/run-tests.scm: Likewise. * tests/migrations/run-tests.scm: Likewise. * tests/openpgp/run-tests.scm: Likewise. * tests/gpgme/Makefile.am: To select the tests to run, use the variable 'TESTS'. This harmonizes the interface with the automake test suite. * tests/gpgsm/Makefile.am: Likewise. * tests/migrations/Makefile.am: Likewise. * tests/openpgp/Makefile.am: Likewise. * tests/openpgp/README: Likewise. * agent/all-tests.scm: New file. * common/all-tests.scm: Likewise. * g10/all-tests.scm: Likewise. * g13/all-tests.scm: Likewise. * tests/gpgme/all-tests.scm: Likewise. * tests/gpgsm/all-tests.scm: Likewise. * tests/migrations/all-tests.scm: Likewise. * tests/openpgp/all-tests.scm: Likewise. * tests/run-tests.scm: Likewise. -- This change allows us to run all tests in parallel and write one XML report capturing the results of every test. It also lays the foundation to parametrize test suites. Signed-off-by: Justus Winter <justus@g10code.com>
* g10, sm, dirmngr, common: Add comment for fall through.NIIBE Yutaka2017-05-105-10/+10
| | | | | | | | | | | | | | | * common/b64dec.c (b64dec_proc): Comment to clarify. * dirmngr/cdblib.c (cdb_make_put): Use same pattern to clarify. * dirmngr/dirmngr-client.c (read_pem_certificate): Likewise. * dirmngr/ks-engine-hkp.c (ks_hkp_get): Likewise. * g10/armor.c (unarmor_pump): Likewise. * g10/gpg.c (main): Likewise. * g10/import.c (read_block): Likewise. * g10/keygen.c (make_backsig): Likewise. * g10/pkclist.c (check_signatures_trust): Likewise. * sm/gpgsm.c (main): Likewise. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* g10: Stop compiler warning for t-stutter.NIIBE Yutaka2017-05-101-0/+1
| | | | | | | | | | | * g10/t-stutter.c (do_test): Refer current_test_group_failed. -- Since this test does not follow the framework of TEST/TEST_P/ABORT, the variable is not used. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* gpg: Properly account for ring trust packets.Justus Winter2017-05-083-2/+7
| | | | | | | | | | | | | | | | | | | | | | | * g10/keyring.c (keyring_get_keyblock): Use the parser's packet count instead of counting ourself. * g10/packet.h (struct parse_packet_ctx_s): New field 'n_parsed_packets'. (init_parse_packet): Initialize new field. * g10/parse-packet.c (parse): Count packets. -- The 'keyring' keystore depends on the number of packets for delete and update operations. With the rework of the ring trust packets, the trust packets were no longer properly accounted for leading to keyring corruptions. The 'keybox' store was not affected. GnuPG-bug-id: 3123 GnuPG-bug-id: 3135 GnuPG-bug-id: 3144 Fixes-commit: a8895c99a7d0750132477d80cd66caaf3a709113 Signed-off-by: Justus Winter <justus@g10code.com>
* gpg: Fix typo.Justus Winter2017-05-081-1/+1
| | | | | -- Signed-off-by: Justus Winter <justus@g10code.com>
* g10: Remove skeleton options files.Daniel Kahn Gillmor2017-05-024-321/+1
| | | | | | | | | | | | | | | | | | | | | * build-aux/speed/w32/inst.nsi: stop installing skeleton files. * doc/gpg.texi: stop documenting skeleton files. * g10/Makefile.am: stop installing skeleton files. * g10/openfile.c (copy_options_file): Remove. (try_make_homedir): do not call copy_options_file. -- The defaults for gpg and dirmngr are good. Both programs should work fine for the simple case without any config file. The skeleton config files were being copied at first use (when the defaults are fine). But when the user needs to fiddle with them (after they've become sophisticated users), they're likely out of date because gpg has been upgraded since then. So they're used for documentation, but they're stale documentation, which is probably worse than a clean empty file. GnuPG-bug-id: 3086 Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
* Spelling fixes in docs and comments.NIIBE Yutaka2017-04-2814-22/+22
| | | | | | | | | | -- In addition, fix trailing spaces in tests/inittests. GnuPG-bug-id: 3121 Reported-by: ka7 (klemens) Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* g10: For signing, prefer available card key when no -u option.NIIBE Yutaka2017-04-271-2/+28
| | | | | | | | | | * g10/skclist.c (build_sk_list): Ask gpg-agent if card is available. Then, use the card key if any. -- GnuPG-bug-id: 1983 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* g10: Minor clean up.NIIBE Yutaka2017-04-262-3/+1
| | | | | | | * g10/main.h (complete_sig): Remove declaration. * g10/sign.c (complete_sig): Make it static. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* g10: invalidate the fd cache for keyring.NIIBE Yutaka2017-04-251-1/+6
| | | | | | | | | | * g10/keyring.c (keyring_search_reset): Don't keep the FD cache. -- GnuPG-bug-id: 3096 Fixes-commit: 5556eca5acd46983bff0b38a1ffbc2f07fbaba9f Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* w32: Enable wildcard expansion with mingw-w64Andre Heinecke2017-04-241-0/+3
| | | | | | | | | | | * g10/gpg.c: Define _dowildcard = -1; -- If this value is defined wildcard support in the c runtime is enabled again. This fixes a regression caused by switching to mingw 3.0 Signed-off-by: Andre Heinecke <aheinecke@intevation.de>
* tests: Locate resources and scripts relative to top source dir.Justus Winter2017-04-243-11/+11
| | | | | | | | | | | | -- Locate every resource and every script used in the tests using a path relative to the top of the source tree. This is a purely mechanical change, mostly done using regular expressions, with a few manual fixups here and there. Signed-off-by: Justus Winter <justus@g10code.com>
* g10: Fix parse_ring_trust.NIIBE Yutaka2017-04-171-1/+1
| | | | | | * g10/parse-packet.c (parse_ring_trust): Fix condition. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* g10: Minor fixes.NIIBE Yutaka2017-04-173-4/+5
| | | | | | | | | * g10/export.c (cleartext_secret_key_to_openpgp): No initialization. (do_export_one_keyblock): Initialize with GPG_ERR_NOT_FOUND. * g10/getkey.c (get_best_pubkey_byname): Add non-null check. * g10/tofu.c (tofu_set_policy): ERR initialize to 0. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* g10: Fix import/export filter property match.NIIBE Yutaka2017-04-171-1/+1
| | | | | | * g10/import.c (impex_filter_getval): Fix to "else if". Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* common, g10: Fix enumeration types.NIIBE Yutaka2017-04-131-10/+13
| | | | | | | | | | | | | | | | * common/openpgpdefs.h (CIPHER_ALGO_PRIVATE10, PUBKEY_ALGO_PRIVATE10) (DIGEST_ALGO_PRIVATE10, COMPRESS_ALGO_PRIVATE10): New. * g10/misc.c (map_pk_gcry_to_openpgp): Add type conversion. (map_cipher_openpgp_to_gcry, openpgp_cipher_algo_name) (openpgp_pk_test_algo2, map_md_openpgp_to_gcry) (pubkey_get_npkey): Add default handling. -- Compilers may emit code assuming the maximum value of enum type. According to OpenPGP specification, there are cases for private uses. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* common: Simplify format_text.NIIBE Yutaka2017-04-122-6/+6
| | | | | | | | | | | * common/stringhelp.c (format_text): Don't allow IN_PLACE formatting. * common/stringhelp.h: Change the API with no IN_PLACE. * common/t-stringhelp.c (test_format_text): Follow the change. * g10/gpgcompose.c (show_help): Likewise. * g10/tofu.c (format_conflict_msg_part1, ask_about_binding) (show_statistics, show_warning): Likewise. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* g10: Minor clean up for export.c.NIIBE Yutaka2017-04-121-19/+16
| | | | | | | | | | | | | | | | * g10/export.c (export_ssh_key): Check IDENTIFIER for error. Release base64 thing on error of get_membuf. -- Compiler (older) may misunderstand the variable IDENTIFIER is not initialized, while good one can do better analysys on the value for ERR (and thus, IDENTIFIER). On the error of get_membuf, still, b64enc_finish should be called, even if it lost the ERR value. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* g10,tools: Fix bzlib.h include order.NIIBE Yutaka2017-04-111-1/+2
| | | | | | | | | | | | * g10/compress-bz2.c: Include bzlib.h after gcrypt.h. * tools/gpgsplit.c: Likewise. -- bzlib.h may include windows.h on Windows. It is better after gcrypt.h which may include winsock2.h. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* g10: Minor clean up for TOFU.NIIBE Yutaka2017-04-111-1/+1
| | | | | | * g10/tofu.c (ask_about_binding): Fix for qualifier. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* gpg: Fix printing of offline taken subkey.Werner Koch2017-04-071-1/+1
| | | | | | | | * g10/keylist.c (list_keyblock_print): Set SECRET to 2 and not 0x32. -- Reported-by: Danielle McLean <dani@00dani.me> Signed-off-by: Werner Koch <wk@gnupg.org>
* gpg: Handle critical marked 'Reason for Revocation'.Werner Koch2017-04-031-0/+1
| | | | | | | | | | | | | * g10/parse-packet.c (can_handle_critical): Add SIGSUBPKT_REVOC_REASON. -- Some software seems to mark that subpacket as criticial. Although gpg has no special treatment for a revocation reasons (except for --list-packets) we can accept a criticial marked anyway. There are no mandatary rules specified on how to handle a revocation reason. Signed-off-by: Werner Koch <wk@gnupg.org>