1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-11-12 21:58:50 +01:00
Commit Graph

9150 Commits

Author SHA1 Message Date
Werner Koch
ffc2522855
gpgsm: Improve cert lookup callback from dirmngr.
* sm/gpgsm.h (FIND_CERT_ALLOW_AMBIG): New.
(FIND_CERT_WITH_EPHEM): New.
* sm/certlist.c (gpgsm_find_cert): Replace arg allow_ambiguous by a
generic flags arg.  Implement the new flag FIND_CERT_WITH_EPHEM.
* sm/call-dirmngr.c (inq_certificate): Return also ephemeral marked
certs.
--

The dirmngr may need to get a certificate from gpgsm's store in the
course of verifying a CRL.  In some cases the certificate is still
marked as epehemeral - this needs to be returned as well.

This _may_ also fix
GnuPG-bug-id: 4436
2023-02-26 19:11:27 +01:00
Werner Koch
332098a0f7
sm: Fix issuer certificate look error due to legacy error code.
* sm/certchain.c (find_up): Get rid of the legacy return code -1 and
chnage var name rc to err.
(gpgsm_walk_cert_chain): Change var name rc to err.
(do_validate_chain): Get rid of the legacy return code -1.

* sm/keydb.c (keydb_search): Replace return code -1 by
GPG_ERR_NOT_FOUND.
(keydb_set_cert_flags): Replace return code -1 by GPG_ERR_NOT_FOUND.
* sm/certchain.c (find_up_search_by_keyid): Ditto.
(find_up_external, find_up, find_up_dirmngr): Ditto.
(gpgsm_walk_cert_chain): Ditto.
(get_regtp_ca_info): Ditto.
* sm/certlist.c (gpgsm_add_to_certlist): Ditto.
(gpgsm_find_cert): Ditto.
* sm/delete.c (delete_one): Ditto.
* sm/export.c (gpgsm_export): Ditto.
(gpgsm_p12_export): Ditto.
* sm/import.c (gpgsm_import_files): Ditto.
* sm/keylist.c (list_cert_colon): Ditto.
(list_internal_keys): Ditto.
* sm/sign.c (add_certificate_list): Ditto.

--

This bug was detected while fixing
GnuPG-bug-id: 4757
Backported-from-master: 473b83d1b9

Some extra code has been taken from
commit ed6ebb696e
2023-02-24 17:46:39 +01:00
NIIBE Yutaka
d6aa8bcbbb
scd: Parse "Algorithm Information" data object in scdaemon.
* scd/app-openpgp.c (data_objects): 0x00FA for binary data.
(do_getattr): Parse the data and send it in status lines.
(get_algorithm_attribute_string): New.
--

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
Backported-from-master: eba2563dab
Backported-from-master: 43bbc25b0f
2023-02-17 13:04:09 +01:00
Werner Koch
1915b95ffd
scd:p15: Add pre-check for ascii-numeric PINs.
* scd/app-p15.c (verify_pin): ascii-numeric is different than BCD.

(cherry picked from commit 029924a46e)
Added a few typo fixes.
2023-02-17 12:15:08 +01:00
Werner Koch
326f6fa166
scd:p15: Use APP_CARD macro at some other places.
--

This makes back porting easier.
2023-02-17 12:09:57 +01:00
Werner Koch
adf387b3f1
scd: Improve reading of binary records.
* scd/iso7816.c (iso7816_read_binary_ext): Handle the 0x6a86 SW the
same as 6b00.
* scd/apdu.c (apdu_get_atr): Modify debug messages.
* scd/app-p15.c (app_select_p15): Print FCI on error.
(read_p15_info): Clean up diag in presence of debug options.
--

Some cards return 6a86 instead of 6b00.

Signed-off-by: Werner Koch <wk@gnupg.org>
Backported-from-master: 44f977d0e3
2023-02-17 12:02:35 +01:00
Werner Koch
88606cc484
scd:p15: Handle cards with bad encoded path objects.
* scd/app-p15.c (read_ef_prkdf, read_ef_pukdf)
(read_ef_cdf, read_ef_aodf): Allow for a zero length path and
correctly skip unsupported auth types.
--

Signed-off-by: Werner Koch <wk@gnupg.org>
Backported-from-master: 7a8545c91b
2023-02-17 11:38:57 +01:00
Werner Koch
1d6ed0a1b4
gpg: --gen-random code cleanup by using es_set_binary.
* g10/gpg.c (main): Replace setmode by es_set_binary and use only when
needed.
--

