aboutsummaryrefslogtreecommitdiffstats
path: root/common
Commit message (Collapse)AuthorAgeFilesLines
* common: Allow the use of the newer ksba_parser_t functions.HEADmasterWerner Koch47 hours2-1/+247
| | | | | | * common/tlv.h: Prepare for use obn ksba 1.9.0 functions. * common/tlv-parser.c [KSBA_VERSION_NUMBER]: Add wrappers for using the ksba versions of the code.
* gpgsm: Support creation of verification of ML-DSA signatures.Werner Koch13 days1-1/+1
| | | | | | | | | | | | | | | | | | | * common/sexputil.c (get_pk_algo_from_key): Enlarge buffer for algo name so that "dilithium3" can be detected. * agent/pksign.c (do_encode_mldsa): New. (agent_pksign_do): Call it. * sm/certcheck.c (pk_algo_from_sexp): Detected ML-DSA. (gpgsm_check_cms_signature): Support ML-DSA. Also rework error cleanup. * sm/sign.c (gpgsm_sign): Support ML-DSA. * sm/verify.c (gpgsm_verify): Fix a comment. -- Libgcrypt 1.12.5 and libksba 1.9.0 are required to work properly. GnuPG-bug-id: 8517
* gpgsm: Basic support for ML-DSA certificatesWerner Koch13 days1-0/+13
| | | | | | | | | | | * common/sexputil.c (pubkey_algo_string): Support GCRY_PK_MLDSA. * sm/certcheck.c (gpgsm_check_cert_sig): Ditto. * sm/keylist.c (oidtranstbl): Add 2 OIDs for ML-DSA. -- Libgcrypt 1.12.5 is required to work properly. GnuPG-bug-id: 8517
* Cleanup some minor compiler warningsWerner Koch2026-10-051-1/+0
| | | | | | | * dirmngr/server.c (proc_pkd_get): Init try_without_subdomain earlier to avoid a false error in the error code path. * dirmngr/dns.c (dns_so_check) [!__linux]: Do not define a label. * common/homedir.c (w32_myproc_self): Remove unused variable.
* doc: Typo fixesWerner Koch2026-10-011-1/+1
| | | | --
* common: Fix composite DO parsing.NIIBE Yutaka2026-09-221-1/+6
| | | | | | | | | | | * common/tlv.c (do_find_tlv): Don't forget the maximum length to N when call it recursively. -- GnuPG-bug-id: 8465 Reported-by: eris Signed-off-by: NIIBE Yutaka <[email protected]>
* Allow gettime.c to be build with -Wformat-nonliteral.Werner Koch2026-09-141-13/+41
| | | | | | | | | | | | | * configure.ac (mycflags): Add -Wformat-nonliteral. * common/gettime.c (asctimestamp): Factor code out to ... (format_time_nl_langinfo): new. Disable the format-nonliteral warning. Add a static initialization. -- Back in 2003 there was no way to disable the nonliteral warning and thus I disabled it entirely because some Linux distros used -Werror. See-also: 8ab35a7d26707dfa0032b3b0dbde6a984a9683cb
* Merge branch 'wk/rfc9980'Werner Koch2026-09-116-149/+541
|\ | | | | | | | | | | | | | | | | | | -- After 25 years the NSA could even convince GnuPG that their idea of using complex algorithm is better for someones(tm) security. But fortunately there is no need to enable it. Thus all guards of pretty good and gnu privacy won't enable --compliance=fips|de-vs or use the option --allow-9980.
| * gpg: Add Brainpool and NIST as specified by an RFC-9980 update.Werner Koch2026-09-091-5/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * common/openpgpdefs.h (pubkey_algo_t): Add constants for algorithm numbers proposed for the rfc-9980 update. Also reserve one for Dilithium. (IS_PUBKEY_ALGO_MLK768): New. (IS_PUBKEY_ALGO_MLK1024): New. (IS_PUBKEY_ALGO_MLK): New. * g10/misc.c (openpgp_pk_test_algo2): Add the new MLK algos. (openpgp_pk_algo_usage): Ditto. (openpgp_pk_algo_name): Ditto. (pubkey_get_npkey): Ditto. (pubkey_get_nskey): Ditto. (pubkey_get_nenc): Ditto. * g10/keyid.c (pubkey_string): Ditto. (keygrip_from_pk): Ditto. Simplify by using the new macros. (hexkeygrip_from_pk): Simplify. * g10/pkglue.c (do_encrypt_kem): Use the new macros to handle the new MLK algos. Map the new algos to ECC curve names. (pk_encrypt): Support all MLK algos. * g10/pubkey-enc.c (get_session_key): Ditto. (get_it): Ditto. * g10/seskey.c (encode_session_key): Ditto. * g10/encrypt.c (create_dek_with_warnings): Ditto. (use_rfc9980_seipdv2): Ditto. (write_pubkey_enc): Ditto. * g10/keygen.c (PQC9980_STD_KEY_PARAM_SUB): Change to use mlk768_bp384. (ecckey_from_sexp): Support all MLK algos. (common_gen): Ditto. (gen_kyber): Add parameters for the new algos. (get_keysize_range): Support the new algos. (fixup_keysize): Support all MLK algos. (do_create): Ditto. (parse_key_parameter_part): Fix "mlk768" input to use "ietf25". Add parameters for the new MLK algos. * g10/import.c (build_mode1003_sexp): Support the new MLK algos. * g10/parse-packet.c (parse_pubkeyenc): Add support for the new MLK algos. (parse_key): Ditto. * kbx/keybox-openpgp.c (keygrip_from_keyparm): Ditto. (parse_key): Ditto. * g10/build-packet.c (do_key): Ditto. (do_pubkey_enc_v6): Ditto. -- This uses the proposed algorithm numbers and was tested by modified samples taken from https://github.com/openpgp-pqc/draft-ietf-openpgp-nist-bp-comp/tree/ \ main/test-vectors on 2026-09-03 with the subkey packets extracted and added to a ietf27 primary key created by gpg. The actual samples could not be tested due to the stupid direct-signature-only-metadata and because we have not yet implemented the ML-DSA.
| * gpg: Make use of the new curve name "ietf25" in 9980 mode.Werner Koch2026-08-062-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * g10/pkglue.c (do_encrypt_kem): Replace Curve25519 by ietf25. Move the wipememory behind the gcry_kdf_close. * g10/import.c (build_mode1003_sexp): Replace Curve25519 by ietf25 for X25519. Add support for PUBKEY_ALGO_MLK1024_448. (internal_skey_object_to_sexp): Replace Curve25519 by ietf25 for X25519. * kbx/keybox-openpgp.c (keygrip_from_keyparm): Ditto. * g10/keyid.c (keygrip_from_pk): Ditto. * g10/keygen.c (gen_ecc): Ditto. (gen_kyber): Ditto. * common/kem.c (ecc_table): Add curve ietf25. * common/openpgp-oid.c (oidtable): Ditto. We use a new OID here despite that RFC-9580 does not use an OID for this algo. Our curve registry however likes to have OIDs.
| * gpg: First take on adding a compliance mode "fips".Werner Koch2026-08-053-139/+442
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * common/compliance.h (CO_FIPS): New. * common/compliance.c: Add basic support for CO_FIPS. (gnupg_pk_is_allowed): Factor code out to ... (gnupg_pk_is_allowed_de_vs): here and add (gnupg_pk_is_allowed_fips): new function. * common/openpgpdefs.h (AEAD_ALGO_GCM): New. * g10/cipher-aead.c (set_nonce_and_ad): Support GCM. * g10/options.h (GNUPG): Set macro also in FIPS mode. * g10/gpg.c (oFIPS): New. (gpgconf_list): Print a compliance_fips line. (compliance_options): Add "fips". (set_compliance_option): Set --allow-9980 in FIPS mode. * g10/keygen.c (write_keybinding): Provide fips compliance string. * g10/mainproc.c (check_sig_and_print): In require compliance mode also fail in FIPS complaince mode. * g10/misc.c (openpgp_aead_test_algo): Support GCM. (openpgp_aead_algo_name): Ditto. (openpgp_aead_algo_info): Ditto. (compliance_failure): Add fips string. * g10/sign.c (mk_notation_policy_etc): Use value 140 for the "manu" notation in FIPS mode. (write_signature_packets): Ditto. (make_keysig_packet): Ditto. * g10/encrypt.c (use_aead): In FIPS mode use GCM instead of OCB. * g10/pkclist.c (select_algo_from_prefs): For SHA256 in FIPS mode. -- This is by way not ready but gives a starting point. Encryption kind of works but even dycryption has not been tested. *PGP people will anyway never use this mode with its NSA approved algorithm set.
| * gpg: Implement generation of ietf25 v6 keys.Werner Koch2026-08-024-9/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * common/kem.c (gnupg_ecc_kem_kdf): Replace arg is_pgp by kdf_algo and adjust callers. * agent/pkdecrypt.c (ecc_kem_decrypt): Replace is_pgp by kemid. Extract a new kdf_variant from the sexp and setup kdf_algo from it. Add dedicated code path for the rfc9580 variant. (agent_kem_decrypt): Directly pass the kemid instead of the is_pgp flag. * common/compliance.c (gnupg_pk_is_compliant) (gnupg_pk_is_allowed): Add X25519. * common/openpgpdefs.h (pubkey_algo_t): Ditto. * kbx/keybox-openpgp.c (keygrip_from_keyparm): Support X25519. (parse_key): Ditto. * g10/parse-packet.c (parse_pubkeyenc, parse_key): Ditto. * g10/build-packet.c (do_key, do_pubkey_enc_v6): Ditto. * g10/call-agent.c (agent_pkdecrypt): Ditto. * g10/ecdh.c (ecc_build_kdf_params): Don't segv when called with wrong algo. * g10/keyid.c (pubkey_string): Map X25519 to "ietf25". (keygrip_from_pk): Support X25519. * g10/misc.c (openpgp_pk_test_algo2): Ditto. (openpgp_pk_algo_usage, openpgp_pk_algo_name) (pubkey_get_npkey, pubkey_get_nskey): Ditto. * g10/encrypt.c (use_rfc9980_seipdv2, write_pubkey_enc): Ditto. * g10/pkglue.c (get_mpi_from_sexp_strip_0x40): New. (do_encrypt_kem): Support X25519. (pk_encrypt): Ditto. * g10/seskey.c (encode_session_key): Ditto. * g10/pubkey-enc.c (get_session_key): Ditto. (get_it): Ditto. Move the special algo setup to the top. * g10/import.c (build_mode1003_sexp): Support X25519. (internal_skey_object_to_sexp): Ditto. * g10/keygen.c (ecckey_from_sexp): Add support for the MLK algos. (do_create_from_keygrip): Support ED25519. (common_gen): Support X25519 and the MLK algos. (gen_ecc): Support X25519. (gen_kyber): Support the MLK variants. (do_create): Support ED25519 and the MLK algos. (parse_key_parameter_part): Add parameter "ietf25".
| * common: Update compliance for new algos.Werner Koch2026-07-261-0/+9
| | | | | | | | | | | | | | * common/compliance.c (gnupg_pk_is_compliant): Add the newly implemented algorithms. (gnupg_pk_is_allowed) <DE_VS>: Allow the current MLK algorithms form decryption.
| * gpg: Rename the PKT_ENCRYPTED_AEAD constant.Werner Koch2026-07-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * common/openpgpdefs.h (PKT_ENCRYPTED_AEAD): Rename to ... (PKT_ENCRYPTED_OCB): this. Change all users. * g10/parse-packet.c (parse_encrypted_aeas): Rename to ... (parse_encrypted_ocb): this. * g10/build-packet.c (do_encrypted_aead): Rename to ... (do_encrypted_ocb): this. -- This aligns the name with the current LibrePGP specification. Note that RFC-9580 does not specify that packet at all despite that it is widely used for many years and peta bytes of data are stored using this format.
| * common: Add new key combiner from RFC-9980.Werner Koch2026-07-222-2/+55
| | | | | | | | * common/kem.c (gnupg_kem_combiner_sha3_256): New.
| * gpg: Add preliminary support for RFC-9980 encryption keys.Werner Koch2026-07-191-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * common/openpgpdefs.h (PUBKEY_ALGO_ED25519) (PUBKEY_ALGO_MLD65_25519,PUBKEY_ALGO_MLD87_448) (PUBKEY_ALGO_MLK768_25519,PUBKEY_ALGO_MLK1024_448): New. (PUBKEY_ALGO_DIL3_25519,PUBKEY_ALGO_DIL5_448) (PUBKEY_ALGO_SPHINX_SHA2): Remove. Never used. * g10/options.h (opt.flags): Add allow_9980 member. (RFC9980): New. * g10/packet.h (PKT_signature): Add field 'salt'. * g10/free-packet.c (free_seckey_enc) (copy_signature): Support that field. * g10/misc.c (openpgp_pk_test_algo2): Add PUBKEY_ALGO_ED25519. (openpgp_pk_algo_usage): Ditto. Also add the other new algos and remove the unused removed algos. (pubkey_get_npkey): Add info for ED25529, MLK768, and MLK1024. (pubkey_get_nskey): Ditto. (pubkey_get_nsig): Add info for PUBKEY_ALGO_ED25519. * g10/keyid.c (pubkey_string): Add strings for new algos. (do_hash_public_key): Support the new algos. Redefine use_v5 to force_v5 and add optional arg 'sig'. (hash_public_key): Add arg optional arg 'sig' and adjust callers. (compute_fingerprint): Support v6 fingerprints and new algos. * g10/parse-packet.c (parse_signature): Support v6 and new algos. (parse_key): Support v6 and reading of public keys. * g10/build-packet.c (gpg_mpi_write_opaque_8): New. (do_key): Support writing v6 keys and new algos. (do_signature): Ditto. * g10/pkglue.c (pk_verify): Support PUBKEY_ALGO_ED25519. * g10/seskey.c (encode_md_value): Ditto. * g10/sig-check.c (check_signature_end_simple): Support longer v6 subpacket length header. (check_signature_over_key_or_uid): Pass signature packet to the hash function. * g10/sign.c (update_keysig_packet): Ditto. * g10/keygen.c (parse_key_parameter_part): Replace unused ML-DSA and Sphinx by new algo names and codes. * kbx/keybox-blob.c (_keybox_create_openpgp_blob): Allow v6 keys. * kbx/keybox-openpgp.c (keygrip_from_keyparm): Adjust for new algos. (parse_key): Support new algos and v6 keys. Note that this function is a simplified version from parse-packet.c. * g10/gpg.c (oAllow9980): New const. (opts): Add option --allow-9980". (main): Set corresponding flag. * tests/openpgp/samplekeys/ietf27-mlk768-v4-pub.asc: New sample. * tests/openpgp/samplekeys/ietf27-mlk768-v6-pub.asc: New sample. -- This is the first patch to support the new RFC-9980 way of implementing PQC encryption and eventually signing. The use of this RFC is not recommended because it blows up the *PGP specification for no good reason and requires inelegant code to support classic OpenPGP and this alternative PQC-resistant specification for the same algorithms. However, certain policies may require interoperability with RFC-9980. At this stage the two sample public keys can be be imported and verified. Stay tuned.
* | common,gpg: Don't enable the partial file guard if already done.NIIBE Yutaka2026-08-122-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | * common/stringhelp.c (has_suffix): New. * common/stringhelp.h (has_suffix): New. * g10/plaintext.c (get_output_file): Only enable the partial file guard when it doesn't have ".part" suffix. -- GnuPG-bug-id: 8399 Suggested-by: Ingo Klöcker Signed-off-by: NIIBE Yutaka <[email protected]>
* | gpgsm: Emit signing time as status output for bad signatures.Philip Le2026-07-301-1/+2
|/ | | | | | | | | | | | | | * common/status.h (enum): Add new STATUS_SIGINFO. * doc/DETAILS: Add description for new STATUS_SIGINFO. * sm/verify.c (gpgsm_verify): Add signature creation time with STATUS_SIGINFO for bad signatures. -- Add the signature creation time with the new STATUS_SIGINFO. For now this status line is only emitted after a BADSIG status line. GnuPG-bug-id: 8364 Co-authored-by: Werner Koch <[email protected]>
* common: Make unix_rootdir work for macOS.Werner Koch2026-07-151-0/+49
| | | | | | * common/homedir.c [APPLE]: Include procinfo.h (macos_myproc_self) [APPLE]: New. (unix_rootdir, gnupg_myproc_self): Call macos specific version.
* common:dotlock:unix: Don't emit wrong error message.NIIBE Yutaka2026-07-071-2/+0
| | | | | | | | | * common/dotlock.c (dotlock_take_unix): It's not an error when it encounters disappeared lockfile. -- Signed-off-by: NIIBE Yutaka <[email protected]>
* common: Prepare to get rid of map_w32_to_errno.Werner Koch2026-06-291-1/+6
| | | | | * common/sysutils.c (gnupg_w32_set_errno): Use gpgrt function if available.
* w32:common: Fix usleep in w32_wait_when_sharing_violation.NIIBE Yutaka2026-06-181-2/+2
| | | | | | | | | | * common/sysutils.c (w32_wait_when_sharing_violation): WTIME is in milliseconds. -- Fixes-commit: 8a5d2674c3be7a6dfe7f35495af4df9e8be20d13 Signed-off-by: NIIBE Yutaka <[email protected]>
* gpg: Use the INT_RCP_FPR subpacket in revocation signatures.Philip Le2026-06-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * common/openpgpdefs.h (sigsubpkttype_t): Add Intended Recipient Fingerprint signature subpacket. * g10/build-packet.c (build_sig_subpkt): Build the Intended Recipient Fingerprint signature subpacket for v4 and v5 keys. * g10/free-packet.c (free_seckey_enc): Free rev_subject_info. (copy_signature): Copy the rev_subject_info struct too. * g10/import.c (import_one): Print info that addtional revocation signatures are checked. (import_revoke_cert): Use the new INT_RCP_FPR subpacket to check revocation signature if the subpacket is present. * g10/packet.h (rev_subject_info_s): New. Contains the fingerprint of the to be revoked key in a revocation signature. (PKT_signature): Add rev_subject_info. * g10/parse-packet.c (dump_sig_subpkt): Print info line about INT_RCP_FPR signature subpacket. (parse_signature): Parse INT_RCP_FPR signature subpacket. * g10/sig-check.c (check_key_signature): Check the revocation signature and ignore revocation for already revoked keys. * g10/sign.c (make_keysig_packet): Write the fingerprint of the to be revoked key into sig->rev_subject_info. -- Add the Intended Recipient Fingerprint (INT_RCP_FPR) signature subpacket to gpg and use it in revocation signatures. This allows standalone revocation signatures (i.e. revocation signatures without the corresponding public key) made by designated revokers to be processed. GnuPG-bug-id: 8252
* common: Fix never used function strlist_copy.Werner Koch2026-05-111-1/+1
| | | | | | | | * common/strlist.c (strlist_copy): Fix obvious bug. -- This function has been around since at least 2003 but was not used until SETATTR was implemented a few days ago.
* common: Add new function strlist_pop_try.Werner Koch2026-05-072-1/+26
| | | | * common/strlist.c (strlist_pop_try): New.
* gpg: New options --show-session-hash and --show-only-session-hash.Werner Koch2026-04-231-0/+1
| | | | | | | | | | * g10/options.h (opt): Add field show_session_hash. * g10/gpg.c (oShowOnlySessionHash,oShowSessionHash): New. (opts): Add options. (main): Set flags. * common/status.h (STATUS_SESSION_HASH): New. * g10/decrypt-data.c (decrypt_data): Emit new status code. Make opt.show_only_session_key work for the new options.
* gpgsm: Allow cipher mode as part of the algo for --cipher-algo.Werner Koch2026-04-073-2/+27
| | | | | | | | | | | | | | | | | | | | | | | | * common/miscellaneous.c (gnupg_cipher_mode_name): New. * common/audit.c (proc_type_encrypt): Print the encryption mode. * sm/misc.c (gpgsm_map_cipher_name_to_oid): New. * sm/gpgsm.c (DEFAULT_CIPHER_ALGO): Change to AES256-CBC for consistent error messages. (main): Replace the alias name mapping using if-else by a call to the new function. * g10/misc.c (openpgp_aead_algo_name): Use gnupg_cipher_mode_name for consistency. -- Note that DEFAULT_CIPHER_ALGO may now also be used to make GCM the default. GnuPG-bug-id: 3979 Take care: This is the first patch to implement GCM encryption. The actual encryption part is not yet ready and instead a debug message will be printed.
* gpgsm: Make GCM fully compliant for de-vsWerner Koch2026-04-021-2/+3
| | | | | | * common/compliance.c (gnupg_cipher_is_compliant): Allow GCM for gpgsm. (gnupg_cipher_is_allowed): Allow GCM for gpgsm also in producer mode.
* common:dotlock: Clean up for error/info/warning message.NIIBE Yutaka2026-03-243-192/+113
| | | | | | | | | | | | | | | | | | | | | | | | | * common/dotlock.c (my_info_*,my_error_*,my_debug_1): Remove. (struct dotlock_handle): Rename to msg_cb from info_cb, and to msg_cb_arg from info_cb_value. (default_msg_cb): New. (read_lockfile): Use msg_cb and msg_cb_arg. (dotlock_create_unix, dotlock_create_w32): Likewise. (dotlock_take_unix, dotlock_take_w32): Likewise. (dotlock_release_unix, dotlock_release_w32): Likewise. (dotlock_release): Likewise. (dotlock_create_with): New. (dotlock_finish_create, dotlock_set_info_cb): Remove. (dotlock_create): Use dotlock_create_with. * common/dotlock.h (define dotlock_create_with): New. (dotlock_finish_create, dotlock_set_info_cb): Remove. (DOTLOCK_LOCKED_ALREADY, DOTLOCK_FATAL): New. (DOTLOCK_PREPARE_CREATE): Remove. * common/t-dotlock.c (lock_and_unlock): Use new internal API. * kbx/backend-sqlite.c (create_or_open_database): Ditto. -- Signed-off-by: NIIBE Yutaka <[email protected]>
* doc: Typo fixWerner Koch2026-02-201-1/+1
| | | | --
* gpgconf: Show /proc/self/exe with -V and -XWerner Koch2026-02-022-51/+103
| | | | | | | | | | | | | * common/homedir.c (w32_rootdir): Factor some code out to ... (w32_myproc_self): here. (unix_rootdir): Factor some code out to ... (unix_myproc_self): here. (gnupg_myproc_self): New. * tools/gpgconf.c (show_version_gnupg): Use new function. -- This is helpful for support in case several GnuPG versions are installed.
* doc: Rename an internal function to clarity the purpose.Werner Koch2026-01-051-3/+3
| | | | | * common/w32-cmdline.c (count_backslashes): Rename to ... (count_leading_backslashes): This.
* dirmngr: Add a compatibility flag for use with newer Libksba versions.Werner Koch2025-11-281-0/+1
| | | | | | | | | | | * dirmngr/dirmngr.h (COMPAT_OCSP_SHA256_CERTID): New. * dirmngr/dirmngr.c (compatibility_flags): Add compat flag. (my_ksba_hash_buffer): Support SHA256. * dirmngr/ocsp.c (do_ocsp_request): Make use of the flag. -- Note that this requires a newer Libksba. Older Libksba versions ignore the request to use SHA256.
* common:dotlock: Escalate a warning message up to INFO from DEBUG.NIIBE Yutaka2025-11-251-5/+8
| | | | | | | | | | | | | | | * common/dotlock.c (dotlock_take): Use my_info_1 when already locked. (dotlock_release): Likewise. -- Since recursive lock is not intended with dotlock (yet), it's a programming error when detecting already locked state on the call of dotlock_take. Also, it's a programming error when detecting non-locked state on the call of dotlock_release. Use of my_debug_1 is not relevant here. Signed-off-by: NIIBE Yutaka <[email protected]>
* common:dotlock: Comment fixes.NIIBE Yutaka2025-11-252-11/+12
| | | | | | | | | * common/dotlock.h: dotlock_tool is now in gpgconf. * common/dotlock.c: Likewise. -- Signed-off-by: NIIBE Yutaka <[email protected]>
* common:dotlock:w32: Minor fixes for Windows.NIIBE Yutaka2025-11-251-5/+4
| | | | | | | | | | | * common/dotlock.c (any8bitchar): Define under HAVE_DOSISH_SYSTEM. (dotlock_create_w32): Add missing call of UNLOCK_all_lockfiles, even though it's currently not implemented yet. (dotlock_take_w32): Use my_set_errno, like other places. -- Signed-off-by: NIIBE Yutaka <[email protected]>
* commond:dotlock: Remove support of use with glib.NIIBE Yutaka2025-11-251-16/+0
| | | | | | | | * common/dotlock.c [DOTLOCK_GLIB_LOGGING]: Remove. -- Signed-off-by: NIIBE Yutaka <[email protected]>
* common,agent,dirmngr,kbx:w32: Synchronous spawning daemon process.NIIBE Yutaka2025-11-202-1/+76
| | | | | | | | | | | | | | | * common/asshelp.c [HAVE_W32_SYSTEM] (start_new_service): Catch the error output when starting daemon and wait until it's ready. (w32_ack_to_frontend): New. * common/asshelp.h (w32_ack_to_frontend): New. * agent/gpg-agent.c [HAVE_W32_SYSTEM] (main): Add w32_ack_to_frontend. * dirmngr/dirmngr.c [HAVE_W32_SYSTEM] (main): Ditto. * kbx/keyboxd.c [HAVE_W32_SYSTEM] (main): Ditto. -- GnuPG-bug-id: 7716 Signed-off-by: NIIBE Yutaka <[email protected]>
* agent,common,dirmngr,tests: Silence warnings of a compiler.NIIBE Yutaka2025-11-201-0/+1
| | | | | | | | | | | | * agent/command.c (cmd_keytocard): Initialize N. * common/ksba-io-support.c (bintoasc): Use GPGRT_ATTR_NONSTRING. * dirmngr/dns.c (dns_aaaa_arpa): Use GPGRT_ATTR_NONSTRING. (dns_sshfp_cmp0): Ditto. * tests/gpgscm/scheme.c (scheme_define): Initialize SSLOT. -- Signed-off-by: NIIBE Yutaka <[email protected]>
* common: New function replace_substr.Werner Koch2025-11-183-1/+151
| | | | | * common/stringhelp.c (replace_substr): New. * common/t-stringhelp.c (test_replace_substr): New test.
* gpg: Allow the import of Kyber secret keys.Werner Koch2025-11-161-1/+1
| | | | | | | | | | | | | | * g10/import.c (transfer_secret_keys): Handle mode 1003. * g10/call-agent.c (agent_import_key): Add arg mode1003. * common/sexputil.c (make_canon_sexp): Create in secmem when the input was in secmem. * agent/findkey.c (agent_write_private_key): Add arg 'linkattr' and change all callers. * agent/command.c (cmd_import_key): Add option '--mode1003'. Reorganize code and implement support for composite keys. -- GnuPG-bug-id: 7315
* common: Fix the test of t-stringhelp.NIIBE Yutaka2025-11-141-2/+5
| | | | | | | | | * common/t-stringhelp.c (stresc): Don't put newline when escaped. -- Reported-by: 8b79fe4dd0581c1cd000e1fbecba9f39e16a396a Signed-off-by: NIIBE Yutaka <[email protected]>
* gpg: Fix possible memory corruption in the armor parser.Werner Koch2025-10-231-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * g10/armor.c (armor_filter): Fix faulty double increment. * common/iobuf.c (underflow_target): Assert that the filter implementations behave well. -- This fixes a bug in a code path which can only be reached with special crafted input data and would then error out at an upper layer due to corrupt input (every second byte in the buffer is unitialized garbage). No fuzzing has yet hit this case and we don't have a test case for this code path. However memory corruption can never be tolerated as it always has the protential for remode code execution. Reported-by: 8b79fe4dd0581c1cd000e1fbecba9f39e16a396a Fixes-commit: c27c7416d5148865a513e007fb6f0a34993a6073 which fixed Fixes-commit: 7d0efec7cf5ae110c99511abc32587ff0c45b14f The bug was introduced on 1999-01-07 by me: * armor.c: Rewrote large parts. which I fixed on 1999-03-02 but missed to fix the other case: * armor.c (armor_filter): Fixed armor bypassing. Below is base64+gzipped test data which can be used with valgrind to show access to uninitalized memory in write(2) in the unpatched code. --8<---------------cut here---------------start------------->8--- H4sICIDd+WgCA3h4AO3QMQ6CQBCG0djOKbY3G05gscYFSRAJt/AExp6Di0cQG0ze a//MV0zOq3Pt+jFN3ZTKfLvP9ZLafqifJUe8juOjeZbVtSkbRPmRgICAgICAgICA gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA gICAgICAgICAgICAgICAgICAgICAgICAgMCXF6dYDgAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAC7E14AAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADwZ94aieId3+8EAA== --8<---------------cut here---------------end--------------->8---
* common: Reformat some comments in iobuf.cWerner Koch2025-10-211-145/+150
| | | | | | | | | | | | | | | | | | -- Comments with stars on the left side are easier to read. Also a long comment in the form if (...) /* This is a comment * for the next block */ { ... } makes it hard to see the start of a block or hides a forgotten block. In contrast to GNU common use we don't want this but put the comment either into the block or with adjusted wording above the condition.
* common,w32: Always use share mode readwrite for the keybox.Werner Koch2025-10-212-3/+4
| | | | | | | | | | | | | | * common/iobuf.c (direct_open) [W32]: Always use a share mode read or write. * kbx/keybox-init.c (_keybox_ll_open): Ditto. This requires the latest gpgrt to work. -- Cherry pick 2.2 commit: 3971b2528f465dcac0ea75c77840cb22b6a969d3 This change might help with GnuPG-bug-id: 7829
* w32:common: Take care of possible race on startup under Windows.NIIBE Yutaka2025-10-211-0/+6
| | | | | | | | | | | | | * common/asshelp.c (start_new_service) [HAVE_W32_SYSTEM]: Remove the socket before starting the daemon. -- Forward port of the 2.2 commit: 7e2133bc16f86e6d8230688f500e95fd3bdbd28c GnuPG-bug-id: 7829 Signed-off-by: NIIBE Yutaka <[email protected]>
* common: New function gnupg_remove_ext.Werner Koch2025-10-212-36/+86
| | | | | | | | | | | | | | | | | | | * common/sysutils.c (gnupg_rename_file): Factor out the wait function to ... (w32_wait_when_sharing_violation): New. (w32_remove): New. (gnupg_remove_ext): New. (gnupg_remove): Now a wrapper arounf gnupg_remove_ext. (gnupg_rename_file) [W32]: Use 32_remove with indefinite wait for sharing violation. -- Forward port of 2.2 commits: 7e3050547314f8c1625f2a1d9e116ff0b534a2bf 8491117f091ae9db1c1df2e6b9199ccde82a7d0a This is based on a suggestion by Gniibe in GnuPG-bug-id: 7829
* build,common,g13,sm,tools: Require GpgRT 1.56.NIIBE Yutaka2025-10-212-11/+0
| | | | | | | | | | | | | | | * configure.ac (NEED_GPGRT_VERSION): Require 1.56. * g13/g13.c (main): Remove support of old gpgrt. * sm/gpgsm.c (main): Likewise. * tools/gpg-wks-client.c (wrong_args, main): Likewise. * tools/gpgconf.c (my_read_reg_string): Likewise. * common/util.h (GPG_ERR_UNEXPECTED_PACKET): Likewise. * common/mapstrings.c (map_static_macro_string): Likewise. -- GnuPG-bug-id: 7855 Signed-off-by: NIIBE Yutaka <[email protected]>
* common,dirmngr:w32: Fix for semi-hosted environment.NIIBE Yutaka2025-10-213-0/+13
| | | | | | | | | | | | | | | * common/init.c [HAVE_W32_SYSTEM] (windows_semihosted_by_wine): New. (_init_common_subsystems): Initialize the variable. * common/stringhelp.c (change_slashes): Don't change slashes under semi-hosted environment. * common/util.h [HAVE_W32_SYSTEM] (windows_semihosted_by_wine): New. * dirmngr/dns-stuff.c [HAVE_W32_SYSTEM] (check_inet_support): Disable the check by "..localmachine" under semi-hosted environment. -- GnuPG-bug-id: 7138 Signed-off-by: NIIBE Yutaka <[email protected]>
* agent,common,gpg: Clean up for S/MIME decryption with KEM API.NIIBE Yutaka2025-10-072-47/+63
| | | | | | | | | | | | | | | | | | | | | | | * agent/agent.h (agent_kem_decrypt): Remove OPTION argument. * agent/command.c (cmd_pkdecrypt): No option is needed. * agent/pkdecrypt.c (composite_pgp_kem_decrypt): Use gnupg_ecc_kem_simple_kdf. (ecc_kem_decrypt): Support the S/MIME case too. Follow the change of gnupg_ecc_kem_kdf. (agent_kem_decrypt): Remove OPTION argument. Also support the S/MIME case. * common/kem.c (gnupg_ecc_kem_kdf): Support the S/MIME case too. Don't support simple ECC part for combined KEM. (gnupg_ecc_kem_simple_kdf): New. * common/util.h (gnupg_ecc_kem_kdf): Support the S/MIME case too. (gnupg_ecc_kem_simple_kdf): New. * g10/pkglue.c (do_encrypt_kem): Use gnupg_ecc_kem_simple_kdf. Use gnupg_ecc_kem_kdf with IS_GPG=1. -- GnuPG-bug-id: 7811 Signed-off-by: NIIBE Yutaka <[email protected]>