aboutsummaryrefslogtreecommitdiffstats
path: root/g10 (unfollow)
Commit message (Collapse)AuthorFilesLines
2022-07-05ecdh: Use gcry_md_read when KDF API is not available.t5964NIIBE Yutaka1-0/+22
* g10/ecdh.c [GCRYPT_VERSION_NUMBER] (derive_kek): Conditionalize. -- Note that it's compile-time check. Signed-off-by: NIIBE Yutaka <[email protected]>
2022-06-16gpg: Use GCRY_KDF_ONESTEP_KDF for FIPS.NIIBE Yutaka1-17/+14
* g10/ecdh.c (derive_kek): Use KDF API of libgcrypt. -- GnuPG-bug-id: 5964 Signed-off-by: NIIBE Yutaka <[email protected]>
2022-06-14g10: Fix garbled status messages in NOTATION_DATAWerner Koch1-9/+4
* g10/cpr.c (write_status_text_and_buffer): Fix off-by-one -- Depending on the escaping and line wrapping the computed remaining buffer length could be wrong. Fixed by always using a break to terminate the escape detection loop. Might have happened for all status lines which may wrap. GnuPG-bug-id: T6027
2022-06-14keygen: Fix reading AEAD preferenceJakub Jelen1-1/+1
* g10/keygen.c (keygen_set_std_prefs): Use the right variable when reading AEAD preference string -- GnuPG-bug-id: 6019 Signed-off-by: Jakub Jelen <[email protected]>
2022-06-03Remove remaining support for WindowsCEWerner Koch4-42/+1
--
2022-05-28gpg: Setup the 'usage' filter property for export.Werner Koch1-0/+6
* g10/export.c (do_export_stream): Merge the key to get the properties ready. -- This makes gpg --export --export-filter 'drop-subkey=usage=~a' (Export all subkeys but those with the auth usage) work without using the workaound of adding --export-options export-clean
2022-04-26gpg: Look up user ID to revoke by UID hashIngo Klöcker1-31/+87
* g10/keyedit.c (find_userid_by_namehash, find_userid): New. (keyedit_quick_revuid): Use find_userid() instead of iterating over the nodes of the keyblock. * tests/openpgp/quick-key-manipulation.scm: Add test for revoking a user ID specified by its hash. -- This makes it possible to specify the user ID to revoke as UID hash when calling --quick-revoke-uid. GnuPG-bug-id: 5936
2022-04-25gpg: Avoid NULL ptr access due to corrupted packets.Werner Koch1-6/+13
* g10/parse-packet.c (parse_signature): Do not create an opaque MPI with NULL and length > 0 (parse_key): Ditto. -- GnuPG-bug-id: 5940, 5946
2022-04-25gpg: Emit an ERROR status as hint for a bad passphrase.Werner Koch1-8/+20
* g10/mainproc.c (proc_symkey_enc): Issue new error code. (proc_encrypted): Ditto. -- This allows GPGME to return a better error message than "bad session key" to the user. Technically we could get run into these errors also in other cases but this more unlikley. For the command line use we don't do anything to not change the expected output of the command line interface. GnuPG-bug-id: 5943
2022-04-22gpg: Fix line end in error messageIngo Klöcker1-1/+1
* g10/keyedit.c (menu_adduid): Move linefeed character to the format string. -- This fixes a literal '\n' in the error message and a missing line feed after the error message.
2022-04-20w32: Do no use Registry item DefaultLogFile for the main tools.Werner Koch1-1/+1
* g10/gpg.c (main): Set LOG_NO_REGISTRY. * sm/gpgsm.c (main): Ditto. * tools/gpg-connect-agent.c (main): Ditto. * tools/gpgconf.c (main): Ditto. (show_other_registry_entries): Print "DefaultLogFile". -- The intention of this mostly forgotten registry entry was to allow for easy debugging of the tools. However, with the global config file common.conf things are anyway better. We disable the use for the commonly used tools so that it does not look like calling gpg on the command line seems to block with no output if the log server (e.g. tcp://1.2.3.4:11111) is not reachable.
2022-04-14gpg: Replace an assert by a log_fatal.Werner Koch1-3/+6
* g10/build-packet.c (do_signature): Use log_fatal. -- GnuPG-bug-id: 5809
2022-04-08gpg: Remove restrictions for the name part of a user-id.Werner Koch1-7/+0
* g10/keygen.c (ask_user_id): Allow for the name to start with a digit. Allow names shorter than 5. -- The reason for this change is that we don't enforce these constraints in the --quick-gen-key interface. I added the constraints right in the beginning of gnupg to make sure that we have a uniform style for user-ids. However, this is all problematic with non-Latin names and we prefer to use mail addresses anyway.
2022-03-29gpg,tools: Remove use of repo only zlib-riscos.h.NIIBE Yutaka1-10/+0
* g10/compress.c: Don't use zlib-riscos.h. * tools/gpgsplit.c: Likewise. -- Signed-off-by: NIIBE Yutaka <[email protected]>
2022-03-28gpg: Remove EAX from the preference list.Werner Koch2-8/+1
* g10/gpg.c (main): Remove note about rfc4880bis. * g10/keygen.c (keygen_set_std_prefs): Use only OCB in the AEAD preference list. -- It is more than unlikely that EAX will ever be used in practice and thus we remove it from the preference list.
2022-03-19gpg: Always use version >= 4 to generate signature.NIIBE Yutaka1-0/+9
* g10/sign.c (update_keysig_packet): Make sure sig->version >= 4. -- GnuPG-bug-id: 5809 Signed-off-by: NIIBE Yutaka <[email protected]>
2022-03-18gpg: Print info about the used AEAD algorithm in the compliance msg.Werner Koch3-5/+18
* g10/misc.c (openpgp_cipher_algo_mode_name): New. * g10/decrypt-data.c (decrypt_data): Use function here. -- Note that openpgp_cipher_algo_mode_name is different from the version 2.2 becuase we append ".CFB" here. Without this change we would see gpg: cipher algorithm 'AES256' may not be used in --compliance=de-vs mode This is confusing because AES256 is compliant. Now we see gpg: cipher algorithm 'AES256.OCB' may not be used in --compliance=de-vs mode which gives a hint on the problem.
2022-03-18gpg: Allow decryption of symencr even for non-compliant cipher.Werner Koch5-18/+47
* g10/decrypt-data.c (decrypt_data): Add arg compliance_error. Adjust all callers. Fail on compliance error only in --require-compliance mode. Make sure to return an error if the buffer is missing; actually that should be an assert. * g10/mainproc.c (proc_encrypted): Delay printing of the compliance mode status. Consult the compliance error now returned by decrypt_data. -- The actual case here is that we fail hard if a message has been AEAD encrypted with one AEAD capable key and also with one passphrase. In general the preference system takes care of not using AEAD if one recipient's key does not support it. However, if the sender uses her own AEAD-capable key _and_ a passphrase the message will be AEAD encrypted. This change allows to decrypt that anyway along with a warning message. Note that this does currently not work in 2.3 due to a non-compliant libgcrypt. We will however, backport this to 2.2.
2022-03-09sign: Construct valid AEAD packets.Jakub Jelen1-1/+2
* g10/sign.c (sign_symencrypt_file): Insert correct version and AEAD information into symkey packet. -- GnuPG-bug-id: 5856 Signed-off-by: Jakub Jelen <[email protected]>
2022-03-08gpg: New option --require-compliance.Werner Koch4-6/+55
* g10/options.h (opt): Add field flags.require_compliance. * g10/gpg.c (oRequireCompliance): New. (opts): Add --require-compliance. (main): Set option. * g10/mainproc.c (proc_encrypted): Emit error if non de-vs compliant. (check_sig_and_print): Ditto. * g10/encrypt.c (encrypt_crypt): Ditto. -- Note that in the --encrypt and --verify cased other checks may kick in earlier than this new --require-compliance controlled one.
2022-03-08gpg: fix --enarmor with zero length source fileJussi Kivilinna2-0/+6
* common/iobuf.c (filter_flush): Remove "src_len == 0" check. * g10/compress-bz2.c (do_compress): Exit early if flush not forced and input length is zero. * g10/compress.c (do_compress): Likewise. -- Remove "(src_len == 0)" check in filter_flush which was introduced to fix compress failure caused by zero length flush from iobuf_close. However this check broke enarmoring file with length of zero. Patch instead fixes zero length flush problem in compress filters. GnuPG-bug-id: T5828 Signed-off-by: Jussi Kivilinna <[email protected]>
2022-03-08g10/cipher-aead: add fast path for avoid memcpy when AEAD encryptingJussi Kivilinna1-12/+57
* g10/cipher-aead.c (do_hash): Add faster path for encrypting directly from input buffer instead of memcpying then encrypting inplace. -- When encrypting with AES256.OCB on AMD Ryzen 5800X, memcpy shows as taking largest portion of computation time. Patch adds fast path for AEAD encryption which largely eliminates need for memcpying when doing AEAD encryption. AES256.OCB throughput increases from 2.2GB/s to 4.2GB/s on said system (1.9x faster). GnuPG-bug-id: T5828 Signed-off-by: Jussi Kivilinna <[email protected]>
2022-03-08g10/decrypt-data: disable output estream buffering to reduce overheadJussi Kivilinna1-0/+2
* g10/decrypt-data.c (decrypt_data): Disable estream buffering for output file. -- Here estream is filled with iobuf_copy which already uses large buffers so additional buffering in estream was just adding memory copy overhead. GnuPG-bug-id: T5828 Signed-off-by: Jussi Kivilinna <[email protected]>
2022-03-08g10/plaintext: disable estream buffering in binary modeJussi Kivilinna1-1/+23
* g10/plaintext.c (handle_plaintext): Disable estream buffering in binary modes. -- Since in binary mode, large buffers are passed from source iobuf to target estream, extra buffering in estream only causes extra memory copying and overhead. GnuPG-bug-id: T5828 Signed-off-by: Jussi Kivilinna <[email protected]>
2022-03-08Use iobuf buffer size for temporary buffer sizeJussi Kivilinna2-10/+15
* common/iobuf.c (iobuf_copy): Use iobuf buffer size for temporary buffers. * g10/plaintext.c (handle_plaintext, do_hash): Likewise. * g10/sign.c (sign_file): Likewise. -- As iobuf will have zerocopy operation for read/write, it is better to use same size buffers as iobuf for temporary copy buffers. GnuPG-bug-id: T5828 Signed-off-by: Jussi Kivilinna <[email protected]>
2022-03-02g10/encrypt: use iobuf_copy instead of manual iobuf_read/iobuf_writeJussi Kivilinna1-9/+3
* g10/encrypt.c (encrypt_simple): Use 'iobuf_copy' for no-literal case. -- GnuPG-bug-id: T5852 Signed-off-by: Jussi Kivilinna <[email protected]>
2022-03-02g10/dearmor: use iobuf_copyJussi Kivilinna1-7/+2
* g10/dearmor.c (dearmor_file, enarmor_file): Use 'iobuf_copy'. -- GnuPG-bug-id: T5852 Signed-off-by: Jussi Kivilinna <[email protected]>
2022-02-27g10/sign: sign_file: use iobuf_read for higher detached signing speedJussi Kivilinna1-2/+2
* g10/sign.c (sign_file): Use iobuf_read instead of iobuf_get for reading data from detached file. -- This patch reduces iobuf_read per byte processing overhead and speeds up detached signing. Detached signing speed on AMD Ryzen 5800X (4.3GiB file, SHA256): gpg process user time before: 3.951s after: 1.898s (2.0x faster) GnuPG-bug-id: T5826 Signed-off-by: Jussi Kivilinna <[email protected]>
2022-02-27g10/plaintext: do_hash: use iobuf_read for higher performanceJussi Kivilinna1-2/+7
* g10/plaintext.c (do_hash): Use iobuf_read instead of iobuf_get for reading data; Use gcry_md_write instead of gcry_md_putc for hash data. -- This patch reduces iobuf_read per byte processing overhead and speeds up detached signature verifying. Detached verifying speed on AMD Ryzen 5800X (4.3GiB file, SHA256): gpg process user time before: 9.410s after: 1.913s (4.9x faster) GnuPG-bug-id: T5826 Signed-off-by: Jussi Kivilinna <[email protected]>
2022-02-25gpg: Clarify a call of ask_for_detached_datafile.NIIBE Yutaka1-1/+1
* g10/mainproc.c (proc_tree): Call ask_for_detached_datafile with MD2=NULL. -- Here, c->mfx.md2 is always NULL, in fact. But, text-wise (when searching the use of "mfx.md2"), before the change, it used mfx.md2, which is irrelevant in the handling of PKT_ONEPASS_SIG. Note that: One-Pass Signature is not available in PGP2. This fix removes (text-wise) unmatch of the calls of functions hash_datafile_by_fd hash_datafiles, and ask_for_detached_datafile. Fixes-commit: 88a916cdd40e43312ffcde6bb1c157fe1c122f74 Signed-off-by: NIIBE Yutaka <[email protected]>
2022-02-23Fix the previous commit.NIIBE Yutaka1-1/+1
-- Fixes-commit: 903c5fe369bc4948718a7d2a0e19b1acdb2406c4 Signed-off-by: NIIBE Yutaka <[email protected]>
2022-02-22gpg: Fix generating AEAD packet.NIIBE Yutaka1-1/+1
* g10/cipher-aead.c (do_free): Fix the condition of the last chunk. -- GnuPG-bug-id: 5853 Signed-off-by: NIIBE Yutaka <[email protected]>
2022-02-08g10/mainproc: avoid extra hash contexts when decrypting MDC inputJussi Kivilinna1-2/+8
* g10/mainproc.c (mainproc_context): New member 'seen_pkt_encrypted_mdc'. (release_list): Clear 'seen_pkt_encrypted_mdc'. (proc_encrypted): Set 'seen_pkt_encrypted_mdc'. (have_seen_pkt_encrypted_aead): Rename to... (have_seen_pkt_encrypted_aead_or_mdc): ...this and add check for 'seen_pkt_encrypted_mdc'. (proc_plaintext): Do not enable extra hash contexts when decrypting MDC input. -- Avoiding extra hash contexts speeds up CFB/MDC decryption quite a lot. For example, decrypting symmetric-key AES-256 encrypted 4 GiB file from RAM to /dev/null sees ~3.4x speed increase on AMD Ryzen 5800X: AES256.CFB encryption: 783 MB/s AES256.CFB decryption: 386 MB/s (before) AES256.CFB encryption: 1.3 GB/s (after patch) Note, AEAD is still significantly faster: AES256.OCB encryption: 2.2 GB/s AES256.OCB decryption: 3.0 GB/s GnuPG-bug-id: T5820 Signed-off-by: Jussi Kivilinna <[email protected]>
2022-02-02gpg: Fix for -Wformat when using uint64_t.NIIBE Yutaka2-4/+5
* g10/cipher-aead.c (do_flush): Use PRIu64. * g10/decrypt-data.c (aead_underflow): Likewise. -- Even among LP64 data model machines, uint64_t type may differ; unsigned long or unsigned long long. Only portable way is use of PRIu64. Signed-off-by: NIIBE Yutaka <[email protected]>
2022-02-01gpg,sm: Set --verbose and clear --quiet in debug mode.Werner Koch1-0/+6
* g10/gpg.c (set_debug): Tweak options. * sm/gpgsm.c (set_debug): Ditto.
2022-01-28gpg: Allow --dearmor to decode all kinds of armor files.Werner Koch3-8/+34
* g10/filter.h (armor_filter_context_t): New fields dearmor_mode and dearmor_state. * g10/dearmor.c (dearmor_file): Set dearmor_mode. * g10/armor.c (is_armor_header): Magic to switch to generic dearmor mode. (parse_header_line): Treat non OpenPGP armor in a special way. (check_input): Ditto. (radix64_read): Detect non OpenPGP armor END lines.
2022-01-18gpg: Print Yubikey version correctly.Werner Koch3-2/+38
* g10/call-agent.c (learn_status_cb): Parse APPVERSION. * g10/call-agent.h (struct agent_card_info_s): Add field appversion. * g10/card-util.c (print_a_version): New. (current_card_status): Print version from appversion. -- This is a regression due to the PIV support. Note that the newer gpg-card worked correctly. GnuPG-bug-id: 5787
2022-01-12gpg: Fix adding the list of ultimate trusted keys.NIIBE Yutaka4-2/+48
* g10/keygen.c (do_generate_keypair): Remove another call to update_ownertrust. * g10/trust.c (update_ownertrust): Add call to tdb_update_utk. * g10/trustdb.c (tdb_update_utk): New. * g10/trustdb.h (tdb_update_utk): New. -- GnuPG-bug-id: 5742 Signed-off-by: NIIBE Yutaka <[email protected]>
2022-01-11gpg: Report failed generation of subkey pair via status interfaceIngo Klöcker1-1/+5
* g10/keygen.c (generate_subkeypair): On error, write error and "key not created" message to status interface. -- This change allows users of the status/command interface to detect errors when adding a subkey to a key. Similar status messages are output by do_generate_keypair. GnuPG-bug-id: 5771
2022-01-11gpg: Request keygrip of key to add via command interfaceIngo Klöcker1-2/+2
* g10/keygen.c (ask_algo): Request keygrip via cpr_get. * doc/help.txt (gpg.keygen.keygrip): New help text. -- This change makes it possible to add an existing (sub)key to another key via the status/command interface. GnuPG-bug-id: 5771
2021-12-20gpg: Correctly set the ownertrust for a new key.Werner Koch1-3/+1
* g10/keygen.c (do_generate_keypair): Use update_ownertrust. -- GnuPG-bug-id: 5742
2021-12-20gpg: Add unfinished code for --export-secret-ssh-key.Werner Koch3-35/+449
* g10/gpg.c (exportSecretSshKey): New. (opts): Add --export-secret-ssh-key. (main): Implement option. * g10/export.c (do_export_stream): Factor keywrap key code out to ... (get_keywrap_key): new. (mb_write_uint32, mb_write_uint8) (mb_write_data, mb_write_cstring) (mb_write_string, mb_write_mpi): New. (receive_raw_seckey_from_agent): New. (export_secret_ssh_key): New. -- Due to time constraints the code is not yet ready.
2021-12-20gpg: Allow passing a keygrip as description to pinentry.Werner Koch2-15/+37
* g10/keydb.h (FORMAT_KEYDESC_KEYGRIP): New. * g10/passphrase.c (gpg_format_keydesc): Add new mode. Signed-off-by: Werner Koch <[email protected]>
2021-12-10gpg: Emit compatible Ed25519 signature.NIIBE Yutaka3-1/+87
* g10/pkglue.c (sexp_extract_param_sos_nlz): New. * g10/pkglue.h: Add the declaration. * g10/sign.c (do_sign): Use sexp_extract_param_sos_nlz for Ed25519. -- Ed25519 signature in GnuPG 2.2 has no leading zeros. GnuPG-bug-id: 5331 Signed-off-by: NIIBE Yutaka <[email protected]>
2021-11-24gpg: Fix function prototype to match declaration.Jakub Jelen1-3/+7
* g10/test-stubs.c (keyserver_import_mbox): Fix prototype -- GnuPG-bug-id: 5393 Signed-off-by: Jakub Jelen <[email protected]>
2021-11-24gpg: Fix format_keyid.NIIBE Yutaka1-5/+4
* g10/keyid.c (format_keyid): Allocate buffer earlier. -- Signed-off-by: NIIBE Yutaka <[email protected]>
2021-11-24gpg: Fix key conversion for SSH.NIIBE Yutaka1-5/+6
* g10/export.c (key_to_sshblob): Use put_membuf with length counted beforehand, and use memcmp instead of strncmp. -- GnuPG-bug-id: 5393 Signed-off-by: NIIBE Yutaka <[email protected]>
2021-11-22gpg: New option --forbid-gen-key.Werner Koch1-9/+40
* g10/gpg.c (oForbidGenKey, opts): New option. (mopt): New local struct (gen_key_forbidden): New. (main): Set and handle the option. -- In large system installation it is sometimes useful to make it a bit harder for users to generate their own keys. An example is a policy to not use on-disk keys.
2021-11-18gpg,gpgsm: Add option --min-rsa-length.Werner Koch2-0/+6
* common/compliance.c (min_compliant_rsa_length): New. (gnupg_pk_is_compliant): Take in account. (gnupg_pk_is_allowed): Ditto. (gnupg_set_compliance_extra_info): New. * g10/gpg.c (oMinRSALength): New. (opts): Add --min-rsa-length. (main): Set value. * g10/options.h (opt): Add field min_rsa_length. * sm/gpgsm.c (oMinRSALength): New. (opts): Add --min-rsa-length. (main): Set value. * sm/gpgsm.h (opt): Add field min_rsa_length.
2021-11-13Update release signing keysWerner Koch1-0/+0
-- The last key is new. As usual the key is on a dedicated card with the Admin PIN accessible to a few core hackers. # ------------------------ >8 ------------------------ pub rsa3072 2017-03-17 [SC] [expires: 2027-03-15] 5B80C5754298F0CB55D8ED6ABCEF7E294B092E28 sig R BCEF7E294B092E28 2017-03-17 Andre Heinecke (Release Signing Key) uid Andre Heinecke (Release Signing Key) sig 3 BCEF7E294B092E28 2017-03-17 Andre Heinecke (Release Signing Key) sig 1FDF723CF462B6B1 2017-03-17 Andre Heinecke <[email protected]> pub ed25519 2020-08-24 [SC] [expires: 2030-06-30] 6DAA6E64A76D2840571B4902528897B826403ADA uid Werner Koch (dist signing 2020) sig 3 528897B826403ADA 2020-08-24 Werner Koch (dist signing 2020) sig 249B39D24F25E3B6 2020-08-24 Werner Koch (dist sig) sig 63113AE866587D0A 2020-08-24 [email protected] sig E3FDFF218E45B72B 2020-08-24 Werner Koch (wheatstone commit signing) sig F2AD85AC1E42B367 2020-08-24 Werner Koch <[email protected]> pub ed25519 2021-05-19 [SC] [expires: 2027-04-04] AC8E115BF73E2D8D47FA9908E98E9B2D19C6C8BD uid Niibe Yutaka (GnuPG Release Key) sig 3 E98E9B2D19C6C8BD 2021-05-19 Niibe Yutaka (GnuPG Release Key) sig 00B45EBD4CA7BABE 2021-09-14 NIIBE Yutaka <[email protected]> sig E267B052364F028D 2021-09-14 NIIBE Yutaka <[email protected]> pub brainpoolP256r1 2021-10-15 [SC] [expires: 2029-12-31] 02F38DFF731FF97CB039A1DA549E695E905BA208 uid GnuPG.com (Release Signing Key 2021) sig 3 549E695E905BA208 2021-10-15 GnuPG.com (Release Signing Key 2021) sig 528897B826403ADA 2021-10-15 Werner Koch (dist signing 2020) sig E3FDFF218E45B72B 2021-10-15 Werner Koch (wheatstone commit signing)