It is better to use our es_set_binary than to use a Windows specific
method which still worked but is fragile because estream might be
changed.  We now set binary only when needed.  Note that it does not
harm to call es_set_binary more often than needed.
2023-02-16 13:17:56 +01:00
Werner Koch
af9a1b5599
agent: Do not consider --min-passphrase-len for the magic wand.
* agent/call-pinentry.c (generate_pin): Lock to exactly 30 octets.
* g10/gpg.c (main) <aGenRandom>: Add Level 30.

(cherry picked from commit ae2f1f0785)
2023-02-16 12:12:55 +01:00
Werner Koch
1d8191faee
gpg: Add level 16 to --gen-random
* g10/gpg.c (main): Add that hack.
--

This is an yet undocumented hack to allow printing hex encoded random
number with gpg.  The level is forced to be 1 which is is good for
almost all uses.  Note that --armor is ignored.

Signed-off-by: Werner Koch <wk@gnupg.org>
Backported-from-master: d847f0651a
2023-02-16 12:05:03 +01:00
Werner Koch
67a2973bf9
gpg: Make "--list-options show-sig-subpackets=n,m" work again.
* g10/gpg.c (parse_list_options): Set value for show-sig-subpackets.
--

Fixes-commit: b6ba7054a0
2023-01-31 11:36:32 +01:00
Werner Koch
fbc1813779
gpgtar: Fix parent directory creation bug
* tools/gpgtar-extract.c (extract_directory): Ignore EEXIST on parent
directory creation.
2023-01-26 12:01:12 +01:00
Werner Koch
c66dacb98a
gpgtar: Allow decryption from stdin.
* tools/gpgtar.c (main): Revamp switch and fix usage test for aDecrypt
and aList.
--

GnuPG-bug-id: 6355
2023-01-26 11:58:25 +01:00
NIIBE Yutaka
92e4f856c5
po: Update Japanese Translation.
--

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2023-01-26 15:20:46 +09:00
Werner Koch
aecebdf705
gpg: Replace --override-compliance-check by a real fix.
* common/compliance.c (gnupg_pk_is_allowed): Handle EdDSA.
* g10/gpg.c (oOverrideComplianceCheck): Remove.
(opts): Turn --override-compliance-check into a dummy option.
* g10/options.h (opt): Remove override_compliance_check.
* g10/sig-check.c (check_key_verify_compliance): Remove use of that
option.
--

The introduction of --override-compliance-check actually hid the real
cause for the signature verification problem in de-vs mode for the
Ed25519 key.  The real fix is to handle the EdDSA algorithm in
gnupg_pk_is_allowed.

Fixes-commit: 773b8fbbe9
GnuPG-bug-id: 5655
2023-01-20 11:12:13 +01:00
Werner Koch
de292078a5
gpg: Do not require --status-fd along with --require-compliance.
* g10/mainproc.c (check_sig_and_print): Do not check whether status is
enabled when checking compliance.
2023-01-20 11:07:15 +01:00
Werner Koch
6df8a513dc
common: Detect PNG and JPEG file formats.
* common/miscellaneous.c (is_file_compressed): Add detect code.
--

GnuPG-bug-id: 6332
2023-01-19 16:14:31 +01:00
Werner Koch
ce8ffd71b7
gpg: Detect already compressed data also when using a pipe.
* common/iobuf.c (file_filter_ctx_t): Add fields for the peek feature.
(file_filter): Implement peeking.
(iobuf_ioctl): Add new IOBUF_IOCTL_PEEK.
* common/iobuf.h (IOBUF_IOCTL_PEEK, IOBUFCTRL_PEEK): New.
* common/miscellaneous.c (is_file_compressed): Rewrite.  Detect PDF.
* g10/encrypt.c (encrypt_simple): Peek before detecting compression.
(encrypt_crypt): Ditto.
* g10/sign.c (sign_file): Also detect already compressed data.

* g10/options.h (opt): Add explicit_compress_option.
* g10/gpg.c (main): Set opt.explicit_compress_option for -z.

--

Note that this patch also introduces a compression check for signing
which was never done in the past.

GnuPG-bug-id: 6332
Backported-from-master: 60963d98cf

Note that sign.c (sign_file) has been re-indented to ease future
backports.
2023-01-19 16:14:03 +01:00
Werner Koch
ca822a2339
common: Replace all assert in iobuf by log_assert.
--
2023-01-19 16:14:02 +01:00
Werner Koch
417e8588f3
gpgtar: Make --status-fd option for fds > 2 work
* tools/gpgtar-create.c (gpgtar_create): Do not close the status_fd in
spawn.
* tools/gpgtar-extract.c (gpgtar_extract): Ditto.
* tools/gpgtar-list.c (gpgtar_list): Ditto.
--

Note that this fix does not handle file descripotors passed via the
--gpg-args options.

