summaryrefslogtreecommitdiffstats
path: root/g10/sig-check.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* gpg: Silence some diagnostics.Werner Koch2022-09-281-1/+1
| | | | | | | | | | | | | | | | | | * g10/parse-packet.c (enum_sig_subpkt): Show "buffer shorter than subpacket" only in debug mode. (parse_signature): Show "signature packet without timestamp / keyid" only in souble verbose mode. * g10/sig-check.c (check_signature_metadata_validity): Use ISO timestamp in UTC for the signature expired note. -- I have seen to many of these diagnostics and in particular the first one seems to be a connected to the others. Thus it does not make sense to show them in standard verbose mode. The ISO timestamp is much easier to read than than the localized timestamp and switching from localtime to UTC should not harm.
* gpg: New option --override-compliance-checkWerner Koch2021-10-131-11/+31
| | | | | | | | | | | | | | | | | | | | | | | * g10/gpg.c (oOverrideComplianceCheck): New. (opts): Add new option. (main): Set option and add check for batch mode. * g10/options.h (opt): Add flags.override_compliance_check. * g10/sig-check.c (check_signature2): Factor complaince checking out to ... (check_key_verify_compliance): this. Turn error into a warning in override mode. -- There is one important use case for this: For systems configured globally to use de-vs mode, Ed25519 and other key types are not allowed because they are not listred in the BSI algorithm catalog. Now, our release signing keys happen to be Ed25519 and thus we need to offer a way for users to check new versions even if the system is in de-vs mode. This does on purpose not work in --batch mode so that scripted solutions won't accidently pass a signature check. GnuPG-bug-id: 5655
* gpg: Do not use weak digest algos if selected by recipient prefs.Werner Koch2020-11-021-7/+5
| | | | | | | | | | | | | | | | | | | | | | | * g10/misc.c (is_weak_digest): New. (print_digest_algo_note): Use it here. * g10/sig-check.c (check_signature_end_simple): Use it. * g10/sign.c (hash_for): Do not use recipient_digest_algo if it is in the least of weak digest algorithm. -- If a message is signed and encrypted to several recipients, the to be used digest algorithm is deduced from the preferences of the recipient. This is so that all recipients are able to check the the signature. However, if the sender has a declared an algorithm as week, that algorithm shall not be used - in this case we fallback to the standard way of selecting an algorithm. Note that a smarter way of selecting the algo is to check this while figuring out the algorithm - this needs more testing and thus we do it the simple way. Reported-by: Phil Pennock Signed-off-by: Werner Koch <wk@gnupg.org>
* gpg: Fix check_signature2 for opaque MPI.NIIBE Yutaka2020-11-021-2/+21
| | | | | | * g10/sig-check.c (check_signature2): Handle the case of opaque MPI. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* gpg: Fix counting buffer size in check_signature2.NIIBE Yutaka2020-11-021-1/+1
| | | | | | * g10/sig-check.c (check_signature2): Use GCRYMPI_FMT_PGP. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* sm: Exclude rsaPSS from de-vs compliance mode.Werner Koch2020-07-031-1/+1
| | | | | | | | | | | | | | | * common/compliance.h (PK_ALGO_FLAG_RSAPSS): New. * common/compliance.c (gnupg_pk_is_compliant): Add arg alog_flags and test rsaPSS. Adjust all callers. (gnupg_pk_is_allowed): Ditto. * sm/misc.c (gpgsm_ksba_cms_get_sig_val): New wrapper function. (gpgsm_get_hash_algo_from_sigval): New. * sm/certcheck.c (gpgsm_check_cms_signature): Change type of sigval arg. Add arg pkalgoflags. Use the PK_ALGO_FLAG_RSAPSS. * sm/verify.c (gpgsm_verify): Use the new wrapper and new fucntion to also get the algo flags. Pass algo flags along. Signed-off-by: Werner Koch <wk@gnupg.org>
* doc: Minor code comment fixes.Werner Koch2020-06-081-1/+2
| | | | --
* gpg: Make use of the included key block in a signature.Werner Koch2020-03-131-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * g10/import.c (read_key_from_file): Rename to ... (read_key_from_file_or_buffer): this and add new parameters. Adjust callers. (import_included_key_block): New. * g10/packet.h (PKT_signature): Add field flags.key_block. * g10/parse-packet.c (parse_signature): Set that flags. * g10/sig-check.c (check_signature2): Add parm forced_pk and change all callers. * g10/mainproc.c (do_check_sig): Ditto. (check_sig_and_print): Try the included key block if no key is available. -- This is is the second part to support the new Key Block subpacket. The idea is that after having received a signed mail, it is instantly possible to reply encrypted - without the need for any centralized infrastructure. There is one case where this does not work: A signed mail is received using a specified signer ID (e.g. using gpg --sender option) and the key block with only that user ID is thus imported. The next time a mail is received using the same key but with a different user ID; the signatures checks out using the key imported the last time. However, the new user id is not imported. Now when trying to reply to that last mail, no key will be found. We need to see whether we can update a key in such a case. GnuPG-bug-id: 4856 Signed-off-by: Werner Koch <wk@gnupg.org>
* gpg: Add option --allow-weak-key-signatures.Werner Koch2019-11-071-1/+3
| | | | | | | | | | | | * g10/gpg.c (oAllowWeakKeySignatures): New. (opts): Add --allow-weak-key-signatures. (main): Set it. * g10/options.h (struct opt): Add flags.allow_weak_key_signatures. * g10/misc.c (print_sha1_keysig_rejected_note): New. * g10/sig-check.c (check_signature_over_key_or_uid): Print note and act on new option. Signed-off-by: Werner Koch <wk@gnupg.org>
* gpg: Ignore all SHA-1 signatures in 3rd party key signatures.Werner Koch2019-10-031-6/+2
| | | | | | | | | | | * g10/sig-check.c (check_signature_over_key_or_uid): No cut-off date and remove debug output. -- With 2.2 we do not not support SHA-1 key signatures anymore even if that means that the WoT shrinks. Signed-off-by: Werner Koch <wk@gnupg.org>
* gpg: Be prepared for chosen-prefix SHA-1 collisions in key signatures.Werner Koch2019-10-031-15/+29
| | | | | | | | * g10/sig-check.c (check_signature_over_key_or_uid): Reject cewrtain SHA-1 based signatures. -- Signed-off-by: Werner Koch <wk@gnupg.org>
* sm: Add yet inactive options to support authenticodeWerner Koch2019-04-301-1/+1
| | | | | | | | | | | | * sm/gpgsm.c (opts): New options --authenticode and --attribute. * sm/gpgsm.h (opt): Add vars authenticode and attribute_list. * sm/sign.c (add_signed_attribute): New but inactive. (gpgsm_sign): Use new options. -- Because libksba 1.4 is not yet ready the new code is not yet active. Signed-off-by: Werner Koch <wk@gnupg.org>
* gpg: Implement v5 keys and v5 signatures.Werner Koch2019-03-141-13/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * g10/build-packet.c (gpg_mpi_write): New optional arg R_NWRITTEN. Allow NULL for OUT. Change all callers. (do_key): Support v5 keys. (build_sig_subpkt_from_sig): Support 32 byte fingerprints. * g10/parse-packet.c (parse_signature): First try to set the keyid from the issuer fingerprint. (parse_key): Support v5 keys. (create_gpg_control): Better make sure to always allocate the static size of the struct in case future compilers print warnings. * g10/keyid.c (hash_public_key): Add v5 support. (keyid_from_pk): Ditto. (keyid_from_fingerprint): Ditto. (fingerprint_from_pk): Ditto. * g10/keygen.c (KEYGEN_FLAG_CREATE_V5_KEY): New. (pVERSION, pSUBVERSION): New. (add_feature_v5): New. (keygen_upd_std_prefs): Call it. (do_create_from_keygrip): Add arg keygen_flags and support the v5 flag. (common_gen): Support the v5 flag. (parse_key_parameter_part): New flags v4 and v5. (parse_key_parameter_string): Add args for version and subversion. (read_parameter_file): New keywords "Key-Version" and "Subkey-Version". (quickgen_set_para): Add arg 'version'. (quick_generate_keypair, generate_keypair): Support version parms. (do_generate_keypair): Support v5 key flag. (generate_subkeypair): Ditto. (generate_card_subkeypair): Preparse for keyflags. (gen_card_key): Ditto. * g10/sig-check.c (check_signature2): Add args extrahash and extrahashlen. (check_signature_end): Ditto. (check_signature_end_simple): Ditto. Use them. * g10/mainproc.c (proc_plaintext): Put extra hash infor into the control packet. (do_check_sig): Add args extrahas and extrahashlen and pass them on. (issuer_fpr_raw): Support 32 byte fingerprint. (check_sig_and_print): get extra hash data and pass it on. -- Note that this is only basic support and requires more fine tuning/fixing. Signed-off-by: Werner Koch <wk@gnupg.org>
* gpg: Implemented latest rfc4880bis version 5 packet hashing.Werner Koch2019-03-141-16/+34
| | | | | | | | | | | | | | | | | * configure.ac (AC_CHECK_SIZEOF): Test size_t. * g10/sig-check.c (check_signature_end_simple): Support v5 signatures as per current rfc4880bis. For correctness also allow for N > 2^32. * g10/sign.c (pt_extra_hash_data_t): New. (hash_sigversion_to_magic): New arg EXTRAHASH. (write_plaintext_packet): New arg R_EXTRAHASH. (write_signature_packets): Pass EXTRAHASH. (sign_file): Ditto. (sign_symencrypt_file): Ditto. -- Take care: The code path for v5 sigs has not yet been tested. Signed-off-by: Werner Koch <wk@gnupg.org>
* gpg: Prepare revocation keys for use with v5 keys.Werner Koch2018-12-041-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * g10/packet.h (struct revocation_key): Add field 'fprlen'. * g10/parse-packet.c (parse_revkeys): Set fprlen and allow for v5 keys. Also fix reading of unitialized data at place where MAX_FINGERPRINT_LEN is used. * g10/revoke.c (gen_desig_revoke): Allow for v5 keys and use fprlen. Do an explicit compare to avoid reading unitialized data. * g10/sig-check.c (check_revocation_keys): Use the fprlen. * g10/getkey.c (merge_selfsigs_main): Do an explicit copy to avoid reading unitialized data. * g10/import.c (revocation_present): Use fprlen. * g10/keyedit.c (show_key_with_all_names): Use fprlen. (menu_addrevoker): Use fprlen. Allow for v5 keys. * g10/keygen.c (keygen_add_revkey): Use fprlen. (parse_revocation_key): Allow for v5 keys. * g10/keyid.c (keyid_from_fingerprint): Allow for v5 keys. Print a better error message in case of bogus fingerprints. * g10/keylist.c (print_revokers): Use fprlen. -- The reading of uninitialized data is harmless but we better fix it to make valgrind happy. More serious was that we always passed MAX_FINGERPRINT_LEN but we will need to support 20 and 32 octet fingerprints and MAX_FINGERPRINT_LEN would be too large for a v4. Signed-off-by: Werner Koch <wk@gnupg.org>
* gpg: Unfinished support for v5 signatures.Werner Koch2018-10-241-10/+19
| | | | | | | | | | | | * g10/parse-packet.c (parse_signature): Allow for v5 signatures. * g10/sig-check.c (check_signature_end_simple): Support the 64bit v5 byte count. * g10/sign.c (hash_sigversion_to_magic): Ditto. (write_signature_packets): Request v5 sig for v5 keys. Remove useless condition. (make_keysig_packet): Request v5 sig for v5 keys. Signed-off-by: Werner Koch <wk@gnupg.org>
* gpg: Fix extra check for sign usage of a data signature.Werner Koch2018-10-081-1/+2
| | | | | | | | | | | * g10/sig-check.c (check_signature_end_simple): -- Obviously we should not ignore a back signature here. Fixes-commit: 214b0077264e35c079e854a8b6374704aea45cd5 GnuPG-bug-id: 4014 Signed-off-by: Werner Koch <wk@gnupg.org>
* gpg: Prepare for signatures with ISSUER_FPR but without ISSUER.Werner Koch2018-07-051-2/+2
| | | | | | | | | | | | | | | | | | * g10/getkey.c (get_pubkey_for_sig): New. (get_pubkeyblock_for_sig): New. * g10/mainproc.c (issuer_fpr_raw): Give global scope. (check_sig_and_print): Use get_pubkeyblock_for_sig. * g10/pkclist.c (check_signatures_trust): Use get_pubkey_for_sig. * g10/sig-check.c (check_signature2): Ditto. (check_signature_over_key_or_uid): Ditto. -- GnuPG-bug-id: 4046 The whole getkey stuff is still a mess with way to much duplication and missing caching of already fetched data. Signed-off-by: Werner Koch <wk@gnupg.org>
* gpg: Extra check for sign usage when verifying a data signature.Werner Koch2018-07-041-2/+11
| | | | | | | | | | | * g10/sig-check.c (check_signature_end_simple): Check sign usage. -- Without this patch the signature verification fails only due to the missing back signature. This check better explains what went wrong. GnuPG-bug-id: 4014 Signed-off-by: Werner Koch <wk@gnupg.org>
* Merge branch 'STABLE-BRANCH-2-2' into masterWerner Koch2018-04-101-343/+347
|\ | | | | | | | | | | | | | | | | -- Fixed conflicts: NEWS - keep master configure.ac - merge g10/card-util.c - mostly 2.2 g10/sig-check.c - 2.2
| * gpg: Check that a key may do certifications.Werner Koch2018-04-061-0/+21
| | | | | | | | | | | | | | | | | | | | * g10/sig-check.c (check_signature_end_simple): Check key usage for certifications. (check_signature_over_key_or_uid): Request usage certification. -- GnuPG-bug-id: 3844 Signed-off-by: Werner Koch <wk@gnupg.org>
| * gpg: Re-indent sig-check.c and use signature class macros.Werner Koch2018-04-061-387/+371
| | | | | | | | | | | | | | | | | | | | * g10/keydb.h (IS_BACK_SIG): New. * g10/sig-check.c: Re-indent and use macros. -- This makes the code easier to understand. Signed-off-by: Werner Koch <wk@gnupg.org>
* | gpg: Prepare for a longer fingerprintWerner Koch2017-09-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * g10/card-util.c (change_cafpr): Use MAX_FINGERPRINT_LEN. * g10/cipher.c (write_header): Use snprintf. * g10/gpg.h (MAX_FINGERPRINT_LEN): Change to 32. (MAX_FORMATTED_FINGERPRINT_LEN): Change to 59 * g10/keyid.c (format_hexfingerprint): Add v5 fingerprint format. * g10/tofu.c (get_policy): Use MAX_FINGERPRINT_LEN for the buffer but keep the raw length for now. -- Note that this patch only increases the size of the buffer and adds a new formatting for v5 fingerprints. Moe work is required to fix internal data structures like those in trustdb.gpg and the tofu tables. Signed-off-by: Werner Koch <wk@gnupg.org>
* | gpg: Let --debug clock time sign and verify.Werner Koch2017-09-271-0/+4
|/ | | | | | | | | | | | | | | | * configure.ac (ENABLE_LOG_CLOCK): New ac_define and option. * common/logging.c (log_clock): Use ENABLE_LOG_CLOCK to enable timestamp printing. * g10/call-agent.c (agent_pksign): Time signing. * g10/sig-check.c (check_signature_end_simple): Time verification. -- Timing for verification is limited to data signatures because this is the most common thing to evaluate. We should consider to change log_clock to printf style so that we could print the signature class and other info. Signed-off-by: Werner Koch <wk@gnupg.org>
* gpg: Fix memory leak in sig-check.Werner Koch2017-08-241-2/+5
| | | | | | | | | | | | | | | | | | | | * g10/sig-check.c (check_signature_over_key_or_uid): Remove useless condition. Actually free when SIGNER was allocated by us. -- SIGNER_ALLOCATED never received a value of -1 but that was tested. IF SIGNER_ALLOCATED was 2 the memory was never freed: if (signer_allocated == 1) if (signer_allocated == 2) free() Fixes-commit: 44cdb9d73f1a0b7d2c8483a119b9c4d6caabc1ec This function needs to be audited more thoroughly. Signed-off-by: Werner Koch <wk@gnupg.org>
* indent: Change comment style on two functionsWerner Koch2017-08-241-63/+71
| | | | | | | | | | | | | | | | | | | | | -- This is to make those function better readable. if (foo) /* Comment */ { } is bad style because it requires extra time to notice the begin of the block and vice versa when noticing the block it is not clear whether this is an conditioned or unconditioned block. Having asterisks on the left is better for view impaired people and for b/w printouts. Signed-off-by: Werner Koch <wk@gnupg.org>
* gpg,sm: String changes for compliance diagnostics.Werner Koch2017-07-281-4/+2
| | | | Signed-off-by: Werner Koch <wk@gnupg.org>
* gpg: Tweak compliance checking for verificationWerner Koch2017-07-271-4/+5
| | | | | | | | | | | | | | | * common/compliance.c (gnupg_pk_is_allowed): Rework to always allow verification. * g10/mainproc.c (check_sig_and_print): Print a con-compliant warning. * g10/sig-check.c (check_signature2): Use log_error instead of log_info. -- We should be able to verify all signatures. So we only print a warning. That is the same beheavour as for untrusted keys etc. GnuPG-bug-id: 3311 Signed-off-by: Werner Koch <wk@gnupg.org>
* indent: Always use "_(" and not "_ (" to mark translatable strings.Werner Koch2017-06-191-2/+2
| | | | | | | | -- This makes greping much easier and we have done that since ever. Signed-off-by: Werner Koch <wk@gnupg.org>
* po: Make a string translatable.Werner Koch2017-06-131-3/+6
| | | | --
* common,gpg,sm: Restrict the use of algorithms according to CO_DE_VS.Justus Winter2017-06-081-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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: Print more stats for the keydb and the signature cache.Werner Koch2017-03-311-1/+30
| | | | | | | | | | | | | * g10/sig-check.c (sig_check_dump_stats): New. (cache_stats): New struct. (check_key_signature2): Update stats. * g10/gpg.c (g10_exit): Call new function. * g10/keydb.c (kid_not_found_cache_count): Replace by ... (kid_not_found_stats): ... new struct. Change users. (keydb_stats): New struct. Update the counters. (keydb_dump_stats): Print all stats. Signed-off-by: Werner Koch <wk@gnupg.org>
* gpg: Pass CTRL to many more functions.Werner Koch2017-03-311-17/+25
| | | | | | | | | | -- For proper operations as a server we need to avoid global variables. Thus we need to pass the session state CTRL to most functions. Quite a lot of changes but fortunately straightforward to do. Signed-off-by: Werner Koch <wk@gnupg.org>
* Remove -I option to common.NIIBE Yutaka2017-03-071-3/+3
| | | | | | | | | | | | | * dirmngr/Makefile.am (AM_CPPFLAGS): Remove -I$(top_srcdir)/common. * g10/Makefile.am (AM_CPPFLAGS): Ditto. * g13/Makefile.am (AM_CPPFLAGS): Ditto. * kbx/Makefile.am (AM_CPPFLAGS): Ditto. * scd/Makefile.am (AM_CPPFLAGS): Ditto. * sm/Makefile.am (AM_CPPFLAGS): Ditto. * tools/Makefile.am (AM_CPPFLAGS): Ditto. * Throughout: Follow the change. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* Change all http://www.gnu.org in license notices to https://Werner Koch2016-11-051-1/+1
| | | | --
* gpg: Fix printing of pubkey algo in --verbose signature verify.Werner Koch2016-09-011-27/+31
| | | | | | | | | | | | | | | | | | | * g10/sig-check.c (check_signature2): Replace arg PK by R_PK and change the semantics. Also clear the other R_ args on function entry, use gpg_error() and change retturn type to gpg_error_t. * g10/mainproc.c (do_check_sig): Add arg R_PK. (list_node): Pass NULL for new arg. (check_sig_and_print): Rework to make use of the returned PK. -- The output gpg: textmode signature, digest algorithm SHA256, key algorithm rsa2048 showed the pubkey algo of the primary key which was surprising. Changed to print the algo of the subkey used for verification. Signed-off-by: Werner Koch <wk@gnupg.org>
* g10: Fix checking key for signature validation.NIIBE Yutaka2016-08-041-2/+2
| | | | | | | | | | | | * g10/sig-check.c (check_signature2): Not only subkey, but also primary key should have flags.valid=1. -- The tweak of gpgv in e32c575e0f3704e7563048eea6d26844bdfc494b only makes sense with this change. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* g10: Fix signature checking.NIIBE Yutaka2016-05-111-4/+9
| | | | | | | | | | | | * g10/sig-check.c (check_signature_over_key_or_uid): Fix call to walk_kbnode. -- Thanks to Vincent Brillault (Feandil). GnuPG-bug-id: 2351 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* gpg: Remove all assert.h and s/assert/log_assert/.Werner Koch2016-04-291-9/+8
| | | | Signed-off-by: Werner Koch <wk@gnupg.org>
* gpg: Prettify a 2 octet hex output.Werner Koch2016-02-261-1/+2
| | | | | | * g10/sig-check.c (check_key_signature2): Wrap line and use %02x. Signed-off-by: Werner Koch <wk@gnupg.org>
* gpg: Show debugging info if a sig with an unsupported sig class is used.Neal H. Walfield2016-02-251-1/+6
| | | | | | | | | * g10/sig-check.c (check_key_signature2): If SIG->CLASS is unsupported, show some debugging information. Don't use BUG to fail. Just return GPG_ERR_BAD_SIGNATURE. -- Signed-off-by: Neal H. Walfield <neal@g10code.com>
* gpg: Split check_key_signature2.Neal H. Walfield2016-02-191-92/+273
| | | | | | | | | | | | * g10/sig-check.c (hash_uid_node): Rename from this... (hash_uid_packet): ... to this. Take a PKT_user_id instead of a KBNODE. (check_key_signature2): Split the basic signature checking functionality into... (check_signature_over_key_or_uid): ... this new function. -- Signed-off-by: Neal H. Walfield <neal@g10code.com>
* gpg: Split the function check_signature_end.Neal H. Walfield2016-02-191-5/+23
| | | | | | | | | * g10/sig-check.c (check_signature_end): Break the basic signature check into... (check_signature_end_simple): ... this new function. -- Signed-off-by: Neal H. Walfield <neal@g10code.com>
* gpg: Use "days" in "...newer than..." diagnostics.Werner Koch2016-01-181-10/+35
| | | | | | | | | | | * g10/sig-check.c (check_signature_metadata_validity): Use days if useful. -- Using days instead of a high number of seconds is for the majority of users a better measurement. Signed-off-by: Werner Koch <wk@gnupg.org>
* Use ngettext for some strings.Werner Koch2016-01-181-11/+10
| | | | | | | | | | | | | | | | | * scd/app-openpgp.c (build_enter_admin_pin_prompt): Use ngettext for some diagnostics. (do_genkey): Ditto. * g10/keyedit.c (check_all_keysigs, menu_delsig, menu_clean): Ditto. * g10/keylist.c (print_signature_stats): Ditto. * g10/keyserver.c (keyserver_refresh): Ditto. * g10/sig-check.c (check_signature_metadata_validity): Ditto. * g10/sign.c (do_sign): Ditto. * g10/trustdb.c (reset_trust_records): Ditto. (validate_keys): Use a table like diagnostic output. -- Suggested-by: Ineiev <ineiev@gnu.org> Signed-off-by: Werner Koch <wk@gnupg.org>
* gpg: Re-indent check_key_signature2.Werner Koch2016-01-121-284/+309
| | | | | | | | | | | | | | | | | | | | | | | | | | | | -- I am considering some changes and thus better start off by switching to standard GNU indentation. This patch also changes comment lines like if (foo) /* Comment on foo. */ { to if (foo) { /* Comment on foo. */ or if (foo) /* Comment on foo. */ { to make the brace of the opening block stand out immediately. Further stars on the left are added to longer comments because that makes the code easier to read by disabled hackers, when reading without font locking, and for reading black-white printouts.
* Fix typos found using codespell.Justus Winter2015-11-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * agent/cache.c: Fix typos. * agent/call-pinentry.c: Likewise. * agent/call-scd.c: Likewise. * agent/command-ssh.c: Likewise. * agent/command.c: Likewise. * agent/divert-scd.c: Likewise. * agent/findkey.c: Likewise. * agent/gpg-agent.c: Likewise. * agent/w32main.c: Likewise. * common/argparse.c: Likewise. * common/audit.c: Likewise. * common/audit.h: Likewise. * common/convert.c: Likewise. * common/dotlock.c: Likewise. * common/exechelp-posix.c: Likewise. * common/exechelp-w32.c: Likewise. * common/exechelp-w32ce.c: Likewise. * common/exechelp.h: Likewise. * common/helpfile.c: Likewise. * common/i18n.h: Likewise. * common/iobuf.c: Likewise. * common/iobuf.h: Likewise. * common/localename.c: Likewise. * common/logging.c: Likewise. * common/openpgp-oid.c: Likewise. * common/session-env.c: Likewise. * common/sexputil.c: Likewise. * common/sysutils.c: Likewise. * common/t-sexputil.c: Likewise. * common/ttyio.c: Likewise. * common/util.h: Likewise. * dirmngr/cdblib.c: Likewise. * dirmngr/certcache.c: Likewise. * dirmngr/crlcache.c: Likewise. * dirmngr/dirmngr-client.c: Likewise. * dirmngr/dirmngr.c: Likewise. * dirmngr/dirmngr_ldap.c: Likewise. * dirmngr/dns-stuff.c: Likewise. * dirmngr/http.c: Likewise. * dirmngr/ks-engine-hkp.c: Likewise. * dirmngr/ks-engine-ldap.c: Likewise. * dirmngr/ldap-wrapper.c: Likewise. * dirmngr/ldap.c: Likewise. * dirmngr/misc.c: Likewise. * dirmngr/ocsp.c: Likewise. * dirmngr/validate.c: Likewise. * g10/encrypt.c: Likewise. * g10/getkey.c: Likewise. * g10/gpg.c: Likewise. * g10/gpgv.c: Likewise. * g10/import.c: Likewise. * g10/keydb.c: Likewise. * g10/keydb.h: Likewise. * g10/keygen.c: Likewise. * g10/keyid.c: Likewise. * g10/keylist.c: Likewise. * g10/keyring.c: Likewise. * g10/mainproc.c: Likewise. * g10/misc.c: Likewise. * g10/options.h: Likewise. * g10/packet.h: Likewise. * g10/parse-packet.c: Likewise. * g10/pkclist.c: Likewise. * g10/pkglue.c: Likewise. * g10/plaintext.c: Likewise. * g10/server.c: Likewise. * g10/sig-check.c: Likewise. * g10/sqlite.c: Likewise. * g10/tdbio.c: Likewise. * g10/test-stubs.c: Likewise. * g10/tofu.c: Likewise. * g10/trust.c: Likewise. * g10/trustdb.c: Likewise. * g13/create.c: Likewise. * g13/mountinfo.c: Likewise. * kbx/keybox-blob.c: Likewise. * kbx/keybox-file.c: Likewise. * kbx/keybox-init.c: Likewise. * kbx/keybox-search-desc.h: Likewise. * kbx/keybox-search.c: Likewise. * kbx/keybox-update.c: Likewise. * scd/apdu.c: Likewise. * scd/app-openpgp.c: Likewise. * scd/app-p15.c: Likewise. * scd/app.c: Likewise. * scd/ccid-driver.c: Likewise. * scd/command.c: Likewise. * scd/iso7816.c: Likewise. * sm/base64.c: Likewise. * sm/call-agent.c: Likewise. * sm/call-dirmngr.c: Likewise. * sm/certchain.c: Likewise. * sm/gpgsm.c: Likewise. * sm/import.c: Likewise. * sm/keydb.c: Likewise. * sm/minip12.c: Likewise. * sm/qualified.c: Likewise. * sm/server.c: Likewise. * tools/gpg-check-pattern.c: Likewise. * tools/gpgconf-comp.c: Likewise. * tools/gpgkey2ssh.c: Likewise. * tools/gpgparsemail.c: Likewise. * tools/gpgtar.c: Likewise. * tools/rfc822parse.c: Likewise. * tools/symcryptrun.c: Likewise. Signed-off-by: Justus Winter <justus@g10code.com>
* gpg: Ensure all weak digest rejection notices are shownDaniel Kahn Gillmor2015-10-261-9/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | * g10/main.h: Add rejection_shown flag to each weakhash struct * g10/misc.c (print_digest_algo_note, additional_weak_digest): Do not treat MD5 separately; (print_digest_rejected_note): Use weakhash.rejection_shown instead of static shown. * g10/options.h (opt): Change from additional_weak_digests to weak_digests. * g10/sig-check.c: Do not treat MD5 separately. * g10/gpg.c (main): Explicitly set MD5 as weak. * g10/gpgv.c (main): Explicitly set MD5 as weak. -- Previously, only one weak digest rejection message was shown, of whichever was the first type encountered. This meant that if "gpg --weak-digest SHA224" encountered both an MD5 digest and a SHA224 digest, it would only show the user that the MD5 digest was rejected. In order to let the user know which algorithms were rejected, we needed to move the "shown" flag into a per-weak-algorithm location. Given this additional complication, it made no sense to continue to treat MD5 specially, so it is added as a default weak algorithm in the same opt.weak_digests data structure as any other. Signed-Off-By: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
* gpg: Improve function documentation and some comments.Neal H. Walfield2015-10-191-43/+197
| | | | | | | | | * g10/main.h: Improve function documentation. * g10/packet.h.h: Improve function documentation. * g10/sig-check.c: Improve function documentation and some comments. -- Signed-off-by: Neal H. Walfield <neal@g10code.com>
* gpg: Improve and regularize naming of signature checking functions.Neal H. Walfield2015-10-191-25/+33
| | | | | | | | | | | | | | * g10/packet.h (signature_check): Rename from this... (check_signature): ... to this. Update users. (signature_check2): Rename from this... (check_signature2): ... to this. Update users. * g10/sig-check.c (do_check): Rename from this... (check_signature_end): ... to this. Update users. (do_check_messages): Rename from this... (check_signature_metadata_validity): ... to this. Update users. -- Signed-off-by: Neal H. Walfield <neal@g10code.com>