GnuPG-bug-id: 6348
2023-01-19 16:13:57 +01:00
Werner Koch
841c691128
Update copyright notices
--
2023-01-16 13:25:22 +01:00
Werner Koch
210ba98355
scd:openpgp: Allow auto-changing of the key attributes in genkey.
* scd/app-openpgp.c (struct app_local_s): Add field keyalgo.
(parse_algorithm_attribute): Store the new keyalgo field.
(change_keyattr): Change info message.
(change_keyattr_from_string): Rewrite to also accept a keyref and a
keyalgo string.
(do_genkey): Change the keyattr if a keyalgo string is given.
* scd/command.c (cmd_genkey): Add option --algo.
--

Having this feature makes it easier to use OpenPGP cards in a similar
way to other cards.  Note that the explicit changing via SETATTR is
still supported.

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit d7d75da505)
(cherry picked from commit b349adc5c0)
2023-01-13 14:54:23 +01:00
Werner Koch
2e39fed109
common: New function get_keyalgo_string.
* common/openpgp-oid.c (struct keyalgo_string_s): New.
(keyalgo_strings): New.
(keyalgo_strings_size, keyalgo_strings_used): New.
(openpgp_oid_or_name_to_curve): New.
(get_keyalgo_string): New.
--

This function is intended as a more general version of gpg's
pubkey_string function.  It has the advantage to avoid mallocs and
uses static table of algorithm strings instead.  There should be only
a few dozen of such strings (if at all) and thus all those allocations
we do internally in gpg's pubkey_string and the static buffers all
over the place are not too nice.

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit 3a1fa13eed)
(cherry picked from commit 332a72f734)
2023-01-13 14:54:20 +01:00
Werner Koch
398cec3ac7
scd: Return CARDTYPE, CARDVERSION, and APPVERSION.
* scd/app.c (strcardtype): New.
(app_write_learn_status): Return more info.
(app_getattr): Allow for CARDTYPE.
2023-01-13 13:59:20 +01:00
Damien Goutte-Gattat via Gnupg-devel
6f276fc17b
sm: Support generation of card-based ECDSA CSR.
* sm/call-agent.c (gpgsm_scd_pksign): Identify type of signing key
and format resulting S-expression accordingly.
--

Current GpgSM implementation assumes card-based keys are RSA keys.
This patch introduces support for ECDSA keys.

GnuPG-bug-id: 4092
Signed-off-by: Damien Goutte-Gattat <dgouttegattat@incenp.org>
(cherry picked from commit 74e9b579ca)

- Removed already applied changes from the original commit.
- Allow for SHA384 and SHA512

Signed-off-by: Werner Koch <wk@gnupg.org>
2023-01-13 10:31:20 +01:00
Werner Koch
4d5126349d
sm: Fix regression due to the new ECC cert generation
* sm/certreqgen.c (create_request): Also set SIGKEYLEN.
--

Fixes-commit: ed62b74a17
2023-01-13 09:43:25 +01:00
Werner Koch
f2d25b04d7
sm: Fix compliance checking for ECC signature verification.
* common/compliance.c (gnupg_pk_is_compliant): Also consider the
gcrypt vids for ECDSA et al.
(gnupg_pk_is_allowed): Ditto.
* sm/verify.c (gpgsm_verify): Consider the curve.  Print a compliance
notice for a non-compliant key.

* sm/certchain.c (gpgsm_validate_chain): Silence the "switching to
chain model".
--

Backported-from-master: 338a5ecaa1
2023-01-12 20:58:21 +01:00
Werner Koch
818051432c
dirmngr: Do not check for Tor for --gpgconf-* options
* dirmngr/dirmngr.c (post_option_parsing): Add arg CMD.
(main): Pass the current command.
2023-01-11 11:13:15 +01:00
Werner Koch
b7f21f9f21
po: Auto update
--
2023-01-11 10:23:57 +01:00
Werner Koch
ff3c86ab25
po: Update German translation
--
2023-01-11 10:20:41 +01:00
Werner Koch
98100fadc4
gpg: Remove duplicated diagnostic.
--

Fixes-commit: a545e14e8a
2023-01-11 10:11:26 +01:00
Werner Koch
73624de5b7
gpg: Add missing space to a diagnostic.
--
2023-01-11 10:06:47 +01:00
Werner Koch
f618731f7e
w32: Make sure DEP is enabled.
* common/init.c (_init_common_subsystems): Test and set the DEP
Policy.
--

Note that this change will now definitely require Windows XP SP3.
2023-01-11 10:04:08 +01:00
Werner Koch
17b985787e
doc: Minor man page fixes.
--
2023-01-11 09:01:04 +01:00
Werner Koch
9a012d2c53
Merge branch 'STABLE-BRANCH-2-2.40' into STABLE-BRANCH-2-2
--
2022-12-23 12:25:44 +01:00
Werner Koch
8c0dedd99b
Post release updates
--
2022-12-09 10:46:26 +01:00
Werner Koch
75ad0ea6dc
Release 2.2.41 2022-12-09 09:39:42 +01:00
Werner Koch
42637c0ead
po: Auto update
--
2022-12-09 09:39:15 +01:00
Werner Koch
5351bc323a
po: Update German translation
--
2022-12-09 09:06:55 +01:00
Werner Koch
e778c9ce89
scd:p15: Skip deleted records.
* scd/app-p15.c (select_and_read_record): Special case deleted
records.  Support 3 byte TLVs.
(read_ef_prkdf): Skip deleted records.
(read_ef_pukdf): Ditto.
(read_ef_cdf): Ditto.
(read_ef_aodf): Ditto.
--

This fixes a problem with some CardOS 5 applications.
2022-12-08 10:58:19 +01:00
Werner Koch
11d3114e1a
speedo: Support CUSTOM_SWDB builds.
--
2022-12-07 16:07:50 +01:00
Werner Koch
8346ebf168
speedo: Introduce the OVERRIDE_TARBALLS feature
--
2022-12-06 12:33:25 +01:00
Werner Koch
bcd3a5c365
doc: Prepare NEWS
--
2022-12-06 10:06:35 +01:00
Werner Koch
115cc4d37c
wkd: Do not send/install/mirror expired user ids.
* tools/gpg-wks.h (struct uidinfo_list_s): Add fields expired and
revoked.
* tools/wks-util.c (append_to_uidinfo_list): Add args expired and
revoked.
(set_expired_revoked): New.
(wks_list_key): Set expired and revoked.
(wks_cmd_install_key): Skip expired uids.
* tools/gpg-wks-client.c (command_check): Print flags.
(command_send): Ignore expired keys.
(mirror_one_key): Ditto.

* g10/export.c (do_export_stream): Silence warning.
--

GnuPG-bug-id: 6292
Backported-from-master: 278f85d1bc
2022-12-06 09:27:12 +01:00
Werner Koch
d9271d594b
gpgsm: Silence the "non-critical certificate policy not allowed".
* sm/certchain.c (check_cert_policy): Print non-critical policy
warning only in verbose mode.

(cherry picked from commit 4f1b9e3abb)
2022-12-06 08:25:41 +01:00
Werner Koch
2f4492f3be
wkd: New option --add-revocs and some fixes.
* tools/gpg-wks.h (opt): Add add_revocs.
* tools/wks-util.c (wks_get_key): Add arg 'binary'.
(wks_armor_key): New.
(wks_find_add_revocs): New.
(wks_cmd_install_key): Get key in binary mode and add revocations if
enabled.
* tools/gpg-wks-client.c (oAddRevocs): New.
(opts): Add --add-revocs.
(parse_arguments): Set option,
(command_send): Get key in binary mode, add revocations if enabled,
and explictly armor key.  Remove kludge to skip the Content-type line
in no_encrypt mode.

(mirror_one_keys_userid): Always filter the key to get rid of the
armor as received from dirmngr.  Add revocations from the local
keyring.
--

Note that this also fixes an oddity of the new mirror command which
used to store the keys armored as received from dirmngr.
2022-11-30 11:25:36 +01:00
Werner Koch
deac3e91eb
wkd: Make use of --debug extprog.
* tools/wks-util.c (debug_gpg_invocation): New.
(get_key_status_cb): Enable debug output.
(wks_get_key): Show gpg invocation.
(wks_list_key): Ditto.
(wks_filter_uid): Ditto.
2022-11-30 11:25:36 +01:00
Werner Koch
edbe30c152
gpg: New export-filter export-revocs
* g10/options.h (EXPORT_REVOCS): New.
* g10/export.c (export_select_filter): New.
(struct export_filter_attic_s): Add field.
(cleanup_export_globals): Cleanup.
(parse_export_options): Add option "export-revocs".
(parse_and_set_export_filter): Parse the select type.
(do_export_revocs): New.
(do_export_stream): Add a way to select things for export.
--

Backported-from-master: c985b52e71
2022-11-30 11:25:36 +01:00
Werner Koch
be02365c3f
gpgsm: Change default algo to AES-256.
* sm/gpgsm.c (DEFAULT_CIPHER_ALGO): Change.
2022-11-30 11:01:25 +01:00
NIIBE Yutaka
cd29ab0435
gpg: Fix double-free in gpg --card-edit.
* g10/card-util.c (change_name): Don't free ISONAME here.

--

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2022-11-30 08:56:05 +09:00